public function createShop($shop_name) { // Create default group shop $shop_group = new ShopGroup(); $shop_group->name = 'Default'; $shop_group->active = true; if (!$shop_group->add()) { $this->setError($this->language->l('Cannot create group shop') . ' / ' . Db::getInstance()->getMsgError()); return false; } // Create default shop $shop = new Shop(); $shop->active = true; $shop->id_shop_group = $shop_group->id; $shop->id_category = 2; $shop->id_theme = 1; $shop->name = $shop_name; if (!$shop->add()) { $this->setError($this->language->l('Cannot create shop') . ' / ' . Db::getInstance()->getMsgError()); return false; } Context::getContext()->shop = $shop; // Create default shop URL $shop_url = new ShopUrl(); $shop_url->domain = Tools::getHttpHost(); $shop_url->domain_ssl = Tools::getHttpHost(); $shop_url->physical_uri = __PS_BASE_URI__; $shop_url->id_shop = $shop->id; $shop_url->main = true; $shop_url->active = true; if (!$shop_url->add()) { $this->setError($this->language->l('Cannot create shop URL') . ' / ' . Db::getInstance()->getMsgError()); return false; } return true; }
$sql = 'SELECT distinct LOWER(TRIM(sil.' . AgileMultipleShop::SHOP_BY_CUSTOM_FIELD . ')) AS id, TRIM(sil.' . AgileMultipleShop::SHOP_BY_CUSTOM_FIELD . ') AS name FROM `' . _DB_PREFIX_ . 'sellerinfo_lang` sil WHERE sil.id_lang = ' . $context->cookie->id_lang . ' AND LENGTH(TRIM(sil.' . AgileMultipleShop::SHOP_BY_CUSTOM_FIELD . ')) > 0 ORDER BY sil.' . AgileMultipleShop::SHOP_BY_CUSTOM_FIELD . ' ASC '; } else { $sql = 'SELECT distinct LOWER(TRIM(si.' . AgileMultipleShop::SHOP_BY_CUSTOM_FIELD . ')) AS id, TRIM(si.' . AgileMultipleShop::SHOP_BY_CUSTOM_FIELD . ') AS name FROM `' . _DB_PREFIX_ . 'sellerinfo` si ORDER BY si.' . AgileMultipleShop::SHOP_BY_CUSTOM_FIELD . ' ASC '; } break; } if (empty($sql)) { return array(); } return Db::getInstance()->ExecuteS($sql); } public static function init_shop_header() { $main_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT')); include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php"; Context::getContext()->smarty->assign(array('is_agilemultipleshop_installed' => 1, 'header_logo_mode' => intval(Configuration::get('ASP_HEADER_LOGO_MODE')), 'base_dir_default' => $main_shop->getBaseURL(), 'seller_shop_name' => Context::getContext()->shop->name, 'id_shop_owner' => Shop::$id_shop_owner, 'seller_logo_url' => isset(Shop::$sellerinfo) ? SellerInfo::get_seller_logo_url_static(Shop::$sellerinfo->id) : '')); } public static function clear_blockcategory_cache() { @session_start(); if (!isset($_SESSION['id_shop_owner'])) { $_SESSION['id_shop_owner'] = 0; } if ($_SESSION['id_shop_owner'] != Shop::$id_shop_owner) { $_SESSION['id_shop_owner'] = Shop::$id_shop_owner; Context::getContext()->smarty->clearAllCache(); } } public static function get_rewrite_rules() {