I've just got this problem on one of my client site trying to use price ranges. Here is the solution. In /includes/functions_prices.php -> function zen_get_products_sale_discount_type we have to prepare separate select, if $product_id > 0.
Now it's OK to have couple of sales depending on product price that will calculate attributes right way.
Change
Code:
$salemaker_sales = $db->Execute("select sale_id, sale_status, sale_name, sale_categories_all, sale_deduction_value, sale_deduction_type, sale_pricerange_from, sale_pricerange_to, sale_specials_condition, sale_categories_selected, sale_date_start, sale_date_end, sale_date_added, sale_date_last_modified, sale_date_status_change from " . TABLE_SALEMAKER_SALES . " where sale_status='1'");
to
Code:
// if set $product_id, we have to pay attention to price range limitation
if($product_id > 0) {
$pricerange_base = zen_get_products_base_price($product_id);
$salemaker_sales = $db->Execute("select sale_id, sale_status, sale_name, sale_categories_all, sale_deduction_value, sale_deduction_type, sale_pricerange_from, sale_pricerange_to, sale_specials_condition, sale_categories_selected, sale_date_start, sale_date_end, sale_date_added, sale_date_last_modified, sale_date_status_change from " . TABLE_SALEMAKER_SALES . "
where sale_status='1'
and (sale_pricerange_from <= '" . $pricerange_base . "' or sale_pricerange_from = '0') and (sale_pricerange_to >= '" . $pricerange_base . "' or sale_pricerange_to = '0')");
}else{
$salemaker_sales = $db->Execute("select sale_id, sale_status, sale_name, sale_categories_all, sale_deduction_value, sale_deduction_type, sale_pricerange_from, sale_pricerange_to, sale_specials_condition, sale_categories_selected, sale_date_start, sale_date_end, sale_date_added, sale_date_last_modified, sale_date_status_change from " . TABLE_SALEMAKER_SALES . " where sale_status='1'");
}
Originally Posted by
Ajeh
Price by Attribute and SaleMaker will produce odd issues on things like the Price Range ...
I do not have a solution for that at this time but will look into it further ...
Bookmarks