[*] FO BO MO : rename function isMultiShopActivated by isFeatureActive

This commit is contained in:
hAitmansour
2011-10-19 09:36:12 +00:00
parent 09bde248ae
commit 5b7a6746e0
31 changed files with 250 additions and 250 deletions

View File

@@ -501,7 +501,7 @@ function runAdminTab($ajaxMode = false)
<a href="?token='.Tools::getAdminToken($tab.intval(Tab::getIdFromClassName($tab)).(int)Context::getContext()->employee->id).'">'.translate('Back Office').'</a>
'.$bread.'</div>';
if (!$ajaxMode && Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL)
if (!$ajaxMode && Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL)
{
echo '<div class="multishop_info">';
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
{

View File

@@ -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 ' </select>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
echo '<div id="header_shoplist">'.translate('Select your shop:').' '.generateShopList().'</div>';
echo '<div class="flatclear">&nbsp;</div>';

View File

@@ -82,7 +82,7 @@ if (empty($context->employee->bo_theme) OR !file_exists($path.$context->employee
}
// Change shop context ?
if (Shop::isMultiShopActivated() && Tools::getValue('setShopContext') !== false)
if (Shop::isFeatureActive() && Tools::getValue('setShopContext') !== false)
{
$context->cookie->shopContext = Tools::getValue('setShopContext');
$url = parse_url($_SERVER['REQUEST_URI']);

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -51,7 +51,7 @@ class AdminAttributes extends AdminTab
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
return;
}
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -88,13 +88,13 @@ class AdminAttributes extends AdminTab
<label>'.$this->l('Group:').' </label>
<div class="margin-form">
<select name="id_attribute_group" id="id_attribute_group" onchange="showAttributeColorGroup(\'id_attribute_group\', \'colorAttributeProperties\')">';
foreach ($attributes_groups AS $attribute_group)
echo '<option value="'.$attribute_group['id_attribute_group'].'"'.($this->getFieldValue($obj, 'id_attribute_group') == $attribute_group['id_attribute_group'] ? ' selected="selected"' : '').'>'.$attribute_group['name'].'</option>';
echo '
</select><sup> *</sup>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$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();
}
}

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -65,12 +65,12 @@ class AdminAttributesGroups extends AdminTab
else
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
}
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 '<tr><td class="center" colspan="'.sizeof($this->_list).'">'.$this->l('No elements found').'</td></tr>';
//$this->displayListContent($this->token);
@@ -173,7 +173,7 @@ class AdminAttributesGroups extends AdminTab
echo '
<td style="width: 140px; vertical-align: top; padding: 4px 0 4px 0; cursor: pointer" class="dragHandle">';
if ($this->_orderBy == 'position' AND $this->_orderWay != 'DESC')
{
echo '<a'.(!($tr['position'] != $positions[sizeof($positions) - 1]) ? ' style="display: none;"' : '').' href="'.self::$currentIndex.
@@ -212,7 +212,7 @@ class AdminAttributesGroups extends AdminTab
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').' <a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
return;
}
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -259,7 +259,7 @@ class AdminAttributesGroups extends AdminTab
</select>
<p>'.$this->l('Choose the type of the attribute group').'</p>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoShop('group_shop');
@@ -274,10 +274,10 @@ class AdminAttributesGroups extends AdminTab
</fieldset>
</form>';
}
/**
* displayListAttributes
*
*
* Display a list of attributes from a group
*/
public function displayListAttributes($id, $irow, $tr)

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -28,7 +28,7 @@
include_once(_PS_ADMIN_DIR_.'/../classes/AdminTab.php');
class AdminCMS extends AdminTab
{
{
private $_category;
public function __construct()
@@ -39,7 +39,7 @@ class AdminCMS extends AdminTab
$this->edit = true;
$this->view = true;
$this->delete = true;
$this->fieldsDisplay = array(
'id_cms' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'link_rewrite' => array('title' => $this->l('URL'), 'width' => 200),
@@ -47,19 +47,19 @@ class AdminCMS extends AdminTab
'position' => array('title' => $this->l('Position'), 'width' => 40,'filter_key' => 'position', 'align' => 'center', 'position' => 'position'),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
);
$this->_category = AdminCMSContent::getCurrentCMSCategory();
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'cms_category` c ON (c.`id_cms_category` = a.`id_cms_category`)';
$this->_select = 'a.position ';
$this->_filter = 'AND c.id_cms_category = '.(int)($this->_category->id);
parent::__construct();
}
private function _displayDraftWarning($active)
{
return
return
'<div class="warn draft" style="'.($active ? 'display:none' : '').'">
<p>
<span style="float: left">
@@ -72,11 +72,11 @@ class AdminCMS extends AdminTab
</p>
</div>';
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
$obj = $this->loadObject(true);
$divLangName = 'meta_title¤meta_description¤meta_keywords¤ccontent¤link_rewrite';
@@ -85,7 +85,7 @@ class AdminCMS extends AdminTab
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
'.$this->_displayDraftWarning($obj->active).'
<fieldset><legend><img src="../img/admin/cms.gif" />'.$this->l('CMS page').'</legend>';
// META TITLE
echo '<label>'.$this->l('CMS Category:').' </label>
<div class="margin-form">
@@ -101,10 +101,10 @@ class AdminCMS extends AdminTab
echo ' <div id="meta_title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
<input size="40" type="text" onkeyup="copyMeta2friendlyURL();" id="name_'.$language['id_lang'].'" name="meta_title_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'meta_title', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
</div>';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_title');
echo ' </div><div class="clear space">&nbsp;</div>';
// META DESCRIPTION
echo ' <label>'.$this->l('Meta description').' </label>
<div class="margin-form">';
@@ -114,7 +114,7 @@ class AdminCMS extends AdminTab
</div>';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_description');
echo ' </div><div class="clear space">&nbsp;</div>';
// META KEYWORDS
echo ' <label>'.$this->l('Meta keywords').' </label>
<div class="margin-form">';
@@ -124,7 +124,7 @@ class AdminCMS extends AdminTab
</div>';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'meta_keywords');
echo ' </div><div class="clear space">&nbsp;</div>';
// LINK REWRITE
echo ' <label>'.$this->l('Friendly URL').' </label>
<div class="margin-form">';
@@ -134,7 +134,7 @@ class AdminCMS extends AdminTab
</div>';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'link_rewrite');
echo ' </div><div class="clear space">&nbsp;</div>';
// CONTENT
echo ' <label>'.$this->l('Page content').' </label>
<div class="margin-form">';
@@ -151,7 +151,7 @@ class AdminCMS extends AdminTab
<input type="radio" name="active" id="active_off" onclick="toggleDraftWarning(true);" value="0" '.(!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '').'/>
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$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 '
<script type="text/javascript">
<script type="text/javascript">
var iso = \''.$isoTinyMCE.'\' ;
var pathCSS = \''._THEME_CSS_DIR_.'\' ;
var ad = \''.$ad.'\' ;
@@ -177,10 +177,10 @@ class AdminCMS extends AdminTab
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce.inc.js"></script>';
}
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 '</div>';
}
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);

