Total weight to display in shopping cart

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Sun May 12, 2013 10:34 pm
Reply with quote
Report this post
Hello guys. Please help me to display weight total in shopping cart.
I did put this code in default_pricelist.php:

<tr class="sectiontableentry1">
<td colspan="4" align="right"><?php echo JText::_ ('COM_VIRTUEMART_PRODUCT_WEIGHT') ?>:</td>
<td colspan="2" align="right">
<?php echo $totalWeight, ' ', JText::_('COM_VIRTUEMART_PRODUCT_WEIGHT_KG') ?>
</td>
</tr>

But it didn't work. Total weight didnt display.
Thanks!
User avatar
Fresh Boarder

teitbite
Mon May 13, 2013 9:04 am
Reply with quote
Report this post
Hi

Please send me an access to ftp, so I'll help You to find a right variable keeping weight in.
User avatar
Moderator

GK User
Mon May 13, 2013 9:39 am
Reply with quote
Report this post
Thanks for reply but I found the solution.
Here it is:

<tr class="sectiontableentry1">
<td colspan="4" align="right"><?php echo JText::_ ('COM_VIRTUEMART_PRODUCT_WEIGHT') ?></td>
<td colspan="2" align="right">

<?php

foreach ( $this->cart->products as $product ) {
$q = 'SELECT `product_weight` FROM `#__virtuemart_products` WHERE `virtuemart_product_id`=' . $product->virtuemart_product_id;
$db = JFactory::getDbo();
$db->setQuery($q);
$productWeight = $db->loadResult();
$totalWeight += $productWeight * $prow->quantity;

}

echo $totalWeight, ' Kg';

?>

</td>
</tr>
User avatar
Fresh Boarder

teitbite
Mon May 13, 2013 10:26 am
Reply with quote
Report this post
Hi

Sure, no problem. Thank You for posting the solution for other users.
User avatar
Moderator


cron