/**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     if ($this->customer->birthday) {
         $birthday = explode('-', $this->customer->birthday);
     } else {
         $birthday = array('-', '-', '-');
     }
     /* Generate years, months and days */
     $this->context->smarty->assign(array('years' => Tools::dateYears(), 'sl_year' => $birthday[0], 'months' => Tools::dateMonths(), 'sl_month' => $birthday[1], 'days' => Tools::dateDays(), 'sl_day' => $birthday[2], 'errors' => $this->errors, 'genders' => Gender::getGenders()));
     if (Module::isInstalled('blocknewsletter')) {
         $this->context->smarty->assign('newsletter', (int) Module::getInstanceByName('blocknewsletter')->active);
     }
     // start of implementation of the module code - taxamo
     // Get selected country
     if (Tools::isSubmit('taxamoisocountryresidence') && !is_null(Tools::getValue('taxamoisocountryresidence'))) {
         $selected_country = Tools::getValue('taxamoisocountryresidence');
     } else {
         $selected_country = Taxamoeuvat::getCountryByCustomer($this->customer->id);
     }
     // Generate countries list
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         $countries = Country::getCountries($this->context->language->id, true);
     }
     /* todo use helper */
     $list = '<option value="">-</option>';
     foreach ($countries as $country) {
         $selected = $country['iso_code'] == $selected_country ? 'selected="selected"' : '';
         $list .= '<option value="' . $country['iso_code'] . '" ' . $selected . '>' . htmlentities($country['name'], ENT_COMPAT, 'UTF-8') . '</option>';
     }
     // Get selected cc prefix
     if (Tools::isSubmit('taxamoccprefix') && !is_null(Tools::getValue('taxamoccprefix'))) {
         $taxamo_cc_prefix = Tools::getValue('taxamoccprefix');
     } else {
         $taxamo_cc_prefix = Taxamoeuvat::getPrefixByCustomer($this->customer->id);
     }
     if ($this->customer->id) {
         $this->context->smarty->assign(array('countries_list' => $list, 'taxamoisocountryresidence' => $selected_country, 'taxamoccprefix' => $taxamo_cc_prefix));
     }
     // end of code implementation module - taxamo
     $this->setTemplate(_PS_THEME_DIR_ . 'identity.tpl');
 }
Esempio n. 2
0
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     /* id_carrier is not defined in database before choosing a carrier, set it to a default one to match a potential cart _rule */
     if (empty($this->context->cart->id_carrier)) {
         $checked = $this->context->cart->simulateCarrierSelectedOutput();
         $checked = (int) Cart::desintifier($checked);
         $this->context->cart->id_carrier = $checked;
         $this->context->cart->update();
         CartRule::autoRemoveFromCart($this->context);
         CartRule::autoAddToCart($this->context);
     }
     // SHOPPING CART
     $this->_assignSummaryInformations();
     // WRAPPING AND TOS
     $this->_assignWrappingAndTOS();
     $selectedCountry = (int) Configuration::get('PS_COUNTRY_DEFAULT');
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         $countries = Country::getCountries($this->context->language->id, true);
     }
     // If a rule offer free-shipping, force hidding shipping prices
     $free_shipping = false;
     foreach ($this->context->cart->getCartRules() as $rule) {
         if ($rule['free_shipping'] && !$rule['carrier_restriction']) {
             $free_shipping = true;
             break;
         }
     }
     $this->context->smarty->assign(array('free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => isset($selectedCountry) ? $selectedCountry : 0, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier.', false), 'errorTOS' => Tools::displayError('You must accept the Terms of Service.', false), 'isPaymentStep' => (bool) (isset($_GET['isPaymentStep']) && $_GET['isPaymentStep']), 'genders' => Gender::getGenders(), 'one_phone_at_least' => (int) Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
     $years = Tools::dateYears();
     $months = Tools::dateMonths();
     $days = Tools::dateDays();
     $this->context->smarty->assign(array('years' => $years, 'months' => $months, 'days' => $days));
     /* Load guest informations */
     if ($this->isLogged && $this->context->cookie->is_guest) {
         $this->context->smarty->assign('guestInformations', $this->_getGuestInformations());
     }
     // ADDRESS
     if ($this->isLogged) {
         $this->_assignAddress();
     }
     // CARRIER
     $this->_assignCarrier();
     // PAYMENT
     $this->_assignPayment();
     Tools::safePostVars();
     $blocknewsletter = Module::getInstanceByName('blocknewsletter');
     $this->context->smarty->assign('newsletter', (bool) ($blocknewsletter && $blocknewsletter->active));
     $this->_processAddressFormat();
     $this->setTemplate(_PS_THEME_DIR_ . 'order-opc.tpl');
 }
