[-] BO : fixed bug #PSCFV-9782 - live edit bug with multistore

This commit is contained in:
Vincent Augagneur
2013-08-19 17:21:03 +02:00
parent 155fd516ba
commit 8a0745e8de
7 changed files with 15 additions and 4 deletions

View File

@@ -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'];

View File

@@ -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;
}

View File

@@ -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';

View File

@@ -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)))

View File

@@ -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));
}

View File

@@ -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));
}

View File

@@ -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));
}