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.

ignore taxon when is not valid

Chien-Fu3a4485787c8c
diff --git a/frontend/app/controllers/spree/products_controller.rb b/frontend/app/controllers/spree/products_controller.rb
index 473d61f544..7b0d5af0e0 100644
--- a/frontend/app/controllers/spree/products_controller.rb
+++ b/frontend/app/controllers/spree/products_controller.rb
@@ -21,8 +21,9 @@ module Spree
def show
redirect_if_legacy_path
- @taxon = params[:taxon_id].present? ? Spree::Taxon.find(params[:taxon_id]) : @product.taxons.first
-
+ @taxon = params[:taxon_id].present? ? Spree::Taxon.find_by(id: params[:taxon_id]) : nil
+ @taxon = @product.taxons.first unless @taxon.present?
+
if !http_cache_enabled? || stale?(etag: etag_show, last_modified: last_modified_show, public: true)
@product_summary = Spree::ProductSummaryPresenter.new(@product).call
@product_properties = @product.product_properties.includes(:property)