// Add a message when a shop is created to indicate that the user should create an URL for this shop + fix some bugs
This commit is contained in:
+14
-13
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
|
||||
+13
-4
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user