public function hookHeader($params) { if (!$this->active || !Configuration::get('GOINTERPAY_STORE') || !Configuration::get('GOINTERPAY_SECRET')) { return false; } $html = ''; if (version_compare(_PS_VERSION_, '1.5', '>')) { $this->context->controller->addJQueryPlugin('fancybox'); } else { $html .= ' <script type="text/javascript" src="' . __PS_BASE_URI__ . 'js/jquery/jquery.fancybox-1.3.4.js"></script> <link type="text/css" rel="stylesheet" href="' . __PS_BASE_URI__ . 'css/jquery.fancybox-1.3.4.css" />'; } if (Tools::getValue('controller') == 'category') { $disable_add_to_cart = $this->_checkProuctForExportOnCategoryPage(); $this->context->smarty->assign('disable_add_to_cart', $disable_add_to_cart); } $this->updateCurrencies(); $details = Db::getInstance()->ExecuteS('SELECT i.`orderId`, o.`id_cart`, o.`id_order`' . (_PS_VERSION_ >= 1.5 ? ', o.`reference`' : '') . ' FROM `' . _DB_PREFIX_ . 'orders` as o, `' . _DB_PREFIX_ . 'gointerpay_order_id` as i WHERE o.`id_cart` = i.`id_cart` AND o.`id_customer` = ' . (int) $this->context->customer->id); $link = array(); include_once _PS_MODULE_DIR_ . 'gointerpay/Rest.php'; $rest = new Rest(Configuration::get('GOINTERPAY_STORE'), Configuration::get('GOINTERPAY_SECRET')); if (count($details)) { if (version_compare(_PS_VERSION_, 1.5, '<')) { foreach ($details as $detail) { $link[(int) $detail['id_order']] = trim(Tools::safeOutput($rest->getOrderStatusLink($detail['orderId']))); } } else { foreach ($details as $detail) { $link[Tools::safeOutput($detail['reference'])] = trim(Tools::safeOutput($rest->getOrderStatusLink($detail['orderId']))); } } } $this->context->smarty->assign(array('pathSsl' => (_PS_VERSION_ >= 1.4 ? Tools::getShopDomainSsl(true, true) : '') . __PS_BASE_URI__ . 'modules/gointerpay/', 'modulePath' => $this->_path, 'links' => $link, 'version15' => _PS_VERSION_ >= 1.5 ? true : false)); $button = true; if (!$this->_isInternational($params['cart'])) { $button = false; } if ($button) { $alert = array(); foreach ($params['cart']->getProducts() as $val) { if (!$this->_isExportProduct((int) $val['id_product'])) { $alert[] = $this->l(Tools::safeOutput($val['name']) . ' is not a product that can be exported.'); } } if (count($alert)) { $this->context->smarty->assign('alert', implode('\\n', $alert)); } } if (Tools::getValue('step') < 1) { $button = false; } /* Check that the selected ship to country is available with Interpay */ if (isset($this->context->cart->id_address_delivery) && $this->context->cart->id_address_delivery && Tools::getValue('ajax') == '') { $ship_to_address = new Address((int) $this->context->cart->id_address_delivery); if (Validate::isLoadedObject($ship_to_address)) { $ship_to_iso_code = Country::getIsoById((int) $ship_to_address->id_country); $ship_to_supported_by_interpay = Db::getInstance()->getValue('SELECT country_code FROM ' . _DB_PREFIX_ . 'gointerpay_countries WHERE country_code = \'' . pSQL($ship_to_iso_code) . '\''); if ($ship_to_supported_by_interpay != $ship_to_iso_code) { $this->context->smarty->assign('interpay_not_supported', true); $button = false; } } } $this->context->smarty->assign('button', $button); return $this->display(__FILE__, 'tpl/header.tpl'); }