diff --git a/admin-dev/functions.php b/admin-dev/functions.php
index 6876171cc..923f44b78 100644
--- a/admin-dev/functions.php
+++ b/admin-dev/functions.php
@@ -501,7 +501,7 @@ function runAdminTab($ajaxMode = false)
'.translate('Back Office').'
'.$bread.'';
- if (!$ajaxMode && Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL)
+ if (!$ajaxMode && Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL)
{
echo '
';
if (Context::shop() == Shop::CONTEXT_GROUP)
@@ -516,7 +516,7 @@ function runAdminTab($ajaxMode = false)
{
if($ajaxMode)
{
- // the differences with index.php is here
+ // the differences with index.php is here
$adminObj->ajaxPreProcess();
$action = Tools::getValue('action');
// no need to use displayConf() here
@@ -532,8 +532,8 @@ function runAdminTab($ajaxMode = false)
$adminObj->{'displayAjax'.$action}();
else
$adminObj->displayAjax();
-
-
+
+
}
else
{
diff --git a/admin-dev/header.inc.php b/admin-dev/header.inc.php
index 2ab4e6ad6..37f820aae 100644
--- a/admin-dev/header.inc.php
+++ b/admin-dev/header.inc.php
@@ -137,7 +137,7 @@ echo '
{
var hints = $(\'.translatable span.hint\');
';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
if (Context::shop() == Shop::CONTEXT_ALL)
$youEditFieldFor = translate('A modification of this field will be applied for all shops');
@@ -268,7 +268,7 @@ foreach (QuickAccess::getQuickAccesses(Context::getContext()->language->id) AS $
echo '
';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
echo '';
echo '';
$this->displayAssoShop('group_shop');
@@ -140,11 +140,11 @@ class AdminAttributes extends AdminTab
{
if (!Combination::isFeatureActive())
return;
-
-
+
+
Module::hookExec('postProcessAttribute',
array('errors' => &$this->_errors)); // send _errors as reference to allow postProcessFeatureValue to stop saving process
-
+
if (Tools::getValue('submitDel'.$this->table))
{
if ($this->tabAccess['delete'] === '1')
@@ -170,7 +170,7 @@ class AdminAttributes extends AdminTab
{
$sql = 'SELECT `position`+1
FROM `'._DB_PREFIX_.'attribute`
- WHERE id_attribute_group = '.(int)Tools::getValue('id_attribute_group').'
+ WHERE id_attribute_group = '.(int)Tools::getValue('id_attribute_group').'
ORDER BY position DESC';
// set the position of the new attribute in $_POST for postProcess() method
$_POST['position'] = DB::getInstance()->getValue($sql);
@@ -184,7 +184,7 @@ class AdminAttributes extends AdminTab
else
parent::postProcess();
}
-
+
}
diff --git a/admin-dev/tabs/AdminAttributesGroups.php b/admin-dev/tabs/AdminAttributesGroups.php
index 11e8f9e7c..0b3959fe2 100644
--- a/admin-dev/tabs/AdminAttributesGroups.php
+++ b/admin-dev/tabs/AdminAttributesGroups.php
@@ -1,6 +1,6 @@
displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').'
'.$this->l('Performances').' ');
}
-
+
public function postProcess()
- {
+ {
if (!Combination::isFeatureActive())
return;
-
+
$this->adminAttributes->tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profile, $this->id);
if (Tools::isSubmit('submitAddattribute') || Tools::isSubmit('submitDelattribute'))
$this->adminAttributes->postProcess($this->token);
@@ -104,7 +104,7 @@ class AdminAttributesGroups extends AdminTab
if ($id_attribute_group <= 0)
{
$sql = 'SELECT `position`+1
- FROM `'._DB_PREFIX_.'attribute_group`
+ FROM `'._DB_PREFIX_.'attribute_group`
ORDER BY position DESC';
// set the position of the new group attribute in $_POST for postProcess() method
$_POST['position'] = DB::getInstance()->getValue($sql);
@@ -139,7 +139,7 @@ class AdminAttributesGroups extends AdminTab
if (!sizeof($this->_list))
echo '
'.$this->l('No elements found').' ';
-
+
//$this->displayListContent($this->token);
@@ -173,7 +173,7 @@ class AdminAttributesGroups extends AdminTab
echo '
';
-
+
if ($this->_orderBy == 'position' AND $this->_orderWay != 'DESC')
{
echo ''.$this->l('Performances').' ');
return;
}
-
+
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -259,7 +259,7 @@ class AdminAttributesGroups extends AdminTab
'.$this->l('Choose the type of the attribute group').'
';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
echo ''.$this->l('GroupShop association:').'
';
-
+
// META KEYWORDS
echo ' '.$this->l('Meta keywords').'
';
@@ -124,7 +124,7 @@ class AdminCMS extends AdminTab
';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_keywords');
echo '
';
-
+
// LINK REWRITE
echo ' '.$this->l('Friendly URL').'
';
@@ -134,7 +134,7 @@ class AdminCMS extends AdminTab
';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'link_rewrite');
echo '
';
-
+
// CONTENT
echo ' '.$this->l('Page content').'
';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
echo ''.$this->l('Shop association:').' ';
$this->displayAssoShop();
@@ -169,7 +169,7 @@ class AdminCMS extends AdminTab
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$this->context->language->iso_code.'.js') ? $this->context->language->iso_code : 'en');
$ad = dirname($_SERVER["PHP_SELF"]);
echo '
-
';
}
-
+
public function display($token = NULL)
{
-
+
if (($id_cms_category = (int)Tools::getValue('id_cms_category')))
self::$currentIndex .= '&id_cms_category='.$id_cms_category;
$this->getList($this->context->language->id, !$this->context->cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$this->context->cookie->__get($this->table.'Orderway') ? 'ASC' : NULL);
@@ -194,9 +194,9 @@ class AdminCMS extends AdminTab
$this->displayList($token);
echo '
';
}
-
+
public function displayList($token = NULL)
- {
+ {
/* Display list header (filtering, pagination and column names) */
$this->displayListHeader($token);
if (!sizeof($this->_list))
@@ -279,7 +279,7 @@ class AdminCMS extends AdminTab
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
$token = Tools::encrypt('PreviewCMS'.$cms->id);
-
+
$preview_url .= $object->active ? '' : '&adtoken='.$token.'&ad='.$admin_dir;
}
Tools::redirectAdmin($preview_url);
@@ -301,7 +301,7 @@ class AdminCMS extends AdminTab
$admin_dir = dirname($_SERVER['PHP_SELF']);
$admin_dir = substr($admin_dir, strrpos($admin_dir,'/') + 1);
$token = Tools::encrypt('PreviewCMS'.$cms->id);
-
+
$preview_url .= $object->active ? '' : '&adtoken='.$token.'&ad='.$admin_dir;
}
Tools::redirectAdmin($preview_url);
diff --git a/admin-dev/tabs/AdminCarriers.php b/admin-dev/tabs/AdminCarriers.php
index b478e5359..881862ca4 100644
--- a/admin-dev/tabs/AdminCarriers.php
+++ b/admin-dev/tabs/AdminCarriers.php
@@ -101,9 +101,9 @@ class AdminCarriers extends AdminTab
$(document).ready(function(){
// At the loading
($("input[name=\'is_free\']:checked").val() == 0) ? $("#shipping_costs_div").show(): $("#shipping_costs_div").hide();
-
+
$("input[name=\'is_free\']").live("change", function(){
- ($("input[name=\'is_free\']:checked").val() == 0) ? $("#shipping_costs_div").show(): $("#shipping_costs_div").hide();
+ ($("input[name=\'is_free\']:checked").val() == 0) ? $("#shipping_costs_div").show(): $("#shipping_costs_div").hide();
});
});
@@ -144,13 +144,13 @@ class AdminCarriers extends AdminTab
if (is_array($carrier_zones))
foreach ($carrier_zones as $carrier_zone)
$carrier_zones_ids[] = $carrier_zone['id_zone'];
-
+
$zones = Zone::getZones(false);
foreach ($zones as $zone)
echo '
'.$zone['name'].' ';
-
+
echo ''.$this->l('The zone in which this carrier is to be used').'
'.$this->l('Group access').'
@@ -255,7 +255,7 @@ class AdminCarriers extends AdminTab
echo '';
}
echo '';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
echo ''.$this->l('Shop association:').'
@@ -334,7 +334,7 @@ class AdminCountries extends AdminTab
getFieldValue($obj, 'display_tax_label') AND $obj->id) ? 'checked="checked" ' : '').'/>
'.$this->l('No').'
';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
echo ''.$this->l('Shop association:').' ';
includeDatepicker(array('date_from', 'date_to'), true);
- echo '
+ echo '
'.$this->l('From:').'
';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
echo ''.$this->l('Shop association:').' ';
$this->displayAssoShop();
diff --git a/admin-dev/tabs/AdminEmployees.php b/admin-dev/tabs/AdminEmployees.php
index 7678962f6..2e88c8059 100644
--- a/admin-dev/tabs/AdminEmployees.php
+++ b/admin-dev/tabs/AdminEmployees.php
@@ -176,7 +176,7 @@ class AdminEmployees extends AdminTab
echo 'getFieldValue($obj, 'id_profile') ? ' selected="selected"' : '').'>'.$profile['name'].' ';
echo ' *
';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
echo '
';
}
-
+
public function display()
{
if (!Tools::isSubmit('viewreferrer'))
echo $this->displayJavascript();
-
+
if ($this->enableCalendar())
{
echo '
@@ -195,7 +195,7 @@ class AdminReferrers extends AdminTab
parent::display();
echo '
';
}
-
+
public function postProcess()
{
if ($this->enableCalendar())
@@ -213,14 +213,14 @@ class AdminReferrers extends AdminTab
Referrer::refreshCache();
if (Tools::isSubmit('submitRefreshIndex'))
Referrer::refreshIndex();
-
+
return parent::postProcess();
}
-
+
public function displayForm($isMainTab = true)
{
parent::displayForm();
-
+
if (!($obj = $this->loadObject(true)))
return;
foreach (array('http_referer_like', 'http_referer_regexp', 'request_uri_like', 'request_uri_regexp') as $field)
@@ -262,7 +262,7 @@ class AdminReferrers extends AdminTab
'.$this->l('Percent of the sales.').'
';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
echo ''.$this->l('Shop association:').' ';
$this->displayAssoShop();
@@ -370,7 +370,7 @@ class AdminReferrers extends AdminTab
';
}
-
+
public function viewreferrer()
{
$referrer = new Referrer((int)(Tools::getValue('id_referrer')));
@@ -399,7 +399,7 @@ class AdminReferrers extends AdminTab
echo ' }
)
}
-
+
function fillProducts(filter)
{
var form = document.layers ? document.forms.product : document.product;
@@ -407,7 +407,7 @@ class AdminReferrers extends AdminTab
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",
{ajaxReferrers:1,ajaxFillProducts:1,id_employee:'.(int)$this->context->employee->id.',token:"'.Tools::getValue('token').'",id_lang:'.(int)$this->context->language->id.',filter:filter},
function(j) {
-
+
form.selectProduct.length = j.length + 1;
for (var i = 0; i < j.length; i++)
{
@@ -436,7 +436,7 @@ class AdminReferrers extends AdminTab
updateConversionRate(0);
';
}
-
+
public function displayListContent($token = NULL)
{
$irow = 0;
diff --git a/admin-dev/tabs/AdminScenes.php b/admin-dev/tabs/AdminScenes.php
index 93e0adc45..a258bfa59 100644
--- a/admin-dev/tabs/AdminScenes.php
+++ b/admin-dev/tabs/AdminScenes.php
@@ -193,7 +193,7 @@ class AdminScenes extends AdminTab
'Uncheck All' => $this->l('Uncheck All')
);
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
echo '
'.$this->l('Shop association:').' ';
$this->displayAssoShop();
@@ -215,7 +215,7 @@ class AdminScenes extends AdminTab
{
echo ''.$this->l('Please add a picture to continue mapping the image...').' ';
echo '
';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
echo '
'.$this->l('Shop association:').' ';
+
';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $langtags, 'description');
echo '
@@ -193,7 +193,7 @@ class AdminSuppliers extends AdminTab
getFieldValue($supplier, 'active') ? 'checked="checked" ' : '').'/>
';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
echo ''.$this->l('GroupShop association:').' ';
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
echo ''.$this->l('GroupShop association:').' ';
$this->displayAssoShop('group_shop');
diff --git a/classes/AdminController.php b/classes/AdminController.php
index 96570f03d..ed49f3be7 100644
--- a/classes/AdminController.php
+++ b/classes/AdminController.php
@@ -225,7 +225,7 @@ class AdminControllerCore extends Controller
if ($controller == 'AdminHome')
$_POST['token'] = $this->token;
- if (!Shop::isMultiShopActivated())
+ if (!Shop::isFeatureActive())
$this->shopLinkType = '';
// Get the name of the folder containing the custom tpl files
@@ -824,7 +824,7 @@ class AdminControllerCore extends Controller
public function initHeader()
{
// Shop context
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
if (Context::shop() == Shop::CONTEXT_ALL)
{
@@ -854,7 +854,7 @@ class AdminControllerCore extends Controller
}
// Multishop
- $is_multishop = Shop::isMultiShopActivated();// && Context::shop() != Shop::CONTEXT_ALL;
+ $is_multishop = Shop::isFeatureActive();// && Context::shop() != Shop::CONTEXT_ALL;
/*if ($is_multishop)
{
if (Context::shop() == Shop::CONTEXT_GROUP)
@@ -959,8 +959,8 @@ class AdminControllerCore extends Controller
'search_type' => Tools::getValue('bo_search_type'),
'bo_query' => Tools::safeOutput(Tools::stripslashes(Tools::getValue('bo_query'))),
'quick_access' => $quick_access,
- 'multi_shop' => Shop::isMultiShopActivated(),
- 'shop_list' => (Shop::isMultiShopActivated() ? generateShopList() : null), //@TODO refacto
+ 'multi_shop' => Shop::isFeatureActive(),
+ 'shop_list' => (Shop::isFeatureActive() ? generateShopList() : null), //@TODO refacto
'tab' => $tab,
'current_parent_id' => (int)Tab::getCurrentParentId(),
'tabs' => $tabs,
@@ -1208,7 +1208,7 @@ class AdminControllerCore extends Controller
$this->context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
// Change shop context ?
- if (Shop::isMultiShopActivated() && Tools::getValue('setShopContext') !== false)
+ if (Shop::isFeatureActive() && Tools::getValue('setShopContext') !== false)
{
$this->context->cookie->shopContext = Tools::getValue('setShopContext');
$url = parse_url($_SERVER['REQUEST_URI']);
@@ -1449,7 +1449,7 @@ class AdminControllerCore extends Controller
$this->_group .= ', a.'.pSQL($this->identifier);
$test_join = !preg_match('#`?'.preg_quote(_DB_PREFIX_.$this->table.'_'.$filter_key).'`? *sa#', $this->_join);
- if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && $test_join)
+ if (Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL && $test_join)
{
$filter_shop = ' JOIN `'._DB_PREFIX_.$this->table.'_'.$filter_key.'` sa ';
$filter_shop .= 'ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_'.$filter_key.' IN ('.implode(', ', $idenfier_shop).'))';
@@ -1729,7 +1729,7 @@ class AdminControllerCore extends Controller
protected function updateAssoShop($id_object = false)
{
- if (!Shop::isMultiShopActivated())
+ if (!Shop::isFeatureActive())
return;
$shop_asso = Shop::getAssoTables();
@@ -1835,7 +1835,7 @@ class AdminControllerCore extends Controller
if (isset($options['visibility']) && $options['visibility'] > Context::getContext()->shop->getContextType())
continue;
- if (Shop::isMultiShopActivated() && isset($_POST['configUseDefault'][$key]))
+ if (Shop::isFeatureActive() && isset($_POST['configUseDefault'][$key]))
{
Configuration::deleteFromContext($key);
continue;
diff --git a/classes/AdminTab.php b/classes/AdminTab.php
index 33309f5e3..3d59c4697 100644
--- a/classes/AdminTab.php
+++ b/classes/AdminTab.php
@@ -226,7 +226,7 @@ abstract class AdminTabCore
// $className = 'AdminCatalog';
$this->token = Tools::getAdminToken($className.(int)$this->id.(int)$this->context->employee->id);
- if (!Shop::isMultiShopActivated())
+ if (!Shop::isFeatureActive())
$this->shopLinkType = '';
}
@@ -898,7 +898,7 @@ abstract class AdminTabCore
protected function updateAssoShop($id_object = false)
{
- if (!Shop::isMultiShopActivated())
+ if (!Shop::isFeatureActive())
return ;
if(!$assos = self::getAssoShop($this->table, $id_object))
@@ -985,7 +985,7 @@ abstract class AdminTabCore
if (isset($options['visibility']) && $options['visibility'] > Context::getContext()->shop->getContextType())
continue;
- if (Shop::isMultiShopActivated() && isset($_POST['configUseDefault'][$key]))
+ if (Shop::isFeatureActive() && isset($_POST['configUseDefault'][$key]))
{
Configuration::deleteFromContext($key);
continue;
@@ -1337,7 +1337,7 @@ abstract class AdminTabCore
else if (!preg_match('#(\s|,)\s*a\.`?'.pSQL($this->identifier).'`?(\s|,|$)#', $this->_group))
$this->_group .= ', a.'.pSQL($this->identifier);
- if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && !preg_match('#`?'.preg_quote(_DB_PREFIX_.$this->table.'_'.$filterKey).'`? *sa#', $this->_join))
+ if (Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL && !preg_match('#`?'.preg_quote(_DB_PREFIX_.$this->table.'_'.$filterKey).'`? *sa#', $this->_join))
$filterShop = 'JOIN `'._DB_PREFIX_.$this->table.'_'.$filterKey.'` sa ON (sa.'.$this->identifier.' = a.'.$this->identifier.' AND sa.id_'.$filterKey.' IN ('.implode(', ', $idenfierShop).'))';
}
@@ -1871,7 +1871,7 @@ abstract class AdminTabCore
// Check if var is invisible (can't edit it in current shop context), or disable (use default value for multishop)
$isDisabled = $isInvisible = false;
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
if (isset($field['visibility']) && $field['visibility'] > $this->context->shop->getContextType())
{
@@ -1907,7 +1907,7 @@ abstract class AdminTabCore
$this->$method($key, $field, $value);
// Multishop default value
- if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && !$isInvisible)
+ if (Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL && !$isInvisible)
echo '
'.$this->l('Use default value').'
@@ -2336,7 +2336,7 @@ abstract class AdminTabCore
protected function displayAssoShop($type = 'shop')
{
- if (!Shop::isMultiShopActivated() || (!$this->_object && $this->context->shop->getContextType() != Shop::CONTEXT_ALL))
+ if (!Shop::isFeatureActive() || (!$this->_object && $this->context->shop->getContextType() != Shop::CONTEXT_ALL))
return;
if ($type != 'shop' && $type != 'group_shop')
diff --git a/classes/Configuration.php b/classes/Configuration.php
index 48feb192c..8f88b7d67 100644
--- a/classes/Configuration.php
+++ b/classes/Configuration.php
@@ -425,7 +425,7 @@ class ConfigurationCore extends ObjectModel
|| (Context::shop() == Shop::CONTEXT_GROUP && Configuration::hasContext($key, null, Shop::CONTEXT_GROUP))) ? true : false;
}
- return (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && $testContext);
+ return (Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL && $testContext);
}
/**
diff --git a/classes/HelperOptions.php b/classes/HelperOptions.php
index 26c5e999e..c7bdeca73 100644
--- a/classes/HelperOptions.php
+++ b/classes/HelperOptions.php
@@ -67,7 +67,7 @@ class HelperOptionsCore extends Helper
// Check if var is invisible (can't edit it in current shop context), or disable (use default value for multishop)
$isDisabled = $isInvisible = false;
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
{
if (isset($field['visibility']) && $field['visibility'] > $this->context->shop->getContextType())
{
@@ -105,7 +105,7 @@ class HelperOptionsCore extends Helper
}
// Multishop default value
- $field['multishop_default'] = (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && !$isInvisible);
+ $field['multishop_default'] = (Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL && !$isInvisible);
// Assign the modifications back to parent array
$category_data['fields'][$key] = $field;
diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php
index 0d9649641..8ed4d85df 100644
--- a/classes/ObjectModel.php
+++ b/classes/ObjectModel.php
@@ -248,7 +248,7 @@ abstract class ObjectModelCore
}
}
- if (!Shop::isMultishopActivated())
+ if (!Shop::isFeatureActive())
{
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
{
diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php
index 59be81d6f..4a5da5949 100644
--- a/classes/shop/Shop.php
+++ b/classes/shop/Shop.php
@@ -728,7 +728,7 @@ class ShopCore extends ObjectModel
/**
* @return bool Return true if there is more than one shop
*/
- public static function isMultiShopActivated()
+ public static function isFeatureActive()
{
static $total = null;
diff --git a/modules/gsitemap/gsitemap.php b/modules/gsitemap/gsitemap.php
index 654ade135..712b8a76f 100644
--- a/modules/gsitemap/gsitemap.php
+++ b/modules/gsitemap/gsitemap.php
@@ -1,6 +1,6 @@
version = '1.7';
$this->author = 'PrestaShop';
$this->need_instance = 0;
-
+
parent::__construct();
$this->displayName = $this->l('Google sitemap');
@@ -55,7 +55,7 @@ class Gsitemap extends Module
file_put_contents(GSITEMAP_FILE, '');
return parent::uninstall();
}
-
+
private function _postValidation()
{
file_put_contents(GSITEMAP_FILE, '');
@@ -64,7 +64,7 @@ class Gsitemap extends Module
else
fclose($fp);
}
-
+
private function getUrlWith($url, $key, $value)
{
if (empty($value))
@@ -79,7 +79,7 @@ class Gsitemap extends Module
Configuration::updateValue('GSITEMAP_ALL_CMS', (int)Tools::getValue('GSITEMAP_ALL_CMS'));
Configuration::updateValue('GSITEMAP_ALL_PRODUCTS', (int)Tools::getValue('GSITEMAP_ALL_PRODUCTS'));
- if (Shop::isMultiShopActivated())
+ if (Shop::isFeatureActive())
$res = $this->generateSitemapIndex();
else
$res = $this->generateSitemap(Configuration::get('PS_SHOP_DEFAULT'), GSITEMAP_FILE);
@@ -88,10 +88,10 @@ class Gsitemap extends Module
$this->_html .= $res ? $this->l('Sitemap file generated') : $this->l('Error while creating sitemap file');
$this->_html .= '';
}
-
+
/**
* Generate sitemap index to reference the sitemap of each shop
- *
+ *
* @return bool
*/
private function generateSitemapIndex()
@@ -112,7 +112,7 @@ XML;
AND su.active = 1';
if (!$result = Db::getInstance()->executeS($sql))
return false;
-
+
$res = true;
foreach ($result as $row)
{
@@ -125,14 +125,14 @@ XML;
$this->_addSitemapIndexNode($xml, 'http://'.$row['domain'].(($row['uri']) ? $row['uri'] : '/').$filename, date('Y-m-d'));
$res &= $last;
}
-
+
$fp = fopen(GSITEMAP_FILE, 'w');
fwrite($fp, $xml->asXML());
fclose($fp);
-
+
return $res && file_exists(GSITEMAP_FILE);
}
-
+
/**
* Generate a sitemap for a shop
*
@@ -146,14 +146,14 @@ XML;
$shop = new Shop($shopID);
if (!$shop->id)
return false;
-
+
$xmlString = <<
XML;
-
+
$xml = new SimpleXMLElement($xmlString);
if (Configuration::get('PS_REWRITING_SETTINGS') AND sizeof($langs) > 1)
@@ -161,7 +161,7 @@ XML;
$this->_addSitemapNode($xml, Tools::getShopDomain(true, true).__PS_BASE_URI__.$lang['iso_code'].'/', '1.00', 'daily', date('Y-m-d'));
else
$this->_addSitemapNode($xml, Tools::getShopDomain(true, true).__PS_BASE_URI__, '1.00', 'daily', date('Y-m-d'));
-
+
/* CMS Generator */
if (Configuration::get('GSITEMAP_ALL_CMS') OR !Module::isInstalled('blockcms'))
$sql = 'SELECT DISTINCT '.(Configuration::get('PS_REWRITING_SETTINGS') ? 'cl.id_cms, cl.link_rewrite, cl.id_lang' : 'cl.id_cms').'
@@ -180,14 +180,14 @@ XML;
WHERE l.`active` = 1
AND cs.id_shop = '.$shopID.'
ORDER BY cl.id_cms, cl.id_lang ASC';
-
+
$cmss = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
foreach ($cmss AS $cms)
{
$tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $this->context->link->getCMSLink((int)$cms['id_cms'], $cms['link_rewrite'], false, (int)$cms['id_lang']) : $this->context->link->getCMSLink((int)$cms['id_cms']);
- $this->_addSitemapNode($xml, $tmpLink, '0.8', 'daily');
+ $this->_addSitemapNode($xml, $tmpLink, '0.8', 'daily');
}
-
+
/* Categories Generator */
$limits = Category::getInterval($shop->getCategory());
if (Configuration::get('PS_REWRITING_SETTINGS'))
@@ -211,15 +211,15 @@ XML;
WHERE nleft >= '.$limits['nleft'].'
AND nright <= '.$limits['nright'].'
ORDER BY c.id_category ASC';
- $categories = Db::getInstance()->executeS($sql);
+ $categories = Db::getInstance()->executeS($sql);
}
-
+
foreach($categories as $category)
{
if (($priority = 0.9 - ($category['level_depth'] / 10)) < 0.1)
$priority = 0.1;
-
- $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $this->context->link->getCategoryLink((int)$category['id_category'], $category['link_rewrite'], (int)$category['id_lang']) : $this->context->link->getCategoryLink((int)$category['id_category']);
+
+ $tmpLink = Configuration::get('PS_REWRITING_SETTINGS') ? $this->context->link->getCategoryLink((int)$category['id_category'], $category['link_rewrite'], (int)$category['id_lang']) : $this->context->link->getCategoryLink((int)$category['id_category']);
$this->_addSitemapNode($xml, $tmpLink, $priority, 'weekly', substr($category['date_upd'], 0, 10));
}
@@ -242,7 +242,7 @@ XML;
'.(Configuration::get('GSITEMAP_ALL_PRODUCTS') ? '' : 'HAVING level_depth IS NOT NULL').'
ORDER BY pl.id_product, pl.id_lang ASC';
$products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
-
+
$tmp = null;
$res = null;
foreach($products AS $product)
@@ -257,7 +257,7 @@ XML;
$res[$tmp]['images'] []= array('id_image' => $product['id_image'], 'legend_image' => $product['legend_image']);
}
}
-
+
foreach ($res as $product)
{
if (($priority = 0.7 - ($product['level_depth'] / 10)) < 0.1)
@@ -267,30 +267,30 @@ XML;
$sitemap = $this->_addSitemapNode($xml, $tmpLink, $priority, 'weekly', substr($product['date_upd'], 0, 10));
$sitemap = $this->_addSitemapNodeImage($sitemap, $product);
}
-
+
/* Add classic pages (contact, best sales, new products...) */
$pages = array(
- 'authentication' => true,
- 'best-sales' => false,
- 'contact' => true,
- 'discount' => false,
- 'index' => false,
- 'manufacturer' => false,
- 'new-products' => false,
- 'prices-drop' => false,
- 'supplier' => false,
+ 'authentication' => true,
+ 'best-sales' => false,
+ 'contact' => true,
+ 'discount' => false,
+ 'index' => false,
+ 'manufacturer' => false,
+ 'new-products' => false,
+ 'prices-drop' => false,
+ 'supplier' => false,
'store' => false);
-
+
// Don't show suppliers and manufacturers if they are disallowed
if (!Module::getInstanceByName('blockmanufacturer')->id && !Configuration::get('PS_DISPLAY_SUPPLIERS'))
unset($pages['manufacturer']);
-
+
if (!Module::getInstanceByName('blocksupplier')->id && !Configuration::get('PS_DISPLAY_SUPPLIERS'))
unset($pages['supplier']);
// Generate nodes for pages
- if(Configuration::get('PS_REWRITING_SETTINGS'))
- foreach ($pages AS $page => $ssl)
+ if(Configuration::get('PS_REWRITING_SETTINGS'))
+ foreach ($pages AS $page => $ssl)
foreach($langs as $lang)
$this->_addSitemapNode($xml, $this->context->link->getPageLink($page, $ssl, $lang['id_lang']), '0.5', 'monthly');
else
@@ -298,7 +298,7 @@ XML;
$this->_addSitemapNode($xml, $this->context->link->getPageLink($page, $ssl), '0.5', 'monthly');
$xmlString = $xml->asXML();
-
+
// Replace URL in XML strings by real shops URL
if ($replaceUrl)
$xmlString = str_replace(array(Tools::getShopDomain(true), Tools::getShopDomainSsl(true)), $replaceUrl, $xmlString);
@@ -306,20 +306,20 @@ XML;
$fp = fopen($filename, 'w');
fwrite($fp, $xmlString);
fclose($fp);
-
+
return file_exists($filename);
}
-
+
private function _addSitemapIndexNode($xml, $loc, $last_mod)
- {
+ {
$sitemap = $xml->addChild('sitemap');
$sitemap->addChild('loc', htmlspecialchars($loc));
$sitemap->addChild('lastmod', $last_mod);
return $sitemap;
}
-
+
private function _addSitemapNode($xml, $loc, $priority, $change_freq, $last_mod = NULL)
- {
+ {
$sitemap = $xml->addChild('url');
$sitemap->addChild('loc', htmlspecialchars($loc));
$sitemap->addChild('priority', $priority);
@@ -328,7 +328,7 @@ XML;
$sitemap->addChild('changefreq', $change_freq);
return $sitemap;
}
-
+
private function _addSitemapNodeImage($xml, $product)
{
foreach ($product['images'] as $img)
@@ -345,12 +345,12 @@ XML;
private function _displaySitemap()
{
if (file_exists(GSITEMAP_FILE) AND filesize(GSITEMAP_FILE))
- {
+ {
$fp = fopen(GSITEMAP_FILE, 'r');
$fstat = fstat($fp);
fclose($fp);
$xml = simplexml_load_file(GSITEMAP_FILE);
-
+
$nbPages = sizeof($xml->url);
$this->_html .= ''.$this->l('Your Google sitemap file is online at the following address:').'
@@ -376,7 +376,7 @@ XML;
value="'.((!file_exists(GSITEMAP_FILE)) ? $this->l('Generate sitemap file') : $this->l('Update sitemap file')).'" />
';
}
-
+
public function getContent()
{
$this->_html .= '
'.$this->l('Search Engine Optimization').'