Esempio n. 3
0
 /**
  * Assign countries var to smarty
  */
 protected function assignCountries()
 {
     $this->id_country = (int) Tools::getCountry();
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         $countries = Country::getCountries($this->context->language->id, true);
     }
     $this->context->smarty->assign(array('countries' => $countries, 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'sl_country' => (int) $this->id_country, 'vat_management' => Configuration::get('VATNUMBER_MANAGEMENT')));
 }
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     /* id_carrier is not defined in database before choosing a carrier, set it to a default one to match a potential cart _rule */
     if (empty($this->context->cart->id_carrier)) {
         $checked = $this->context->cart->simulateCarrierSelectedOutput();
         $checked = (int) Cart::desintifier($checked);
         $this->context->cart->id_carrier = $checked;
         $this->context->cart->update();
         CartRule::autoRemoveFromCart($this->context);
         CartRule::autoAddToCart($this->context);
     }
     // SHOPPING CART
     $this->_assignSummaryInformations();
     // WRAPPING AND TOS
     $this->_assignWrappingAndTOS();
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         $countries = Country::getCountries($this->context->language->id, true);
     }
     // If a rule offer free-shipping, force hidding shipping prices
     $free_shipping = false;
     foreach ($this->context->cart->getCartRules() as $rule) {
         if ($rule['free_shipping'] && !$rule['carrier_restriction']) {
             $free_shipping = true;
             break;
         }
     }
     $this->context->smarty->assign(array('free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => (int) Tools::getCountry(), 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier.', false), 'errorTOS' => Tools::displayError('You must accept the Terms of Service.', false), 'isPaymentStep' => isset($_GET['isPaymentStep']) && $_GET['isPaymentStep'], 'genders' => Gender::getGenders(), 'one_phone_at_least' => (int) Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
     $years = Tools::dateYears();
     $months = Tools::dateMonths();
     $days = Tools::dateDays();
     $this->context->smarty->assign(array('years' => $years, 'months' => $months, 'days' => $days));
     /* Load guest informations */
     if ($this->isLogged && $this->context->cookie->is_guest) {
         $this->context->smarty->assign('guestInformations', $this->_getGuestInformations());
     }
     // ADDRESS
     if ($this->isLogged) {
         $this->_assignAddress();
     }
     // CARRIER
     $this->_assignCarrier();
     // PAYMENT
     $this->_assignPayment();
     Tools::safePostVars();
     $newsletter = Configuration::get('PS_CUSTOMER_NWSL') || Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active;
     $this->context->smarty->assign('newsletter', $newsletter);
     $this->context->smarty->assign('optin', (bool) Configuration::get('PS_CUSTOMER_OPTIN'));
     $this->context->smarty->assign('field_required', $this->context->customer->validateFieldsRequiredDatabase());
     $this->_processAddressFormat();
     $link = new Link();
     if (Tools::getValue('deleteFromOrderLine')) {
         $id_product = Tools::getValue('id_product');
         $date_from = Tools::getValue('date_from');
         $date_to = Tools::getValue('date_to');
         $obj_cart_bk_data = new HotelCartBookingData();
         $cart_data_dlt = $obj_cart_bk_data->deleteRoomDataFromOrderLine($this->context->cart->id, $this->context->cart->id_guest, $id_product, $date_from, $date_to);
         if ($cart_data_dlt) {
             Tools::redirect($link->getPageLink('order', null, $this->context->language->id));
         }
     }
     if ((bool) Configuration::get('PS_ADVANCED_PAYMENT_API')) {
         $this->addJS(_THEME_JS_DIR_ . 'advanced-payment-api.js');
         $this->setTemplate(_PS_THEME_DIR_ . 'order-opc-advanced.tpl');
     } else {
         if (Module::isInstalled('hotelreservationsystem')) {
             require_once _PS_MODULE_DIR_ . 'hotelreservationsystem/define.php';
             $obj_cart_bk_data = new HotelCartBookingData();
             $obj_htl_bk_dtl = new HotelBookingDetail();
             $obj_rm_type = new HotelRoomType();
             $htl_rm_types = $this->context->cart->getProducts();
             if (!empty($htl_rm_types)) {
                 foreach ($htl_rm_types as $type_key => $type_value) {
                     $product = new Product($type_value['id_product'], false, $this->context->language->id);
                     $cover_image_arr = $product->getCover($type_value['id_product']);
                     if (!empty($cover_image_arr)) {
                         $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'small_default');
                     } else {
                         $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'small_default');
                     }
                     $unit_price = Product::getPriceStatic($type_value['id_product'], true, null, 6, null, false, true, 1);
                     if (isset($this->context->customer->id)) {
                         $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $type_value['id_product']);
                     } else {
                         $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $type_value['id_product']);
                     }
                     $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['id_product']);
                     $cart_htl_data[$type_key]['id_product'] = $type_value['id_product'];
                     $cart_htl_data[$type_key]['cover_img'] = $cover_img;
                     $cart_htl_data[$type_key]['name'] = $product->name;
                     $cart_htl_data[$type_key]['unit_price'] = $unit_price;
                     $cart_htl_data[$type_key]['adult'] = $rm_dtl['adult'];
                     $cart_htl_data[$type_key]['children'] = $rm_dtl['children'];
                     foreach ($cart_bk_data as $data_k => $data_v) {
                         $date_join = strtotime($data_v['date_from']) . strtotime($data_v['date_to']);
                         if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) {
                             $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1;
                             $num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'];
                             $vart_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] * $num_days;
                             $amount = Product::getPriceStatic($type_value['id_product'], true, null, 6, null, false, true, 1);
                             $amount *= $vart_quant;
                             $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount;
                         } else {
                             $num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
                             $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1;
                             $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from'];
                             $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to'];
                             $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days;
                             $amount = Product::getPriceStatic($type_value['id_product'], true, null, 6, null, false, true, 1);
                             $amount *= $num_days;
                             $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount;
                             $cart_htl_data[$type_key]['date_diff'][$date_join]['link'] = $link->getPageLink('order', null, $this->context->language->id, "id_product=" . $type_value['id_product'] . "&deleteFromOrderLine=1&date_from=" . $data_v['date_from'] . "&date_to=" . $data_v['date_to']);
                         }
                     }
                 }
                 $this->context->smarty->assign('cart_htl_data', $cart_htl_data);
             }
         }
         $this->setTemplate(_PS_THEME_DIR_ . 'order-opc.tpl');
     }
 }
