Product Price Filter By Users Group

?features_hash=3-1-10-TRY

price_from = 1

price_to = 10

Only one price is applied according to the filter.

Price Filter:

    if (isset($params['price_from']) && fn_is_numeric($params['price_from'])) {
        $condition .= db_quote(' AND prices.price >= ?d', fn_convert_price(trim($params['price_from'])));
        $params['extend'][] = 'prices2';
        $params['extend'][] = 'prices';
    }
if (isset($params['price_to']) && fn_is_numeric($params['price_to'])) {
    $condition .= db_quote(' AND prices.price <= ?d', fn_convert_price(trim($params['price_to'])));
    $params['extend'][] = 'prices2';

-----------------------

usergroup_id =?

percentage_discount = ?

lower_limit =1

?features_hash=3-1-10-TRY

low level

price_from = 1

price_to = 10

intermediate level

price_from = 1

price_to = 10

high level

price_from = 1

price_to = 10

each member group must be applied separately.

Filter does not produce a correct result when a member is logged in

Similar code

    $usergroup_condition = db_quote("AND ?:product_prices.usergroup_id IN (?n)", ((AREA == 'C' || defined('ORDER_MANAGEMENT')) ? array_merge(array(USERGROUP_ALL), $auth['usergroup_ids']) : USERGROUP_ALL));
$price = db_get_field(
    "SELECT MIN(IF(?:product_prices.percentage_discount = 0, ?:product_prices.price, "
        . "?:product_prices.price - (?:product_prices.price * ?:product_prices.percentage_discount)/100)) as price "
    . "FROM ?:product_prices "
    . "WHERE lower_limit <=?i AND ?:product_prices.product_id = ?i ?p "
    . "ORDER BY lower_limit DESC LIMIT 1",
    $amount, $product_id, $usergroup_condition
);

Is there any idea that this is done?

2018-12-17_12-53-19.png

:) filter does not work when a separate price is entered into a member group

as it actually has a bug.