From 8a0745e8de8d447d4b18f7033907eb3c7f8ceeb2 Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Mon, 19 Aug 2013 17:21:03 +0200 Subject: [PATCH] [-] BO : fixed bug #PSCFV-9782 - live edit bug with multistore --- classes/controller/FrontController.php | 2 +- controllers/admin/AdminModulesPositionsController.php | 7 ++++--- controllers/front/CategoryController.php | 2 ++ controllers/front/CmsController.php | 2 ++ controllers/front/ManufacturerController.php | 2 ++ controllers/front/ProductController.php | 2 ++ controllers/front/SupplierController.php | 2 ++ 7 files changed, 15 insertions(+), 4 deletions(-) diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index 8aef87c4d..4d34edf32 100755 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -594,7 +594,7 @@ class FrontControllerCore extends Controller protected function canonicalRedirection($canonical_url = '') { - if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET') + if (!$canonical_url || !Configuration::get('PS_CANONICAL_REDIRECT') || strtoupper($_SERVER['REQUEST_METHOD']) != 'GET' || Tools::getValue('live_edit')) return; $match_url = (($this->ssl && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; diff --git a/controllers/admin/AdminModulesPositionsController.php b/controllers/admin/AdminModulesPositionsController.php index 2d757330d..0a86d3c5f 100644 --- a/controllers/admin/AdminModulesPositionsController.php +++ b/controllers/admin/AdminModulesPositionsController.php @@ -270,12 +270,13 @@ class AdminModulesPositionsControllerCore extends AdminController 'href' => self::$currentIndex.'&addToHook'.($this->display_key ? '&show_modules='.$this->display_key : '').'&token='.$this->token, 'desc' => $this->l('Transplant a module') ); - + $live_edit_params = array( 'live_edit' => true, 'ad' => $admin_dir, 'liveToken' => $this->token, - 'id_employee' => (int)$this->context->employee->id + 'id_employee' => (int)$this->context->employee->id, + 'id_shop' => (int)$this->context->shop->id ); $this->context->smarty->assign(array( @@ -304,7 +305,7 @@ class AdminModulesPositionsControllerCore extends AdminController $lang = ''; if (Configuration::get('PS_REWRITING_SETTINGS') && count(Language::getLanguages(true)) > 1) $lang = Language::getIsoById($this->context->employee->id_lang).'/'; - $url = $this->context->shop->getBaseURL().$lang.Dispatcher::getInstance()->createUrl('index', (int)$this->context->language->id, $live_edit_params); + $url = 'http://'.Tools::getHttpHost().'/'.$lang.Dispatcher::getInstance()->createUrl('index', (int)$this->context->language->id, $live_edit_params); return $url; } diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index 33dfc3bf3..f270f0bfb 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -53,6 +53,8 @@ class CategoryControllerCore extends FrontController public function canonicalRedirection($canonicalURL = '') { + if (Tools::getValue('live_edit')) + return ; if (!Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop()) { $this->redirect_after = '404'; diff --git a/controllers/front/CmsController.php b/controllers/front/CmsController.php index 75877f647..c5a282b00 100644 --- a/controllers/front/CmsController.php +++ b/controllers/front/CmsController.php @@ -33,6 +33,8 @@ class CmsControllerCore extends FrontController public function canonicalRedirection($canonicalURL = '') { + if (Tools::getValue('live_edit')) + return ; if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms))) parent::canonicalRedirection($canonicalURL); else if (Validate::isLoadedObject($this->cms_category) && ($canonicalURL = $this->context->link->getCMSCategoryLink($this->cms_category))) diff --git a/controllers/front/ManufacturerController.php b/controllers/front/ManufacturerController.php index 096b2e4c9..dbc2f3b2a 100644 --- a/controllers/front/ManufacturerController.php +++ b/controllers/front/ManufacturerController.php @@ -40,6 +40,8 @@ class ManufacturerControllerCore extends FrontController public function canonicalRedirection($canonicalURL = '') { + if (Tools::getValue('live_edit')) + return ; if (Validate::isLoadedObject($this->manufacturer)) parent::canonicalRedirection($this->context->link->getManufacturerLink($this->manufacturer)); } diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index c68d691f6..2b315a282 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -69,6 +69,8 @@ class ProductControllerCore extends FrontController public function canonicalRedirection($canonical_url = '') { + if (Tools::getValue('live_edit')) + return ; if (Validate::isLoadedObject($this->product)) parent::canonicalRedirection($this->context->link->getProductLink($this->product)); } diff --git a/controllers/front/SupplierController.php b/controllers/front/SupplierController.php index 5d39df6d6..78fda9152 100644 --- a/controllers/front/SupplierController.php +++ b/controllers/front/SupplierController.php @@ -41,6 +41,8 @@ class SupplierControllerCore extends FrontController public function canonicalRedirection($canonicalURL = '') { + if (Tools::getValue('live_edit')) + return ; if (Validate::isLoadedObject($this->supplier)) parent::canonicalRedirection($this->context->link->getSupplierLink($this->supplier)); }