Add product weight and cart weight on view cart in Cs-cart

This is a minor addon code to show product weight and total weight on the cart.  You can add this code to any of your existing addon or my_changes addon.  To illustrate, I will do the changes to my_changes addon.

  1. Make sure you have the addon installed.  Verify from Administration->addons page.
    my_changes_installed
  2. Add template code to show product weight, create folder and files if not present.
    skins\basic\customer\addons\my_changes\hooks\checkout\product_info.post.tpl

     {$lang.products_weight} : {$product.weight} {$settings.General.weight_symbol}
    
  3. Add template code to show cart weight,  create folder and files if not present.
    skins\basic\customer\addons\my_changes\hooks\checkout\checkout_totals.pre.tpl

    {assign var="cart_weight" value=''}
    {foreach from=$cart_products item="product" key="key"}
    {assign var=cart_weight value=$cart_weight+$product.weight*$product.amount}
    {/foreach}
    <li class="subtotal">
     <span class="checkout-item-title">{$lang.weight}</span>
     <span class="checkout-item-value">{$cart_weight} {$settings.General.weight_symbol}</span>
    </li>
    
  4. That’s it, just the clear cache admin.php?cc and check cart after adding a few products having weight.
    product_weight_on_cart
Posted in CS-Cart, CS-Cart Addons, PHP
2 comments on “Add product weight and cart weight on view cart in Cs-cart
  1. david says:

    i also tried this,it works,thank you very much

  2. Harry says:

    Is there a way to add weight to the packing list?

Leave a Reply

Your email address will not be published. Required fields are marked *

*