I think you are using the wrong function ...
count_contents doesn't make that kind of check ...
Look at the function in the shopping_cart class for:
Code:function in_cart_check($check_what, $check_value='1') {
I think you are using the wrong function ...
count_contents doesn't make that kind of check ...
Look at the function in the shopping_cart class for:
Code:function in_cart_check($check_what, $check_value='1') {
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.1]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Thanks for staying with me on this. I am trying, I just really don't have much experience...
Here's what I put in items. I read an old thread of yours and tried to create a variable to count the number of books.
What does the == mean? Is that equal or not equal? At any rate, when I book one book in the cart, item does not show with this code. Arggghhhh.
// disable when products_model is not all books this goes in item
global $db;
$chk_how_manybooks = $_SESSION['cart']->in_cart_check('products_model','book');
if ($total_count - $chk_how_manybooks == 0) {
// show
$this->enabled = true;
} else {
// hide
$this->enabled = false;
}
In the IF you want == for the evaluation of the values ...
Start with the clean item.php and change this function:
Where this is running you need to use the count_content function and test if in the Admin or not so everything works right ...Code:// class constructor function item() { global $order, $db; $this->code = 'item'; $this->title = MODULE_SHIPPING_ITEM_TEXT_TITLE; $this->description = MODULE_SHIPPING_ITEM_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_ITEM_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_ITEM_TAX_CLASS; $this->tax_basis = MODULE_SHIPPING_ITEM_TAX_BASIS; // disable only when entire cart is free shipping if (zen_get_shipping_enabled($this->code)) { $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false); } if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEM_ZONE > 0) ) { $check_flag = false; $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_ITEM_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while (!$check->EOF) { if ($check->fields['zone_id'] < 1) { $check_flag = true; break; } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } $check->MoveNext(); } if ($check_flag == false) { $this->enabled = false; } } // disable when products_model is not all books this goes in item global $db; if (IS_ADMIN_FLAG == false && ( $_SESSION['cart']->count_contents() - $_SESSION['cart']->in_cart_check('products_model','book') == 0 )) { // show $this->enabled = true; } else { // hide $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.1]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Finally got it all to work. thanks!!! I put the code you gave me in item.php. I wanted zones to NOT appear when the order was all books so I made a few changes and put a slight variation code as shown below. I had trouble with the brackets but finally got it. So I put this code in zones.php.
// class constructor
function zones() {
global $order, $db;
$this->code = 'zones';
$this->title = MODULE_SHIPPING_ZONES_TEXT_TITLE;
$this->description = MODULE_SHIPPING_ZONES_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_ZONES_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_ZONES_TAX_CLASS;
$this->tax_basis = MODULE_SHIPPING_ZONES_TAX_BASIS;
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);
}
// disable when products_model is not all books this goes in item
global $db;
if (IS_ADMIN_FLAG == false && ( $_SESSION['cart']->count_contents() - $_SESSION['cart']->in_cart_check('products_model','book') == 0 )) {
// hide
$this->enabled = false;
} else {
// show
$this->enabled = true;
}
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
$this->num_zones = 4;
}
Be sure to really test that code ... I think you need change:
to read:Code:// disable when products_model is not all books this goes in item global $db;
Code:// disable when products_model is not all books this goes in item global $db, $cart;
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.1]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
thanks for the follow up. I did test it and it worked without the additional coding but I added it and tested it and it still works.
Also I realized it should say, this goes in zones... not item.
Hi, my general shipping is based on zone rate but I am thinking of adding a category that will need to be priced as per item shipping (that's what the dropshipper for that category uses), which code would I need to edit for that?
I am using 1.3.8a
T-I-A!
What happens when you have an order with a mix of Products that use the two different shipping methods?![]()
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.1]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
I had kinda thought of that but not properly, not sure what to do for the best tbh, my current supplier has a 6.99 charge for upto 30kg, the supplier for the new section has a max charge of £15 (which would be 11 items weighing a total of just over a kg), I'll have to see if I may be able to figure it into my markup per item (or at least some) but don't think that will be viable.....
.....*goes back to the drawing board*
ajeh, u seem good with this...
i have aerosols i want to sell.
but the carriage for aerosols is alot more
i want to set it so when any order involves aerosols, it changes from flat carriage to "flat carriage - different cost"
so delivery is £6.95
but when an aerosol is added, delivery is now £15...
is this possible :S
????
pleaseee help me![]()
i may not know how yet, but i soon will....i hope :)
Bookmarks