Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fix: Replace deprecated Image#plp_url with cdn_image_url variant(:xlarge) (#13678)

Damian Legawiec4a6d51605d1b
diff --git a/spree/core/app/services/spree/data_feeds/google/required_attributes.rb b/spree/core/app/services/spree/data_feeds/google/required_attributes.rb
index d244e5d366..274354c44c 100644
--- a/spree/core/app/services/spree/data_feeds/google/required_attributes.rb
+++ b/spree/core/app/services/spree/data_feeds/google/required_attributes.rb
@@ -41,15 +41,10 @@ module Spree
end
def get_image_link(variant, product)
- # try getting image from variant
- img = variant.images.first&.plp_url
+ image = variant.thumbnail || product.thumbnail
+ return if image.nil?
- # if no image specified for variant try getting product image
- if img.nil?
- img = product.images.first&.plp_url
- end
-
- img
+ Rails.application.routes.url_helpers.cdn_image_url(image.attachment.variant(:xlarge))
end
def format_price(variant)
diff --git a/spree/core/spec/services/spree/data_feeds/google/rss_spec.rb b/spree/core/spec/services/spree/data_feeds/google/rss_spec.rb
index e412f8ae8f..ec51ac2211 100644
--- a/spree/core/spec/services/spree/data_feeds/google/rss_spec.rb
+++ b/spree/core/spec/services/spree/data_feeds/google/rss_spec.rb
@@ -54,7 +54,9 @@ module Spree
end
it 'includes image link' do
- expect(result.value[:file]).to include("<g:image_link>#{variant.images.first.plp_url}</g:image_link>").once
+ image = variant.images.first
+ expected_url = Rails.application.routes.url_helpers.cdn_image_url(image.attachment.variant(:xlarge))
+ expect(result.value[:file]).to include("<g:image_link>#{expected_url}</g:image_link>").once
end
it 'includes price' do