예제 #1
0
 /**
  * Return available groups
  *
  * @param int $id_lang
  * @param bool $id_shop
  *
  * @return array Groups
  */
 public function getGroups($id_lang, $id_shop = false)
 {
     return \GroupCore::getGroups($id_lang, $id_shop);
 }
예제 #2
0
파일: Group.php 프로젝트: M03G/PrestaShop
 /**
  * Return current group object
  * Use context
  *
  * @return Group Group object
  */
 public static function getCurrent()
 {
     if (self::$ps_unidentified_group === null) {
         self::$ps_unidentified_group = Configuration::get('PS_UNIDENTIFIED_GROUP');
     }
     if (self::$ps_customer_group === null) {
         self::$ps_customer_group = Configuration::get('PS_CUSTOMER_GROUP');
     }
     $customer = Context::getContext()->customer;
     if (Validate::isLoadedObject($customer)) {
         $id_group = (int) $customer->id_default_group;
     } else {
         $id_group = (int) self::$ps_unidentified_group;
     }
     if (!isset(self::$groups[$id_group])) {
         self::$groups[$id_group] = new Group($id_group);
     }
     if (!self::$groups[$id_group]->isAssociatedToShop(Context::getContext()->shop->id)) {
         $id_group = (int) self::$ps_customer_group;
         if (!isset(self::$groups[$id_group])) {
             self::$groups[$id_group] = new Group($id_group);
         }
     }
     return self::$groups[$id_group];
 }