here is my code. you may need to hire a specialist to redo this, or you could try to work it out on your own:
Code:
function quote($method = '') {
global $order, $total_count;
// i ignore free shipping items.. all items are priced not matter what.
//$total_count = $total_count - $_SESSION['cart']->free_shipping_items();
// each array item is another array consisting of the product name, it's base shipping cost,
// the price of each extra unit shipped, and the IDs of each product in that price category.
$product_chart = array(
'hoops' => array(
'base' => 15,
'extra' => 3,
'ids' => array(6, 7, 8, 10, 11)
),
'videos' => array(
'base' => 3,
'extra' => 1,
'ids' => array(3, 12)
),
'tickets' => array(
'base' => 0,
'extra' => 0,
'ids' => array(9)
)
);
$cost = 0;
// calculate the cost based on quantity
foreach ($order->products as $product) {
foreach ($product_chart as $product_type => $product_details) {
if (in_array($product['id'], $product_details['ids'])) {
$qty = $product['qty'];
$cost += $product_details['base'] + $product_details['extra'] * ($qty - 1);
}
}
}
$this->quotes = array(
'id' => $this->code,
'module' => 'Shipping',
'methods' => array(
array(
'id' => $this->code,
'title' => MODULE_SHIPPING_MY_ITEM_TEXT_WAY,
'cost' => $cost
)
)
);
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;
}
Bookmarks