To give customers who are in a certain customer group pricing group (customers_group_pricing = 1)
only half (0.5) the regular quantity discount, I modified to following files:
\includes\modules\products_quantity_discounts.php
This file will display the quantity discount at the product information page.
Just above the code
Code:
$display_price = zen_get_products_base_price($products_id_current);
$display_specials_price = zen_get_products_special_price($products_id_current, true);
$disc_cnt = 1;
$quantityDiscounts = array();
$columnCount = 0;
I included:
Code:
//modification by pe7er
//check if current customer is part of a certain (customers_group_pricing) group pricing (zen_group_pricing -> 1) category
$gpcheck = $db->Execute("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_id = '".$_SESSION['customer_id']."' AND customers_group_pricing = '1'; ");
if ($gpcheck->fields['count'] >0){
$distri_discount = 0.5; // the customers in this price group get 50% of the quantity discount
}else{
$distri_discount = 1; // other customers will receive the full quantity discount
}// end modification.
and I changed (about 6 lines)
Code:
= $display_price - (($products_discounts_query->fields['discount_price'] *$distri_discount)/100);
into
Code:
= $display_price - ($display_price * (($products_discounts_query->fields['discount_price'] *$distri_discount)/100));
\shop\includes\functions\functions_prices.php
This file calculates the quantity prices.
Just AFTER:
Code:
$display_specials_price = zen_get_products_special_price($product_id, true);
I added:
Code:
//modification by pe7er
//check if current customer is part of a certain (customers_group_pricing) group pricing (zen_group_pricing -> 1) category
$gpcheck = $db->Execute("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_id = '".$_SESSION['customer_id']."' AND customers_group_pricing = '1'; ");
if ($gpcheck->fields['count'] >0){
$distri_discount = 0.5;
}else{
$distri_discount = 1;
} // end modification.
and I changed (about 6 lines):
Code:
($products_discounts_query->fields['discount_price'])/100);
into:
Code:
(($distri_discount * $products_discounts_query->fields['discount_price'])/100));