// when upgrade process (INSTALL_VERSION defined), initialize return now an empty shop object (+ die2Exception)
This commit is contained in:
+22
-11
@@ -213,7 +213,8 @@ class ShopCore extends ObjectModel
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the shop from current domain / uri and get an instance of this shop
|
* Find the shop from current domain / uri and get an instance of this shop
|
||||||
*
|
* if INSTALL_VERSION is defined, will return an empty shop object
|
||||||
|
*
|
||||||
* @return Shop
|
* @return Shop
|
||||||
*/
|
*/
|
||||||
public static function initialize()
|
public static function initialize()
|
||||||
@@ -263,19 +264,29 @@ class ShopCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get instance of found shop
|
if($id_shop)
|
||||||
$shop = new Shop($id_shop);
|
|
||||||
if (!Validate::isLoadedObject($shop) || !$shop->active)
|
|
||||||
{
|
{
|
||||||
// No shop found ... too bad, let's redirect to default shop
|
// Get instance of found shop
|
||||||
$default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
$shop = new Shop($id_shop);
|
||||||
if (!$default_shop)
|
if (!Validate::isLoadedObject($shop) || !$shop->active)
|
||||||
|
{
|
||||||
|
// No shop found ... too bad, let's redirect to default shop
|
||||||
|
$default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
|
||||||
// Hmm there is something really bad in your Prestashop !
|
// Hmm there is something really bad in your Prestashop !
|
||||||
die('Shop not found');
|
if (!Validate::isLoadedObject($default_shop))
|
||||||
$url = 'http://'.$default_shop->domain.$default_shop->getBaseURI().ltrim($_SERVER['SCRIPT_NAME'], '/').'?'.$_SERVER['QUERY_STRING'];
|
throw new PrestashopException('Shop not found');
|
||||||
header('location: '.$url);
|
|
||||||
exit;
|
$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();
|
||||||
|
else
|
||||||
|
throw new PrestashopException('Shop not found');
|
||||||
|
|
||||||
return $shop;
|
return $shop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user