thn_ Posted March 19 Share Posted March 19 I know there is an option to show quantity on product page in details section, but it is way to hidden, I want to show available quantity on product list and product page next to add to cart button. I've copied {block name='product_quantities'} {if $product.show_quantities} <div class="product-quantities"> <label class="label">{l s='In stock' d='Shop.Theme.Catalog'}</label> <span data-stock="{$product.quantity}" data-allow-oosp="{$product.allow_oosp}">{$product.quantity} {$product.quantity_label}</span> </div> {/if} {/block} to product-list.tpl and it works, shows available quantity, but not like it should. On category page it shows for example available 100 pieces, when I'll add 10 to cart it changes from "available 100 pieces" to "available 10 pieces", if i'll add 10 more pieces then it turns into "available 20 pieces" etc. On the other hand I've added this code to product-prices.tpl right under reference, and it shows "available 100 pieces", but when I'll add 10 to cart it still says "available 100 pieces" when same piece of code in product details works like it should (after adding 10 to cart shows 90 available). Where I'm making mistake? Link to comment Share on other sites More sharing options...
Prestashop Addict Posted March 19 Share Posted March 19 (edited) What is your PS version? You have to put the code into themes/yourtheme/catalog/_partials/miniatures/product.tpl. Following code works and have the right stock quantity available decrease with cart. {block name='product_quantities'} <div class="product-quantities"> <label class="label">{l s='In stock' d='Shop.Theme.Catalog'}</label> <span data-stock="{$product.quantity}" data-allow-oosp="{$product.allow_oosp}">{$product.quantity} {$product.quantity_label}</span> </div> {/block} Edited March 19 by Prestashop Addict (see edit history) Link to comment Share on other sites More sharing options...
thn_ Posted March 20 Author Share Posted March 20 18 hours ago, Prestashop Addict said: What is your PS version? You have to put the code into themes/yourtheme/catalog/_partials/miniatures/product.tpl. Following code works and have the right stock quantity available decrease with cart. {block name='product_quantities'} <div class="product-quantities"> <label class="label">{l s='In stock' d='Shop.Theme.Catalog'}</label> <span data-stock="{$product.quantity}" data-allow-oosp="{$product.allow_oosp}">{$product.quantity} {$product.quantity_label}</span> </div> {/block} Video of what is happening in category page: Video showing what is happening on product page: I have PS 1.7.8.5, theme Warehouse. Link to comment Share on other sites More sharing options...
Prestashop Addict Posted March 21 Share Posted March 21 I tested on PS 1.7.8.11 and 8.1.4 with classic theme Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now