';
@@ -211,7 +225,7 @@ class AdminShop extends AdminTab
echo '';
}
-
+
protected function displayAddButton()
{
echo '
'.$this->l('Add new shop').'';
diff --git a/classes/AdminTab.php b/classes/AdminTab.php
index 9f5dc270a..8d315eb6e 100644
--- a/classes/AdminTab.php
+++ b/classes/AdminTab.php
@@ -197,19 +197,20 @@ abstract class AdminTabCore
$this->id = Tab::getCurrentTabId();
$this->_conf = array(
- 1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'),
- 3 => $this->l('Creation successful'), 4 => $this->l('Update successful'),
- 5 => $this->l('Status update successful'), 6 => $this->l('Settings update successful'),
- 7 => $this->l('Image successfully deleted'), 8 => $this->l('Module downloaded successfully'),
- 9 => $this->l('Thumbnails successfully regenerated'), 10 => $this->l('Message sent to the customer'),
- 11 => $this->l('Comment added'), 12 => $this->l('Module installed successfully'),
- 13 => $this->l('Module uninstalled successfully'), 14 => $this->l('Language successfully copied'),
- 15 => $this->l('Translations successfully added'), 16 => $this->l('Module transplanted successfully to hook'),
- 17 => $this->l('Module removed successfully from hook'), 18 => $this->l('Upload successful'),
- 19 => $this->l('Duplication completed successfully'), 20 => $this->l('Translation added successfully but the language has not been created'),
- 21 => $this->l('Module reset successfully'), 22 => $this->l('Module deleted successfully'),
- 23 => $this->l('Localization pack imported successfully'), 24 => $this->l('Refund Successful'),
- 25 => $this->l('Images successfully moved'));
+ 1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'),
+ 3 => $this->l('Creation successful'), 4 => $this->l('Update successful'),
+ 5 => $this->l('Status update successful'), 6 => $this->l('Settings update successful'),
+ 7 => $this->l('Image successfully deleted'), 8 => $this->l('Module downloaded successfully'),
+ 9 => $this->l('Thumbnails successfully regenerated'), 10 => $this->l('Message sent to the customer'),
+ 11 => $this->l('Comment added'), 12 => $this->l('Module installed successfully'),
+ 13 => $this->l('Module uninstalled successfully'), 14 => $this->l('Language successfully copied'),
+ 15 => $this->l('Translations successfully added'), 16 => $this->l('Module transplanted successfully to hook'),
+ 17 => $this->l('Module removed successfully from hook'), 18 => $this->l('Upload successful'),
+ 19 => $this->l('Duplication completed successfully'), 20 => $this->l('Translation added successfully but the language has not been created'),
+ 21 => $this->l('Module reset successfully'), 22 => $this->l('Module deleted successfully'),
+ 23 => $this->l('Localization pack imported successfully'), 24 => $this->l('Refund Successful'),
+ 25 => $this->l('Images successfully moved'),
+ );
if (!$this->identifier) $this->identifier = 'id_'.$this->table;
if (!$this->_defaultOrderBy) $this->_defaultOrderBy = $this->identifier;
$className = get_class($this);
diff --git a/classes/Configuration.php b/classes/Configuration.php
index d931614c7..6e874e544 100644
--- a/classes/Configuration.php
+++ b/classes/Configuration.php
@@ -146,6 +146,10 @@ class ConfigurationCore extends ObjectModel
$langID = (int)$langID;
if (!isset(self::$_CONF[$langID]))
$langID = 0;
+
+ // If conf if not initialized, try manual query
+ if (!self::$_CONF)
+ return Db::getInstance()->getValue('SELECT `value` FROM '._DB_PREFIX_.'configuration WHERE `name` = \''.pSQL($key).'\'');
if ($shopID && Configuration::hasKey($key, $langID, null, $shopID))
return self::$_CONF[$langID]['shop'][$shopID][$key];
diff --git a/classes/Shop.php b/classes/Shop.php
index 87a5ff139..dc24fb96e 100644
--- a/classes/Shop.php
+++ b/classes/Shop.php
@@ -138,7 +138,7 @@ class ShopCore extends ObjectModel
AND su.main = 1';
if (!$row = Db::getInstance()->getRow($sql))
return ;
-
+
$this->theme_name = $row['name'];
$this->physical_uri = $row['physical_uri'];
$this->virtual_uri = $row['virtual_uri'];
@@ -218,7 +218,7 @@ class ShopCore extends ObjectModel
AND s.active = 1
AND s.deleted = 0
ORDER BY LENGTH(uri) DESC';
-
+
$id_shop = '';
if ($results = Db::getInstance()->executeS($sql))
foreach ($results as $row)
@@ -233,8 +233,17 @@ class ShopCore extends ObjectModel
// Get instance of found shop
$shop = new Shop($id_shop);
- if (!Validate::isLoadedObject($shop))
- $shop = new Shop(1);
+ if (!Validate::isLoadedObject($shop) || !$shop->active)
+ {
+ // No shop found ... too bad, let's redirect to default shop
+ $defaultShop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));
+ if (!$defaultShop)
+ // Hmm there is something really bad in your Prestashop !
+ die('Shop not found');
+ $url = 'http://'.$defaultShop->domain.$defaultShop->getBaseURI().ltrim($_SERVER['SCRIPT_NAME'], '/').'?'.$_SERVER['QUERY_STRING'];
+ header('location: '.$url);
+ exit;
+ }
return $shop;
}