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'); } } }
public function initContent() { parent::initContent(); if ($this->_legal && ($tpl = $this->_legal->getThemeOverride('order-opc'))) { $this->setTemplate($tpl); } }
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'); } } }