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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix displaying product images in order emails (#14264)
Kacper Mękarskia820fb671b1b
diff --git a/spree/emails/app/helpers/spree/mail_helper.rb b/spree/emails/app/helpers/spree/mail_helper.rbindex 1ef4ac2646..bff478544a 100644--- a/spree/emails/app/helpers/spree/mail_helper.rb+++ b/spree/emails/app/helpers/spree/mail_helper.rb@@ -4,6 +4,10 @@ module Spreeinclude Spree::ImagesHelperdef variant_image_url(variant)+ Spree::Deprecation.warn(+ 'Spree::MailHelper#variant_image_url is deprecated. Use spree_image_url instead. Will be removed in Spree 6.0.'+ )+image = variant.primary_mediaimage.present? && image.attached? ? spree_image_url(image, variant: :mini) : image_url('noimage/small.png')enddiff --git a/spree/emails/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb b/spree/emails/app/views/spree/reimbursement_mailer/reimbursement_email.html.erbindex 2506e0cb25..1979c2084c 100644--- a/spree/emails/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb+++ b/spree/emails/app/views/spree/reimbursement_mailer/reimbursement_email.html.erb@@ -19,7 +19,12 @@<% @reimbursement.return_items.exchange_requested.each do |return_item| %><tr><td class="purchase_image">- <%= link_to(image_tag(variant_image_url(return_item.variant)), spree_storefront_resource_url(return_item.variant.product)) %>+ <% image = return_item.variant.primary_media || return_item.variant.product.primary_media %>+ <% if image.present? && image.attached? %>+ <%= link_to(spree_image_tag(image, variant: :mini, alt: return_item.variant.name), spree_storefront_resource_url(return_item.variant.product)) %>+ <% else %>+ <%= link_to(image_tag('noimage/small.png', alt: return_item.variant.name), spree_storefront_resource_url(return_item.variant.product)) %>+ <% end %></td><td class="purchase_item"><strong>diff --git a/spree/emails/app/views/spree/shared/purchased_items_table/_line_item.html.erb b/spree/emails/app/views/spree/shared/purchased_items_table/_line_item.html.erbindex c0514add6b..b1dab0a901 100644--- a/spree/emails/app/views/spree/shared/purchased_items_table/_line_item.html.erb+++ b/spree/emails/app/views/spree/shared/purchased_items_table/_line_item.html.erb@@ -1,6 +1,6 @@<tr><td class="purchase_image">- <% image = line_item.variant.default_image %>+ <% image = line_item.variant.primary_media || line_item.product.primary_media %><% if image.present? && image.attached? %><%= link_to(spree_image_tag(image, variant: :mini, alt: line_item.name), spree_storefront_resource_url(line_item.product)) %><% else %>