How can i display the total weight of all products that are in the cart?
Example:
Total weight of your cart: 2000kg
I open the smarty tempalte debugger and found
{$cart_products.ARRAY_ID.weight} but this only the weight of one group of product.
Moreover if you have quantity = 10 for this product this is not multiplied.
So i guess i have to look in controller checkout.php,
calculate it, assign it in some smarty variable and display it from the template.
Anyone else has done it before?
Look at the core/fn.cart.php where it calculates the total weight to pass to the realtime shipping quote routines. You can probably just do:
Registry::get(‘view’)->assign(‘shipping_weight’, $weight);
Where '$weight is the total calculated weight.
Then in your template do:
{if $shipping_weight}
HOWEVER YOU WANT TO FORMAT YOUR OUTPUT
{/if}