Let's say you were customizing the Flat Rate flat shipping module, you could use this code:
Code:
// bof: add additional charge if products 12 or 15 are in the cart
global $cart;
$chk_products = 0;
$extra_shipping = 0.00;
$chk_products += $_SESSION['cart']->in_cart_check('products_id','12');
$chk_products += $_SESSION['cart']->in_cart_check('products_id','15');
if ($chk_products > 0 ) {
$extra_shipping = 5.00;
}
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
'cost' => MODULE_SHIPPING_FLAT_COST + $extra_shipping)));
// eof: add additional charge if products 12 or 15 are in the cart
Bookmarks