View File

@@ -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();
});
});
</script>
@@ -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 '<input type="checkbox" id="zone_'.$zone['id_zone'].'" name="zone_'.$zone['id_zone'].'" value="true" '.
Tools::getValue('zone_'.$zone['id_zone'], (in_array($zone['id_zone'], $carrier_zones_ids) ? ' checked="checked"' : '')).'>
<label class="t" for="zone_'.$zone['id_zone'].'"> <b>'.$zone['name'].'</b></label><br />';
echo '<p>'.$this->l('The zone in which this carrier is to be used').'</p>
</div>
<label>'.$this->l('Group access').'</label>
@@ -255,7 +255,7 @@ class AdminCarriers extends AdminTab
echo '</div>';
}
echo '</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();

View File

@@ -80,9 +80,9 @@ class AdminCountries extends AdminTab
$tmp_addr_format = new AddressFormat();
$tmp_addr_format->id_country = $id_country;
}
$tmp_addr_format->format = Tools::getValue('address_layout');
if (strlen($tmp_addr_format->format) > 0)
{
if ($tmp_addr_format->checkFormatFields())
@@ -93,7 +93,7 @@ class AdminCountries extends AdminTab
foreach($errorList as $numError => $error)
$this->_errors[] = $error;
}
if (!$save_status)
$this->_errors[] = Tools::displayError('Invalid address layout'.Db::getInstance()->getMsgError());
@@ -109,10 +109,10 @@ class AdminCountries extends AdminTab
{
$html = '<ul>';
$appendContainer = '';
$objectList = AddressFormat::getLiableClass('Address');
$objectList['Address'] = NULL;
// Get the available properties for each class
foreach($objectList as $className => &$object)
{
@@ -130,13 +130,13 @@ class AdminCountries extends AdminTab
}
return $html .= '</ul>';
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
$defaultLayout = '';
$defaultLayoutTab = array(
array('firstname', 'lastname'),
array('company'),
@@ -146,19 +146,19 @@ class AdminCountries extends AdminTab
array('postcode', 'city'),
array('Country:name'),
array('phone'));
if (!($obj = $this->loadObject(true)))
return;
foreach ($defaultLayoutTab as $line)
$defaultLayout .= implode(' ', $line)."\r\n";
echo '
<script type="text/javascript" language="javascript" src="'._PS_JS_DIR_.'jquery/jquery-fieldselection.js"></script>
<script type="text/javascript" language="javascript">
lastLayoutModified = "";
$(document).ready(function()
{
$(".availableFieldsList").css("display", "none");
@@ -187,9 +187,9 @@ class AdminCountries extends AdminTab
{
switchExplanationText("'.$this->l('Will delete the current layout').'");
});
});
function switchExplanationText(text)
{
$("#explanationText").fadeOut("fast", function()
@@ -198,12 +198,12 @@ class AdminCountries extends AdminTab
$(this).fadeIn("fast");
});
}
function addFieldsToCursorPosition(pattern)
{
$("#ordered_fields").replaceSelection(pattern + " ");
}
function displayAvailableFields(containerName)
{
$(".availableFieldsList").each( function (){
@@ -212,7 +212,7 @@ class AdminCountries extends AdminTab
});
$("#availableListFieldsFor_" + containerName).slideToggle();
}
function resetLayout(defaultLayout, type)
{
if (confirm("'.$this->l('Are you sure to apply this selection ?').'"))
@@ -220,7 +220,7 @@ class AdminCountries extends AdminTab
$("#ordered_fields").val(unescape(defaultLayout.replace(/\+/g, " ")));
}
}
</script>
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post">
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
@@ -267,7 +267,7 @@ class AdminCountries extends AdminTab
$address_layout = AddressFormat::getAddressCountryFormat($obj->id);
if ($value = Tools::getValue('address_layout'))
$address_layout = $value;
echo ' </select>
<p>'.$this->l('Geographical zone where country is located').'</p>
</div>
@@ -334,7 +334,7 @@ class AdminCountries extends AdminTab
<input type="radio" name="display_tax_label" id="display_tax_label_off" value="0" '.((!$this->getFieldValue($obj, 'display_tax_label') AND $obj->id) ? 'checked="checked" ' : '').'/>
<label class="t" for="display_tax_label_off"> <img src="../img/admin/disabled.gif" alt="" title="" />'.$this->l('No').'</label>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();

View File

@@ -316,7 +316,7 @@ class AdminCustomers extends AdminTab
'.$this->l('Registration date:').' '.Tools::displayDate($customer->date_add, $this->context->language->id, true).'<br />
'.$this->l('Last visit:').' '.($customerStats['last_visit'] ? Tools::displayDate($customerStats['last_visit'], $this->context->language->id, true) : $this->l('never')).'<br />
'.($countBetterCustomers != '-' ? $this->l('Rank: #').' '.(int)$countBetterCustomers.'<br />' : '')
.(Shop::isMultiShopActivated() ? '<br />'.$this->l('Shop:').' '.Shop::getInstance($customer->id_shop)->name : '').'
.(Shop::isFeatureActive() ? '<br />'.$this->l('Shop:').' '.Shop::getInstance($customer->id_shop)->name : '').'
</fieldset>
<fieldset style="width:300px;float:left;margin-left:50px">
<div style="float: right">
@@ -691,13 +691,13 @@ class AdminCustomers extends AdminTab
<tr>
<th style="width: 200px">'.$this->l('Date').'</th>
<th style="width: 200px">'.$this->l('Name').'</th>
'.((Shop::isMultiShopActivated())? '<th style="width: 200px">'.$this->l('Shop').'</th>' : '').'
'.((Shop::isFeatureActive())? '<th style="width: 200px">'.$this->l('Shop').'</th>' : '').'
</tr>';
foreach ($referrers as $referrer)
echo '<tr>
<td>'.Tools::displayDate($referrer['date_add'], $this->context->language->id, true).'</td>
<td>'.$referrer['name'].'</td>
'.((Shop::isMultiShopActivated())? '<td>'.$referrer['shop_name'].'</td>' : '').'
'.((Shop::isFeatureActive())? '<td>'.$referrer['shop_name'].'</td>' : '').'
</tr>';
echo '</table><div class="clear">&nbsp;</div>';
}
@@ -849,7 +849,7 @@ class AdminCustomers extends AdminTab
echo '<p>'.$this->l('No group created').'</p>';
echo '
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
$shops = Shop::getShops();
echo '

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -29,7 +29,7 @@ class AdminDiscounts extends AdminTab
{
public function __construct()
{
$this->context = Context::getContext();
$this->context = Context::getContext();
$this->table = 'discount';
$this->className = 'Discount';
$this->lang = true;
@@ -42,12 +42,12 @@ class AdminDiscounts extends AdminTab
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'currency` c ON (c.`id_currency` = a.`id_currency`)
LEFT JOIN `'._DB_PREFIX_.'discount_type` dt ON (dt.`id_discount_type` = a.`id_discount_type`)
LEFT JOIN `'._DB_PREFIX_.'discount_type_lang` dtl ON (dt.`id_discount_type` = dtl.`id_discount_type` AND dtl.`id_lang` = '.(int)$this->context->language->id.')';
$typesArray = array();
$types = Discount::getDiscountTypes($this->context->language->id);
foreach ($types AS $type)
$typesArray[$type['id_discount_type']] = $type['name'];
$this->fieldsDisplay = array(
'id_discount' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Code'), 'width' => 85, 'prefix' => '<span class="discount_name">', 'suffix' => '</span>', 'filter_key' => 'a!name'),
@@ -71,11 +71,11 @@ class AdminDiscounts extends AdminTab
parent::__construct();
}
protected function copyFromPost(&$object, $table)
{
{
parent::copyFromPost($object, $table);
$object->cumulable = (!isset($_POST['cumulable']) ? false : true);
$object->cumulable_reduction = (!isset($_POST['cumulable_reduction']) ? false : true);
}
@@ -92,7 +92,7 @@ class AdminDiscounts extends AdminTab
if (Tools::getValue('id_discount_type') == 0)
$this->_errors[] = Tools::displayError('Please set a type for this voucher.');
if (Tools::getValue('id_discount_type') == Discount::AMOUNT AND Tools::getValue('id_currency') == 0)
$this->_errors[] = Tools::displayError('Please set a currency for this voucher.');
$this->_errors[] = Tools::displayError('Please set a currency for this voucher.');
if ((Tools::getValue('id_discount_type') == Discount::PERCENT || Tools::getValue('id_discount_type') == 2) && !Tools::getValue('value'))
$this->_errors[] = Tools::displayError('Please set a amount for this voucher.');
if (!Validate::isBool_Id(Tools::getValue('id_target')))
@@ -173,7 +173,7 @@ class AdminDiscounts extends AdminTab
'{lastname}' => $customer->lastname,
'{email}' => $customer->email,
'{voucher_num}' => $object->name);
@Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'voucher_new', Mail::l('New voucher'), $data, $customer->email, $customer->firstname.' '.$customer->lastname);
}
}
@@ -181,7 +181,7 @@ class AdminDiscounts extends AdminTab
{
$customer = null;
$customers = $group->getCustomers();
if ($customers)
foreach ($customers as $customer)
{
@@ -190,11 +190,11 @@ class AdminDiscounts extends AdminTab
'{lastname}' => $customer['lastname'],
'{email}' => $customer['email'],
'{voucher_num}' => $object->name);
@Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'voucher_new', Mail::l('New voucher'), $data, $customer['email'], $customer['firstname'].' '.$customer['lastname']);
}
}
Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&token='.$token);
}
}
@@ -211,10 +211,10 @@ class AdminDiscounts extends AdminTab
public function displayForm($isMainTab = true)
{
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
echo '
<script type="text/javascript">
function discountType()
@@ -233,13 +233,13 @@ class AdminDiscounts extends AdminTab
$("#percent-span").css("display", "none");
$("#id_currency").css("display", "block");
$(\'#behavior_not_exhausted\').show();
}
else if ($("#id_discount_type").val() == '.Discount::FREE_SHIPPING.')
$("#value-div").css("display", "none");
if ($(\'#id_discount_type\').val() != '.Discount::AMOUNT.')
$(\'#behavior_not_exhausted\').hide();
}
$(document).ready(function(){
$("#id_discount_type").change(function(){discountType();});
@@ -298,7 +298,7 @@ class AdminDiscounts extends AdminTab
<input size="33" type="text" name="description_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
<p class="clear">'.$this->l('Will appear in cart next to voucher code').'</p>
</div>';
</div>';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'description', 'description');
echo ' </div>
<div class="clear" / >
@@ -365,13 +365,13 @@ class AdminDiscounts extends AdminTab
</optgroup>
</select><br />'.$this->l('Filter:').' <input type="text" size="25" name="filter" id="filter" onkeyup="fillCustomersAjax();" class="space" value="" />
<script type="text/javascript">
var formDiscount = document.layers ? document.forms.discount : document.discount;
var formDiscount = document.layers ? document.forms.discount : document.discount;
function fillCustomersAjax()
{
var filterValue = \''.(($value = (int)($this->getFieldValue($obj, 'id_customer'))) ? '0_'.$value : (($value = (int)($this->getFieldValue($obj, 'id_group'))) ? '1_'.$value : '')).'\';
if ($(\'#filter\').val())
filterValue = $(\'#filter\').val();
$.getJSON("'.dirname(self::$currentIndex).'/ajax.php",{ajaxDiscountCustomers:1,filter:filterValue},
function(obj) {
var groups_length = obj.groups.length;
@@ -381,7 +381,7 @@ class AdminDiscounts extends AdminTab
if (obj.customers.length == 0)
customers_length = 1;
formDiscount.id_target.length = 1 + customers_length + groups_length;
if (obj.groups.length == 0)
{
formDiscount.id_target.options[1].value = -1;
@@ -403,13 +403,13 @@ class AdminDiscounts extends AdminTab
formDiscount.id_target.options[50].className = "groups_filtered";
}
}
if (obj.customers.length == 0)
{
formDiscount.id_target.options[groups_length+1].value = -1;
formDiscount.id_target.options[groups_length+1].text = \''.$this->l('No match found').'\';
formDiscount.id_target.options[groups_length+1].className = "customers_filtered";
}
}
else
{
for (i = 0; i < obj.customers.length && i < 50; i++)
@@ -441,11 +441,11 @@ class AdminDiscounts extends AdminTab
}
);
}
fillCustomersAjax();
fillCustomersAjax();
</script>
</div><br />';
includeDatepicker(array('date_from', 'date_to'), true);
echo '
echo '
<label>'.$this->l('From:').' </label>
<div class="margin-form">
<input type="text" size="20" id="date_from" name="date_from" value="'.($this->getFieldValue($obj, 'date_from') ? htmlentities($this->getFieldValue($obj, 'date_from'), ENT_COMPAT, 'UTF-8') : date('Y-m-d H:i:s')).'" /> <sup>*</sup>
@@ -472,7 +472,7 @@ class AdminDiscounts extends AdminTab
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
<p>'.$this->l('Enable or disable voucher').'</p>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();

View File

@@ -176,7 +176,7 @@ class AdminEmployees extends AdminTab
echo '<option value="'.$profile['id_profile'].'"'.($profile['id_profile'] === $this->getFieldValue($obj, 'id_profile') ? ' selected="selected"' : '').'>'.$profile['name'].'</option>';
echo '</select> <sup>*</sup>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '
<script type="text/javascript">
@@ -265,7 +265,7 @@ class AdminEmployees extends AdminTab
$assos = self::getAssoShop($this->table);
if (count($assos[0]) == 0 && $this->table = 'employee')
if (Shop::isMultiShopActivated() && _PS_ADMIN_PROFILE_ != $_POST['id_profile'])
if (Shop::isFeatureActive() && _PS_ADMIN_PROFILE_ != $_POST['id_profile'])
$this->_errors[] = Tools::displayError('The employee must be associated with at least one shop');
}
return parent::postProcess();

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -177,7 +177,7 @@ class AdminFeatures extends AdminTab
$this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:').'<a href="index.php?tab=AdminPerformance&token='.Tools::getAdminTokenLite('AdminPerformance').'#featuresDetachables">'.$this->l('Performances').'</a>');
return;
}
parent::displayForm();
if (!($obj = $this->loadObject(true)))
@@ -204,7 +204,7 @@ class AdminFeatures extends AdminTab
echo '
<div class="clear"></div>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoShop('group_shop');
@@ -230,9 +230,9 @@ class AdminFeatures extends AdminTab
{
if (!Feature::isFeatureActive())
return ;
$this->adminFeaturesValues->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
if (Tools::isSubmit('submitAddfeature_value') || Tools::isSubmit('submitDelfeature_value'))
$this->adminFeaturesValues->postProcess($this->token);
@@ -265,7 +265,7 @@ class AdminFeatures extends AdminTab
if ($id_feature <= 0)
{
$sql = 'SELECT `position`+1
FROM `'._DB_PREFIX_.'feature`
FROM `'._DB_PREFIX_.'feature`
ORDER BY position DESC';
// set the position of the new feature in $_POST for postProcess() method
$_POST['position'] = DB::getInstance()->getValue($sql);
@@ -276,7 +276,7 @@ class AdminFeatures extends AdminTab
$_POST[$key] = str_replace ('\n', '', str_replace('\r', '', $value));
parent::postProcess();
}
}
else
parent::postProcess();

View File

@@ -124,7 +124,7 @@ class AdminGroups extends AdminTab
<p>'.$this->l('How the prices are displayed on order summary for this customer group (tax included or excluded).').'</p>
</div>
<div class="clear">&nbsp;</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoShop('group_shop');
@@ -460,10 +460,10 @@ class AdminGroups extends AdminTab
{
$reduction = Tools::getValue('reductionByCategory');
$id_category = Tools::getValue('id_category');
$category = new Category((int)($id_category));
$category->addGroupsIfNoExist(Tools::getValue('id_group'));
$groupReduction->id_category = (int)($id_category);
$groupReduction->id_group = (int)($obj->id);
$groupReduction->reduction = (float)($reduction) / 100;

View File

@@ -791,7 +791,7 @@ class AdminImport extends AdminTab
else
{
// Associate product to shop
if (Shop::isMultiShopActivated() && $product->shop)
if (Shop::isFeatureActive() && $product->shop)
{
$product->shop = explode(',', $product->shop);
$shops = array();
@@ -1067,7 +1067,7 @@ class AdminImport extends AdminTab
$customer->passwd = md5(_COOKIE_KEY_.$customer->passwd);
// Associate product to shop
if (Shop::isMultiShopActivated() && $customer->id_shop)
if (Shop::isFeatureActive() && $customer->id_shop)
{
if (!is_numeric($customer->id_shop))
$customer->id_shop = Shop::getIdByName($customer->id_shop);
@@ -1259,7 +1259,7 @@ class AdminImport extends AdminTab
if ($res)
{
// Associate supplier to group shop
if (Shop::isMultiShopActivated() && $manufacturer->shop)
if (Shop::isFeatureActive() && $manufacturer->shop)
{
$manufacturer->shop = explode(',', $manufacturer->shop);
$shops = array();
@@ -1316,7 +1316,7 @@ class AdminImport extends AdminTab
else
{
// Associate supplier to group shop
if (Shop::isMultiShopActivated() && $supplier->shop)
if (Shop::isFeatureActive() && $supplier->shop)
{
$supplier->shop = explode(',', $supplier->shop);
$shops = array();

View File

@@ -388,7 +388,7 @@ class AdminLanguages extends AdminTab
<p>'.$this->l('Allow or disallow this language to be selected by the customer').'</p>
</div>
<p id="resultCheckLangPack"><img src="'._PS_IMG_.'admin/ajax-loader.gif" alt="" /> '.$this->l('Check if a language pack is available for this ISO code...').'</p>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -44,7 +44,7 @@ class AdminManufacturers extends AdminTab
$countries = Country::getCountries($this->context->language->id);
foreach ($countries AS $country)
$this->countriesArray[$country['id_country']] = $country['name'];
$this->fieldsDisplayAddresses = array(
'id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'm!manufacturer_name' => array('title' => $this->l('Manufacturer'), 'width' => 100),
@@ -54,7 +54,7 @@ class AdminManufacturers extends AdminTab
'city' => array('title' => $this->l('City'), 'width' => 150),
'country' => array('title' => $this->l('Country'), 'width' => 100, 'type' => 'select', 'select' => $this->countriesArray, 'filter_key' => 'cl!id_country'));
$this->_includeTabTitle = array($this->l('Manufacturers addresses'));
$this->_joinAddresses = 'LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON
$this->_joinAddresses = 'LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON
(cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.') ';
$this->_joinAddresses .= 'LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (a.`id_manufacturer` = m.`id_manufacturer`)';
$this->_selectAddresses = 'cl.`name` as country, m.`name` AS manufacturer_name';
@@ -88,11 +88,11 @@ class AdminManufacturers extends AdminTab
imageResize(_PS_MANU_IMG_DIR_.$id_manufacturer.'.jpg', _PS_MANU_IMG_DIR_.$id_manufacturer.'-'.stripslashes($imageType['name']).'.jpg', (int)($imageType['width']), (int)($imageType['height']));
}
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
if (!($manufacturer = $this->loadObject(true)))
return;
$langtags = 'cdesc2¤cdesc¤mmeta_title¤mmeta_keywords¤mmeta_description';
@@ -117,7 +117,7 @@ class AdminManufacturers extends AdminTab
</div>';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $langtags, 'cdesc2');
echo '</div>';
echo '<br class="clear" /><br /><br /><label>'.$this->l('Description').'</label>
<div class="margin-form">';
foreach ($this->_languages as $language)
@@ -127,13 +127,13 @@ class AdminManufacturers extends AdminTab
</div>';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $langtags, 'cdesc');
echo '</div>';
// TinyMCE
$iso = $this->context->language->iso_code;
$isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
$ad = dirname($_SERVER["PHP_SELF"]);
echo '
<script type="text/javascript">
<script type="text/javascript">
var iso = \''.$isoTinyMCE.'\' ;
var pathCSS = \''._THEME_CSS_DIR_.'\' ;
var ad = \''.$ad.'\' ;
@@ -185,7 +185,7 @@ class AdminManufacturers extends AdminTab
<input type="radio" name="active" id="active_off" value="0" '.(!$this->getFieldValue($manufacturer, 'active') ? 'checked="checked" ' : '').'/>
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoShop('group_shop');
@@ -208,7 +208,7 @@ class AdminManufacturers extends AdminTab
$products = $manufacturer->getProductsLite($this->context->language->id);
$addresses = $manufacturer->getAddresses($this->context->language->id);
echo '<h3>'.$this->l('Total addresses:').' '.sizeof($addresses).'</h3>';
echo '<hr />';
foreach ($addresses AS $addresse)

View File

@@ -344,7 +344,7 @@ class AdminModules extends AdminTab
else
{
// If we install a module, force temporary global context for multishop
if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL)
if (Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL)
{
Context::getContext()->tmpOldShop = clone(Context::getContext()->shop);
Context::getContext()->shop = new Shop();
@@ -371,7 +371,7 @@ class AdminModules extends AdminTab
</tr>';
// Display checkbox in toolbar if multishop
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
$activateOnclick = 'onclick="location.href = \''.$this->getCurrentUrl('enable').'&enable=\'+(($(this).attr(\'checked\')) ? 1 : 0)"';
$toolbar .= '<tr>
@@ -399,7 +399,7 @@ class AdminModules extends AdminTab
elseif ($echo === false)
$module_errors[] = $name;
if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL && isset(Context::getContext()->tmpOldShop))
if (Shop::isFeatureActive() && Context::shop() != Shop::CONTEXT_ALL && isset(Context::getContext()->tmpOldShop))
{
Context::getContext()->shop = clone(Context::getContext()->tmpOldShop);
unset(Context::getContext()->tmpOldShop);
@@ -1035,12 +1035,12 @@ class AdminModules extends AdminTab
$return = '';
$href = self::$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&tab_module='.$module->tab;
if ($module->id)
$return .= '<a class="action_module" '.($module->active && method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('desactive', $href).'"' : '').' href="'.self::$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&'.($module->active ? 'enable=0' : 'enable=1').'&tab_module='.$module->tab.'" '.((Shop::isMultiShopActivated()) ? 'title="'.htmlspecialchars($module->active ? $this->l('Disable this module') : $this->l('Enable this module for all shops')).'"' : '').'>'.($module->active ? $this->l('Disable') : $this->l('Enable')).'</a>&nbsp;&nbsp;';
$return .= '<a class="action_module" '.($module->active && method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('desactive', $href).'"' : '').' href="'.self::$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&'.($module->active ? 'enable=0' : 'enable=1').'&tab_module='.$module->tab.'" '.((Shop::isFeatureActive()) ? 'title="'.htmlspecialchars($module->active ? $this->l('Disable this module') : $this->l('Enable this module for all shops')).'"' : '').'>'.($module->active ? $this->l('Disable') : $this->l('Enable')).'</a>&nbsp;&nbsp;';
if ($module->id AND $module->active)
$return .= '<a class="action_module" '.(method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('reset', $href).'"' : '').' href="'.self::$currentIndex.'&token='.$this->token.'&module_name='.urlencode($module->name).'&reset&tab_module='.$module->tab.'">'.$this->l('Reset').'</a>&nbsp;&nbsp;';
if ($module->id AND (method_exists($module, 'getContent') OR (isset($module->is_configurable) AND $module->is_configurable) OR Shop::isMultiShopActivated()))
if ($module->id AND (method_exists($module, 'getContent') OR (isset($module->is_configurable) AND $module->is_configurable) OR Shop::isFeatureActive()))
$return .= '<a class="action_module" '.(method_exists($module, 'onclickOption')? 'onclick="'.$module->onclickOption('configure', $href).'"' : '').' href="'.self::$currentIndex.'&configure='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.urlencode($module->name).'">'.$this->l('Configure').'</a>&nbsp;&nbsp;';
$hrefDelete = self::$currentIndex.'&deleteModule='.urlencode($module->name).'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.urlencode($module->name);

View File

@@ -261,12 +261,12 @@ class AdminModulesPositions extends AdminTab
</form>
<fieldset style="width:250px;float:right"><legend>'.$this->l('Live edit').'</legend>';
if (Shop::isMultiShopActivated() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP)
if (Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP)
echo '<p>'.$this->l('You have to select a shop to use live edit').'</p>';
else
echo '<p>'.$this->l('By clicking here you will be redirected to the front office of your shop to move and delete modules directly.').'</p>
<br>
<a href="'.$this->context->link->getPageLink('index', false, null, 'live_edit&ad='.$admin_dir.'&liveToken='.sha1($admin_dir._COOKIE_KEY_).((Shop::isMultiShopActivated()) ? '&id_shop='.Context::getContext()->shop->getID() : '')).'" target="_blank" class="button">'.$this->l('Run LiveEdit').'</a>';
<a href="'.$this->context->link->getPageLink('index', false, null, 'live_edit&ad='.$admin_dir.'&liveToken='.sha1($admin_dir._COOKIE_KEY_).((Shop::isFeatureActive()) ? '&id_shop='.Context::getContext()->shop->getID() : '')).'" target="_blank" class="button">'.$this->l('Run LiveEdit').'</a>';
echo '</fieldset>';
// Print hook list
@@ -276,7 +276,7 @@ class AdminModulesPositions extends AdminTab
echo '<div id="unhook_button_position_top"><input class="button floatr" type="submit" name="unhookform" value="'.$this->l('Unhook the selection').'"/></div>';
$canMove = (Shop::isMultiShopActivated() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP) ? false : true;
$canMove = (Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP) ? false : true;
if (!$canMove)
echo '<br /><div><b>'.$this->l('If you want to order / move following data, please go in shop context (select a shop in shop list)').'</b></div>';
foreach ($hooks AS $hook)

View File

@@ -681,7 +681,7 @@ class AdminOrders extends AdminTab
<br />
<fieldset style="width: 400px">
<legend><img src="../img/admin/details.gif" /> '.$this->l('Order details').'</legend>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('Shop:').' </label>
<div style="margin: 2px 0 1em 190px;">'.Shop::getInstance($order->id_shop)->name.'</div>';

View File

@@ -893,7 +893,7 @@ class AdminProducts extends AdminTab
if (isset($result['success']))
{
$shops = false;
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
$shops = Shop::getShops();
$obj = new Product((int)Tools::getValue('id_product'));
$countImages = (int)Db::getInstance()->getValue('SELECT COUNT(id_product) FROM '._DB_PREFIX_.'image WHERE id_product = '.(int)$obj->id);
@@ -2504,7 +2504,7 @@ class AdminProducts extends AdminTab
</td>
</tr>
<tr id="shop_association">
<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;'.(!Shop::isMultiShopActivated() ? 'display:none;' : '').'">'.$this->l('Shop association:').'</td><td style="padding-bottom:5px;">';
<td style="vertical-align:top;text-align:right;padding-right:10px;font-weight:bold;'.(!Shop::isFeatureActive() ? 'display:none;' : '').'">'.$this->l('Shop association:').'</td><td style="padding-bottom:5px;">';
$this->displayAssoShop();
echo '</td>
</tr>
@@ -3435,7 +3435,7 @@ class AdminProducts extends AdminTab
return '';
global $attributeJs, $images;
$shops = false;
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
$shops = Shop::getShops();
$countImages = (int)Db::getInstance()->getValue('SELECT COUNT(id_product) FROM '._DB_PREFIX_.'image WHERE id_product = '.(int)$obj->id);
@@ -3935,7 +3935,7 @@ class AdminProducts extends AdminTab
public function getLineTableImage($image, $imagesTotal, $token, $shops)
{
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
$imgObj = new Image((int)$image['id_image']);
$image_obj = new Image($image['id_image']);
$img_path = $image_obj->getExistingImgPath();
@@ -3953,7 +3953,7 @@ class AdminProducts extends AdminTab
<a '.($image['position'] == $imagesTotal ? ' style="display: none;"' : '').' href="'.self::$currentIndex.'&id_image='.$image['id_image'].'&imgPosition='.($image['position'] + 1).'&imgDirection=1&token='.($token ? $token : $this->token).'"><img src="../img/admin/down.gif" alt="" border="0"></a>';
$html .= '
</td>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
foreach ($shops as $shop)
$html .= '
<td class="center"><input type="checkbox" class="image_shop" name="'.(int)$image['id_image'].'" value="'.(int)$shop['id_shop'].'" '.($imgObj->isAssociatedToShop($shop['id_shop']) ? 'checked="1"' : '').' /></td>';

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -58,7 +58,7 @@ class AdminReferrers extends AdminTab
$this->view = true;
$this->edit = true;
$this->delete = true;
parent::__construct();
$this->_select = 'SUM(sa.cache_visitors) AS cache_visitors, SUM(sa.cache_visits) AS cache_visits, SUM(sa.cache_pages) AS cache_pages,
@@ -88,19 +88,19 @@ class AdminReferrers extends AdminTab
{
return (!Tools::isSubmit('add'.$this->table) AND !Tools::isSubmit('submitAdd'.$this->table) AND !Tools::isSubmit('update'.$this->table));
}
public function displayJavascript()
{
$products = Product::getSimpleProducts($this->context->language->id);
$productsArray = array();
foreach ($products as $product)
$productsArray[] = $product['id_product'];
return '
<script type="text/javascript">
var productIds = new Array(\''.implode('\',\'', $productsArray).'\');
var referrerStatus = new Array();
function newProductLine(id_referrer, result)
{
return \'\'+
@@ -123,7 +123,7 @@ class AdminReferrers extends AdminTab
\' <td align="center">--</td>\'+
\'</tr>\';
}
function showProductLines(id_referrer)
{
if (!referrerStatus[id_referrer])
@@ -146,12 +146,12 @@ class AdminReferrers extends AdminTab
}
</script>';
}
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 '<div class="clear space">&nbsp;</div>';
}
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
<input type="text" size="8" name="percent_fee" value="'.number_format((float)($this->getFieldValue($obj, 'percent_fee')), 2).'" />
<p>'.$this->l('Percent of the sales.').'</p>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
@@ -370,7 +370,7 @@ class AdminReferrers extends AdminTab
<br class="clear" />
</form>';
}
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);
</script>';
}
public function displayListContent($token = NULL)
{
$irow = 0;

View File

@@ -193,7 +193,7 @@ class AdminScenes extends AdminTab
'Uncheck All' => $this->l('Uncheck All')
);
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
@@ -215,7 +215,7 @@ class AdminScenes extends AdminTab
{
echo '<br/><span class="bold">'.$this->l('Please add a picture to continue mapping the image...').'</span><br/><br/>';
echo '</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -36,9 +36,9 @@ class AdminSuppliers extends AdminTab
$this->delete = true;
$this->_select = 'COUNT(p.`id_product`) AS products';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product` p ON (a.`id_supplier` = p.`id_supplier`)';
$this->fieldImageSettings = array('name' => 'logo', 'dir' => 'su');
$this->fieldsDisplay = array(
'id_supplier' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Name'), 'width' => 120),
@@ -46,16 +46,16 @@ class AdminSuppliers extends AdminTab
'products' => array('title' => $this->l('Number of products'), 'align' => 'right', 'filter_type' => 'int', 'tmpTableFilter' => true),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
);
parent::__construct();
}
public function viewsupplier()
{
if (!($supplier = $this->loadObject()))
return;
return;
echo '<h2>'.$supplier->name.'</h2>';
$products = $supplier->getProductsLite($this->context->language->id);
echo '<h3>'.$this->l('Total products:').' '.sizeof($products).'</h3>';
foreach ($products AS $product)
@@ -118,11 +118,11 @@ class AdminSuppliers extends AdminTab
}
}
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
if (!($supplier = $this->loadObject(true)))
return;
@@ -144,7 +144,7 @@ class AdminSuppliers extends AdminTab
<input size="33" type="text" name="description_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($supplier, 'description', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />
<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
<p class="clear">'.$this->l('Will appear in supplier list').'</p>
</div>';
</div>';
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, $langtags, 'description');
echo ' <div class="clear"></div>
</div>
@@ -193,7 +193,7 @@ class AdminSuppliers extends AdminTab
<input type="radio" name="active" id="active_off" value="0" '.(!$this->getFieldValue($supplier, 'active') ? 'checked="checked" ' : '').'/>
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoShop('group_shop');
@@ -207,7 +207,7 @@ class AdminSuppliers extends AdminTab
</fieldset>
</form>';
}
public function afterImageUpload()
{
/* Generate image with differents size */

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -36,20 +36,20 @@ class AdminZones extends AdminTab
$this->lang = false;
$this->edit = true;
$this->delete = true;
$this->fieldsDisplay = array(
'id_zone' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Zone'), 'width' => 150),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
);
parent::__construct();
}
public function displayForm($isMainTab = true)
{
parent::displayForm();
if (!($obj = $this->loadObject(true)))
return;
echo '
@@ -70,7 +70,7 @@ class AdminZones extends AdminTab
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
<p>'.$this->l('Allow or disallow shipping to this zone').'</p>
</div>';
if (Shop::isMultiShopActivated())
if (Shop::isFeatureActive())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoShop('group_shop');

View File

@@ -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;

View File

@@ -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 '<div class="preference_default_multishop">
<label>
<input type="checkbox" name="configUseDefault['.$key.']" value="1" '.(($isDisabled) ? 'checked="checked"' : '').' onclick="checkMultishopDefaultValue(this, \''.$key.'\')" /> '.$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')

View File

@@ -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);
}
/**

View File

@@ -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;

View File

@@ -248,7 +248,7 @@ abstract class ObjectModelCore
}
}
if (!Shop::isMultishopActivated())
if (!Shop::isFeatureActive())
{
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
{

View File

@@ -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;

View File

@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -40,7 +40,7 @@ class Gsitemap extends Module
$this->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 .= '</h3>';
}
/**
* 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 version="1.0" encoding="UTF-8" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
</urlset>
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 .= '<p>'.$this->l('Your Google sitemap file is online at the following address:').'<br />
@@ -376,7 +376,7 @@ XML;
value="'.((!file_exists(GSITEMAP_FILE)) ? $this->l('Generate sitemap file') : $this->l('Update sitemap file')).'" />
</form>';
}
public function getContent()
{
$this->_html .= '<h2>'.$this->l('Search Engine Optimization').'</h2>