0
votes

I'm trying to simply display the inventory count (the number displayed in the spree admin as "count on hand") in the front-end of my app. I'd like to display it on the product page to show how many of a product is left available...i'm still getting familiar with Spree...can I just do this through the front-end via deface changes???

I'm using Spree 2-1-stable...so far i've tried to replace the unordered list in the _taxons partial (spree / frontend / app / views / spree / products / _taxons.html.erb) with the count on hand using the following deface override...but i think I may be way off base.

Deface::Override.new(:virtual_path => 'spree/products/_taxons',
  :replace => "ul#similar_items_by_taxon",
  :text => "<%= product.total_on_hand %>",
  :name => "product_profile_changes",)

(A previous stackO posting below had said to call total_on_hand, but that doesn't seem to be working either...)

Show all spree ecommerce products together with their count-on-hand displayed

My current code throws the following error:

SystemStackError in Spree::ProductsController#show
stack level too deep

Rails.root: /Users/user/Documents/spree_flash_sales/spec/dummy

If i have to add something to the controller or model, which specific files would it go in and what would the code look like? Any help would be much appreciated...thanks,

1

1 Answers

1
votes

Well i guess i'll leave my own answer...another boneheaded mistake.

I just left out the @ in the text line. i.e,

:text => "<%= @product.total_on_hand %>",

(I need to take some courses on debugging)