// Context part 30
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8008 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
183e1289c4
commit
7c67fd84c2
7 files changed
+73
-72
No files matched your search
+48
-62
@@ -113,30 +113,26 @@ class FrontControllerCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
$defaultCountry = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
|
|
||||||
|
|
||||||
// Switch language if needed and init cookie language
|
// Switch language if needed and init cookie language
|
||||||
if ($iso = Tools::getValue('isolang') AND Validate::isLanguageIsoCode($iso) AND ($id_lang = (int)(Language::getIdByIso($iso))))
|
if ($iso = Tools::getValue('isolang') AND Validate::isLanguageIsoCode($iso) AND ($id_lang = (int)(Language::getIdByIso($iso))))
|
||||||
$_GET['id_lang'] = $id_lang;
|
$_GET['id_lang'] = $id_lang;
|
||||||
|
|
||||||
Tools::switchLanguage();
|
Tools::switchLanguage();
|
||||||
Tools::setCookieLanguage($cookie);
|
Tools::setCookieLanguage($this->context->cookie);
|
||||||
$currency = Tools::setCurrency($cookie);
|
$currency = Tools::setCurrency($this->context->cookie);
|
||||||
|
|
||||||
if (Validate::isLoadedObject($currency))
|
if (Validate::isLoadedObject($currency))
|
||||||
$smarty->ps_currency = $currency;
|
$this->context->smarty->ps_currency = $currency;
|
||||||
if (!Validate::isLoadedObject($language = new Language($cookie->id_lang)))
|
|
||||||
$language = new Language(Configuration::get('PS_LANG_DEFAULT'));
|
$this->context->smarty->ps_language = $this->context->language;
|
||||||
$smarty->ps_language = $language;
|
|
||||||
$this->context->language = $language;
|
|
||||||
|
|
||||||
$protocol_link = (Configuration::get('PS_SSL_ENABLED') OR (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://';
|
$protocol_link = (Configuration::get('PS_SSL_ENABLED') OR (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://';
|
||||||
$protocol_content = ((isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) OR (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://';
|
$protocol_content = ((isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) OR (!empty($_SERVER['HTTPS']) AND strtolower($_SERVER['HTTPS']) != 'off')) ? 'https://' : 'http://';
|
||||||
$link = new Link($protocol_link, $protocol_content);
|
$link = new Link($protocol_link, $protocol_content);
|
||||||
$this->context->link = $link;
|
$this->context->link = $link;
|
||||||
|
|
||||||
if ($this->auth AND !$cookie->isLogged($this->guestAllowed))
|
if ($this->auth AND !$this->context->cookie->isLogged($this->guestAllowed))
|
||||||
Tools::redirect('index.php?controller=authentication'.($this->authRedirection ? '&back='.$this->authRedirection : ''));
|
Tools::redirect('index.php?controller=authentication'.($this->authRedirection ? '&back='.$this->authRedirection : ''));
|
||||||
|
|
||||||
/* Theme is missing or maintenance */
|
/* Theme is missing or maintenance */
|
||||||
@@ -145,46 +141,46 @@ class FrontControllerCore
|
|||||||
elseif (basename($_SERVER['PHP_SELF']) != 'disabled.php' AND !(int)(Configuration::get('PS_SHOP_ENABLE')))
|
elseif (basename($_SERVER['PHP_SELF']) != 'disabled.php' AND !(int)(Configuration::get('PS_SHOP_ENABLE')))
|
||||||
$this->maintenance = true;
|
$this->maintenance = true;
|
||||||
elseif (Configuration::get('PS_GEOLOCATION_ENABLED'))
|
elseif (Configuration::get('PS_GEOLOCATION_ENABLED'))
|
||||||
if (($newDefault = $this->geolocationManagement($defaultCountry)) && Validate::isLoadedObject($newDefault))
|
if (($newDefault = $this->geolocationManagement($this->context->country)) && Validate::isLoadedObject($newDefault))
|
||||||
$defaultCountry = $newDefault;
|
$this->context->country = $newDefault;
|
||||||
|
|
||||||
if (isset($_GET['logout']) OR ($cookie->logged AND Customer::isBanned((int)$cookie->id_customer)))
|
if (isset($_GET['logout']) OR ($this->context->cookie->logged AND Customer::isBanned((int)$this->context->cookie->id_customer)))
|
||||||
{
|
{
|
||||||
$cookie->logout();
|
$this->context->cookie->logout();
|
||||||
Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
|
Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
|
||||||
}
|
}
|
||||||
elseif (isset($_GET['mylogout']))
|
elseif (isset($_GET['mylogout']))
|
||||||
{
|
{
|
||||||
$cookie->mylogout();
|
$this->context->cookie->mylogout();
|
||||||
Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
|
Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_MODULES = array();
|
$_MODULES = array();
|
||||||
|
|
||||||
/* Cart already exists */
|
/* Cart already exists */
|
||||||
if ((int)$cookie->id_cart)
|
if ((int)$this->context->cookie->id_cart)
|
||||||
{
|
{
|
||||||
$cart = new Cart($cookie->id_cart);
|
$cart = new Cart($this->context->cookie->id_cart);
|
||||||
if ($cart->OrderExists())
|
if ($cart->OrderExists())
|
||||||
unset($cookie->id_cart, $cart, $cookie->checkedTOS);
|
unset($this->context->cookie->id_cart, $cart, $this->context->cookie->checkedTOS);
|
||||||
/* Delete product of cart, if user can't make an order from his country */
|
/* Delete product of cart, if user can't make an order from his country */
|
||||||
elseif (intval(Configuration::get('PS_GEOLOCATION_ENABLED')) AND
|
elseif (intval(Configuration::get('PS_GEOLOCATION_ENABLED')) AND
|
||||||
!in_array(strtoupper($cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) AND
|
!in_array(strtoupper($this->context->cookie->iso_code_country), explode(';', Configuration::get('PS_ALLOWED_COUNTRIES'))) AND
|
||||||
$cart->nbProducts() AND intval(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR')) != -1 AND
|
$cart->nbProducts() AND intval(Configuration::get('PS_GEOLOCATION_NA_BEHAVIOR')) != -1 AND
|
||||||
!self::isInWhitelistForGeolocation())
|
!self::isInWhitelistForGeolocation())
|
||||||
unset($cookie->id_cart, $cart);
|
unset($this->context->cookie->id_cart, $cart);
|
||||||
// update cart values
|
// update cart values
|
||||||
elseif ($cookie->id_customer != $cart->id_customer OR $cookie->id_lang != $cart->id_lang OR $currency->id != $cart->id_currency)
|
elseif ($this->context->cookie->id_customer != $cart->id_customer OR $this->context->cookie->id_lang != $cart->id_lang OR $currency->id != $cart->id_currency)
|
||||||
{
|
{
|
||||||
if ($cookie->id_customer)
|
if ($this->context->cookie->id_customer)
|
||||||
$cart->id_customer = (int)($cookie->id_customer);
|
$cart->id_customer = (int)($this->context->cookie->id_customer);
|
||||||
$cart->id_lang = (int)($cookie->id_lang);
|
$cart->id_lang = (int)($this->context->cookie->id_lang);
|
||||||
$cart->id_currency = (int)$currency->id;
|
$cart->id_currency = (int)$currency->id;
|
||||||
$cart->update();
|
$cart->update();
|
||||||
}
|
}
|
||||||
/* Select an address if not set */
|
/* Select an address if not set */
|
||||||
if (isset($cart) && (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0 ||
|
if (isset($cart) && (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0 ||
|
||||||
!isset($cart->id_address_invoice) || $cart->id_address_invoice == 0) && $cookie->id_customer)
|
!isset($cart->id_address_invoice) || $cart->id_address_invoice == 0) && $this->context->cookie->id_customer)
|
||||||
{
|
{
|
||||||
$to_update = false;
|
$to_update = false;
|
||||||
if (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0)
|
if (!isset($cart->id_address_delivery) || $cart->id_address_delivery == 0)
|
||||||
@@ -205,14 +201,14 @@ class FrontControllerCore
|
|||||||
if (!isset($cart) OR !$cart->id)
|
if (!isset($cart) OR !$cart->id)
|
||||||
{
|
{
|
||||||
$cart = new Cart();
|
$cart = new Cart();
|
||||||
$cart->id_lang = (int)($cookie->id_lang);
|
$cart->id_lang = (int)($this->context->cookie->id_lang);
|
||||||
$cart->id_currency = (int)($cookie->id_currency);
|
$cart->id_currency = (int)($this->context->cookie->id_currency);
|
||||||
$cart->id_guest = (int)($cookie->id_guest);
|
$cart->id_guest = (int)($this->context->cookie->id_guest);
|
||||||
$cart->id_group_shop = (int)$this->id_current_group_shop;
|
$cart->id_group_shop = (int)$this->id_current_group_shop;
|
||||||
$cart->id_shop = $this->id_current_shop;
|
$cart->id_shop = $this->id_current_shop;
|
||||||
if ($cookie->id_customer)
|
if ($this->context->cookie->id_customer)
|
||||||
{
|
{
|
||||||
$cart->id_customer = (int)($cookie->id_customer);
|
$cart->id_customer = (int)($this->context->cookie->id_customer);
|
||||||
$cart->id_address_delivery = (int)(Address::getFirstCustomerAddressId($cart->id_customer));
|
$cart->id_address_delivery = (int)(Address::getFirstCustomerAddressId($cart->id_customer));
|
||||||
$cart->id_address_invoice = $cart->id_address_delivery;
|
$cart->id_address_invoice = $cart->id_address_delivery;
|
||||||
}
|
}
|
||||||
@@ -231,7 +227,7 @@ class FrontControllerCore
|
|||||||
setlocale(LC_TIME, $locale);
|
setlocale(LC_TIME, $locale);
|
||||||
setlocale(LC_NUMERIC, 'en_US.UTF-8');
|
setlocale(LC_NUMERIC, 'en_US.UTF-8');
|
||||||
|
|
||||||
$smarty->ps_language = $language;
|
$this->context->smarty->ps_language = $this->context->language;
|
||||||
|
|
||||||
/* get page name to display it in body id */
|
/* get page name to display it in body id */
|
||||||
// @todo check here
|
// @todo check here
|
||||||
@@ -239,12 +235,12 @@ class FrontControllerCore
|
|||||||
$page_name = Dispatcher::getInstance()->getController();
|
$page_name = Dispatcher::getInstance()->getController();
|
||||||
$page_name = (preg_match('/^[0-9]/', $page_name)) ? 'page_'.$page_name : $page_name;
|
$page_name = (preg_match('/^[0-9]/', $page_name)) ? 'page_'.$page_name : $page_name;
|
||||||
|
|
||||||
$smarty->assign(Tools::getMetaTags($language->id, $page_name));
|
$this->context->smarty->assign(Tools::getMetaTags($this->context->language->id, $page_name));
|
||||||
$smarty->assign('request_uri', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
|
$this->context->smarty->assign('request_uri', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI'])));
|
||||||
|
|
||||||
/* Breadcrumb */
|
/* Breadcrumb */
|
||||||
$navigationPipe = (Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>');
|
$navigationPipe = (Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>');
|
||||||
$smarty->assign('navigationPipe', $navigationPipe);
|
$this->context->smarty->assign('navigationPipe', $navigationPipe);
|
||||||
|
|
||||||
if (!defined('_PS_BASE_URL_'))
|
if (!defined('_PS_BASE_URL_'))
|
||||||
define('_PS_BASE_URL_', Tools::getShopDomain(true));
|
define('_PS_BASE_URL_', Tools::getShopDomain(true));
|
||||||
@@ -255,7 +251,7 @@ class FrontControllerCore
|
|||||||
|
|
||||||
Product::initPricesComputation();
|
Product::initPricesComputation();
|
||||||
|
|
||||||
$display_tax_label = $defaultCountry->display_tax_label;
|
$display_tax_label = $this->context->country->display_tax_label;
|
||||||
if ($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')})
|
if ($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')})
|
||||||
{
|
{
|
||||||
$infos = Address::getCountryAndState((int)($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
$infos = Address::getCountryAndState((int)($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));
|
||||||
@@ -263,11 +259,11 @@ class FrontControllerCore
|
|||||||
if (Validate::isLoadedObject($country))
|
if (Validate::isLoadedObject($country))
|
||||||
$display_tax_label = $country->display_tax_label;
|
$display_tax_label = $country->display_tax_label;
|
||||||
}
|
}
|
||||||
$smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'link' => $link,
|
'link' => $link,
|
||||||
'cart' => $cart,
|
'cart' => $cart,
|
||||||
'currency' => $currency,
|
'currency' => $currency,
|
||||||
'cookie' => $cookie,
|
'cookie' => $this->context->cookie,
|
||||||
'page_name' => $page_name,
|
'page_name' => $page_name,
|
||||||
'base_dir' => _PS_BASE_URL_.__PS_BASE_URI__,
|
'base_dir' => _PS_BASE_URL_.__PS_BASE_URI__,
|
||||||
'base_dir_ssl' => $protocol_link.Tools::getShopDomainSsl().__PS_BASE_URI__,
|
'base_dir_ssl' => $protocol_link.Tools::getShopDomainSsl().__PS_BASE_URI__,
|
||||||
@@ -275,7 +271,7 @@ class FrontControllerCore
|
|||||||
'tpl_dir' => _PS_THEME_DIR_,
|
'tpl_dir' => _PS_THEME_DIR_,
|
||||||
'modules_dir' => _MODULE_DIR_,
|
'modules_dir' => _MODULE_DIR_,
|
||||||
'mail_dir' => _MAIL_DIR_,
|
'mail_dir' => _MAIL_DIR_,
|
||||||
'lang_iso' => $language->iso_code,
|
'lang_iso' => $this->context->language->iso_code,
|
||||||
'come_from' => Tools::getHttpHost(true, true).Tools::htmlentitiesUTF8(str_replace('\'', '', urldecode($_SERVER['REQUEST_URI']))),
|
'come_from' => Tools::getHttpHost(true, true).Tools::htmlentitiesUTF8(str_replace('\'', '', urldecode($_SERVER['REQUEST_URI']))),
|
||||||
'cart_qties' => (int)$cart->nbProducts(),
|
'cart_qties' => (int)$cart->nbProducts(),
|
||||||
'currencies' => Currency::getCurrencies(),
|
'currencies' => Currency::getCurrencies(),
|
||||||
@@ -292,10 +288,10 @@ class FrontControllerCore
|
|||||||
));
|
));
|
||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
$smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'id_currency_cookie' => (int)$currency->id,
|
'id_currency_cookie' => (int)$currency->id,
|
||||||
'logged' => $cookie->isLogged(),
|
'logged' => $this->context->cookie->isLogged(),
|
||||||
'customerName' => ($cookie->logged ? $cookie->customer_firstname.' '.$cookie->customer_lastname : false)
|
'customerName' => ($this->context->cookie->logged ? $this->context->cookie->customer_firstname.' '.$this->context->cookie->customer_lastname : false)
|
||||||
));
|
));
|
||||||
|
|
||||||
// TODO for better performances (cache usage), remove these assign and use a smarty function to get the right media server in relation to the full ressource name
|
// TODO for better performances (cache usage), remove these assign and use a smarty function to get the right media server in relation to the full ressource name
|
||||||
@@ -317,19 +313,20 @@ class FrontControllerCore
|
|||||||
|
|
||||||
foreach ($assignArray as $assignKey => $assignValue)
|
foreach ($assignArray as $assignKey => $assignValue)
|
||||||
if (substr($assignValue, 0, 1) == '/' OR $protocol_content == 'https://')
|
if (substr($assignValue, 0, 1) == '/' OR $protocol_content == 'https://')
|
||||||
$smarty->assign($assignKey, $protocol_content.Tools::getMediaServer($assignValue).$assignValue);
|
$this->context->smarty->assign($assignKey, $protocol_content.Tools::getMediaServer($assignValue).$assignValue);
|
||||||
else
|
else
|
||||||
$smarty->assign($assignKey, $assignValue);
|
$this->context->smarty->assign($assignKey, $assignValue);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These shortcuts are DEPRECATED as of version 1.5.
|
* These shortcuts are DEPRECATED as of version 1.5.
|
||||||
* Use the Context to access objects instead.
|
* Use the Context to access objects instead.
|
||||||
* Example: $this->context->cart
|
* Example: $this->context->cart
|
||||||
*/
|
*/
|
||||||
self::$cookie = $cookie;
|
self::$cookie = $this->context->cookie;
|
||||||
self::$cart = $cart;
|
self::$cart = $cart;
|
||||||
self::$smarty = $smarty;
|
self::$smarty = $this->context->smarty;
|
||||||
self::$link = $link;
|
self::$link = $link;
|
||||||
|
$defaultCountry = $this->context->country;
|
||||||
|
|
||||||
if ($this->maintenance)
|
if ($this->maintenance)
|
||||||
$this->displayMaintenancePage();
|
$this->displayMaintenancePage();
|
||||||
@@ -344,27 +341,16 @@ class FrontControllerCore
|
|||||||
$this->iso = $iso;
|
$this->iso = $iso;
|
||||||
$this->setMedia();
|
$this->setMedia();
|
||||||
|
|
||||||
if (isset($cookie->id_customer) && (int)$cookie->id_customer)
|
if($this->context->cookie->id_country)
|
||||||
{
|
$customer->geoloc_id_country = (int)$this->context->cookie->id_country;
|
||||||
$customer = new Customer($cookie->id_customer);
|
if($this->context->cookie->id_state)
|
||||||
$customer->logged = $cookie->logged;
|
$customer->geoloc_id_state = (int)$this->context->cookie->id_state;
|
||||||
}
|
if($this->context->cookie->postcode)
|
||||||
else
|
$customer->geoloc_postcode = (int)$this->context->cookie->postcode;
|
||||||
$customer = new Customer();
|
|
||||||
|
|
||||||
if($cookie->id_country)
|
|
||||||
$customer->geoloc_id_country = (int)$cookie->id_country;
|
|
||||||
if($cookie->id_state)
|
|
||||||
$customer->geoloc_id_state = (int)$cookie->id_state;
|
|
||||||
if($cookie->postcode)
|
|
||||||
$customer->geoloc_postcode = (int)$cookie->postcode;
|
|
||||||
|
|
||||||
|
|
||||||
$this->context->customer = $customer;
|
|
||||||
$this->context->cart = $cart;
|
$this->context->cart = $cart;
|
||||||
$this->context->currency = $currency;
|
$this->context->currency = $currency;
|
||||||
$this->context->controller = $this;
|
$this->context->controller = $this;
|
||||||
$this->context->country = $defaultCountry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display a maintenance page if shop is closed */
|
/* Display a maintenance page if shop is closed */
|
||||||
|
|||||||
+1
-1
@@ -104,7 +104,7 @@ abstract class ModuleCore
|
|||||||
*/
|
*/
|
||||||
public function __construct($name = null, Context $context = null)
|
public function __construct($name = null, Context $context = null)
|
||||||
{
|
{
|
||||||
$this->context = ($context) ? $context : Context::getContext();
|
$this->context = $context ? $context : Context::getContext();
|
||||||
|
|
||||||
if ($this->name == NULL)
|
if ($this->name == NULL)
|
||||||
$this->name = $this->id;
|
$this->name = $this->id;
|
||||||
|
|||||||
+20
-5
@@ -98,6 +98,7 @@ Language::loadLanguages();
|
|||||||
|
|
||||||
/* Loading default country */
|
/* Loading default country */
|
||||||
$defaultCountry = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
|
$defaultCountry = new Country(Configuration::get('PS_COUNTRY_DEFAULT'), Configuration::get('PS_LANG_DEFAULT'));
|
||||||
|
Context::getContext()->country = $defaultCountry;
|
||||||
|
|
||||||
/* Instantiate cookie */
|
/* Instantiate cookie */
|
||||||
$cookieLifetime = (time() + (((int)Configuration::get('PS_COOKIE_LIFETIME_BO') > 0 ? (int)Configuration::get('PS_COOKIE_LIFETIME_BO') : 1)* 3600));
|
$cookieLifetime = (time() + (((int)Configuration::get('PS_COOKIE_LIFETIME_BO') > 0 ? (int)Configuration::get('PS_COOKIE_LIFETIME_BO') : 1)* 3600));
|
||||||
@@ -107,21 +108,35 @@ else
|
|||||||
$cookie = new Cookie('ps', '', $cookieLifetime);
|
$cookie = new Cookie('ps', '', $cookieLifetime);
|
||||||
Context::getContext()->cookie = $cookie;
|
Context::getContext()->cookie = $cookie;
|
||||||
|
|
||||||
/* Instantiate language */
|
/* Create employee if in BO, customer else */
|
||||||
if (defined('PS_ADMIN_DIR'))
|
if (defined('PS_ADMIN_DIR'))
|
||||||
{
|
{
|
||||||
$employee = new Employee($cookie->id_employee);
|
$employee = new Employee($cookie->id_employee);
|
||||||
Context::getContext()->employee = $employee;
|
Context::getContext()->employee = $employee;
|
||||||
|
|
||||||
$cookie->id_lang = (int)$employee->id_lang;
|
$cookie->id_lang = (int)$employee->id_lang;
|
||||||
$language = new Language($cookie->id_lang ? $cookie->id_lang : Configuration::get('PS_LANG_DEFAULT'));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$language = new Language($cookie->id_lang);
|
if (isset($cookie->id_customer) && (int)$cookie->id_customer)
|
||||||
if (!Validate::isLoadedObject($language))
|
{
|
||||||
$language = new Language(Configuration::get('PS_LANG_DEFAULT'));
|
$customer = new Customer($cookie->id_customer);
|
||||||
|
$customer->id_guest = $cookie->id_guest;
|
||||||
|
$customer->logged = $cookie->logged;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$customer = new Customer();
|
||||||
|
$customer->id_guest = $cookie->id_guest;
|
||||||
|
}
|
||||||
|
Context::getContext()->customer = $customer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the language stored in the cookie is not available language, use default language
|
||||||
|
if (isset($cookie->id_lang) && $cookie->id_lang)
|
||||||
|
$language = new Language($cookie->id_lang);
|
||||||
|
if (!isset($language) || !Validate::isLoadedObject($language))
|
||||||
|
$language = new Language(Configuration::get('PS_LANG_DEFAULT'));
|
||||||
Context::getContext()->language = $language;
|
Context::getContext()->language = $language;
|
||||||
|
|
||||||
/* Define order state */
|
/* Define order state */
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class ManufacturerControllerCore extends FrontController
|
|||||||
$nbProducts = count($data);
|
$nbProducts = count($data);
|
||||||
$this->pagination($nbProducts);
|
$this->pagination($nbProducts);
|
||||||
|
|
||||||
$manufacturers = Manufacturer::getManufacturers(true, (int)self::$cookie->id_lang, true, $this->p, $this->n, false, $id_current_group_shop);
|
$manufacturers = Manufacturer::getManufacturers(true, $this->context->language->id, true, $this->p, $this->n, false, $id_current_group_shop);
|
||||||
$imgDir = _PS_MANU_IMG_DIR_;
|
$imgDir = _PS_MANU_IMG_DIR_;
|
||||||
foreach ($data AS &$item)
|
foreach ($data AS &$item)
|
||||||
$row['image'] = (!file_exists(_PS_MANU_IMG_DIR_.'/'.$row['id_manufacturer'].'-medium.jpg')) ? $this->context->language->iso_code.'-default' : $row['id_manufacturer'];
|
$row['image'] = (!file_exists(_PS_MANU_IMG_DIR_.'/'.$row['id_manufacturer'].'-medium.jpg')) ? $this->context->language->iso_code.'-default' : $row['id_manufacturer'];
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ class ParentOrderControllerCore extends FrontController
|
|||||||
'carriers' => $carriers,
|
'carriers' => $carriers,
|
||||||
'default_carrier' => (int)(Configuration::get('PS_CARRIER_DEFAULT'))
|
'default_carrier' => (int)(Configuration::get('PS_CARRIER_DEFAULT'))
|
||||||
));
|
));
|
||||||
self::$smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'HOOK_EXTRACARRIER' => Module::hookExec('extraCarrier', array('address' => $address)),
|
'HOOK_EXTRACARRIER' => Module::hookExec('extraCarrier', array('address' => $address)),
|
||||||
'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers))
|
'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers))
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class ProductControllerCore extends FrontController
|
|||||||
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
|
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
|
||||||
if (Validate::isLoadedObject($this->product))
|
if (Validate::isLoadedObject($this->product))
|
||||||
{
|
{
|
||||||
$canonicalURL = self::$link->getProductLink($this->product);
|
$canonicalURL = $this->context->link->getProductLink($this->product);
|
||||||
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
||||||
{
|
{
|
||||||
header('HTTP/1.0 301 Moved');
|
header('HTTP/1.0 301 Moved');
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class SupplierControllerCore extends FrontController
|
|||||||
{
|
{
|
||||||
if (Validate::isLoadedObject($this->supplier))
|
if (Validate::isLoadedObject($this->supplier))
|
||||||
{
|
{
|
||||||
$canonicalURL = self::$link->getSupplierLink($this->supplier);
|
$canonicalURL = $this->context->link->getSupplierLink($this->supplier);
|
||||||
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
if (!preg_match('/^'.Tools::pRegexp($canonicalURL, '/').'([&?].*)?$/', Tools::getProtocol().$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']))
|
||||||
{
|
{
|
||||||
header('HTTP/1.0 301 Moved');
|
header('HTTP/1.0 301 Moved');
|
||||||
|
|||||||
Reference in new issue
Block a user