You can do this by editing the Order Total module:
/includes/modules/order_total/ot_loworderfee.php
and replace the whole function process with the new code:
Code:
function process() {
global $order, $currencies;
$chk_manufacturers_1_id = 3; // manufacturers_id 3
$chk_manufacturers_1_total = 0;
$chk_manufacturers_1_min = 30.00;
$chk_manufacturers_1_extra = 3.00;
$chk_manufacturers_2_id = 4; // manufacturers_id 4
$chk_manufacturers_2_total = 0;
$chk_manufacturers_2_min = 40.00;
$chk_manufacturers_2_extra = 4.00;
$products = $_SESSION['cart']->get_products();
//echo '<pre>'; echo print_r($products); echo '</pre>';
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
$product_id = $products[$i]['id'];
$ppe = $products[$i]['final_price'];
$ppt = $ppe * $products[$i]['quantity'];
$productsPriceTotal = $ppt + $products[$i]['onetime_charges'];
//echo 'product_id: ' . $product_id . ' $ppt: ' . $ppt . ' qty: ' . $products[$i]['quantity'] . ' $productsPriceTotal: ' . $productsPriceTotal . '<br>';
if (zen_products_lookup($product_id, 'manufacturers_id') == $chk_manufacturers_1_id && (int)$product_id == (int)$products[$i]['id']) {
$chk_manufacturers_1_total += $productsPriceTotal;
//echo '$chk_manufacturers_1_id: ' . $chk_manufacturers_1_id . ' $product_id: ' . $product_id . ' $chk_manufacturers_1_total: ' . $productsPriceTotal . '<br>';
}
if (zen_products_lookup($product_id, 'manufacturers_id') == $chk_manufacturers_2_id && (int)$product_id == (int)$products[$i]['id']) {
$chk_manufacturers_2_total += $productsPriceTotal;
//echo '$chk_manufacturers_2_id: ' . $chk_manufacturers_2_id . ' $product_id: ' . $product_id . ' $chk_manufacturers_2_total: ' . $productsPriceTotal . '<br>';
}
} // end FOR loop
$extra_fee = ($chk_manufacturers_1_total < $chk_manufacturers_1_min ? $chk_manufacturers_1_extra : 0) + ($chk_manufacturers_2_total < $chk_manufacturers_2_min ? $chk_manufacturers_2_extra : 0);
if ($extra_fee > 0) {
$tax_address = zen_get_tax_locations();
$tax = zen_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
$tax_description = zen_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $tax_address['country_id'], $tax_address['zone_id']);
// calculate from flat fee or percentage
$low_order_fee = $extra_fee;
$order->info['tax'] += zen_calculate_tax($low_order_fee, $tax);
$order->info['tax_groups']["$tax_description"] += zen_calculate_tax($low_order_fee, $tax);
$order->info['total'] += $low_order_fee + zen_calculate_tax($low_order_fee, $tax);
if (DISPLAY_PRICE_WITH_TAX == 'true') {
$low_order_fee += zen_calculate_tax($low_order_fee, $tax);
}
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format($low_order_fee, true, $order->info['currency'], $order->info['currency_value']),
'value' => $low_order_fee);
}
}
The set the variables to match your manufacturers_id, minimum, extra fee for each set, example:
$chk_manufacturers_1_id = 3; // manufacturers_id 3
$chk_manufacturers_1_total = 0;
$chk_manufacturers_1_min = 30.00;
$chk_manufacturers_1_extra = 3.00;
This would be manufacturers_id 3, minimum $30.00 and extra fee $3.00 ...
Bookmarks