sachin427 Posted November 6, 2010 Share Posted November 6, 2010 What im trying to do is display a warning (just a line of text) in my shopping cart summary. When a customer requests items that are out of stock, I want this warning to appear. Thanks in advance. Link to comment Share on other sites More sharing options...
rocky Posted November 8, 2010 Share Posted November 8, 2010 PrestaShop already displays a red circle icon for products that are out-of-stock in the cart and prevents you from proceeding until you have removed the out-of-stock product from your cart. Is that not enough? Do you want an error message before the customer clicked "Next" instead of after? Link to comment Share on other sites More sharing options...
sachin427 Posted November 8, 2010 Author Share Posted November 8, 2010 Sorry for not being clear. I currently allow customers to order out of stock items, in which case the red icon appears telling them that the item is not in stock. I would like to go a step further and display a note at the bottom of the shopping cart summary reminding them that orders will take extra time to ship out when ordering out of stock items. I want this note to appear only when out of stock items are in the cart. Thanks Link to comment Share on other sites More sharing options...
rocky Posted November 9, 2010 Share Posted November 9, 2010 Try adding the following to shopping-cart.tpl where you want the warning message to appear: {assign var='out_of_stock' value=0} {foreach from=$products item=product} {if $product.quantity == 0} {assign var='out_of_stock' value=1} {/if} {/foreach} {if $out_of_stock}{l s='Warning: Some products in your cart are out-of-stock and will take longer to be delivered.'}{/if} Link to comment Share on other sites More sharing options...
sachin427 Posted November 10, 2010 Author Share Posted November 10, 2010 Works like a charm! Many thanks. Link to comment Share on other sites More sharing options...
kamppa Posted January 4, 2017 Share Posted January 4, 2017 Try adding the following to shopping-cart.tpl where you want the warning message to appear: {assign var='out_of_stock' value=0}{foreach from=$products item=product} {if $product.quantity == 0} {assign var='out_of_stock' value=1} {/if}{/foreach}{if $out_of_stock}{l s='Warning: Some products in your cart are out-of-stock and will take longer to be delivered.'}{/if} Seems good but does not work with 1.6. Could there also be a message when stock quantity is 2 but the customer orders 3 or more. Link to comment Share on other sites More sharing options...
kamppa Posted January 11, 2017 Share Posted January 11, 2017 I was able to add a line to cart that shows product quantity in stock only in the case of customer ordering more than stock quantity. shopping-cart-product-line.tpl {if $product.quantity_available < $product.cart_quantity && $product.quantity_available >= 0}{$product.stock_quantity}{l s=' qty'}{else}{/if} This does not work with ajax but only when page is refreshed. 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