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) );
}