Hello,
And If the customer comes back to this page again later, how to make him informed that the product is already in the cart?
Customers are generally informed of what they have added to their cart by displaying a cart module listing every products added to their cart or only displaying the amount of product on their cart.
Is there a way to show only the total of added items. Like "Added to Cart: 5 items" ?
Doing it will be more complex, but to fix the code that Nicolas gave you, a solution can be to, edit the file "show_default" file of the "Product" view of your front-end template, and add after these lines :
<div id="hikashop_product_quantity_main" class="hikashop_product_quantity_main">
<?php
//LAYOUT quantity
$this->row = & $this->element;
$this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1' . $form . ',\'cart\'); } else { return false; }';
$this->setLayout('quantity');
echo $this->loadTemplate();
?>
</div>
this :
<span id ="nb_product_added" class="nb_product_added">
</span>
And change the code that Nicolas gave you by :
$this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ document.getElementById(\'nb_product_added\').innerHTML=field.value+\' products added to the cart\';return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1' . $form . ',\'cart\'); } else { return false; }';