sukysa Posted August 21, 2019 Share Posted August 21, 2019 Hello, It is possible to show currently stock in Prestashop 1.7 cart? Im trying to add {$product.quantity} in cart-detailed-product-line.tpl, but this variable shows same QTY that i added to cart (attaching screenshot)... In product.tpl and other pages this variable works fine! Link to comment Share on other sites More sharing options...
sukysa Posted August 21, 2019 Author Share Posted August 21, 2019 Maybe someone was do that customization? Link to comment Share on other sites More sharing options...
ApoA Posted August 28, 2019 Share Posted August 28, 2019 hello, have you tried using {$product.stock_quantity}? it shows the total in stock, it will not change everytime you add product quantity because you didn't actually buy the product, but you if really want, you can do some thing like {$product.stock_quantity - $product.quantity} and display it in cart-detailed-product-line.tpl anywhere. i hope it helps. 1 Link to comment Share on other sites More sharing options...
sukysa Posted August 28, 2019 Author Share Posted August 28, 2019 1 hour ago, ApoA said: hello, have you tried using {$product.stock_quantity}? it shows the total in stock, it will not change everytime you add product quantity because you didn't actually buy the product, but you if really want, you can do some thing like {$product.stock_quantity - $product.quantity} and display it in cart-detailed-product-line.tpl anywhere. i hope it helps. Hello, Thanks for advice, just tried and got HTTP ERROR 500. Link to comment Share on other sites More sharing options...
ApoA Posted August 29, 2019 Share Posted August 29, 2019 (edited) hello, really? heres what i did, i edited cart-detailed-product-line.tpl, <!-- product left body: description --> <div class="product-line-grid-body col-md-4 col-xs-8"> <div class="product-line-info"> <a class="label" href="{$product.url}" data-id_customization="{$product.id_customization|intval}">{$product.name}</a> </div> {* I ADDED JUST THIS ONE *} <label>{$product.stock_quantity - $product.quantity}</label> {* I ADDED JUST THIS ONE *} below that "product-line-info" class, that's what i added, just a label, and it works fine with me, you noticed the "299" from the picture?, that is the label with the amount of stock left, it changes everytime i add quantity for this product. it's just to show you how to get the stocks left for a product, if you get it right you can use that to anywhere you like in that tpl depending on your site. i hope my explanation is clear 😁 Edited August 29, 2019 by ApoA (see edit history) Link to comment Share on other sites More sharing options...
mobeen Posted September 2, 2019 Share Posted September 2, 2019 is there a way to show total stock available? regardless of what was added to the cart? Link to comment Share on other sites More sharing options...
ApoA Posted September 3, 2019 Share Posted September 3, 2019 hello, well what you need is just {$product.stock_quantity} Link to comment Share on other sites More sharing options...
mobeen Posted September 3, 2019 Share Posted September 3, 2019 4 hours ago, ApoA said: hello, well what you need is just {$product.stock_quantity} doesn't seem to work Link to comment Share on other sites More sharing options...
ApoA Posted September 3, 2019 Share Posted September 3, 2019 2 minutes ago, mobeen said: doesn't seem to work can you show me how you did it? Link to comment Share on other sites More sharing options...
sukysa Posted September 3, 2019 Author Share Posted September 3, 2019 I'm also added {$product.stock_quantity} and have same HTTP ERROR 500 I'm using Prestashop 1.7.5.2, Link to comment Share on other sites More sharing options...
ApoA Posted September 3, 2019 Share Posted September 3, 2019 1 minute ago, sukysa said: I'm also added {$product.stock_quantity} and have same HTTP ERROR 500 I'm using Prestashop 1.7.5.2, how did you guys did it? i did it before i replied my answer and it works just fine. are you sure you edited the right file? Link to comment Share on other sites More sharing options...
MAndimba Posted February 3, 2020 Share Posted February 3, 2020 On 8/29/2019 at 3:58 AM, ApoA said: hello, really? heres what i did, i edited cart-detailed-product-line.tpl, <!-- product left body: description --> <div class="product-line-grid-body col-md-4 col-xs-8"> <div class="product-line-info"> <a class="label" href="{$product.url}" data-id_customization="{$product.id_customization|intval}">{$product.name}</a> </div> {* I ADDED JUST THIS ONE *} <label>{$product.stock_quantity - $product.quantity}</label> {* I ADDED JUST THIS ONE *} below that "product-line-info" class, that's what i added, just a label, and it works fine with me, you noticed the "299" from the picture?, that is the label with the amount of stock left, it changes everytime i add quantity for this product. it's just to show you how to get the stocks left for a product, if you get it right you can use that to anywhere you like in that tpl depending on your site. i hope my explanation is clear 😁 This one worked for me...thanks a lot Link to comment Share on other sites More sharing options...
Arethusa Posted July 15, 2020 Share Posted July 15, 2020 On 8/28/2019 at 9:28 AM, ApoA said: hello, have you tried using {$product.stock_quantity}? it shows the total in stock, it will not change everytime you add product quantity because you didn't actually buy the product, but you if really want, you can do some thing like {$product.stock_quantity - $product.quantity} and display it in cart-detailed-product-line.tpl anywhere. i hope it helps. ¡Thanks a lot! $product.stock_quantity is perfect. Link to comment Share on other sites More sharing options...
CasperGGHPM Posted September 27, 2022 Share Posted September 27, 2022 Hi Guys, $product.stock_quantity is working fine for mee in on the cart page. This is exactly what i need on the product page. The product quantity that is not influenced by the amount in cart. I tried using this same variable on the product page but it does not work. Is there any variable or any way i can display the total quantity in stock on the product page? Hope someone can help me. 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