Index: branches/5.1.x/units/orders/orders_event_handler.php =================================================================== diff -u -r13465 -r13549 --- branches/5.1.x/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 13465) +++ branches/5.1.x/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 13549) @@ -1,6 +1,6 @@ 0) { // if we are adding product - $product =& $this->Application->recallObject('p'); + $product =& $this->Application->recallObject('p', null, Array ('skip_autoload' => true)); $product->Load($prod_id); $object->SetDBField('ProductId', $prod_id); $object->SetDBField('ProductName', $product->GetField('Name')); @@ -3828,11 +3828,13 @@ $user_groups = explode(',', $this->Application->RecallVar('UserGroups')); $default_group = $this->Application->ConfigValue('User_LoggedInGroup'); if (!in_array($default_group, $user_groups)){ - $user_groups[]=$default_group; + $user_groups[] = $default_group; } - $fields['PaymentType']['options_sql'] .= ' AND '; - $fields['PaymentType']['options_sql'] .= ' (PortalGroups LIKE "%%,'.implode(',%%" OR PortalGroups LIKE "%%,', $user_groups).',%%")'; - + $fields['PaymentType']['options_sql'] = str_replace( + 'ORDER BY ', + 'AND (PortalGroups LIKE "%%,'.implode(',%%" OR PortalGroups LIKE "%%,', $user_groups).',%%") ORDER BY ', + $fields['PaymentType']['options_sql'] + ); } $this->Application->setUnitOption($event->Prefix, 'Fields', $fields);