public function getAgileSellerLink($id_seller, $alias = NULL, $id_lang = NULL) { if (!$id_seller) { return ''; } include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php"; $sellerinfo = new SellerInfo(SellerInfo::getIdBSellerId($id_seller)); $id_shopurl = Shop::get_main_url_id($sellerinfo->id_shop); $shopurl = new ShopUrl($id_shopurl); $url = $shopurl->getURL() . $this->getLangLink(); if (Module::IsInstalled('agilemultipleshop')) { include_once _PS_ROOT_DIR_ . "/modules/agilemultipleshop/agilemultipleshop.php"; if ((int) Configuration::get('ASP_SHOP_URL_MODE') == AgileMultipleShop::SHOP_URL_MODE_DOMAIN) { return $url; } } if ($this->allow) { return $url; } else { return _PS_BASE_URL_SSL_ . __PS_BASE_URI__ . 'index.php?controller=agileseller&id_seller=' . (int) $id_seller; } }
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); } }