Hi,
it happened several times that they called me saying that a product was out of stock when instead it was available in quantity 1. This happens when the customer does not realize that he already has the product in the cart and then the system shows him the product not available (precisely because he took the last one).
I would like to make sure that if the customer already has the last product in the cart, he is notified that he already has the latest available product in the cart.
Reading this thread https://www.prestashop.com/forums/topic/1008079-risoltosolazione-al-problema-prodotto-non-disponibile-perchè-già-nel-carrello/ in the Italian forum I made these changes to the product-add-to-cart.tpl file:
1. Just after the code:
{if !$configuration.is_catalog}
add the following:
{$in_cart = 0}
{foreach from=$cart['products'] item='cart_product'}
{if $cart_product['id_product'] == $product.id}
{$in_cart = 1}
{/if}
{/foreach}
Change the code:
{block name='product_availability'}
<span id="product-availability">
{if $product.show_availability && $product.availability_message}
{if $product.availability == 'available'}
<i class="material-icons rtl-no-flip 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}
{/if}
</span>
{/block}
with the following:
{block name='product_availability'}
<span id="product-availability">
{if $product.show_availability && $product.availability_message}
{if $product.availability == 'available'}
<i class="material-icons rtl-no-flip product-available"></i>
{$product.availability_message}
{elseif $product.availability == 'last_remaining_items'}
<i class="material-icons product-last-items"></i>
{$product.availability_message}
{else}
{if !$in_cart}
<i class="material-icons product-unavailable"></i>
{/if}
{/if}
{if !$in_cart}
{$product.availability_message}
{/if}
{/if}
</span>
{/block}
Everything works fine except that when a product is available I find myself with the word "Available Available" (twice) under the product ... can you please help me solve this problem?
Thanks and best regards,
Fabrizio.