You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shop crashes with NoMethodError in Spree::Taxons#show
Showing /var/lib/gems/2.3.0/gems/solidus_frontend-2.5.0.beta2/app/views/spree/shared/_products.html.erb where line #35 raised:
undefined method `to_d' for nil:NilClass
The line is: <span class="price selling" itemprop="price" content="<%= product.price_for(current_pricing_options).to_d %>">
The crash occurs because product.price_for(current_pricing_options) is nil in that moment.
Thanks for the detailed report. Also, hi! I follow you on twitter and am a fan of your work.
The issue seems to be that taxon_preview doesn't use the Searcher (everywhere else displaying Products does) and therefore doesn't filter out products which don't match the current pricing options. Tomorrow I'll take a look at either filtering the products in this taxon by the current pricing options or using the searcher here.
A second bug here is I don't think _products.html.erb should have errored. We have a show_products_without_price Config setting, so we should allow rendering this view with a product lacking a price. I'll also look at this tomorrow.
Steps to reproduce
Expected behavior
Expect to see no products.
Actual behavior
Shop crashes with
NoMethodError in Spree::Taxons#show
The line is:
<span class="price selling" itemprop="price" content="<%= product.price_for(current_pricing_options).to_d %>">
The crash occurs because
product.price_for(current_pricing_options)
isnil
in that moment.System configuration
Solidus Version:
Extensions in use:
gem 'solidus_paypal_braintree', github: 'solidusio/solidus_paypal_braintree', branch: :master
The text was updated successfully, but these errors were encountered: