jan_p_dk Posted March 25, 2019 Share Posted March 25, 2019 Hi, I try to get product availability to show in cart like it show's at productlist. I edit cart-detailed-product-line.tpl If I for example try to take code from product.tpl and put in to cart-detailed-product-line.tpl the status always show 'In stock' <article data-id-product="{$product.id_product}" data-id-product-attribute="{$product.id_product_attribute}"> <div class="availability"> {block name='product_availability'} <span class="pl-availability"> {if $product.show_availability && $product.availability_message} {if $product.availability == 'available'} <i class="material-icons product-available"></i> {elseif $product.availability == 'last_remaining_items'} <i class="material-icons product-last-items"></i> {else} <i class="material-icons product-unavailable"></i> {/if} {$product.availability_message} {else} {if $product.allow_oosp == 0} <i class="material-icons product-available"></i> {l s='In stock' d='Shop.Theme.Catalog'} {/if} {if $product.allow_oosp == 1} {* <i class="material-icons product-unavailable"></i> {l s='Out of stock' d='Shop.Theme.Catalog'} *} <i class="material-icons product-available"></i> {l s='In stock' d='Shop.Theme.Catalog'} {/if} {/if} </span> {/block} </div> </article> {$product.availability} always = available even if product in stock or not. Can anyone guide me how to do this? Thanks. Link to comment Share on other sites More sharing options...
JanHavlicek Posted January 20, 2020 Share Posted January 20, 2020 Bump! Any news regarding this please? It used to be in PS16, now I upgraded to 1.7.6.x and the product availability is missing in cart summary. Link to comment Share on other sites More sharing options...
JanHavlicek Posted January 20, 2020 Share Posted January 20, 2020 (edited) Can you at least read before you reply, please? PS1.6.x - when you add something to the cart, there is a summary, which shows Availability for each product. Nothing like that is in PS17, this feature was removed. Any idea, how to add this feature to PS17? Screenshots attached. Thanks Edited January 20, 2020 by JanHavlicek (see edit history) Link to comment Share on other sites More sharing options...
afshop Posted June 25, 2020 Share Posted June 25, 2020 On 1/20/2020 at 4:49 PM, JanHavlicek said: Can you at least read before you reply, please? PS1.6.x - when you add something to the cart, there is a summary, which shows Availability for each product. Nothing like that is in PS17, this feature was removed. Any idea, how to add this feature to PS17? Screenshots attached. Thanks Hello did you solve it? Thanks Angela Link to comment Share on other sites More sharing options...
JanHavlicek Posted June 26, 2020 Share Posted June 26, 2020 Hi, I didn't. I just stopped accepting orders for unavailable items Link to comment Share on other sites More sharing options...
archyjoe Posted September 18, 2020 Share Posted September 18, 2020 Hello, Can anyone solve the problem? I really need this. Link to comment Share on other sites More sharing options...
iulianm17 Posted November 20, 2020 Share Posted November 20, 2020 I have same problem. Any updates? Link to comment Share on other sites More sharing options...
archyjoe Posted January 28, 2021 Share Posted January 28, 2021 Nope, still searching :/ Link to comment Share on other sites More sharing options...
DARKF3D3 Posted April 10, 2021 Share Posted April 10, 2021 Here's the solution to show product availability on cart (tested on PS1.7.7.3): File to be modified: themes/classic/templates/catalog/_partials/product-add-to-cart.tpl {if $product.stock_quantity<=0} <span style="font-weight:700;color:red;">Out of stock</span> {elseif $product.stock_quantity < $product.quantity} <span style="font-weight:700;color:orange;">Non available in the desidered quantity</span> {else} <span style="font-weight:700;color:green;">Available</span> {/if} Link to comment Share on other sites More sharing options...
Quentin Fahrner Posted April 22, 2021 Share Posted April 22, 2021 Thanks @DARKF3D3, a solution like this one works properly on my side. Link to comment Share on other sites More sharing options...
GrafFoto Posted July 9, 2021 Share Posted July 9, 2021 Hello everybody, can you please tell me where you have to put the code in the product-add-to-cart.tpl ?! THX Link to comment Share on other sites More sharing options...
DARKF3D3 Posted July 9, 2021 Share Posted July 9, 2021 (edited) /templates/checkout/_partials/cart-detailed-product-line.tpl <!-- availability --> <div class="cart-product-availability"> {if $product.stock_quantity<=0} <span class="product-not-available"><i class="icon-times"></i> Out of stock</span> {elseif $product.stock_quantity < $product.quantity} <span class="product-insufficient-stock"><i class="icon-exclamation"></i> Only {$product.stock_quantity} available</span> {else} <span class="product-available"><i class="icon-check"></i> Available</span> {/if} </div> Edited September 1, 2021 by DARKF3D3 (see edit history) 1 Link to comment Share on other sites More sharing options...
GrafFoto Posted July 13, 2021 Share Posted July 13, 2021 Hello Dark, thx for your answer. But are you sure, that this works in the BASKET? I would think this code is for the product-page?! If I try this, nothing changes at the basket, but I have an error at my product page? Link to comment Share on other sites More sharing options...
GrafFoto Posted July 13, 2021 Share Posted July 13, 2021 Hello again, after some research I think the right file for the shopping cart should be: themes / classic / templates / checkout / _partials cart-detailed-product-line.tpl Link to comment Share on other sites More sharing options...
DARKF3D3 Posted September 1, 2021 Share Posted September 1, 2021 You're right, I made confusion when wrote the reply. Now I edited my previous post with the correct file and code to use. Hope it helps. Link to comment Share on other sites More sharing options...
GrafFoto Posted September 23, 2021 Share Posted September 23, 2021 Hello Darkf3d3, you saved my day! It works perfect! I`ve had some problems, that the icons did not appear. But it is no problem to solve it with some lines of css. For those, who are not sure, where they should place the code - here is my code without icons and the place in the code: original code in /templates/checkout/_partials/cart-detailed-product-line.tpl : <div class="current-price"> <span class="price">{$product.price}</span> {if $product.unit_price_full} <div class="unit-price-cart">{$product.unit_price_full}</div> {/if} </div> </div> New code after this (with german text): <!-- availability --> <div class="cart-product-availability"> {if $product.stock_quantity<=0} <span class="product-not-available">Zur Zeit nicht verfügbar</span><br><span class="product-not-available-2">Bitte aus dem Warenkorb entfernen.</span> {elseif $product.stock_quantity < $product.quantity} <span class="product-insufficient-stock">Nur {$product.stock_quantity} Stück verfügbar</span><br><span class="product-not-available-2">Bitte passen Sie den Warenkorb an.</span> {else} <span class="product-available">Verfügbar</span> {/if} </div> CSS: .cart-product-availability .product-not-available, .cart-product-availability .product-insufficient-stock { color: white; background-color: darkred; padding: 5px 8px; border-radius: 5px; } .cart-product-availability .product-available { color: white; background-color: green; padding: 5px 8px; border-radius: 5px; } .product-not-available-2 { padding-top: 5px; line-height: 30px; font-weight: bold; } 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