News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

To select shipment by combination of product weight =0 OR >0.. Need Help!

Started by alwinchankong, February 06, 2014, 15:34:35 PM

Previous topic - Next topic

alwinchankong

Condition:
To detect shipment if upon checkout if any product's weight in shopping cart is 0 or >0


/administrator/components/com_virtuemart/plugins/vmpsplugin.php

protected function getOrderWeight (VirtueMartCart $cart, $to_weight_unit) {
 
    $i=0;
    $totalweight=array();
static $weight = 0.0;
if(count($cart->products)>0 and empty($weight)){
foreach ($cart->products as $product) {
     
vmdebug('getOrderWeight',$product->product_weight);                 
        $totalweight[$i]=". $weight . ";
       
        if (in_array("0.0", $totalweight)) {
            $weight = 0.0;
        }
       
        else
        {
            $weight += (ShopFunctions::convertWeigthUnit ($product->product_weight, $product->product_weight_uom, $to_weight_unit) * $product->quantity);
        }

}
}
return $weight;
}


But it doesn't work the way as i expected. Please advice.