No worries, I looked at the shopping cart class to see how this was being managed, and made some changes to includes/functions/extra_functions/sfl_functions.php to resolve this issue.
The changes are all in function get_sfl_products()
replace the original function with this one
function get_sfl_products() {
global $db;
if($_SESSION['customer_id']) {
$customer_group_query = "SELECT gp.group_name
FROM " . TABLE_CUSTOMERS . " cu
LEFT JOIN " . TABLE_GROUP_PRICING . " gp ON cu.customers_group_pricing=gp.group_id
WHERE cu.customers_id = " . $_SESSION['customer_id'];
if($customer_group = $db->Execute($customer_group_query)) {
$customers_group=$customer_group->fields['group_name'];
}
}
$contents = build_contents();
while (list($products_id, ) = each($contents)) {
$products_query = "select p.products_id, p.master_categories_id, p.products_status, pd.products_name, p.products_model, p.products_image,
p.products_price, p.products_weight, p.products_tax_class_id,
p.products_group_a_price, p.products_group_b_price,
p.products_group_c_price, p.products_group_d_price,
p.products_quantity_order_min, p.products_quantity_order_units,
p.product_is_free, p.products_priced_by_attribute,
p.products_discount_type, p.products_discount_type_from
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = '" . (int)$products_id . "'
and pd.products_id = p.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
if ($products = $db->Execute($products_query)) {
$prid = $products->fields['products_id'];
$products_price = $products->fields['products_price'];
//fix here
/*
$special_price = zen_get_products_special_price($prid);
if ($special_price) {
$products_price = $special_price;
}
*/
$special_price = zen_get_products_special_price($prid);
if ($special_price and $products->fields['products_priced_by_attribute'] == 0) {
$products_price = $special_price;
} else {
$special_price = 0;
}
if($customers_group and $special_price == 0) {
if($customers_group == GROUP_PRICE_PER_ITEM1 && $products->fields['products_group_a_price'] != 0) {
$products_price = $products->fields['products_group_a_price'];
} elseif($customers_group == GROUP_PRICE_PER_ITEM2 && $products->fields['products_group_b_price'] != 0) {
$products_price = $products->fields['products_group_b_price'];
} elseif($customers_group == GROUP_PRICE_PER_ITEM3 && $products->fields['products_group_c_price'] != 0) {
$products_price = $products->fields['products_group_c_price'];
} elseif($customers_group == GROUP_PRICE_PER_ITEM4 && $products->fields['products_group_d_price'] != 0) {
$products_price = $products->fields['products_group_d_price'];
}
}
if (zen_get_products_price_is_free($products->fields['products_id'])) {
// no charge
$products_price = 0;
}
// adjust price for discounts when priced by attribute
if ($products->fields['products_priced_by_attribute'] == '1' and zen_has_product_attributes($products->fields['products_id'], 'false')) {
// reset for priced by attributes
// $products_price = $products->fields['products_price'];
if ($special_price) {
$products_price = $special_price;
} else {
$products_price = $products->fields['products_price'];
}
} else {
// discount qty pricing
if ($products->fields['products_discount_type'] != '0') {
$products_price = zen_get_products_discount_price_qty($products->fields['products_id'], $contents[$products_id]['qty']);
}
}
//clr 030714 update $products_array to include attribute value_text. This is needed for text attributes.
// convert quantity to proper decimals
if (QUANTITY_DECIMALS != 0) {
// $new_qty = round($new_qty, QUANTITY_DECIMALS);
$fix_qty = $contents[$products_id]['qty'];
switch (true) {
case (!strstr($fix_qty, '.')):
$new_qty = $fix_qty;
break;
default:
$new_qty = preg_replace('/[0]+$/','',$contents[$products_id]['qty']);
break;
}
} else {
$new_qty = $contents[$products_id]['qty'];
}
$check_unit_decimals = zen_get_products_quantity_order_units((int)$products->fields['products_id']);
if (strstr($check_unit_decimals, '.')) {
$new_qty = round($new_qty, QUANTITY_DECIMALS);
} else {
$new_qty = round($new_qty, 0);
}
if ($new_qty == (int)$new_qty) {
$new_qty = (int)$new_qty;
}
$products_array[] = array('id' => $products_id,
'category' => $products->fields['master_categories_id'],
'name' => $products->fields['products_name'],
'model' => $products->fields['products_model'],
'image' => $products->fields['products_image'],
'price' => ($products->fields['product_is_free'] =='1' ? 0 : $products_price),
// 'quantity' => $contents[$products_id]['qty'],
'quantity' => $new_qty,
// 'weight' => $products->fields['products_weight'] + $attributes_weight($products_id),
// fix here
'final_price' => ($products_price + attributes_price($products_id, $contents)),
'onetime_charges' => (attributes_price_onetime_charges($products_id, $new_qty, $contents)),
'tax_class_id' => $products->fields['products_tax_class_id'],
'attributes' => (isset($contents[$products_id]['attributes']) ? $contents[$products_id]['attributes'] : ''),
'attributes_values' => (isset($contents[$products_id]['attributes_values']) ? $contents[$products_id]['attributes_values'] : ''),
'products_priced_by_attribute' => $products->fields['products_priced_by_attribute'],
'product_is_free' => $products->fields['product_is_free'],
'products_discount_type' => $products->fields['products_discount_type'],
'products_discount_type_from' => $products->fields['products_discount_type_from']);
}
}
return $products_array;
}
Bookmarks