[-] Core: Group::getCurrent() return the default customer group of the shop if default customer group is not associated to shop

This commit is contained in:
Rémi Gaillard
2013-11-12 18:49:52 +01:00
parent 6d7e2055ce
commit 75df12dd94
+10 -1
View File
@@ -305,12 +305,21 @@ class GroupCore extends ObjectModel
public static function getCurrent()
{
static $groups = array();
$customer = Context::getContext()->customer;
if (Validate::isLoadedObject($customer))
{
$id_group = (int)$customer->id_default_group;
$group = new Group((int)$id_group);
if (!$group->isAssociatedToShop(Context::getContext()->shop->id))
$group = new Group((int)Configuration::get('PS_CUSTOMER_GROUP'));
}
else
$id_group = (int)Configuration::get('PS_UNIDENTIFIED_GROUP');
if (!isset($groups[$id_group]) && isset($group))
$groups[$id_group] = $group;
if (!isset($groups[$id_group]))
$groups[$id_group] = new Group($id_group);