<?php defined('HOSTCMS') || exit('HostCMS: access denied.'); /** * * Версия для HostCMS v.6x * @author KAD * http://www.artemkuts.ru/ * artem.kuts@gmail.com * * Копирование и использование файлов модуля * в коммерческих целях ЗАПРЕЩЕНО * */ class Kad_Shop_Producer { /** * The singleton instances. * @var mixed */ static public $instance = NULL; /** * Register an existing instance as a singleton. * @return object */ static public function instance() { if (is_null(self::$instance)) { self::$instance = new self(); } return self::$instance; } public function __construct() { } /* * Получаем производителей * $group - группа интернет магазина * $ins = TRUE|FALSE Получить производителей для вложенных подгрупп */ static function getAll($group, $ins = false) { $oGroup = Core_Entity::factory('shop_group', $group); $oShop_Producers = $oGroup->Shop->Shop_Producers; $oShop_Producers->queryBuilder() ->select('shop_producers.*') ->distinct() ->join('shop_items', 'shop_items.shop_producer_id', '=', 'shop_producers.id') ->where('shop_items.deleted', '=', 0) ; if ($ins) { $aChildren = $oGroup->Shop_Groups->getGroupChildrenId(); $aChildren[] = $group; $oShop_Producers->queryBuilder()->where('shop_items.shop_group_id', 'IN', $aChildren); } elseif ($group != 0) { $oShop_Producers->queryBuilder()->where('shop_items.shop_group_id', '=', $group); } $aShop_Producers = $oShop_Producers->findAll(); return $aShop_Producers; } }