Esempio n. 5
0
 /**
  * Assign countries var to smarty
  */
 protected function assignCountries()
 {
     // Select the most appropriate country
     if (isset($_POST['id_country']) && is_numeric($_POST['id_country'])) {
         $selectedCountry = (int) $_POST['id_country'];
     }
     if (!isset($selectedCountry)) {
         $selectedCountry = (int) Configuration::get('PS_COUNTRY_DEFAULT');
     }
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         $countries = Country::getCountries($this->context->language->id, true);
     }
     $this->context->smarty->assign(array('countries' => $countries, 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'sl_country' => isset($selectedCountry) ? $selectedCountry : 0, 'vat_management' => Configuration::get('VATNUMBER_MANAGEMENT')));
 }
Esempio n. 6
0
 /**
  * Assign countries var to smarty
  */
 protected function assignCountries()
 {
     if (isset($this->create_account)) {
         // Select the most appropriate country
         if (isset($_POST['id_country']) && is_numeric($_POST['id_country'])) {
             $selectedCountry = (int) $_POST['id_country'];
         }
         /* FIXME : language iso and country iso are not similar,
         		 * maybe an associative table with country an language can resolve it,
         		 * But for now it's a bug !
         		 * @see : bug #6968
         		 * @link:http://www.prestashop.com/bug_tracker/view/6968/
         		 elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
         		 {
         		 $array = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
         		 if (Validate::isLanguageIsoCode($array[0]))
         		 {
         		 $selectedCountry = Country::getByIso($array[0]);
         		 if (!$selectedCountry)
         		 $selectedCountry = (int)(Configuration::get('PS_COUNTRY_DEFAULT'));
         		 }
         		 }*/
         if (!isset($selectedCountry)) {
             $selectedCountry = (int) Configuration::get('PS_COUNTRY_DEFAULT');
         }
         if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
             $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
         } else {
             $countries = Country::getCountries($this->context->language->id, true);
         }
         $this->context->smarty->assign(array('countries' => $countries, 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'sl_country' => isset($selectedCountry) ? $selectedCountry : 0, 'vat_management' => Configuration::get('VATNUMBER_MANAGEMENT')));
     }
 }
Esempio n. 7
0
 public function initContent()
 {
     $this->context->controller->addJS(self::$amz_payments->getPathUri() . 'views/js/amzpayments_checkout.js');
     $this->context->cart->id_address_delivery = null;
     $this->context->cart->id_address_invoice = null;
     parent::initContent();
     if (empty($this->context->cart->id_carrier)) {
         $checked = $this->context->cart->simulateCarrierSelectedOutput();
         $checked = (int) Cart::desintifier($checked);
         $this->context->cart->id_carrier = $checked;
         $this->context->cart->update();
         CartRule::autoRemoveFromCart($this->context);
         CartRule::autoAddToCart($this->context);
     }
     $this->_assignSummaryInformations();
     $this->_assignWrappingAndTOS();
     $selected_country = (int) Configuration::get('PS_COUNTRY_DEFAULT');
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         $countries = Country::getCountries($this->context->language->id, true);
     }
     $free_shipping = false;
     foreach ($this->context->cart->getCartRules() as $rule) {
         if ($rule['free_shipping'] && !$rule['carrier_restriction']) {
             $free_shipping = true;
             break;
         }
     }
     $this->context->smarty->assign(array('advanced_payment_api' => false, 'free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => isset($selected_country) ? $selected_country : 0, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier.', false), 'errorTOS' => Tools::displayError('You must accept the Terms of Service.', false), 'isPaymentStep' => (bool) Tools::getIsset(Tools::getValue('isPaymentStep')) && Tools::getValue('isPaymentStep'), 'genders' => Gender::getGenders(), 'one_phone_at_least' => (int) Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
     $years = Tools::dateYears();
     $months = Tools::dateMonths();
     $days = Tools::dateDays();
     $this->context->smarty->assign(array('years' => $years, 'months' => $months, 'days' => $days));
     $this->_assignCarrier();
     Tools::safePostVars();
     $blocknewsletter = Module::getInstanceByName('blocknewsletter');
     $this->context->smarty->assign('newsletter', (bool) $blocknewsletter && $blocknewsletter->active);
     $this->context->smarty->assign(array('amz_module_path' => self::$amz_payments->getPathUri(), 'amz_session' => Tools::getValue('session') ? Tools::getValue('session') : $this->context->cookie->amazon_id, 'sellerID' => Configuration::get('AMZ_MERCHANT_ID'), 'sandboxMode' => false));
     if (isset($this->context->cookie->amz_access_token) && $this->context->cookie->amz_access_token != '' && !AmazonPaymentsCustomerHelper::customerHasAmazonCustomerId($this->context->cookie->id_customer)) {
         $this->context->smarty->assign('show_amazon_account_creation_allowed', true);
     } else {
         $this->context->smarty->assign('show_amazon_account_creation_allowed', false);
     }
     $this->context->smarty->assign('preselect_create_account', Configuration::get('PRESELECT_CREATE_ACCOUNT') == 1);
     $this->context->smarty->assign('force_account_creation', Configuration::get('FORCE_ACCOUNT_CREATION') == 1);
     if (Configuration::get('TEMPLATE_VARIANT_BS') == 1) {
         $this->setTemplate('amzpayments_bs.tpl');
     } else {
         $this->setTemplate('amzpayments.tpl');
     }
 }
