简体   繁体   中英

How to Multiply Product unit with feature value in cart summary Prestashop

Screenshot (Prestashop) I added a image of Cart summary. So I added product features in cart summary and one of them is "Bag" which is weight in Kg. "Total KG" section shows total weight means "product quantity x Bag weight". I used this code and it's working when we click add to cart.

<td>
{assign var="features"     value=Product::getFrontFeaturesStatic(Context::getContext()->language->id,   $product.id_product)} 
{foreach $features as $feature}
{if $feature.id_feature == 9}
<div>{$feature.value*$product.cart_quantity|escape:'htmlall':'UTF-8'} Kg</div>
{/if}
{/foreach}
</td>

But when we increase quantity directly through cart summary page through + and - buttons then it's not working. I know it is possible but using ajax only.

When product quantity is modified on the Cart page then an Ajax request is sent to CartController.php (front) and which finally calls updateQty() function in Cart.php class file.

So you need to add the code that you are using to updateQty() function as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM