Hi all,
I hope this is the right forum to ask this question.
A few months ago, I asked whether I could restrict the shipping method by weight. I was restricting by quantity, but weight turned to be much more convenient.
Basically, I have two available shipping methods, but one of them only accepts packages up to 2kg. I have my weights in lbs. The code I'm using in zones.php is:
So if anything weights more than 4.4lbs, this method won't appear.Code:global $cart; if (!IS_ADMIN_FLAG && $_SESSION['cart']->weight >= 4.4) { $this->enabled = false; }
But recently, I got an order for products that combined weighted 4.75lbs, yet the restricted method showed, so I get an order that says "The shipping rate cannot be determined at this time" even though I restricted it to 4.4lbs tops.
So I checked to see what happened, since the code is right.
It turns out that the products actually weight 3.75lbs, which is under my 4.4lbs limit, and I set a tare weight of 1lb for any package, so when added, I get 4.75lbs.
But the code checks for the product weight only, not the product + tare, so the code doesn't work. The invalid shipping method shows.
I hope I've explained it right!
Now for my question, what can I do so the code tests for the whole weight, including product + tare? Maybe something along the lines of:
Is there any such variable?Code:global $cart; if (!IS_ADMIN_FLAG && $_SESSION['cart']->totalweight >= 4.4) { $this->enabled = false; }
Thanks in advance for any pointers here,
Humberto
http://www.panamarts.com
Bookmarks