Does the includes/functions/functions_price.php AND/OR admin/includes/functions/functions_price.php need to be updated with this? I've actually tried both, reviewed the update several times making sure to place the code in the appropriate spot according to the second revision by edingtoncollection with no success. So starting simple, I wanted to again verify which file or files needed to be updated.

Thanks

Quote Originally Posted by edingtoncollection View Post
I realized I placed some code in the wrong spot.... here is the corrected code:

The following changes in the functions_prices.php page:

under: //get specials price or sale price
find:

if ($specials->RecordCount() > 0) {
// if ($product->fields['products_priced_by_attribute'] == 1) {
$special_price = $specials->fields['specials_new_products_price'];
} else {
$special_price = false;
}

replace with:

if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {
$special_price = false;
} else {

if ($specials->RecordCount() > 0) {
// if ($product->fields['products_priced_by_attribute'] == 1) {
$special_price = $specials->fields['specials_new_products_price'];
} else {
$special_price = false;
}
}



and under: // return special price only
find:

if ($specials_price_only==true) {
if (zen_not_null($special_price)) {
return $special_price;
} else {
return false;
}
} else {
// get sale price

// changed to use master_categories_id
// $product_to_categories = $db->Execute("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "'");
// $category = $product_to_categories->fields['categories_id'];

$product_to_categories = $db->Execute("select master_categories_id from " . TABLE_PRODUCTS . " where products_id = '" . $product_id . "'");
$category = $product_to_categories->fields['master_categories_id'];

$sale = $db->Execute("select sale_specials_condition, sale_deduction_value, sale_deduction_type from " . TABLE_SALEMAKER_SALES . " where sale_categories_all like '%," . $category . ",%' and sale_status = '1' and (sale_date_start <= now() or sale_date_start = '0001-01-01') and (sale_date_end >= now() or sale_date_end = '0001-01-01') and (sale_pricerange_from <= '" . $product_price . "' or sale_pricerange_from = '0') and (sale_pricerange_to >= '" . $product_price . "' or sale_pricerange_to = '0')");
if ($sale->RecordCount() < 1) {
return $special_price;
}

replace with:

if ($_SESSION['customer_whole'] && $_SESSION['customer_whole'] != '0' ) {
return false;
} else {
if ($specials_price_only==true) {
if (zen_not_null($special_price)) {
return $special_price;
} else {
return false;
}
} else {
// get sale price

// changed to use master_categories_id
// $product_to_categories = $db->Execute("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "'");
// $category = $product_to_categories->fields['categories_id'];

$product_to_categories = $db->Execute("select master_categories_id from " . TABLE_PRODUCTS . " where products_id = '" . $product_id . "'");
$category = $product_to_categories->fields['master_categories_id'];

$sale = $db->Execute("select sale_specials_condition, sale_deduction_value, sale_deduction_type from " . TABLE_SALEMAKER_SALES . " where sale_categories_all like '%," . $category . ",%' and sale_status = '1' and (sale_date_start <= now() or sale_date_start = '0001-01-01') and (sale_date_end >= now() or sale_date_end = '0001-01-01') and (sale_pricerange_from <= '" . $product_price . "' or sale_pricerange_from = '0') and (sale_pricerange_to >= '" . $product_price . "' or sale_pricerange_to = '0')");

if ($sale->RecordCount() < 1) {
return $special_price;
}
}

******

Without this correction there was a problem with the prices being displayed as both a wholesale price and a sale price with the same figures. Sorry for any confusion.