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