New Zenner
- Join Date:
- Sep 2007
- Posts:
- 21
- Plugin Contributions:
- 0
Disable shipping method by weight. zones.php
Hi all,
I've been searching but unable to find an answer for this:
I use two shipping methods, one is Certified Mail and the other is EMS (I'm based in Panama). For both, I use zones.php. I use two copies, renamed one to ems.php. It works great.
The issue I have is that Certified Mail (zones.php) only accepts up to 4.4lbs.
If the order goes higher than that, I get a "The shipping rate cannot be determined at this time, $0.00" message, but the user can continue and place the order anyway.
What I need is a way to restrict the shipping method, so that if the order weights more than 4.4lbs, the Certified Mail option doesn't appear.
At first, I thought I had solved the by using a simple, not-elegant method, (since I'm not a programmer), and I tested for number of products:
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','8') > 4)) {
$this->enabled = false;
}
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','9') > 0)) {
$this->enabled = false;
}
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','112') > 0)) {
$this->enabled = false;
}
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','111') > 2)) {
$this->enabled = false;
}
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','119') > 2)) {
$this->enabled = false;
}
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_id','120') > 0)) {
$this->enabled = false;
}
So when a customer orders more than a certain amount of products, the Certified Mail option doesn't even appear and the customer is forced to choose EMS.
But today a customer placed an order that included some of these products and another not tested for, and got the same message.
So what I really need is to test for weight, but I don't have the slightest idea of how to do that!
I'm currently using v1.3.9h, my zones.php says:
/**
* @package shippingMethod
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: zones.php 6347 2007-05-20 19:46:59Z ajeh $
*/
My site is at http://www.panamarts.com
How would I do that?
Thanks in advance for any help,
Humberto Olarte Cupas