// Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into bootstrap
Conflicts: .gitignore admin-dev/themes/default/css/admin.css admin-dev/themes/default/template/controllers/categories/helpers/list/list_header.tpl admin-dev/themes/default/template/controllers/customers/helpers/list/list_header.tpl admin-dev/themes/default/template/controllers/modules/list.tpl admin-dev/themes/default/template/controllers/modules/page.tpl admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl admin-dev/themes/default/template/controllers/orders/_documents.tpl admin-dev/themes/default/template/controllers/orders/_shipping.tpl admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl admin-dev/themes/default/template/controllers/payment/helpers/view/view.tpl admin-dev/themes/default/template/controllers/payment/restrictions.tpl admin-dev/themes/default/template/controllers/products/images.tpl admin-dev/themes/default/template/controllers/products/informations.tpl admin-dev/themes/default/template/header.tpl admin-dev/themes/default/template/helpers/form/form.tpl admin-dev/themes/default/template/helpers/modules_list/list.tpl classes/Tools.php controllers/admin/AdminCartRulesController.php controllers/admin/AdminProductsController.php css/admin.css
This commit is contained in:
+48
-1
@@ -50,6 +50,53 @@ if (!Validate::isModuleName($module))
|
||||
if (!Tools::file_exists_cache($module_path = dirname(__FILE__).'/../modules/'.$module.'/'.$module.'.php'))
|
||||
die(Tools::displayError());
|
||||
|
||||
|
||||
$shop_id = '';
|
||||
Shop::setContext(Shop::CONTEXT_ALL);
|
||||
if (Context::getContext()->cookie->shopContext)
|
||||
{
|
||||
$split = explode('-', Context::getContext()->cookie->shopContext);
|
||||
if (count($split) == 2)
|
||||
{
|
||||
if ($split[0] == 'g')
|
||||
{
|
||||
if (Context::getContext()->employee->hasAuthOnShopGroup($split[1]))
|
||||
Shop::setContext(Shop::CONTEXT_GROUP, $split[1]);
|
||||
else
|
||||
{
|
||||
$shop_id = Context::getContext()->employee->getDefaultShopID();
|
||||
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
|
||||
}
|
||||
}
|
||||
else if (Shop::getShop($split[1]) && Context::getContext()->employee->hasAuthOnShop($split[1]))
|
||||
{
|
||||
$shop_id = $split[1];
|
||||
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$shop_id = Context::getContext()->employee->getDefaultShopID();
|
||||
Shop::setContext(Shop::CONTEXT_SHOP, $shop_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check multishop context and set right context if need
|
||||
if (Shop::getContext())
|
||||
{
|
||||
if (Shop::getContext() == Shop::CONTEXT_SHOP && !Shop::CONTEXT_SHOP)
|
||||
Shop::setContext(Shop::CONTEXT_GROUP, Shop::getContextShopGroupID());
|
||||
if (Shop::getContext() == Shop::CONTEXT_GROUP && !Shop::CONTEXT_GROUP)
|
||||
Shop::setContext(Shop::CONTEXT_ALL);
|
||||
}
|
||||
|
||||
// Replace existing shop if necessary
|
||||
if (!$shop_id)
|
||||
Context::getContext()->shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||
elseif (Context::getContext()->shop->id != $shop_id)
|
||||
Context::getContext()->shop = new Shop($shop_id);
|
||||
|
||||
|
||||
require_once($module_path);
|
||||
|
||||
$grid = new $module();
|
||||
@@ -59,4 +106,4 @@ if ($option)
|
||||
$grid->setOption($option);
|
||||
|
||||
$grid->create($render, $type, $width, $height, $start, $limit, $sort, $dir);
|
||||
$grid->render();
|
||||
$grid->render();
|
||||
|
||||
Reference in New Issue
Block a user