Hi Linda,
I'm new to PHP but I was able to modify your code somewhat to my purposes. I'm trying to create 2 additional handling categories in your UPS Module. One for shipping a 4' tube to add an additional $10 to the shipping cost, and one for shipping an 8' tube to add the $10 cost of the tube, plus the mandatory $10.50 addl. handling fee for UPS. Here's my code, but it shows 2 of every shipping option in the cart, and it only takes the 4' option. Any advice is appreciated!
PHP Code:
// bof: customize for extra charges
global $cart;
$chk_molding = 0;
$chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','141');
$chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','136');
$chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','137');
$chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','139');
$chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','138');
$chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','140');
$chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','142');
$chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','171');
$chk_molding4 = 0;
$chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','164');
$chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','165');
$chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','166');
$chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','167');
$chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','169');
$chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','170');
// continue adding for more categories
$molding_handling = 0;
if ($chk_molding > 0) {
// add tube
$molding_handling = 10.00;
// add extra handling
$molding_handling += 10.50;
}
$molding4_handling = 0;
if ($chk_molding4 > 0) {
// add tube
$molding_handling = 10.00;
}
// add $molding_handling to cost
$methods[] = array('id' => $type,
'title' => $this->types[$type],
'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) + $molding_handling );
// add $molding4_handling to cost
$methods[] = array('id' => $type,
'title' => $this->types[$type],
'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) + $molding4_handling );
// eof: customize for extra charges
Thanks in advance!
Using v1.5.0 - clean install, no upgrades: http://restorationstuff.com/ecommerce
~Joe
Bookmarks