How can I kill the table rate module when:
A) the weight of total items is over 300 lbs.
Or,
B). When an item from a specific category is added to the cart.
I will try any suggestions and report back here.
How can I kill the table rate module when:
A) the weight of total items is over 300 lbs.
Or,
B). When an item from a specific category is added to the cart.
I will try any suggestions and report back here.
If you do a search on:
$_SESSION['cart']->in_cart_check
$this->enabled
You should find numerous examples of how this can be used to test the cart content ...
There are also ways to include similar tests for the Order Total to enable/disable based on the $this->enabled
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Ajeh, Yes I did find a whole lot of examples and it makes much sense to me now.
I used the above to kill table rate module when there is category '38' in the cart. It works well.Code:if (IS_ADMIN_FLAG == false) { // disable if category 38 items are in the cart if ($_SESSION['cart']->in_cart_check('master_categories_id','38') > 0) { $this->enabled = false; } }
separate Next Question:
How do I tweak it in a way that table rate is killed when the weight is above 300 labs?
Whats the variable for total weight in cart?
Samar
The weight is in:
$_SESSION['cart']->weight
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
You have an error in the IF statement:
Code:global $cart; if (IS_ADMIN_FLAG == false) { // disable if weight over 300lbs if ($_SESSION['cart']->weight > 300) { $this->enabled = false; } }
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
I don't know ...
Taking that exact code, I edit the Table Rate table:
/includes/modules/shipping/table.php
and change the code to:
and when the weight in the cart is 300 or less it shows and when 301 or more it does not show ...Code:// disable only when entire cart is free shipping if (zen_get_shipping_enabled($this->code)) { $this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false); } global $cart; if (IS_ADMIN_FLAG == false) { // disable if weight over 300lbs if ($_SESSION['cart']->weight > 300) { $this->enabled = false; } } if ($this->enabled) {
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Linda, I got it. I had a syntax in 'my' code.
Thank you so much. The code above works perfectly.
Samar
You are most welcome ... thanks for the update that this is now working for you after you fixed your syntax error in the code ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Bookmarks