// Fix multishop when an URL is not found in shop_url
This commit is contained in:
+20
-27
@@ -274,37 +274,30 @@ class ShopCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id_shop)
|
if (!$id_shop && defined('_PS_ADMIN_DIR_'))
|
||||||
{
|
{
|
||||||
// Get instance of found shop
|
// If in admin, we can access to the shop without right URL
|
||||||
$shop = new Shop($id_shop);
|
$shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||||
if (!Validate::isLoadedObject($shop) || !$shop->active)
|
$shop->physical_uri = str_replace('\\', '/', dirname(dirname($_SERVER['SCRIPT_NAME']))).'/';
|
||||||
{
|
$shop->virtual_uri = '';
|
||||||
// No shop found ... too bad, let's redirect to default shop
|
return $shop;
|
||||||
$default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
|
||||||
|
|
||||||
// Hmm there is something really bad in your Prestashop !
|
|
||||||
if (!Validate::isLoadedObject($default_shop))
|
|
||||||
throw new PrestaShopException('Shop not found');
|
|
||||||
|
|
||||||
$url = 'http://'.$default_shop->domain.$default_shop->getBaseURI().ltrim($_SERVER['SCRIPT_NAME'], '/').'?'.$_SERVER['QUERY_STRING'];
|
|
||||||
header('location: '.$url);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if (defined('INSTALL_VERSION'))
|
$shop = new Shop($id_shop);
|
||||||
$shop = new Shop();
|
if (!Validate::isLoadedObject($shop) || !$shop->active || !$id_shop)
|
||||||
else if (defined('_PS_ADMIN_DIR_'))
|
{
|
||||||
{
|
// No shop found ... too bad, let's redirect to default shop
|
||||||
// If in admin, we can access to the shop without right URL
|
$default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||||
$shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
|
||||||
$shop->physical_uri = str_replace('\\', '/', dirname(dirname($_SERVER['SCRIPT_NAME'])));
|
// Hmm there is something really bad in your Prestashop !
|
||||||
$shop->virtual_uri = '';
|
if (!Validate::isLoadedObject($default_shop))
|
||||||
}
|
|
||||||
else
|
|
||||||
throw new PrestaShopException('Shop not found');
|
throw new PrestaShopException('Shop not found');
|
||||||
|
|
||||||
|
$url = 'http://'.$default_shop->domain.$default_shop->getBaseURI().'index.php'.'?'.$_SERVER['QUERY_STRING'];
|
||||||
|
header('location: '.$url);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
return $shop;
|
return $shop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user