VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Coding Central => Topic started by: ronjb on December 15, 2013, 21:34:52 PM

Title: how to display total weight of all products in cart checkout
Post by: ronjb on December 15, 2013, 21:34:52 PM
i was able to show the each product weight per row of the product with this
<?php echo $prow->product_weight ?>

but i can't get the total weight of all products, i tried

<?php echo $this->totalWeight ?>

but it didn't work any ideas how can i get the total weight of all products to be displayed on the checkout cart page?

thanks in advance
Title: Re: how to display total weight of all products in cart checkout
Post by: greaves on January 06, 2014, 14:21:51 PM
Did you find a solution ?
Title: Re: how to display total weight of all products in cart checkout
Post by: lindapowers on January 06, 2014, 14:46:06 PM
ship_mode ?

That is how the field is named in CCVAOM, we use it to export orders but have no clue if they renamed that field from the VM one.
Title: Re: how to display total weight of all products in cart checkout
Post by: PRO on January 06, 2014, 18:25:32 PM


There is another way, but this was easier for me

Here is the function to add up the product weights

<?php function cWeight($products){
      $tweight= 0;
      foreach ( $products as $prow) {
         $tweight += $prow->product_weight*$prow->quantity;
      }
return $tweight;
   } ?>


Then, you can echo it anywhere you want like this


   <?php echo cWeight($this->cart->products);?>


Title: Re: how to display total weight of all products in cart checkout
Post by: theocharis78 on June 24, 2014, 09:32:38 AM
in which file write the codes?