-
Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories?
Been researching this, can't figure it out.
Basically, one whole category in my store is a product that will be dropshipped by the manufacturer, a flat $10 for shipping any amount ordered in that category, and can only be shipped to the US. I know I need to use Flat Rate Shipping and US zone.
BUT, all other categories I have here in stock and will be shipping myself based on weight, using USPS. I will ship internationally for these items, so more zones.
I've seen lots on using and cloning different shipping modules for different zones, but not for different categories.
If a customer orders a mixture of products from the dropship category and from the other categories, I will need their cart to itemize the $10 flat fee plus the additional shipping by weight (I think it would be cool if these could show on separate lines if possible).
Anyone have any experience with this? Thanks!
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
OK, I just found a post where someone was having the exact same issue: http://www.zen-cart.com/forum/showthread.php?t=123932
One suggested solution was to compromise and come up with one flat rate for the whole store, which I just don't think will work in my case. The category that I need to be a flat rate of $10 for shipping is higher priced jewelry pieces compared to the clothing and accessory items in the rest of the store. If someone buys an $8 shirt, they are not going to want to pay $10 shipping, it would only be a good deal if they buy more items. If I compromise and say the flat rate is $5 shipping, I'll be losing on shipping in most circumstances. Anything above $5 is too much for those items under $10. I was thinking I could do the whole store by weight, and make those dropshipped items weigh more so the shipping charge is higher for them, but then it might go over $10 if they order a lot from that category.
The thread I posted above talks about adapting osC modules for Zen Cart, and I found the directions here: http://www.zen-cart.com/wiki/index.p...dules_from_osC
But where would I find the osC modules in the first place?
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Nevermind, I found it: addons.oscommerce.com/info/4129
I'll update if it does what I'm needing to after I modify it.....
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Did you try just setting the weight to 0 on the Products from that Category and then just test if 1 or more Products from that Category and add the Flat Rate amount to the calculated shipping cost in the USPS shipping module?
You can also make it so if all Products in the order are from that Category then turn off the USPS shipping module and just enable the Flat Rate flat shipping module ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
I actually had that thought, that one way to separate these products from the ones that would ship by weight would be to set their weight to 0, and then to "somehow" make all the 0 weight products fall under the flat shipping price. It's just the "somehow" that I don't get!
When you say "test if 1 or more Products from that Category and add the Flat Rate amount", are you talking about a .php query or something? Honestly my .php knowledge is limited, I can cut/paste in all the right areas and files. What files do I want to be looking at? I'm doubting that this is as simple as configuring in the admin area.
I downloaded that osC module, and there look to be over 20 php files that I'd have to modify, not sure that's the route to go....
Thank you!
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
If all the Products in that Category are using the same master_categories_id ... say this was categories_id 10 ... you could test for how many are being used with:
Code:
global $cart;
$chk_flat_cat = $_SESSION['cart']->in_cart_check('master_categories_id','10')
$chk_flat_cat would then tell you the number of Products x quantity in the shopping cart ...
I would have to really sit down to write the customizations to the code for this ... which is not hard, but more time consuming ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Yes, they are all under the same master category. I totally understand what I'm asking would be time consuming, and I'm not at all expecting you to come up with the whole fix for me. Would you be able to just tell me what file I'd be putting that test into? If I know what file to start with, I can experiment and investigate and see if I can figure it out....
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
I'd customize the Flat Rate flat shipping module:
/includes/modules/shipping/flat.php
and I would customize the USPS shipping module:
/includes/modules/shipping/usps.php
You can then determine which one needs to run based on the results of the test of the cart contents ...
Controlling the $this->enabled determines which runs, by setting it to false when it should not run and true when it should run ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Cool, thanks for the headstart, I'll see what I can do!
One more question and I'm out of your hair, to create the right override setup, would I put the modified files in:
1. includes/modules/my_template/shipping
or
2. includes/modules/shipping/my_template
Or would they both work the same?
Thanks again!
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
The shipping modules do not have overrides ...
Save a copy of the originals on your computer ... and then save a copy of your customized files on your computer for the future ...
Don't try to save them in the:
/includes/modules/shipping
directory as this is a self loading directory and unless you name them right, they will cause you issues if left in there ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
So I've read through the suggestions you gave me, Linda, and have read through most of the following thread and gotten a lot of ideas: http://www.zen-cart.com/forum/showthread.php?t=91394.
I now have some more questions.
1. Are the Master Categories the main categories in my categories sidebox? In terms of this string of links to get to the rings, Alchemy of England/Gothic Jewelery/Rings, is Alchemy of England (which has a lot of other subcategories too) the Master Category, or is Rings? If it helps, here is my store: www.blackorchidcouture.com.
2. So if I add a weight to all the products I want to ship with USPS, and keep all the Alchemy products at 0, then only the wieghted products will generate a shipping price for USPS? And then I just need to have the flat shipping activated anytime I there is an Alchemy product in the cart?
3. Would this code work in the flat.php to add the flat rate to the Alchemy category (category ID 1).....
PHP Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
}
// disable for one master_categories_id
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','1') > 0)) {
// show FLAT
$this->enabled = true;
} else {
// hide FLAT
$this->enabled = false;
}
I hope I'm getting close, the shipping is the last thing holding me back!
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
If you do not use linked products, then the master_categories_id matches the categories_id that it is in ...
If you do use linked products, then you have to see which of the 1+ categories_id has been assigned as the master_categories_id on the product ...
If you have 0 weight on the products that you want the flat rate charge on, you have to check that on the Configuration ... Shipping/Packaging ... that you have marked 0 weight does NOT mean Free Shipping ...
Above the line:
// disable for one master_categories_id
put the code:
global $cart;
so that you can use calls to the cart ...
Are you trying to use Flat Rate when *only* products from master_categories_id is 1 or to also show it with USPS when there is 1 or more products in the cart from categories_id 1
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
I'll have more time to look this all over later, but for now, I don't believe I'm using linked products, Alchemy of England is master category 1, then there are subcategories, then more subcategories folders with the different products.
As for what I need to happen in the cart, if someone orders one or more of these products, I'll need to charge them a flat $10, no matter the quantity. If anything is ordered from any other category also, this $10 needs to be ADDED TO the USPS shipping calculation for these other products. If only other products are ordered and no Alchemy products, I need only USPS to come up.
Thank you! I'll be back tonight.....
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
The master_categories_id is NOT the top level categories_id of a branch on the category tree ...
The master_categories_id is related to the immediate categories_id that the Product is in ...
So if you have a Top Level Category for Alchemy of England that is categories_id 1 and 3 subcategories with Products, then it is those subcategories categories_id that would be the master_categories_id for the Products ...
So what you can do is in Flat Rate flat shipping module you want to count how many products are in the multiple categories_id with the master_categories_id and see if it is the same as the total item count in the cart ... if so, then the whole cart should use Flat Rate ...
If not, then you want to have USPS shipping module check if 1 or more are in those categories_id and if so, add $10.00 to the calculated cost from USPS ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Now that I understand the master_categories_id, I'm thinking the easiest thing would be if I could test if the products were from a certain manufacturer, in this case Alchemy. I will have a lot of master_categories_id's under the top category of Alchemy. I was looking for a way to use the manufacturer instead, and I found both manufacturers_id and product_model. Would either of these work to test in place of master_categories_id?
Thanks!
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
You can test for the manufacturers_id with:
$_SESSION['cart']->in_cart_check('manufacturers_id','XX')
where XX is the manufacturers_id that you want to check ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Yaye, thanks! That's going to be easier I think.
I think I just have one more question. Is the cart able to use/combine TWO shipping modules in one session? Meaning if there are mixed products/manufacturers, will it apply the USPS module for the weighted products AND the Flat module/$10 for the Alchemy products?
Or is it more like, it will use Flat for only Alchemy products, USPS for only other products, and if they are mixed, it won't use Flat at all, but I will need to make it add $10 to the USPS calculation? In which case it will look like one big price, it won't separate the shipping in the cart?
One last idea, would it be easier to just use USPS, keep the Alchemy products at 0 weight so they don't get figured in, and have the cart add a one time $10 "handling fee" if there are one or more Alchemy products?
I think this is the last bit of info I need to fill in the gaps!
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Just one shipping module ...
But you can add an additional calculation to the USPS shipping module to add on to the cost of the USPS quotes ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Ok, since anytime there will be mixed products in the cart, Alchemy and others, and in case I will be using USPS with Alchemy products set to 0 weight, and the module set to add the additional $10 charge for the Alchemy products, I figured it might work to just use the USPS all the time, and not use the Flat Module ever. Just seems like less to get entangled.
So, in the USPS module I took elements of different things I'm reading and have come up with this:
PHP Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
}
$order_total_amount = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
global $cart;
//check if manufacturer alchemy is in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','alchemy') > 0)); {
$drop_ship_extra_charge = $manufacturer_alchemy;
}
// set 223 to your country 2 character country
if ($order->delivery['country']['iso_code_2'] != 'US') {
if ($drop_ship_extra_charge > 0) {
$cat_extra_charge = 10;
}
}
echo 'I see ' . 'An additional $10 shipping fee for Alchemy products will apply to your total.'<br>';
The part $manufacturer_alchemy I completely made up, I'm not sure what to use there.
Am I at all close? Does it need any tweaks? Am I correct that just using the usps module alone should work so long as it charges the $10 fee for Alchemy, and the Alchemy products don't have a set weight to trigger the USPS module?
If I'm way off, please let me know!
Thank you!
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Close to the concept ... :smile:
Code:
//check if manufacturer alchemy is in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','XX') > 0)); {
$manufacturer_alchemy = $_SESSION['cart']->in_cart_check('manufacturers_id','XX');
// this goes here or further down to make the calculation
$drop_ship_extra_charge = $manufacturer_alchemy;
}
you need the XX to be the manufactuers_id for the Alchemy manufacturer ...
Then you can check:
1 are any in the cart
2 if they are in the cart, how many
3 calculate the extra charge
If you want that echo to only show when the $10.00 is added not US shipping then put it inside the IF otherwise it always show ...
Then, add the calculated charge to the cost on the quotes ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
I know something is wrong with what I have now because check out goes to a white page, but am I closer?
PHP Code:
global $cart;
//check if manufacturer alchemy is in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','alchemy') > 0)); {
$manufacturer_alchemy = $_SESSION['cart']->in_cart_check('manufacturers_id','alchemy');
$drop_ship_extra_charge = $manufacturer_alchemy;
}
// charge dropship fee for alchemy
if ($drop_ship_extra_charge > 0) {
$cat_extra_charge = 10;
'cost' => ($cat_extra_charge + MODULE_SHIPPING_USPS_HANDLING);
echo 'An additional $10 shipping fee for Alchemy items has been applied.';
} else {
$cat_extra_charge = 0;
}
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Oh, and I forgot to say I didn't try to make the php count how many Alchemy products are in the cart because whether there are one or many, only one $10 fee will be added. Unless it's still necessary to count them, and that's what's messing this all up.....
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
You are not using the cost correctly ...
The whole section in there should look like:
Code:
global $cart;
//check if manufacturer alchemy is in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','alchemy') > 0)); {
$manufacturer_alchemy = $_SESSION['cart']->in_cart_check('manufacturers_id','alchemy');
$drop_ship_extra_charge = $manufacturer_alchemy;
}
// charge dropship fee for alchemy
if ($drop_ship_extra_charge > 0) {
$cat_extra_charge = 10;
echo 'An additional $10 shipping fee for Alchemy items has been applied.';
} else {
$cat_extra_charge = 0;
}
$methods = array();
$size = sizeof($uspsQuote);
for ($i=0; $i<$size; $i++) {
list($type, $cost) = each($uspsQuote[$i]);
// BOF: UPS USPS
$title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) $title .= $transittime[$type];
/*
$methods[] = array('id' => $type,
'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
*/
$cost = preg_replace('/[^0-9.]/', '', $cost);
$methods[] = array('id' => $type,
'title' => $title,
'cost' => $cat_extra_charge + ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
}
$this->quotes['methods'] = $methods;
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Well, it took me this long to get my USPS webtools user id and get on their production server, so I couldn't test out these changes I made to usps.php until now.
The php is obviously correct because the usps module is showing and calculating, but it's not calculating the extra $10 fee if there are Alchemy products in the cart.
One Alchemy product alone in the cart with my zip code brought up $5.70 for shipping (and my Alchemy products are all set to 0 weight). I also tested a non-Alchemy product alone and it was over $6 (and set to .04 weight), and then added an Alchemy product, but that didn't change the shipping calculation.
Plus, I guess putting the $10 dropship fee in the USPS module is going to make it look like the Alchemy products are going to be shipped USPS? The manufacturer actually sends them Fed Ex.
Here is what I added, with what comes before and after it so you can see where I put it. Any ideas on what's missing?
PHP Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
}
if ($this->enabled) {
// check MODULE_SHIPPING_USPS_HANDLING_METHOD is in
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_USPS_HANDLING_METHOD'");
if ($check_query->EOF) {
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Handling Per Order or Per Box', 'MODULE_SHIPPING_USPS_HANDLING_METHOD', 'Box', 'Do you want to charge Handling Fee Per Order or Per Box?', '6', '0', 'zen_cfg_select_option(array(\'Order\', \'Box\'), ', now())");
}
}
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_USPS_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_USPS_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;
}
}
$this->types = array('EXPRESS' => 'Express Mail',
'FIRST CLASS' => 'First-Class Mail',
'PRIORITY' => 'Priority Mail',
'PARCEL' => 'Parcel Post',
'MEDIA' => 'Media Mail',
'BPM' => 'Bound Printed Matter',
'LIBRARY' => 'Library'
);
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
I am not sure what it is you added and what you posted is the wrong section of code ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Oops, I completely cut/paste the wrong section! :lookaroun
Here's what I put and where it is in the file, I'll make my changes red:
Code:
if (is_array($uspsQuote)) {
if (isset($uspsQuote['error'])) {
$this->quotes = array('module' => $this->title,
'error' => $uspsQuote['error']);
} else {
// BOF: UPS USPS
if (in_array('Display weight', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) {
switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
case (0):
$show_box_weight = '';
break;
case (1):
$show_box_weight = ' (' . $shipping_num_boxes . ' ' . TEXT_SHIPPING_BOXES . ')';
break;
case (2):
$show_box_weight = ' (' . number_format($usps_shipping_weight * $shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT . ')';
break;
default:
$show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($usps_shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
break;
}
}
// EOF: UPS USPS
// BOF: UPS USPS
$this->quotes = array('id' => $this->code,
'module' => $this->title . $show_box_weight);
// EOF: UPS USPS
global $cart;
//check if manufacturer alchemy is in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','alchemy') > 0)); {
$manufacturer_alchemy = $_SESSION['cart']->in_cart_check('manufacturers_id','alchemy');
$drop_ship_extra_charge = $manufacturer_alchemy;
}
// charge dropship fee for alchemy
if ($drop_ship_extra_charge > 0) {
$cat_extra_charge = 10;
echo 'An additional $10 shipping fee for Alchemy items has been applied.';
} else {
$cat_extra_charge = 0;
}
$methods = array();
$size = sizeof($uspsQuote);
for ($i=0; $i<$size; $i++) {
list($type, $cost) = each($uspsQuote[$i]);
// BOF: UPS USPS
$title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) $title .= $transittime[$type];
/*
$methods[] = array('id' => $type,
'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
*/
$cost = preg_replace('/[^0-9.]/', '', $cost);
$methods[] = array('id' => $type,
'title' => $title,
'cost' => $cat_extra_charge + ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
}
$this->quotes['methods'] = $methods;
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Change the two 'alchemy' to be the value of the manufacturers_id for alchemy ...
Code:
$_SESSION['cart']->in_cart_check('manufacturers_id','alchemy')
So if the value is 38 use:
Code:
$_SESSION['cart']->in_cart_check('manufacturers_id',38)
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
OK, we're super close, I changed those manufacturer id's, and now when I put an Alchemy product in the cart and put my zip, the shipping is $15.70, so it's adding the $10 on top of what usps is calculating for shipping, the only thing is that the usps shouldn't be calculating, I only need the flat $10.
Is this the reason that I needed to also configure the flat.php, for cases when there are only Alchemy products in the cart? I guess I thought the usps module would just not calculate anything because of the 0 weight and just add the dropship charge. Maybe because I haven't taken the tare off? I'll try that.....
Ok, that changed it a bit, but didn't eliminate it. The total including the $10 is coming to $11.22/first class, and $14.90/priority, so the very base amounts.
Is there a way to further change usps.php or is it time to work on flat.php?
Thank you soooooo much for all the help you've given me!
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
What are the shipping charges if:
1 Alchemy Product
2 Alchemy Product
3 Alchemy Product
1 Alchemy Product and 1 Regular
2 Alchemy Product and 2 Regular
3 Alchemy Product and 1 Regular
2 Alchemy Product and 2 Regular
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
I tested each of those, and they ALL came out to $14.90 for priority.
So with more than one Alchemy product it correctly only adds one $10 charge, but in call cases, whether it's just Alchemy products or Alchemy plus regular, it's doing the $10 plus the base priority mail charge (the two regular products are light). If I just do the two regular products and no Alchemy, it came it $4.90.....
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Let's pretend I am not understanding the ultimate goal here ...
If I have other Products that are not an Alchemy product, then USPS is correct, right?
If I have 1 or more Alchemy products then it should be a Flat $10.00, correct?
What happens when I have 1 or more Alchemy products and other non-Alchemy products in the cart? Should it just add $10.00 to the USPS charge?
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Yes, what you said is exactly what I want, though the alchemy flat $10 charge doesn't HAVE to be under usps since the manufacturer actually Fed Ex's them, but had come to the point that this way seemed the easiest.
Originally you had told me to set up flat.php to run if there were ONLY alchemy products, and if there were mixed products to have the usps ADD the "dropship" charge. Once I understood that a dropship charge could be added in this way, I thought I could just go the route of configuring usps.php. But now that it seems to want to add a base usps shipping price even if the weight is 0 (maybe just the nature of usps, which maybe can't be altered?), then I'm stuck again. But at least I'm closer than I was last week!
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
If you could tell me for sure if there should be a $10.00 charge added to the USPS rates when there are 1 or more Alchemy products in the cart and other products at the same time ...
and if there are only Alchemy products in the cart that the USPS module should be turned off and just the Flat Rate of $10.00 should be charged ... there are ways to make the modules turn on and off ...
1 Alchemy product - Flat Rate flat shows for $10.00 and USPS is turned off
2 Alchemy products - Flat Rate flat shows for $10.00 and USPS is turned off
1 Alchemy product and 1 or more other non-Alchemy products in cart - USPS shows with $10.00 added to quotes and Flat Rate flat is turned off
0 Alchemy products and other non-Alchemy products in the cart shows regular USPS quotes only and Flat Rate flat is turned off
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Yes, all the scenarios you layed out are exactly true.
It sounds to me from what you're saying that I DO need the flat rate for the times that there are only alchemy products, so I'll work with that, I think that with all I've learned I'll be able to work it out, I'll post when I'm stuck or when it works.....
Thank you!
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
OK, I've installed and modified flat.php, and also added some more code to usps.php, but something isn't right somewhere because the shipping options don't show up in the cart, and when I go to checkout an HTTP 500 error happens. Here's the two code changes:
In usps.php, to disable the module if only alchemy products are in the cart, which will be tested by the total cart equaling 0:
Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
}
global $cart;
// check total weight
if (IS_ADMIN_FLAG == false) {
$chk_weight = $_SESSION['cart']->in_cart_check('products-weight','0');
}
// disable if product weight is more than zero
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products-weight') > 0)) {
// show USPS
$this->enabled = true;
} else {
// hide USPS
$this->enabled = false;
}
In flat.php, my goal is for it to check if the manufacturer Alchemy is in the cart AND if the total cart weight is 0, in which case I want it to be enabled. If the weight is more than zero and alchemy is not in the cart, it should be disabled:
Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
}
global $cart;
// check total weight and manufacturer id
if (IS_ADMIN_FLAG == false) {
$chk_weight = $_SESSION['cart']->in_cart_check('products-weight','0');
$chk_manufacturer = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
}
// disable if product weight is more than zero
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products-weight','0')) {
// show FLAT
$this->enabled = true;
} else {
// hide FLAT
$this->enabled = false;
}
// disable if no alchemy products in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','1') = 0)) {
// hide FLAT
$this->enabled = false;
}
Any ideas?
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Try using this to test the cart for weight:
Code:
global $cart;
// disable if product weight is more than zero in cart
if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_weight() > 0) {
$this->enabled = false;
} else {
$this->enabled = true;
}
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
On testing how many are in the cart for your manufacturer ...
Code:
// disable if no alchemy products in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','1') == 0)) {
// hide FLAT
$this->enabled = false;
}
you missed an equal sign ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Ok, thank you, I changed flat.php the way you suggested.
Now I'm not getting the internal error when I check out, but in the shopping cart and when I click checkout, I get this error:
1054 Unknown column 'products' in 'field list'
in:
[select products-weight as check_it from products where products_id='2' limit 1]
And depending on which product I have in the cart, the number after products_id is different.
Does this have anything to do with the shipping modules??
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
I need to see your code ... this is not a valid field: products-weight
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Oops again!! I looked back, and realized I had products-weight instead of products_weight, so I changed three instances of it. Now the flat rate is working and showing the flat $10 charge if there are 1+ alchemy products in the cart, but if there are other products with or without any alchemy products, the USPS is not coming up at all.
The following red is ALL the custom code I've added to USPS (I've got global $cart; in there twice, is that bad?):
Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
}
global $cart;
// check total weight
if (IS_ADMIN_FLAG == false) {
$chk_weight = $_SESSION['cart']->in_cart_check('products_weight','0');
}
// disable if product weight is more than zero
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_weight') > 0)) {
// show USPS
$this->enabled = true;
} else {
// hide USPS
$this->enabled = false;
}
//(LEAVING OUT A WHOLE SECTION OF CODE HERE TO SAVE SPACE)
// BOF: UPS USPS
$this->quotes = array('id' => $this->code,
'module' => $this->title . $show_box_weight);
// EOF: UPS USPS
global $cart;
//check if manufacturer alchemy is in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','1') > 0)); {
$manufacturer_alchemy = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
$drop_ship_extra_charge = $manufacturer_alchemy;
}
// charge dropship fee for alchemy
if ($drop_ship_extra_charge > 0) {
$cat_extra_charge = 10;
echo 'An additional $10 shipping fee for Alchemy items has been applied.';
} else {
$cat_extra_charge = 0;
}
$methods = array();
$size = sizeof($uspsQuote);
for ($i=0; $i<$size; $i++) {
list($type, $cost) = each($uspsQuote[$i]);
// BOF: UPS USPS
$title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) $title .= $transittime[$type];
/*
$methods[] = array('id' => $type,
'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
*/
$cost = preg_replace('/[^0-9.]/', '', $cost);
$methods[] = array('id' => $type,
'title' => $title,
'cost' => $cat_extra_charge + ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
}
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
This IF has no purpose, at this time:
Code:
// check total weight
if (IS_ADMIN_FLAG == false) {
$chk_weight = $_SESSION['cart']->in_cart_check('products_weight','0');
}
global $cart; is needed in each function ... but just 1 time per function ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
I sure hope I'm not driving you crazy.....:blush:
Ok, I took that out of usps.php AND flat.php, and for now I'm working on Flat.
I feel like I'm onto something, but may have the parentheses wrong, something is wrong, but I'm starting to understand this a bit!
I realized I had to give flat.php more instructions so it will really know when to use it and when to not:
PHP Code:
global $cart;
// check for manufacturer id alchemy
if (IS_ADMIN_FLAG == false) {
$chk_manufacturer = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
}
// disable if no alchemy products in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','1') == 0)) {
// hide FLAT
$this->enabled = false;
}
// disable if there are weighted products
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_weight') > 0)) {
// hide FLAT
$this->enabled = false;
}
// enable if total product weight is 0 AND there are alchemy products
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_weight') == 0)) && (('manufacturers_id','1') > 0)) {
// show FLAT
$this->enabled = true;
}
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
This one isn't doing anything and I think there is a unbalanced use of the parens:
Code:
// enable if total product weight is 0 AND there are alchemy products
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_weight') == 0)) && (('manufacturers_id','1') > 0)) {
// show FLAT
$this->enabled = true;
}
But the better way is to clean up all that code and condense it:
Code:
global $cart;
// check for manufacturer id alchemy
if (IS_ADMIN_FLAG == false) {
$chk_manufacturer = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
$chk_products_weight = $_SESSION['cart']->show_weight();
}
// enable if total product weight is 0 AND there are alchemy products
if (IS_ADMIN_FLAG == false && $chk_products_weight == 0 && $chk_manufacturer > 0) {
// show FLAT
$this->enabled = true;
} else {
$this->enabled = false;
}
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
I finally made this work and thought I'd update in case others were needing to do the same thing. With what I'd done up to this point it wasn't working correctly, and I finally just simplified it and had both the USPS and FLAT modules check the total cart weight, if it's zero it uses flat, if it's more than zero it uses USPS. If USPS is being used, it checks for Alchemy products, and if there are any it adds my flat rate to the USPS.
Linda, thank you so much for sticking with me on this and helping me so much! I learned a lot!
Here's the code in case it helps someone else, my added code is in green...
In flat.php...
Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
}
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
}
global $cart;
// check total cart weight
if (IS_ADMIN_FLAG == false) {
$chk_products_weight = $_SESSION['cart']->show_weight();
}
// enable if total product weight is 0
if (IS_ADMIN_FLAG == false && $chk_products_weight == 0) {
// show FLAT
$this->enabled = true;
} else {
// hide FLAT
$this->enabled = false;
}
In usps.php....
Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
}
global $cart;
// check cart weight
if (IS_ADMIN_FLAG == false) {
$chk_products_weight = $_SESSION['cart']->show_weight();
}
// enable if total product weight is more than zero
if (IS_ADMIN_FLAG == false && $chk_products_weight > 0) {
// show USPS
$this->enabled = true;
} else {
$this->enabled = false;
}
// BOF: UPS USPS
$this->quotes = array('id' => $this->code,
'module' => $this->title . $show_box_weight);
// EOF: UPS USPS
global $cart;
//check if manufacturer alchemy is in cart
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','1') > 0)); {
$manufacturer_alchemy = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
$drop_ship_extra_charge = $manufacturer_alchemy;
}
// charge dropship fee for alchemy
if ($drop_ship_extra_charge > 0) {
$cat_extra_charge = 10;
echo 'An additional $10 shipping fee for Alchemy items has been applied.';
} else {
$cat_extra_charge = 0;
}
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Hi
I haven't had any luck posting around elsewhere, so I thought I'd try here.
I'd like to do something similar to the OP and what's been discussed here...
I've been playing with the codes on this thread, as you can see below, but haven't had any success getting them to work for me.
PHP Code:
global $cart;
//check if manufacturer is in cart
if ((IS_ADMIN_FLAG == false &&
$_SESSION['cart']->in_cart_check('manufacturers_id','1','2') > 0)); {
$manufacturer_excalibur, $manufacturer_greenpower =
$_SESSION['cart']->in_cart_check('manufacturers_id','1','2');
}
// enable if manufacturer is in cart
if (IS_ADMIN_FLAG == false && $chk_manufacturers_id == 0) {
// show FLAT
$this->enabled = true;
} else {
// hide FLAT
$this->enabled = false;
}
I want to get the cart to only show the Flat Rate shipping option when products from the manufacturers Excalibur and Greenpower are in the cart - otherwise show the Per Item option.
I really have little idea how the coding works, so any help would be much appreciated.
Thanks in advance,
Tija
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
What happens if I have 1 Product from Excalibur and 2 Products from Greenpower and then 2 Products from other manufacturers_id ... :unsure:
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
To control the Flat Rate flat shipping module so that it only shows if ALL products in the cart are from manufacturers_id 1 or 2 you can use:
Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
}
// check if manufacturer 1 or 2 is in cart
if (IS_ADMIN_FLAG == false) {
global $cart;
$chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
$chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
$chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
if ($chk_manufacturers_id > 0) {
$this->enabled = true;
} else {
$this->enabled = false;
}
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Quote:
Originally Posted by
Ajeh
To control the Flat Rate flat shipping module so that it only shows if ALL products in the cart are from manufacturers_id 1 or 2 you can use:
Code:
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
}
// check if manufacturer 1 or 2 is in cart
if (IS_ADMIN_FLAG == false) {
global $cart;
$chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
$chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
$chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
if ($chk_manufacturers_id > 0) {
$this->enabled = true;
} else {
$this->enabled = false;
}
Ah, OK - thanks for the reply and for cleaning that up :)
Quote:
Originally Posted by
Ajeh
What happens if I have 1 Product from Excalibur and 2 Products from Greenpower and then 2 Products from other manufacturers_id ... :unsure:
Most of my items are drop-shipped and remain a flat rate no matter how many a customer buys, and I subsidise the shipping when a customer buys products combined with drop-shipped products. So the shipping remains $15.
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
OK, so I tried the code, Linda... now both the shipping estimator and the admin shipping modules page aren't working.
I know I'm doing something wrong - I just have no idea what.
Any suggestions?
- Tija
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Yeps ... add the missing closing bracket that I left out:
Code:
// check if manufacturer 1 or 2 is in cart
if (IS_ADMIN_FLAG == false) {
global $cart;
$chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
$chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
$chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
if ($chk_manufacturers_id > 0) {
$this->enabled = true;
} else {
$this->enabled = false;
}
}
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
That works :) Thanks so much Linda :)
Now I just have one last question...
I have two different drop-shipping rates for different products (say A for $15 and B for $35), and then use Per Item for the products I stock.
So, when a customer has any number of drop-ship A in their cart, Flat Rate #1 at $15 will be the only option available. The same goes for each of the other products - Flat Rate #2 at $35, Per Item at $6, etc.
I want to have just one shipping method as the only option, no matter what a customer has in their cart, but this next part is confusing me as to how to get it to work:
If a customer buys one of each of the drop-shipped items (A and B), Flat Rate #2 ($35) would be the only option.
And if a customer buys either of the drop-shipped items (A or B), combined with products I stock, then the respective shipping rate would show. For example, if a customer buys an item from A as well as items I stock, the shipping would be Flat Rate #1 at $15. If item A was changed to B, then the shipping would be #2 at $35.
How would I get all this into the code?
Again - thanks so much for your help. I REALLY appreciate it :)
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
If you were to add this code into the quote section of the Item Rate item shipping module:
Code:
// check if manufacturer 1 or 2 is in cart
if (IS_ADMIN_FLAG == false) {
global $cart;
$chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
$chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
$chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
}
You would know how many items are from manufacturers_id 1 and from manufacturers_id 2 ...
The Item Rate is using the number of items in the cart ...
If you were to subtract from the number of items about to be calculated the $chk_manufacturers_id you would then just be charging the Item Rate for all products not in 1 and 2 ... just under this code in item.php
Code:
// adjusted count for free shipping
$item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();
then, you can add in the extra charge for the Flat Rate amount to this calculation based on $chk_manufacturers_id1 >= 1 add $15.00 and $chk_manufacturers_id2 >= 1 add $35 ... by adjusting the code in this section:
Code:
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
'cost' => (MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING)));
So Flat Rate should only be used for manufacturers_id 1 and 2 and the amounts altered to $15 or $35 or both ... otherwise, Flat Rate should not show if there are other products in the cart ...
Item Rate should be altered to not show when only products are from manufacturers_id 1 and 2 ...
Item Rate should be altered to reduce the item count based on anything from manufacturers_id 1 and 2 ... and add the additional charges for manufacturers_id 1 and 2 ...
Note: in theory, this could all be done in Item Rate item as the Item Rate would be 0 when only products are from manufacturers_id 1 and 2 ... and then the calculations for manufacturers_id 1 and 2 would be used ... providing you write the code correctly ... :cool:
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Well, I added the codes into the modules, but now the shipping estimate shows two Per Item methods, instead of Flat Rate, when I have manufacturers 1 and/or 2 in the cart (the one that should be Flat Rate is showing at $0).
The Per Item module (the one that's supposed to show) is fine when I have products from any other manufacturer in the cart, and it is the only option available.
I'm thinking it has something to do with this part you mentioned:
Quote:
Originally Posted by
Ajeh
If you were to subtract from the number of items about to be calculated the $chk_manufacturers_id you would then just be charging the Item Rate for all products not in 1 and 2 ... just under this code in item.php
Code:
// adjusted count for free shipping
$item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();
I don't quite understand what you mean by this... am I supposed to add a piece of coding here?
Thanks again,
Tija
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
If you only used the Item Rate item shipping module ... you would do the calculation for the two manufacturers_id in it ...
NOTE: based on where the code is you do not need to test for if in the admin or not ...
Change the quote function to:
Code:
// class methods
function quote($method = '') {
global $order, $total_count;
// check if manufacturer 1 or 2 is in cart
global $cart;
$chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
$chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
$chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
// calculate charges for manufacturers 1 or 2
$extra_manufacturers_charge = 0.00;
if ($chk_manufacturers_id1 > 0) {
$extra_manufacturers_charge += 15;
}
if ($chk_manufacturers_id2 > 0) {
$extra_manufacturers_charge += 35;
}
// adjust count for manufacturers
// adjusted count for free shipping
$item_total_count = $total_count - $chk_manufacturers_id1 - $chk_manufacturers_id2 - $_SESSION['cart']->free_shipping_items();
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
'cost' => $extra_manufacturers_charge + (MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING)));
This way, there is only one shipping method handling everything ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Well, that works for the two separate drop-ship prices, but this part doesn't seem to be working:
Code:
// adjust count for manufacturers
// adjusted count for free shipping
$item_total_count = $total_count - $chk_manufacturers_id1 - $chk_manufacturers_id2 - $_SESSION['cart']->free_shipping_items();
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
'cost' => $extra_manufacturers_charge + (MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING)));
When I have the two different manufacturers in the cart, the shipping adds together - so it comes to $50 instead of $35 for the combined drop-ship items, and just adds the Per Item rate onto those rates for drop-ship products combined with products I stock.
Any ideas?
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Could you post the whole quote portion of the item.php file so that we can see what you are using right now?
NOTE: this is the only portion of the code that should be changed and the only shipping module that should be installed ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Hopefully this is the correct part of the code... I'm not familiar with PHP at all :unsure:
Code:
// class methods
function quote($method = '') {
global $order, $total_count;
// check if manufacturer 1 or 2 is in cart
global $cart;
$chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
$chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
$chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
// calculate charges for manufacturers 1 or 2
$extra_manufacturers_charge = 0.00;
if ($chk_manufacturers_id1 > 0) {
$extra_manufacturers_charge += 15;
}
if ($chk_manufacturers_id2 > 0) {
$extra_manufacturers_charge += 35;
}
// adjust count for manufacturers
// adjusted count for free shipping
$item_total_count = $total_count - $chk_manufacturers_id1 - $chk_manufacturers_id2 - $_SESSION['cart']->free_shipping_items();
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
'cost' => $extra_manufacturers_charge + (MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
return $this->quotes;
}
Quote:
NOTE: this is the only portion of the code that should be changed and the only shipping module that should be installed ...
I haven't altered any other part of the code and it is the only module installed except for Zone Rates, as I ship internationally.
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
What charges do you get if you add 1 product from manufacturers_id 1?
What charges do you get if you add 2 product from manufacturers_id 1?
What charges do you get if you add 1 product from manufacturers_id 2?
What charges do you get if you add 2 product from manufacturers_id 2?
What charges do you get if you add 1 product from manufacturers_id 1 and 1 product from manufacturers_id 2?
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Quote:
what charges do you get if you add 1 product from manufacturers_id 1?
$15
Quote:
what charges do you get if you add 2 product from manufacturers_id 1?
$15
Quote:
what charges do you get if you add 1 product from manufacturers_id 2?
$35
Quote:
what charges do you get if you add 2 product from manufacturers_id 2?
$35
Quote:
what charges do you get if you add 1 product from manufacturers_id 1 and 1 product from manufacturers_id 2?
$50
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Okay so that part is working fine to charge the correct amounts based on those two manufacturers_id values ...
Now, you should have your Item Rate setup to charge a certain amount per item when you add a Product to the order that is not in manufacturers_id 1 or 2 ...
If you add 1 Product to the order that is not in manufacturers_id 1 or 2 what is the amount?
If you add 2 Product to the order that is not in manufacturers_id 1 or 2 what is the amount?
If you add 1 Product to the order that is not in manufacturers_id 1 or 2 and add 1 Product from manufacturers_id 1 what is the amount?
If you add 2 Product to the order that is not in manufacturers_id 1 or 2 and add 1 Product from manufacturers_id 1 what is the amount?
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
HELP I can not figure out how to add a new post so I am just replying to this one.
My customer called and my site is sending the message "not shipping to your area at this time" I tested the site and it does this to me also. I have not touched the site except to add products. I have 1.39e. I charge a flat rate for shipping and taxes are based on the store=MN. I set all my products as 0 rate so that they go to the flat rate shipping. This worked fine and is now not working. I have the zone turned off. I looked in book and can not find anything. Please I am not real versed in computer language so keep it simple. LOL
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Quote:
Okay so that part is working fine to charge the correct amounts based on those two manufacturers_id values ...
The $50 that the cart charges for 1 product from manufacturers_id 1 and 1 product from manufacturers_id 2 should just be $35.
Quote:
If you add 1 Product to the order that is not in manufacturers_id 1 or 2 what is the amount?
$3
Quote:
If you add 2 Product to the order that is not in manufacturers_id 1 or 2 what is the amount?
$6
Quote:
If you add 1 Product to the order that is not in manufacturers_id 1 or 2 and add 1 Product from manufacturers_id 1 what is the amount?
$18
Quote:
If you add 2 Product to the order that is not in manufacturers_id 1 or 2 and add 1 Product from manufacturers_id 1 what is the amount?
$21 (this one and the one above should remain $15, as I do not charge shipping for items I stock when combined with drop-shipped products.)
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Okay ...
Are you saying ...
if the cart contains 1 or more Product from manufactures_id 2 charge $35, regardless of any other product in the cart?
if the cart contains 1 or more Product from manufactures_id 1 (and none from manufacturers_id 2) charge $15, regardless of any other product in the cart?
And if the cart contains any number of Products from any thing and *none* from manufacturers_id 1 or 2 then charge the $3 per Item?
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Quote:
Originally Posted by
Ajeh
Okay ...
Are you saying ...
if the cart contains 1 or more Product from manufactures_id 2 charge $35, regardless of any other product in the cart?
if the cart contains 1 or more Product from manufactures_id 1 (and none from manufacturers_id 2) charge $15, regardless of any other product in the cart?
And if the cart contains any number of Products from any thing and *none* from manufacturers_id 1 or 2 then charge the $3 per Item?
Yes, that's what I'd like. Sorry if how I worded it was confusing.
Again, thanks heaps for your help :bigups:
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
That is very different from what it sounded like you wanted ...
Start over with the Item Rate item shipping module and try the code as:
Code:
// class methods
function quote($method = '') {
global $order, $total_count;
// check if manufacturer 1 or 2 is in cart
global $cart;
$chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
$chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
$chk_shipping_charges = 0.00;
switch(true) {
case ($chk_manufacturers_id2 > 0):
$chk_shipping_charges = 35.00;
break;
case ($chk_manufacturers_id1 > 0):
$chk_shipping_charges = 15.00;
break;
}
// adjusted count for free shipping
$item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
'cost' => ($chk_shipping_charges > 0 ? $chk_shipping_charges : ((MODULE_SHIPPING_ITEM_COST * $item_total_count) + MODULE_SHIPPING_ITEM_HANDLING) ) )));
if ($this->tax_class > 0) {
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
It works perfectly :clap: Thanks so much.
I just have a couple of final questions that are a little off-topic...
First - I mentioned earlier that I ship internationally, and therefore have the Zone Rates shipping mod installed. The only thing is that it shows on the shipping estimator when it is set to national shipping (which is Australia), saying "No shipping available to the selected country".
Is there any way to get it to hide completely unless a customer specifies a country other than Australia?
Second is the same as above, except reversed. So is there a way to hide the Per Item shipping module when a customer specifies an international country?
Once more, I appreciate everything you've done and I'll be sending a cup of coffee your way (I'm going to have to ask you how I go about that, though).
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Build a Zone for the Rest of the World and add it to the Item Rate item shipping module ...
What are your settings on the Zone Rate zones shipping module? It sounds like you do not have a setting correct on it ...
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Quote:
Build a Zone for the Rest of the World and add it to the Item Rate item shipping module ...
After checking, I found I hadn't set up my Zone Definitions properly. Now that I've fixed them, the Per Item mod no longer displays internationally.
Quote:
What are your settings on the Zone Rate zones shipping module? It sounds like you do not have a setting correct on it ...
Again, looking over the settings, I found I had overlooked the Skip Countries option on the Zone Rates mod :oops:
So I think everything is sorted out now.
As always, thanks for everything, and if you could give me the details I need to pay you, a well-earned cup of coffee will be on its way :smile:
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Thanks for the update that all is working properly now ...
The link for coffee and donuts to the Zen Cart Team is in my signature ... :cool:
-
Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories
Hi Linda
It seems I overlooked one aspect of my shipping when I was discussing it with you...
I have just now realised that I have some small accessories available from manufacturer 1, but which ship at a separate price.
I managed to incorporate the shipping prices for them just fine using a table rate (up to 2 accessories for $5 and up to 10 for $10), but now I can't hide that module when the regular items from manufacturer 1 are in the cart.
So, I want the Per Item module to show as before, when regular items from manufacturer 1 are in the cart, but to have it hide and the Table Rate module to show when accessories from manufacturer 1 are in the cart (each are listed in separate categories).
I've tried to alter some of the codes you've given previously, but I've had no luck with it.
This is what I had hoped would work:
PHP Code:
if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','4') > 0)) && (('manufacturers_id','1') > 0)) {
$this->enabled = true;
} else {
$this->enabled = false;
}
I'd really appreciate it (again!) if you could show me what I need to change to get it to work :smile:
Thanks,
Tija