I'm trying to add a weight limitation for a payment module in oscommerce. So if the total items in cart has a weight above 2kg I don't want to display it as an payment option.
I tried to do something like this:
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
if ($order->products[$i]['weight'] > '2') {
$this->enabled = false;
}
}
When I echo
it, the total weight is zero.
I manage to exclude the payment option when the cart contains above 25 items with with the following code:
$total_units = 0;
for ($i=0, $j=count($order->products); $i<$j; $i++) {
$total_units += $order->products[$i]['qty'];
}
if ($total_units > '25') {
$this->enabled = false;
}