Index: branches/5.2.x/units/orders/order_calculator.php =================================================================== diff -u -N -r16516 -r16775 --- branches/5.2.x/units/orders/order_calculator.php (.../order_calculator.php) (revision 16516) +++ branches/5.2.x/units/orders/order_calculator.php (.../order_calculator.php) (revision 16775) @@ -1,6 +1,6 @@ Application->ConfigValue('Comm_PriceBracketCalculation') == 1) { // if we have to stick to primary group, then its pricing will go first, // but if there is no pricing for primary group, then next optimal will be taken - $primary_group = $this->getUserPrimaryGroup($user_id); + /** @var UserHelper $user_helper */ + $user_helper = $this->Application->recallObject('UserHelper'); + $primary_group = $user_helper->getPrimaryGroup($user_id); + return '( IF(GroupId = ' . $primary_group . ', 1, 2) ) ASC, pp.Price ASC'; } @@ -787,24 +790,6 @@ } /** - * Returns primary group of given user - * - * @param int $user_id - * @return int - */ - protected function getUserPrimaryGroup($user_id) - { - if ($user_id > 0) { - $sql = 'SELECT PrimaryGroupId - FROM ' . TABLE_PREFIX . 'Users - WHERE PortalUserId = ' . $user_id; - return $this->Conn->GetOne($sql); - } - - return $this->Application->ConfigValue('User_LoggedInGroup'); - } - - /** * Returns ItemData associated with given order item * * @param Array $item