예제 #1
0
 public static function checkAccessStatic($id_product, $id_customer)
 {
     if (!egms_shop::getEgmsAccess($id_product)) {
         return false;
     }
     return parent::checkAccessStatic($id_product, $id_customer);
     /*
     if (!Group::isFeatureActive())
     	return true;
     
     
     $cache_id = 'Product::checkAccess_'.(int)$id_product.'-'.(int)$id_customer.(!$id_customer ? '-'.(int)Group::getCurrent()->id : '');
     if (!Cache::isStored($cache_id))
     {
     	if (!$id_customer)
     		$result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
     		SELECT ctg.`id_group`
     		FROM `'._DB_PREFIX_.'category_product` cp
     		INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`)
     		WHERE cp.`id_product` = '.(int)$id_product.' AND ctg.`id_group` = '.(int)Group::getCurrent()->id);
     	else
     		$result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
     		SELECT cg.`id_group`
     		FROM `'._DB_PREFIX_.'category_product` cp
     		INNER JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = cp.`id_category`)
     		INNER JOIN `'._DB_PREFIX_.'customer_group` cg ON (cg.`id_group` = ctg.`id_group`)
     		WHERE cp.`id_product` = '.(int)$id_product.' AND cg.`id_customer` = '.(int)$id_customer);
     
     
     	Cache::store($cache_id, $result);
     }
     return Cache::retrieve($cache_id);
     */
 }
    public function getUrls()
    {
        $id_shop = null;
        //if (Shop::getContext() == Shop::CONTEXT_SHOP)
        //	$id_shop = $this->context->shop->id;//Context::getContext()->shop->id;
        $shops = egms_shop::getShopUrls($id_shop);
        foreach ($shops as $shop) {
            $sql = 'SELECT id_egms_cu, id_shop_url FROM ' . _DB_PREFIX_ . 'egms_city_url cu 
					WHERE cu.id_shop_url=' . (int) $shop['id_shop_url'];
            $row = Db::getInstance()->getRow($sql);
            if (!isset($row['id_shop_url']) || $row['id_egms_cu'] == $this->id_egms_cu && $row['id_shop_url'] == $shop['id_shop_url']) {
                $this->urls[] = array('id' => $shop['id_shop_url'], 'name' => $shop['domain']);
            }
        }
    }