Esempio n. 8
0
 /**
  * Assign template vars related to countries display
  */
 protected function assignCountries()
 {
     // Get selected country
     if (Tools::isSubmit('id_country') && !is_null(Tools::getValue('id_country')) && is_numeric(Tools::getValue('id_country'))) {
         $selected_country = (int) Tools::getValue('id_country');
     } else {
         if (isset($this->_address) && isset($this->_address->id_country) && !empty($this->_address->id_country) && is_numeric($this->_address->id_country)) {
             $selected_country = (int) $this->_address->id_country;
         } else {
             if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
                 // get all countries as language (xy) or language-country (wz-XY)
                 $array = array();
                 preg_match("#(?<=-)\\w\\w|\\w\\w(?!-)#", $_SERVER['HTTP_ACCEPT_LANGUAGE'], $array);
                 if (!Validate::isLanguageIsoCode($array[0]) || !($selected_country = Country::getByIso($array[0]))) {
                     $selected_country = (int) Configuration::get('PS_COUNTRY_DEFAULT');
                 }
             } else {
                 $selected_country = (int) Configuration::get('PS_COUNTRY_DEFAULT');
             }
         }
     }
     // Generate countries list
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         $countries = Country::getCountries($this->context->language->id, true);
     }
     // @todo use helper
     $list = '';
     foreach ($countries as $country) {
         $selected = $country['id_country'] == $selected_country ? 'selected="selected"' : '';
         $list .= '<option value="' . (int) $country['id_country'] . '" ' . $selected . '>' . htmlentities($country['name'], ENT_COMPAT, 'UTF-8') . '</option>';
     }
     // Assign vars
     $this->context->smarty->assign(array('countries_list' => $list, 'countries' => $countries));
 }
 protected function assignCountries()
 {
     ${"GLOBALS"}["vjnnsubap"] = "list";
     $vhheljumal = "selected_country";
     $zryhlvp = "list";
     $tjuksry = "countries";
     ${"GLOBALS"}["vpjnzdqa"] = "countries";
     if (Tools::isSubmit("country") && !is_null(Tools::getValue("country")) && is_numeric(Tools::getValue("country"))) {
         ${$vhheljumal} = (int) Tools::getValue("country");
     } else {
         if (isset($this->sellerinfo) && isset($this->sellerinfo->country) && !empty($this->sellerinfo->country) && is_numeric($this->sellerinfo->country)) {
             ${${"GLOBALS"}["ontiydub"]} = (int) $this->sellerinfo->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} = "";
     // echo 'COUNTRY: ' . Tools::getValue("country") . "\n";
     foreach (${$tjuksry} as ${${"GLOBALS"}["flggvi"]}) {
         // echo ${${"GLOBALS"}["flggvi"]}["name"] . "\n";
         $selected = Tools::getValue("country") == ${${"GLOBALS"}["flggvi"]}["name"] ? 'selected="selected"' : 'NO';
         // echo $selected . "\n";
         ${"GLOBALS"}["fjhrecq"] = "country";
         ${"GLOBALS"}["qwgsebzu"] = "selected_country";
         ${"GLOBALS"}["siifuhtsc"] = "list";
         // Selected
         @(${${"GLOBALS"}["orvncxo"]} = ${${"GLOBALS"}["fjhrecq"]}["name"] == ${${"GLOBALS"}["qwgsebzu"]} ? "selected=\"selected\"" : "");
         $tiaupxkdtky = "country";
         ${${"GLOBALS"}["siifuhtsc"]} .= "<option " . $selected . "value=\"" . htmlentities(${${"GLOBALS"}["flggvi"]}["name"], ENT_COMPAT, "UTF-8") . "\">" . htmlentities(${${"GLOBALS"}["flggvi"]}["name"], ENT_COMPAT, "UTF-8") . "</option>";
     }
     $this->context->smarty->assign(array("countries_list" => ${${"GLOBALS"}["vjnnsubap"]}, "countries" => ${${"GLOBALS"}["coohkibbnl"]}));
 }
Esempio n. 10
0
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     $this->context->smarty->assign('about_shop_cart', true);
     //print_r($_POST);
     //print '<br><br>';
     //print_r($this->errors);
     $this->context->smarty->assign('genders', Gender::getGenders());
     $this->context->smarty->assign('auth_type', '2');
     $this->assignDate();
     $this->assignCountries();
     $this->context->smarty->assign('newsletter', 1);
     $back = Tools::getValue('back');
     $key = Tools::safeOutput(Tools::getValue('key'));
     if (!empty($key)) {
         $back .= (strpos($back, '?') !== false ? '&' : '?') . 'key=' . $key;
     }
     if ($back == Tools::secureReferrer(Tools::getValue('back'))) {
         $this->context->smarty->assign('back', html_entity_decode($back));
     } else {
         $this->context->smarty->assign('back', Tools::safeOutput($back));
     }
     if (Tools::getValue('display_guest_checkout')) {
         //                    die('111');
         if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
             $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
         } else {
             $countries = Country::getCountries($this->context->language->id, true);
         }
         //			if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
         //			{
         //				// get all countries as language (xy) or language-country (wz-XY)
         //				$array = array();
         //				preg_match("#(?<=-)\w\w|\w\w(?!-)#",$_SERVER['HTTP_ACCEPT_LANGUAGE'],$array);
         //				if (!Validate::isLanguageIsoCode($array[0]) || !($sl_country = Country::getByIso($array[0])))
         //					$sl_country = (int)Configuration::get('PS_COUNTRY_DEFAULT');
         //			}
         //			else
         $sl_country = (int) Tools::getValue('id_country', Configuration::get('PS_COUNTRY_DEFAULT'));
         $this->context->smarty->assign(array('inOrderProcess' => true, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'sl_country' => (int) $sl_country, 'countries' => $countries));
     }
     if (Tools::getValue('create_account')) {
         $this->context->smarty->assign('email_create', 1);
     }
     if (Tools::getValue('multi-shipping') == 1) {
         $this->context->smarty->assign('multi_shipping', true);
     } else {
         $this->context->smarty->assign('multi_shipping', false);
     }
     $this->assignAddressFormat();
     // Call a hook to display more information on form
     $this->context->smarty->assign(array('HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
     // Just set $this->template value here in case it's used by Ajax
     $this->setTemplate(_PS_THEME_DIR_ . 'authentication.tpl');
     if ($this->ajax) {
         // Call a hook to display more information on form
         $this->context->smarty->assign(array('PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'genders' => Gender::getGenders()));
         $return = array('hasError' => !empty($this->errors), 'errors' => $this->errors, 'page' => $this->context->smarty->fetch($this->template), 'token' => Tools::getToken(false));
         die(Tools::jsonEncode($return));
     }
 }
Esempio n. 11
0
 protected function assignCountries()
 {
     $qcoysueo = "selected_country";
     $brnohvtad = "selected_country";
     ${"GLOBALS"}["bshcoeb"] = "country";
     if (Tools::isSubmit("id_country") && !is_null(Tools::getValue("id_country")) && is_numeric(Tools::getValue("id_country"))) {
         ${$brnohvtad} = (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)) {
             ${$qcoysueo} = (int) $this->sellerinfo->id_country;
         } else {
             if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
                 $ywiomnxv = "selected_country";
                 $irkslognd = "array";
                 ${$irkslognd} = preg_split("/,|-/", $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
                 if (!Validate::isLanguageIsoCode(${${"GLOBALS"}["ujwvmuqxlqu"]}[0]) || !(${${"GLOBALS"}["poexqmjljv"]} = Country::getByIso(${${"GLOBALS"}["ujwvmuqxlqu"]}[0]))) {
                     ${$ywiomnxv} = (int) Configuration::get("PS_COUNTRY_DEFAULT");
                 }
             } else {
                 ${${"GLOBALS"}["poexqmjljv"]} = (int) Configuration::get("PS_COUNTRY_DEFAULT");
             }
         }
     }
     $jasmsd = "list";
     if (Configuration::get("PS_RESTRICT_DELIVERED_COUNTRIES")) {
         ${${"GLOBALS"}["yseltbpqjcm"]} = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         ${${"GLOBALS"}["yseltbpqjcm"]} = Country::getCountries($this->context->language->id, true);
     }
     ${$jasmsd} = "";
     foreach (${${"GLOBALS"}["yseltbpqjcm"]} as ${${"GLOBALS"}["bshcoeb"]}) {
         ${"GLOBALS"}["mnphxfotp"] = "country";
         $kdrxfnvdvkm = "country";
         ${"GLOBALS"}["vfiytny"] = "selected";
         ${"GLOBALS"}["xpjkdr"] = "list";
         ${"GLOBALS"}["ffhdyh"] = "selected";
         ${"GLOBALS"}["thqfbs"] = "country";
         ${${"GLOBALS"}["ffhdyh"]} = ${${"GLOBALS"}["mnphxfotp"]}["id_country"] == ${${"GLOBALS"}["poexqmjljv"]} ? "selected=\"selected\"" : "";
         ${${"GLOBALS"}["xpjkdr"]} .= "<option value=\"" . (int) ${$kdrxfnvdvkm}["id_country"] . "\" " . ${${"GLOBALS"}["vfiytny"]} . ">" . htmlentities(${${"GLOBALS"}["thqfbs"]}["name"], ENT_COMPAT, "UTF-8") . "</option>";
     }
     $this->context->smarty->assign(array("countries_list" => ${${"GLOBALS"}["opsfmtdnn"]}, "countries" => ${${"GLOBALS"}["yseltbpqjcm"]}));
 }
Esempio n. 12
0
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     // SHOPPING CART
     $this->_assignSummaryInformations();
     // WRAPPING AND TOS
     $this->_assignWrappingAndTOS();
     $selectedCountry = (int) Configuration::get('PS_COUNTRY_DEFAULT');
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         $countries = Country::getCountries($this->context->language->id, true);
     }
     // If a rule offer free-shipping, force hidding shipping prices
     $free_shipping = false;
     foreach ($this->context->cart->getCartRules() as $rule) {
         if ($rule['free_shipping']) {
             $free_shipping = true;
             break;
         }
     }
     $this->context->smarty->assign(array('free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => isset($selectedCountry) ? $selectedCountry : 0, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier before', false), 'errorTOS' => Tools::displayError('You must accept the Terms of Service before', false), 'isPaymentStep' => (bool) (isset($_GET['isPaymentStep']) && $_GET['isPaymentStep']), 'genders' => Gender::getGenders()));
     /* Call a hook to display more information on form */
     self::$smarty->assign(array('HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
     $years = Tools::dateYears();
     $months = Tools::dateMonths();
     $days = Tools::dateDays();
     $this->context->smarty->assign(array('years' => $years, 'months' => $months, 'days' => $days));
     /* Load guest informations */
     if ($this->isLogged && $this->context->cookie->is_guest) {
         $this->context->smarty->assign('guestInformations', $this->_getGuestInformations());
     }
     if ($this->isLogged) {
         $this->_assignAddress();
     }
     // ADDRESS
     // CARRIER
     $this->_assignCarrier();
     // PAYMENT
     $this->_assignPayment();
     Tools::safePostVars();
     $this->context->smarty->assign('newsletter', (int) Module::getInstanceByName('blocknewsletter')->active);
     $this->_processAddressFormat();
     $this->setTemplate(_PS_THEME_DIR_ . 'order-opc.tpl');
 }
Esempio n. 13
0
 protected function makeAddressForm()
 {
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $availableCountries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         $availableCountries = Country::getCountries($this->context->language->id, true);
     }
     $form = new CustomerAddressForm($this->context->smarty, $this->context->language, $this->getTranslator(), $this->makeAddressPersister(), new CustomerAddressFormatter($this->context->country, $this->getTranslator(), $availableCountries));
     $form->setAction($this->getCurrentURL());
     return $form;
 }
 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);
     }
 }
 public function process()
 {
     // SHOPPING CART
     $this->_assignSummaryInformations();
     // WRAPPING AND TOS
     $this->_assignWrappingAndTOS();
     $selectedCountry = (int) Configuration::get('PS_COUNTRY_DEFAULT');
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries((int) self::$cookie->id_lang, true, true);
     } else {
         $countries = Country::getCountries((int) self::$cookie->id_lang, true);
     }
     self::$smarty->assign(array('isLogged' => $this->isLogged, 'isGuest' => isset(self::$cookie->is_guest) ? self::$cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => isset($selectedCountry) ? $selectedCountry : 0, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier before', false), 'errorTOS' => Tools::displayError('You must accept terms of service before', false), 'isPaymentStep' => (bool) (isset($_GET['isPaymentStep']) and $_GET['isPaymentStep'])));
     /* Call a hook to display more information on form */
     self::$smarty->assign(array('HOOK_CREATE_ACCOUNT_FORM' => Module::hookExec('createAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Module::hookExec('createAccountTop')));
     $years = Tools::dateYears();
     $months = Tools::dateMonths();
     $days = Tools::dateDays();
     self::$smarty->assign(array('years' => $years, 'months' => $months, 'days' => $days));
     /* Load guest informations */
     if ($this->isLogged and self::$cookie->is_guest) {
         self::$smarty->assign('guestInformations', $this->_getGuestInformations());
     }
     if ($this->isLogged) {
         $this->_assignAddress();
     }
     // ADDRESS
     // CARRIER
     $this->_assignCarrier();
     // PAYMENT
     $this->_assignPayment();
     Tools::safePostVars();
     if ($blocknewsletter = Module::getInstanceByName('blocknewsletter')) {
         self::$smarty->assign('newsletter', (int) $blocknewsletter->active);
     } else {
         self::$smarty->assign('newsletter', 0);
     }
 }
Esempio n. 16
0
 public function process()
 {
     parent::process();
     /* Secure restriction for guest */
     if (self::$cookie->is_guest) {
         Tools::redirect('addresses.php');
     }
     if (Tools::isSubmit('id_country') and Tools::getValue('id_country') != NULL and is_numeric(Tools::getValue('id_country'))) {
         $selectedCountry = (int) Tools::getValue('id_country');
     } elseif (isset($this->_address) and isset($this->_address->id_country) and !empty($this->_address->id_country) and is_numeric($this->_address->id_country)) {
         $selectedCountry = (int) $this->_address->id_country;
     } elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         $array = preg_split('/,|-/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
         if (!Validate::isLanguageIsoCode($array[0]) or !($selectedCountry = Country::getByIso($array[0]))) {
             $selectedCountry = (int) Configuration::get('PS_COUNTRY_DEFAULT');
         }
     } else {
         $selectedCountry = (int) Configuration::get('PS_COUNTRY_DEFAULT');
     }
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries((int) self::$cookie->id_lang, true, true);
     } else {
         $countries = Country::getCountries((int) self::$cookie->id_lang, true);
     }
     $countriesList = '';
     foreach ($countries as $country) {
         $countriesList .= '<option value="' . (int) $country['id_country'] . '" ' . ($country['id_country'] == $selectedCountry ? 'selected="selected"' : '') . '>' . htmlentities($country['name'], ENT_COMPAT, 'UTF-8') . '</option>';
     }
     if ((Configuration::get('VATNUMBER_MANAGEMENT') and file_exists(_PS_MODULE_DIR_ . 'vatnumber/vatnumber.php')) && VatNumber::isApplicable(Configuration::get('PS_COUNTRY_DEFAULT'))) {
         self::$smarty->assign('vat_display', 2);
     } elseif (Configuration::get('VATNUMBER_MANAGEMENT')) {
         self::$smarty->assign('vat_display', 1);
     } else {
         self::$smarty->assign('vat_display', 0);
     }
     self::$smarty->assign('ajaxurl', _MODULE_DIR_);
     self::$smarty->assign('vatnumber_ajax_call', (int) file_exists(_PS_MODULE_DIR_ . 'vatnumber/ajax.php'));
     self::$smarty->assign(array('countries_list' => $countriesList, 'countries' => $countries, 'errors' => $this->errors, 'token' => Tools::getToken(false), 'select_address' => (int) Tools::getValue('select_address')));
 }
Esempio n. 17
0
 /**
  * Assign template vars related to countries display
  */
 protected function assignCountries()
 {
     $this->id_country = (int) Tools::getCountry($this->_address);
     // Generate countries list
     if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
         $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
     } else {
         $countries = Country::getCountries($this->context->language->id, true);
     }
     // @todo use helper
     $list = '';
     foreach ($countries as $country) {
         $selected = (int) $country['id_country'] === $this->id_country ? ' selected="selected"' : '';
         $list .= '<option value="' . (int) $country['id_country'] . '"' . $selected . '>' . htmlentities($country['name'], ENT_COMPAT, 'UTF-8') . '</option>';
     }
     // Assign vars
     $this->context->smarty->assign(array('countries_list' => $list, 'countries' => $countries, 'sl_country' => (int) $this->id_country));
 }
Esempio n. 18
0
 public function initContent()
 {
     $internal_referrer = isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], Dispatcher::getInstance()->createUrl('order-opc', $this->context->cookie->id_lang));
     $upsell = @Module::getInstanceByName('upsell');
     if ($upsell && $upsell->active && !(Tools::getValue('skip_offers') == 1 || $internal_referrer)) {
         ParentOrderController::initContent();
         // We need this to display the page properly (parent of overriden controller)
         $upsell->getUpsells();
         $this->template = $upsell->setTemplate('upsell-products.tpl');
     } else {
         if (!$this->isOpcModuleActive()) {
             return parent::initContent();
         }
         $this->origInitContent();
         $this->_assignSummaryInformations();
         $this->_assignWrappingAndTOS();
         $selectedCountry = (int) Configuration::get('PS_COUNTRY_DEFAULT');
         if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
             $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
         } else {
             $countries = Country::getCountries($this->context->language->id, true);
         }
         $free_shipping = false;
         foreach ($this->context->cart->getCartRules() as $rule) {
             if ($rule['free_shipping'] && !$rule['carrier_restriction']) {
                 $free_shipping = true;
                 break;
             }
         }
         $this->context->smarty->assign(array('free_shipping' => $free_shipping, 'isLogged' => $this->isLogged, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => isset($selectedCountry) ? $selectedCountry : 0, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier before', false), 'errorTOS' => Tools::displayError('You must accept the Terms of Service before', false), 'isPaymentStep' => (bool) (Tools::getIsset('isPaymentStep') && Tools::getValue('isPaymentStep')), 'genders' => Gender::getGenders()));
         $this->context->smarty->assign(array('HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
         $years = Tools::dateYears();
         $months = Tools::dateMonths();
         $days = Tools::dateDays();
         $this->context->smarty->assign(array('years' => $years, 'months' => $months, 'days' => $days));
         if ($this->isLogged) {
             $this->context->smarty->assign('guestInformations', $this->_getGuestInformations());
         }
         if ($this->context->cart->id_address_delivery > 0) {
             $def_address = new Address($this->context->cart->id_address_delivery);
             $def_country = $def_address->id_country;
             $def_state = $def_address->id_state;
         } else {
             $def_country = 0;
             $def_state = 0;
         }
         if ($this->context->cart->id_address_invoice > 0) {
             $def_address_invoice = new Address($this->context->cart->id_address_invoice);
             $def_country_invoice = $def_address_invoice->id_country;
             $def_state_invoice = $def_address_invoice->id_state;
         } else {
             $def_country_invoice = 0;
             $def_state_invoice = 0;
         }
         if ($this->context->cart->id_address_delivery > 0 && $this->context->cart->id_address_invoice > 0 && $this->context->cart->id_address_delivery != $this->context->cart->id_address_invoice) {
             $def_different_billing = 1;
         } else {
             $def_different_billing = 0;
         }
         $this->context->smarty->assign('def_different_billing', $def_different_billing);
         $this->context->smarty->assign('def_country', $def_country);
         $this->context->smarty->assign('def_state', $def_state);
         $this->context->smarty->assign('def_country_invoice', $def_country_invoice);
         $this->context->smarty->assign('def_state_invoice', $def_state_invoice);
         if ($this->isLogged) {
             $this->_assignAddress();
         }
         // ADDRESS
         $this->_assignCarrier();
         $this->_assignPayment();
         Tools::safePostVars();
         if (!$this->context->cart->isMultiAddressDelivery()) {
             $this->context->cart->setNoMultishipping();
         }
         // As the cart is no multishipping, set each delivery address lines with the main delivery address
         $summary = $this->context->cart->getSummaryDetails(null, true);
         // to force refresh on product.id_address_delivery
         $this->_assignSummaryInformations();
         $blocknewsletter = Module::getInstanceByName('blocknewsletter');
         $this->context->smarty->assign('newsletter', (bool) ($blocknewsletter && $blocknewsletter->active));
         $this->context->smarty->assign('opc_templates_path', $this->opc_templates_path);
         $this->context->smarty->assign('twoStepCheckout', false);
         // TODO: hardcoded value!
         $online_country = new Country($this->opc_config['online_country_id']);
         if ($online_country->active) {
             $this->context->smarty->assign('onlineCountryActive', true);
         }
         if (Tools::isSubmit('cart-only')) {
             $this->context->smarty->assign('onlyCartSummary', '1');
             $this->context->smarty->assign('order_process_type', Configuration::get('PS_ORDER_PROCESS_TYPE'));
             $this->setTemplate('shopping-cart.tpl');
         } else {
             $this->setTemplate('order-opc.tpl');
         }
     }
 }
Esempio n. 19
0
 public function process()
 {
     parent::process();
     $back = Tools::getValue('back');
     $key = Tools::safeOutput(Tools::getValue('key'));
     if (!empty($key)) {
         $back .= (strpos($back, '?') !== false ? '&' : '?') . 'key=' . $key;
     }
     if (!empty($back)) {
         self::$smarty->assign('back', Tools::safeOutput($back));
         if (strpos($back, 'order.php') !== false) {
             if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
                 $countries = Carrier::getDeliveredCountries((int) self::$cookie->id_lang, true, true);
             } else {
                 $countries = Country::getCountries((int) self::$cookie->id_lang, true);
             }
             self::$smarty->assign(array('inOrderProcess' => true, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'sl_country' => (int) Tools::getValue('id_country', Configuration::get('PS_COUNTRY_DEFAULT')), 'countries' => $countries));
         }
     }
 }
Esempio n. 20
0
 public function initContent()
 {
     // Upsell integration
     $internal_referrer = isset($_SERVER['HTTP_REFERER']) && strstr($_SERVER['HTTP_REFERER'], Dispatcher::getInstance()->createUrl('order-opc', $this->context->cookie->id_lang));
     $upsell = @Module::getInstanceByName('upsell');
     if ($upsell && $upsell->active && !(Tools::getValue('skip_offers') == 1 || $internal_referrer)) {
         ParentOrderController::initContent();
         // We need this to display the page properly (parent of overriden controller)
         $upsell->getUpsells();
         $this->template = $upsell->setTemplate('upsell-products.tpl');
     } else {
         if (!$this->isOpcModuleActive()) {
             return parent::initContent();
         }
         // parent::initContent(); - toto by volalo celu metodu aj s volanim sablony z default themy
         $this->origInitContent();
         // SHOPPING CART
         $this->_assignSummaryInformations();
         // WRAPPING AND TOS
         $this->_assignWrappingAndTOS();
         $selectedCountry = (int) Configuration::get('PS_COUNTRY_DEFAULT');
         if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) {
             $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
         } else {
             $countries = Country::getCountries($this->context->language->id, true);
         }
         // If a rule offer free-shipping, force hidding shipping prices
         $free_shipping = false;
         foreach ($this->context->cart->getCartRules() as $rule) {
             if ($rule['free_shipping'] && !$rule['carrier_restriction']) {
                 $free_shipping = true;
                 break;
             }
         }
         $this->context->smarty->assign(array('free_shipping' => $free_shipping, 'isLogged' => $this->isLogged, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => isset($selectedCountry) ? $selectedCountry : 0, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier before', false), 'errorTOS' => Tools::displayError('You must accept the Terms of Service before', false), 'isPaymentStep' => (bool) (Tools::getIsset('isPaymentStep') && Tools::getValue('isPaymentStep')), 'genders' => Gender::getGenders()));
         /* Call a hook to display more information on form */
         $this->context->smarty->assign(array('HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop')));
         $years = Tools::dateYears();
         $months = Tools::dateMonths();
         $days = Tools::dateDays();
         $this->context->smarty->assign(array('years' => $years, 'months' => $months, 'days' => $days));
         /* Load guest informations */
         //if ($this->isLogged && $this->context->cookie->is_guest) // opckt changed.
         if ($this->isLogged) {
             $this->context->smarty->assign('guestInformations', $this->_getGuestInformations());
         }
         // OPCKT default address update - in case customer is not yet logged-in and address is not
         // yet entered and refresh happens
         if ($this->context->cart->id_address_delivery > 0) {
             $def_address = new Address($this->context->cart->id_address_delivery);
             $def_country = $def_address->id_country;
             $def_state = $def_address->id_state;
         } else {
             $def_country = 0;
             $def_state = 0;
         }
         if ($this->context->cart->id_address_invoice > 0) {
             $def_address_invoice = new Address($this->context->cart->id_address_invoice);
             $def_country_invoice = $def_address_invoice->id_country;
             $def_state_invoice = $def_address_invoice->id_state;
         } else {
             $def_country_invoice = 0;
             $def_state_invoice = 0;
         }
         if ($this->context->cart->id_address_delivery > 0 && $this->context->cart->id_address_invoice > 0 && $this->context->cart->id_address_delivery != $this->context->cart->id_address_invoice) {
             $def_different_billing = 1;
         } else {
             $def_different_billing = 0;
         }
         $this->context->smarty->assign('def_different_billing', $def_different_billing);
         $this->context->smarty->assign('def_country', $def_country);
         $this->context->smarty->assign('def_state', $def_state);
         $this->context->smarty->assign('def_country_invoice', $def_country_invoice);
         $this->context->smarty->assign('def_state_invoice', $def_state_invoice);
         if ($this->isLogged) {
             $this->_assignAddress();
         }
         // ADDRESS
         // CARRIER
         $this->_assignCarrier();
         // PAYMENT
         $this->_assignPayment();
         Tools::safePostVars();
         if (!$this->context->cart->isMultiAddressDelivery()) {
             $this->context->cart->setNoMultishipping();
         }
         // As the cart is no multishipping, set each delivery address lines with the main delivery address
         // cart-summary
         $summary = $this->context->cart->getSummaryDetails(null, true);
         // to force refresh on product.id_address_delivery
         $this->_assignSummaryInformations();
         $blocknewsletter = Module::getInstanceByName('blocknewsletter');
         $this->context->smarty->assign('newsletter', (bool) ($blocknewsletter && $blocknewsletter->active));
         //$this->_processAddressFormat(); - v OPC module to nepotrebujeme, to je len format
         // "offline" needitovatelnej adresy
         //$this->setTemplate(_PS_THEME_DIR_.'order-opc.tpl');
         $this->context->smarty->assign('opc_templates_path', $this->opc_templates_path);
         $this->context->smarty->assign('twoStepCheckout', false);
         // TODO: hardcoded value!
         //$this->context->smarty->assign('paypal_express_checkout_on', isset($this->context->cookie->express_checkout));
         $online_country = new Country($this->opc_config['online_country_id']);
         if ($online_country->active) {
             $this->context->smarty->assign('onlineCountryActive', true);
         }
         if (Tools::isSubmit('cart-only')) {
             $this->context->smarty->assign('onlyCartSummary', '1');
             $this->context->smarty->assign('order_process_type', Configuration::get('PS_ORDER_PROCESS_TYPE'));
             $this->setTemplate('shopping-cart.tpl');
         } else {
             $this->setTemplate('order-opc.tpl');
         }
     }
 }