protected function processSubmitSellerinfo() { $lang_cookie = self::$cookie->id_lang; if ($lang_cookie != 1) { $_POST['address1_1'] = $_POST['address1_' . $lang_cookie]; $_POST['address2_1'] = $_POST['address1_' . $lang_cookie]; $_POST['address2_1'] = $_POST['address1_' . $lang_cookie]; $_POST['city_1'] = $_POST['city_' . $lang_cookie]; $_POST['description_1'] = $_POST['description_' . $lang_cookie]; } ${"GLOBALS"}["vjnnsubap"] = "list"; $vhheljumal = "selected_country"; $zryhlvp = "list"; $tjuksry = "countries"; ${"GLOBALS"}["vpjnzdqa"] = "countries"; if (Tools::isSubmit("id_country") && !is_null(Tools::getValue("id_country")) && is_numeric(Tools::getValue("id_country"))) { ${$vhheljumal} = (int) Tools::getValue("id_country"); } else { if (isset($this->sellerinfo) && isset($this->sellerinfo->id_country) && !empty($this->sellerinfo->id_country) && is_numeric($this->sellerinfo->id_country)) { ${${"GLOBALS"}["ontiydub"]} = (int) $this->sellerinfo->id_country; } else { if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { $duwbhhjzvvl = "array"; ${$duwbhhjzvvl} = preg_split("/,|-/", $_SERVER["HTTP_ACCEPT_LANGUAGE"]); if (!Validate::isLanguageIsoCode(${${"GLOBALS"}["tjlrhpthnf"]}[0]) || !(${${"GLOBALS"}["ontiydub"]} = Country::getByIso(${${"GLOBALS"}["tjlrhpthnf"]}[0]))) { ${${"GLOBALS"}["ontiydub"]} = (int) Configuration::get("PS_COUNTRY_DEFAULT"); } } else { ${${"GLOBALS"}["ontiydub"]} = (int) Configuration::get("PS_COUNTRY_DEFAULT"); } } } if (Configuration::get("PS_RESTRICT_DELIVERED_COUNTRIES")) { ${${"GLOBALS"}["vpjnzdqa"]} = Carrier::getDeliveredCountries($this->context->language->id, true, true); } else { ${${"GLOBALS"}["coohkibbnl"]} = Country::getCountries($this->context->language->id, true); } ${$zryhlvp} = ""; $countries = ${$tjuksry}; /**************** LANGUAGE LEVEL *******************/ $seller_id_lang = $this->sellerinfo->id_seller; $langLevel = Tools::getValue("lang_level"); $dialect = Tools::getValue("lang"); $main_lang = Tools::getValue('main_lang'); /*foreach ($dialect as $key => $value) { $level = $langLevel[$key]; Db::getInstance(_PS_USE_SQL_SLAVE_)->execute(" INSERT INTO " . _DB_PREFIX_ . "sellerinfo_language (seller_id, language, language_level) VALUES ('$seller_id_lang', '$value', '$level') "); }*/ // die('<pre>' . print_r($dialect, true)); $langLevel = implode(',', Tools::getValue("lang_level")); $languages = implode(',', Tools::getValue("lang")); $this->sellerinfo->language = $languages; $this->sellerinfo->language_level = $langLevel; $this->sellerinfo->main_language = $main_lang; $jlbwjt = "shop_name"; ${"GLOBALS"}["oonrqhi"] = "shop_name"; ${"GLOBALS"}["zlobvkbr"] = "virtual_uri"; AgileMultipleSeller::ensure_date_custom_field(); $uskhfeodhv = "zip_code_format"; ${${"GLOBALS"}["oonrqhi"]} = ""; if (isset($_POST["shop_name"])) { ${$jlbwjt} = trim($_POST["shop_name"], " "); } $famsbcd = "country"; if (isset($_POST["virtual_uri"])) { ${${"GLOBALS"}["zlobvkbr"]} = Tools::link_rewrite(trim($_POST["virtual_uri"], " /")) . "/"; } /*if (empty($_POST["postcode"])) $this->errors[] = Tools::displayError("Postcode is required field.");*/ if (empty($_POST["address1_1"])) { $this->errors[] = Tools::displayError("Address is required field."); } if (empty($_POST["city_1"])) { $this->errors[] = Tools::displayError("City is required field."); } if (empty($_POST["phone"])) { $this->errors[] = Tools::displayError("Phone is required field."); } $this->errors = array_merge($this->errors, $this->sellerinfo->validateController()); $this->sellerinfo->id_customer = self::$cookie->id_customer; if (Module::isInstalled("agilemultipleshop")) { $mcovgfrp = "shop_name"; ${"GLOBALS"}["xdpblji"] = "seller_shopurl"; if (empty(${$mcovgfrp})) { $this->errors[] = Tools::displayError("The shop name can not be empty."); } if (empty($_POST["virtual_uri"]) and (int) Configuration::get("ASP_SHOP_URL_MODE") == agilemultipleshop::SHOP_URL_MODE_VIRTUAL) { $this->errors[] = Tools::displayError("The shop Virtual Uri can not be empty."); } ${"GLOBALS"}["edessnqo"] = "id_found"; ${"GLOBALS"}["kkzhciyk"] = "seller_shop"; if ($this->sellerinfo->id_shop <= 1) { $this->sellerinfo->id_shop = 0; } ${${"GLOBALS"}["kkzhciyk"]} = new Shop($this->sellerinfo->id_shop); if (Shop::shop_name_duplicated(${${"GLOBALS"}["oxjolt"]}, $seller_shop->id)) { $this->errors[] = Tools::displayError("The shop name you select has been used by other seller. Please choose a new one."); } ${"GLOBALS"}["asepnxuok"] = "seller_shop"; if ($this->errors) { return; } if (!Validate::isLoadedObject(${${"GLOBALS"}["asepnxuok"]})) { $this->sellerinfo->id_shop = AgileMultipleShop::create_new_shop($this->sellerinfo->id_seller, ${${"GLOBALS"}["oxjolt"]}); $this->sellerinfo->update(); ${${"GLOBALS"}["esrnnrtkg"]} = new Shop($this->sellerinfo->id_shop); } ${${"GLOBALS"}["xdpblji"]} = new ShopUrl(Shop::get_main_url_id($seller_shop->id)); ${${"GLOBALS"}["edessnqo"]} = $seller_shopurl->canAddThisUrl($seller_shopurl->domain, $seller_shopurl->domain_ssl, $seller_shopurl->physical_uri, ${${"GLOBALS"}["uovivsqns"]}); if (intval(${${"GLOBALS"}["vphoqso"]}) > 0) { $this->errors[] = Tools::displayError("The uri you select has been used by other seller. Please choose a new one."); } } ${"GLOBALS"}["uehqptpfhppm"] = "seller_shop"; if (!(${${"GLOBALS"}["flggvi"]} = new Country($this->sellerinfo->id_country)) || !Validate::isLoadedObject(${$famsbcd})) { throw new PrestaShopException("Country cannot be loaded with address->id_country"); } if ((int) $country->contains_states && !(int) $this->sellerinfo->id_state) { $this->errors[] = Tools::displayError("This country requires a state selection."); } ${$uskhfeodhv} = $country->zip_code_format; if ($country->need_zip_code) { $guefxsgyxvp = "zip_code_format"; ${"GLOBALS"}["ayucbbdhdhcq"] = "zip_code_format"; $krvjmkmqh = "postcode"; ${"GLOBALS"}["smbwfoxbj"] = "zip_code_format"; if ((${${"GLOBALS"}["wnwubvg"]} = Tools::getValue("postcode")) && ${${"GLOBALS"}["ayucbbdhdhcq"]}) { ${"GLOBALS"}["gusjike"] = "zip_regexp"; ${"GLOBALS"}["bgahkjn"] = "zip_regexp"; $edhlvb = "zip_regexp"; ${"GLOBALS"}["yvbcolkxptn"] = "zip_regexp"; $pslxhegowq = "zip_regexp"; ${${"GLOBALS"}["ctdciodhb"]} = "/^" . ${${"GLOBALS"}["ebwpvmqblmd"]} . "\$/ui"; ${"GLOBALS"}["mivinoyltqoh"] = "zip_regexp"; ${$pslxhegowq} = str_replace(" ", "( |)", ${${"GLOBALS"}["ctdciodhb"]}); ${${"GLOBALS"}["mivinoyltqoh"]} = str_replace("-", "(-|)", ${${"GLOBALS"}["bgahkjn"]}); ${${"GLOBALS"}["ctdciodhb"]} = str_replace("N", "[0-9]", ${${"GLOBALS"}["gusjike"]}); ${${"GLOBALS"}["ctdciodhb"]} = str_replace("L", "[a-zA-Z]", ${${"GLOBALS"}["ctdciodhb"]}); ${${"GLOBALS"}["ctdciodhb"]} = str_replace("C", $country->iso_code, ${${"GLOBALS"}["yvbcolkxptn"]}); // if (!preg_match(${$edhlvb}, ${${"GLOBALS"}["wnwubvg"]})) // $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is invalid.") . "<br />" . Tools::displayError("Must be typed as follows:") . " " . str_replace("C", $country->iso_code, str_replace("N", "0", str_replace("L", "A", ${${"GLOBALS"}["ebwpvmqblmd"]}))); } /*else if (${$guefxsgyxvp}) $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is required."); else if (${${"GLOBALS"}["wnwubvg"]} && !preg_match("/^[0-9a-zA-Z -]{4,9}\$/ui", ${$krvjmkmqh})) $this->errors[] = "<strong>" . Tools::displayError("Zip / Postal code") . "</strong> " . Tools::displayError("is invalid.") . "<br />" . Tools::displayError("Must be typed as follows:") . " " . str_replace("C", $country->iso_code, str_replace("N", "0", str_replace("L", "A", ${${"GLOBALS"}["smbwfoxbj"]}))); */ } if ($country->isNeedDni() && (!Tools::getValue("dni") || !Validate::isDniLite(Tools::getValue("dni")))) { $this->errors[] = Tools::displayError("Identification number is incorrect or has already been used."); } $this->sellerinfo->dni = Tools::getValue("dni"); $this->sellerinfo->latitude = Tools::getValue("latitude"); $this->sellerinfo->longitude = Tools::getValue("longitude"); $this->sellerinfo->id_sellertype1 = Tools::getValue("id_sellertype1"); $this->sellerinfo->id_sellertype2 = Tools::getValue("id_sellertype2"); // echo '<pre>', print_r($_FILES, true) , '</pre>'; SellerInfo::processLogoUpload($this->sellerinfo); SellerInfo::processLicenseUpload($this->sellerinfo); $this->errors = array_merge($this->errors, $this->sellerinfo->validateController()); if (!empty($this->errors)) { return; } $this->sellerinfo->save(); if (Module::isInstalled("agilemultipleshop") and Validate::isLoadedObject(${${"GLOBALS"}["uehqptpfhppm"]})) { $wrheluzg = "shop_name"; $seller_shop->name = ${$wrheluzg}; $seller_shop->save(); ${"GLOBALS"}["sxuwmytjl"] = "virtual_uri"; $seller_shopurl->virtual_uri = ${${"GLOBALS"}["sxuwmytjl"]}; $seller_shopurl->save(); Tools::generateHtaccess(); } if (empty($this->errors)) { self::$smarty->assign("cfmmsg_flag", 1); } }
$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() {
public static function create_new_shop($id_seller, $name) { $knpphuwouh = "name"; $ebmaugy = "name"; $awebgo = "name"; ${"GLOBALS"}["avcwqfcrll"] = "name"; ${"GLOBALS"}["ecrzsoxmp"] = "id_show_url"; ${"GLOBALS"}["eoufbdiy"] = "shop"; if (empty(${${"GLOBALS"}["plonjgth"]})) { ${$awebgo} = "shop"; } if (Shop::shop_name_duplicated(${${"GLOBALS"}["avcwqfcrll"]}, 0)) { ${$knpphuwouh} = ${$ebmaugy} . "-" . ${${"GLOBALS"}["blyprwch"]}; } ${${"GLOBALS"}["dcjyfpglzfy"]} = new Shop((int) Configuration::get("PS_SHOP_DEFAULT")); ${${"GLOBALS"}["eoufbdiy"]} = new Shop(); $shop->name = ${${"GLOBALS"}["plonjgth"]}; $shop->id_shop_group = $defshop->id_shop_group; $shop->id_category = $defshop->id_category; ${"GLOBALS"}["lydbmjobdy"] = "id_found"; $shop->active = 1; $shop->deleted = 0; $shop->id_theme = $defshop->id_theme; ${"GLOBALS"}["dbvkuxo"] = "id_show_url"; $shop->add(); ${${"GLOBALS"}["iqatubf"]} = "SELECT id_shop_url \tFROM " . _DB_PREFIX_ . "shop_url WHERE active = 1 AND main=1 AND id_shop = " . (int) Configuration::get("PS_SHOP_DEFAULT"); ${${"GLOBALS"}["dbvkuxo"]} = intval(Db::getInstance()->getValue(${${"GLOBALS"}["iqatubf"]})); ${${"GLOBALS"}["flauwpvwozn"]} = new ShopUrl(${${"GLOBALS"}["ecrzsoxmp"]}); $shopurl->id = 0; $shopurl->id_shop = $shop->id; if ((int) Configuration::get("ASP_SHOP_URL_MODE") == agilemultipleshop::SHOP_URL_MODE_DOMAIN) { $shopurl->domain = Tools::link_rewrite(${${"GLOBALS"}["plonjgth"]}) . "." . str_replace("www.", "", $shopurl->domain); $shopurl->domain_ssl = Tools::link_rewrite(${${"GLOBALS"}["plonjgth"]}) . "." . str_replace("www.", "", $shopurl->domain_ssl); } else { $shopurl->virtual_uri = Tools::link_rewrite(${${"GLOBALS"}["plonjgth"]}); } ${${"GLOBALS"}["lydbmjobdy"]} = $shopurl->canAddThisUrl($shopurl->domain, $shopurl->domain_ssl, $shopurl->physical_uri, $shopurl->virtual_uri); if (intval(${${"GLOBALS"}["ewdnile"]}) > 0) { $shopurl->virtual_uri = $shopurl->virtual_uri . "-" . ${${"GLOBALS"}["blyprwch"]}; } $shopurl->active = 1; $shopurl->add(); Tools::generateHtaccess(); return $shop->id; }