Jump to content

[SOLVED] Out of Stock Warning


Recommended Posts

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

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

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

  • 6 years later...

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...