// Some fix + improve ergonomy + Tools::isMultiShopActived() moved in Shop class + 1.5.0.1 version in install script

This commit is contained in:
rMalie
2011-08-02 09:54:23 +00:00
parent 66eab15a18
commit 3c8c85b1cd
46 changed files with 370 additions and 357 deletions
+35
View File
@@ -385,3 +385,38 @@ function simpleXMLToArray ($xml, $flattenValues = true, $flattenAttributes = tru
return $return;
}
/**
* Generate a sweet HTML list for shop selection
*
* @todo move in adminTab
* @return string
*/
function generateShopList()
{
$tree = Shop::getTree();
// Get default value
list($shopID, $shopGroupID) = Shop::getContext();
if ($shopID)
$value = 's-'.$shopID;
else if ($shopGroupID)
$value = 'g-'.$shopGroupID;
else
$value = '';
// Generate HTML
$url = $_SERVER['REQUEST_URI'] . (($_SERVER['QUERY_STRING']) ? '&' : '?') . 'setShopContext=';
$html = '<select class="shopList" onchange="location.href = \''.$url.'\'+$(this).val();">';
$html .= '<option value="" class="first">'.translate('All shops').'</option>';
foreach ($tree as $gID => $groupData)
{
$html .= '<option class="group" value="g-'.$gID.'" '.(($value == 'g-'.$gID) ? 'selected="selected"' : '').'>'.htmlspecialchars($groupData['name']).'</option>';
foreach ($groupData['shops'] as $sID => $shopData)
if ($shopData['active'])
$html .= '<option value="s-'.$sID.'" class="shop" '.(($value == 's-'.$sID) ? 'selected="selected"' : '').'>&raquo; '.$shopData['name'].'</option>';
}
$html .= '</select>';
return $html;
}
+2 -2
View File
@@ -117,8 +117,8 @@ foreach (QuickAccess::getQuickAccesses((int)($cookie->id_lang)) AS $quick)
echo ' </select>
</div>';
if (Tools::isMultiShopActivated())
echo '<div id="header_shoplist">'.Shop::generateHtmlList().'</div>';
if (Shop::isMultiShopActivated())
echo '<div id="header_shoplist">'.translate('Select your shop:').' '.generateShopList().'</div>';
echo ' <div class="flatclear">&nbsp;</div>
'.Module::hookExec('backOfficeTop').'
+11 -13
View File
@@ -74,21 +74,19 @@ if (empty($tab) and !sizeof($_POST))
</div>
<a href="?token='.Tools::getAdminToken($tab.intval(Tab::getIdFromClassName($tab)).intval($cookie->id_employee)).'">'.translate('Back Office').'</a>
'.$bread;
if (Tools::isMultiShopActivated())
{
echo '
<span style="float:right">'.translate('You are currently view/configure your store for').' <b>';
if (Context::getContext()->shop->getContextType() == Shop::CONTEXT_ALL)
echo 'all shops';
elseif (Context::getContext()->shop->getContextType() == Shop::CONTEXT_GROUP)
echo 'all shops of group shop <b>'.Context::getContext()->shop->getGroup()->name.'</b>';
elseif (Context::getContext()->shop->getContextType() == Shop::CONTEXT_SHOP)
echo 'shop <b>'.Context::getContext()->shop->name.'</b>';
echo '</b>
</span>&nbsp;';
}
echo '
</div>';
if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL)
{
echo '<div class="multishop_info">';
if (Context::shop() == Shop::CONTEXT_GROUP)
printf(translate('You are configuring your store for group shop %s'), '<b>'.Context::getContext()->shop->getGroup()->name.'</b>');
elseif (Context::shop() == Shop::CONTEXT_SHOP)
printf(translate('You are configuring your store for shop %s'), '<b>'.Context::getContext()->shop->name.'</b>');
echo '</div>';
}
if (Validate::isLoadedObject($adminObj))
{
+1 -1
View File
@@ -75,7 +75,7 @@ if (empty($employee->bo_theme) OR !file_exists($path.$employee->bo_theme.'/admin
}
// Change shop context ?
if (Tools::isMultiShopActivated() && Tools::getValue('setShopContext') !== false)
if (Shop::isMultiShopActivated() && Tools::getValue('setShopContext') !== false)
{
$cookie->shopContext = Tools::getValue('setShopContext');
$url = parse_url($_SERVER['REQUEST_URI']);
+2 -2
View File
@@ -84,10 +84,10 @@ class AdminAttributes extends AdminTab
echo '
</select><sup> *</sup>
</div>';
if (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoGroupShop();
$this->displayAssoShop('group_shop');
echo '</div>';
}
echo '
+2 -3
View File
@@ -59,7 +59,6 @@ class AdminAttributesGroups extends AdminTab
else
{
parent::display();
$this->displayAssoGroupShop();
}
}
@@ -209,10 +208,10 @@ class AdminAttributesGroups extends AdminTab
<label class="t" for="is_color_group_off"><img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('No').'" /></label>
<p>'.$this->l('This is a color group').'</p>
</div>';
if (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoGroupShop();
$this->displayAssoShop('group_shop');
echo '</div>';
}
echo '
+2 -2
View File
@@ -151,10 +151,10 @@ 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 (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop('meta_title');
$this->displayAssoShop();
echo '</div>';
}
// SUBMIT
+2 -4
View File
@@ -49,9 +49,7 @@ class AdminCarriers extends AdminTab
'active' => array('title' => $this->l('Status'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
'is_free' => array('title' => $this->l('Is Free'), 'align' => 'center', 'icon' => array(0 => 'disabled.gif', 1 => 'enabled.gif', 'default' => 'disabled.gif'), 'type' => 'bool', 'orderby' => false)
);
$this->_group = 'GROUP BY a.id_carrier';
$this->optionTitle = $this->l('Carrier options');
$this->_fieldsOptions = array(
'PS_CARRIER_DEFAULT' => array('title' => $this->l('Default carrier:'), 'desc' => $this->l('The default carrier used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_carrier', 'list' => Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, ALL_CARRIERS)),
@@ -244,7 +242,7 @@ class AdminCarriers extends AdminTab
echo '</div>';
}
echo '</div>';
if (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
+6 -5
View File
@@ -38,10 +38,11 @@ class AdminContacts extends AdminTab
$this->delete = true;
$this->fieldsDisplay = array(
'id_contact' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Title'), 'width' => 130),
'email' => array('title' => $this->l('E-mail address'), 'width' => 130),
'description' => array('title' => $this->l('Description'), 'width' => 150));
'id_contact' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Title'), 'width' => 130),
'email' => array('title' => $this->l('E-mail address'), 'width' => 130),
'description' => array('title' => $this->l('Description'), 'width' => 150),
);
$this->optionTitle = $this->l('Contact options');
$this->_fieldsOptions = array(
@@ -101,7 +102,7 @@ class AdminContacts extends AdminTab
echo '
<p style="clear: both">'.$this->l('Additional information about this contact').'</p>
</div>';
if (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
+1 -1
View File
@@ -325,7 +325,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 (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
+9 -8
View File
@@ -38,13 +38,14 @@ class AdminCurrencies extends AdminTab
$this->delete = true;
$this->fieldsDisplay = array(
'id_currency' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Currency'), 'width' => 100),
'iso_code' => array('title' => $this->l('ISO code'), 'align' => 'center', 'width' => 35),
'iso_code_num' => array('title' => $this->l('ISO code num'), 'align' => 'center', 'width' => 35),
'sign' => array('title' => $this->l('Symbol'), 'width' => 20, 'align' => 'center', 'orderby' => false, 'search' => false),
'conversion_rate' => array('title' => $this->l('Conversion rate'), 'float' => true, 'align' => 'center', 'width' => 50, 'search' => false),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false));
'id_currency' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Currency'), 'width' => 100),
'iso_code' => array('title' => $this->l('ISO code'), 'align' => 'center', 'width' => 35),
'iso_code_num' => array('title' => $this->l('ISO code num'), 'align' => 'center', 'width' => 35),
'sign' => array('title' => $this->l('Symbol'), 'width' => 20, 'align' => 'center', 'orderby' => false, 'search' => false),
'conversion_rate' => array('title' => $this->l('Conversion rate'), 'float' => true, 'align' => 'center', 'width' => 50, 'search' => false),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
);
$this->optionTitle = $this->l('Currencies options');
$this->_fieldsOptions = array(
@@ -217,7 +218,7 @@ class AdminCurrencies extends AdminTab
<input type="radio" name="active" id="active_off" 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 (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
+4 -4
View File
@@ -291,7 +291,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 />' : '')
.(Tools::isMultiShopActivated() ? '<br />'.$this->l('Shop:').' '.Shop::getInstance($customer->id_shop)->name : '').'
.(Shop::isMultiShopActivated() ? '<br />'.$this->l('Shop:').' '.Shop::getInstance($customer->id_shop)->name : '').'
</fieldset>
<fieldset style="width:300px;float:left;margin-left:50px">
<div style="float: right">
@@ -666,13 +666,13 @@ class AdminCustomers extends AdminTab
<tr>
<th style="width: 200px">'.$this->l('Date').'</th>
<th style="width: 200px">'.$this->l('Name').'</th>
'.((Tools::isMultiShopActivated())? '<th style="width: 200px">'.$this->l('Shop').'</th>' : '').'
'.((Shop::isMultiShopActivated())? '<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>
'.((Tools::isMultiShopActivated())? '<td>'.$referrer['shop_name'].'</td>' : '').'
'.((Shop::isMultiShopActivated())? '<td>'.$referrer['shop_name'].'</td>' : '').'
</tr>';
echo '</table><div class="clear">&nbsp;</div>';
}
@@ -823,7 +823,7 @@ class AdminCustomers extends AdminTab
echo '<p>'.$this->l('No group created').'</p>';
echo '
</div>';
if (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
$shops = Shop::getShops();
echo '
+2 -3
View File
@@ -35,13 +35,12 @@ class AdminDiscounts extends AdminTab
$this->lang = true;
$this->edit = true;
$this->delete = true;
$this->_select = 'dtl.`name` AS discount_type, s.name shop_name,
$this->_select = 'dtl.`name` AS discount_type,
IF(a.id_discount_type = 1, CONCAT(a.value, " %"),
IF(a.id_discount_type = 2, CONCAT(a.value, " ", c.sign),
"--")) as strvalue';
$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_.'shop` s ON (s.`id_shop` = a.`id_shop`)
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();
@@ -446,7 +445,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 (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
+2 -3
View File
@@ -56,7 +56,6 @@ class AdminFeatures extends AdminTab
else
{
parent::display();
$this->displayAssoGroupShop();
}
}
@@ -155,10 +154,10 @@ class AdminFeatures extends AdminTab
echo '
<div class="clear"></div>
</div>';
if (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoGroupShop();
$this->displayAssoShop('group_shop');
echo '</div>';
}
echo '
+5
View File
@@ -137,4 +137,9 @@ EOF;
</fieldset>
</form>';
}
protected function displayAddButton()
{
echo '<br /><a href="'.self::$currentIndex.'&add'.$this->table.'&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add new group shop').'</a><br /><br />';
}
}
+2 -3
View File
@@ -43,7 +43,6 @@ class AdminGroups extends AdminTab
WHERE jc.`deleted` != 1
AND jcg.`id_group` = a.`id_group`) AS nb
';
$this->_group = 'GROUP BY a.id_group';
$this->_listSkipDelete = array(1);
$this->fieldsDisplay = array(
@@ -126,10 +125,10 @@ class AdminGroups extends AdminTab
<div class="margin-form">
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
</div>';
if (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoGroupShop();
$this->displayAssoShop('group_shop');
echo '</div>';
}
echo '
+4 -4
View File
@@ -779,7 +779,7 @@ class AdminImport extends AdminTab
else
{
// Associate product to shop
if (Tools::isMultiShopActivated() && $product->shop)
if (Shop::isMultiShopActivated() && $product->shop)
{
$product->shop = explode(',', $product->shop);
$shops = array();
@@ -1017,7 +1017,7 @@ class AdminImport extends AdminTab
$customer->passwd = md5(_COOKIE_KEY_.$customer->passwd);
// Associate product to shop
if (Tools::isMultiShopActivated() && $customer->id_shop)
if (Shop::isMultiShopActivated() && $customer->id_shop)
{
if (!is_numeric($customer->id_shop))
$customer->id_shop = Shop::getIdByName($customer->id_shop);
@@ -1205,7 +1205,7 @@ class AdminImport extends AdminTab
if ($res)
{
// Associate supplier to group shop
if (Tools::isMultiShopActivated() && $manufacturer->shop)
if (Shop::isMultiShopActivated() && $manufacturer->shop)
{
$manufacturer->shop = explode(',', $manufacturer->shop);
$shops = array();
@@ -1258,7 +1258,7 @@ class AdminImport extends AdminTab
else
{
// Associate supplier to group shop
if (Tools::isMultiShopActivated() && $supplier->shop)
if (Shop::isMultiShopActivated() && $supplier->shop)
{
$supplier->shop = explode(',', $supplier->shop);
$shops = array();
+1 -2
View File
@@ -50,7 +50,6 @@ class AdminLanguages extends AdminTab
$this->_fieldsOptions = array(
'PS_LANG_DEFAULT' => array('title' => $this->l('Default language:'), 'desc' => $this->l('The default language used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_lang', 'list' => Language::getlanguages(false)),
);
$this->_group = 'GROUP BY a.id_lang';
parent::__construct();
}
@@ -368,7 +367,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 (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
+2 -3
View File
@@ -65,7 +65,6 @@ class AdminManufacturers extends AdminTab
$this->_select = 'COUNT(`id_product`) AS `products`, (SELECT COUNT(ad.`id_manufacturer`) as `addresses` FROM `'._DB_PREFIX_.'address` ad WHERE ad.`id_manufacturer` = a.`id_manufacturer` AND ad.`deleted` = 0 GROUP BY ad.`id_manufacturer`) as `addresses`';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product` p ON (a.`id_manufacturer` = p.`id_manufacturer`)';
$this->_joinCount = false;
$this->_group = 'GROUP BY a.`id_manufacturer`';
$this->fieldImageSettings = array('name' => 'logo', 'dir' => 'm');
@@ -188,10 +187,10 @@ 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 (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoGroupShop();
$this->displayAssoShop('group_shop');
echo '</div>';
}
echo '
-1
View File
@@ -43,7 +43,6 @@ class AdminMeta extends AdminTab
'title' => array('title' => $this->l('Title'), 'width' => 120),
'url_rewrite' => array('title' => $this->l('Friendly URL'), 'width' => 120)
);
$this->_group = 'GROUP BY a.id_meta';
$this->optionTitle = $this->l('URLs Setup');
$this->_fieldsOptions = array(
+3 -3
View File
@@ -308,7 +308,7 @@ class AdminModules extends AdminTab
</tr>';
// Display checkbox in toolbar if multishop
if (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
$activateOnclick = 'onclick="location.href = \''.$this->getCurrentUrl('enable').'&enable=\'+(($(this).attr(\'checked\')) ? 1 : 0)"';
$toolbar .= '<tr>
@@ -938,12 +938,12 @@ class AdminModules extends AdminTab
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.'&module_name='.urlencode($module->name).'" '.((Tools::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.'&module_name='.urlencode($module->name).'" '.((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;';
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.'&module_name='.urlencode($module->name).'">'.$this->l('Reset').'</a>&nbsp;&nbsp;';
if ($module->id AND (method_exists($module, 'getContent') OR (isset($module->is_configurable) AND $module->is_configurable) OR Tools::isMultiShopActivated()))
if ($module->id AND (method_exists($module, 'getContent') OR (isset($module->is_configurable) AND $module->is_configurable) OR Shop::isMultiShopActivated()))
$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);
+2 -2
View File
@@ -252,7 +252,7 @@ class AdminModulesPositions extends AdminTab
</form>
<fieldset style="width:250px;float:right"><legend>'.$this->l('Live edit').'</legend>';
if (Tools::isMultiShopActivated() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP)
if (Shop::isMultiShopActivated() && $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>
@@ -267,7 +267,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 = (Tools::isMultiShopActivated() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP) ? false : true;
$canMove = (Shop::isMultiShopActivated() && $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)
+3 -5
View File
@@ -657,12 +657,10 @@ class AdminOrders extends AdminTab
<br />
<fieldset style="width: 400px">
<legend><img src="../img/admin/details.gif" /> '.$this->l('Order details').'</legend>';
if (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
$shop = new Shop((int)$order->id_shop);
echo '
<label>'.$this->l('Shop:').' </label>
<div style="margin: 2px 0 1em 190px;">'.$shop->name.'</div>';
echo '<label>'.$this->l('Shop:').' </label>
<div style="margin: 2px 0 1em 190px;">'.Shop::getInstance($order->id_shop)->name.'</div>';
}
echo '
<label>'.$this->l('Original cart:').' </label>
+1 -1
View File
@@ -358,7 +358,7 @@ class AdminPreferences extends AdminTab
echo '<div class="margin-form" style="padding-top:5px;">';
}
$isDisabled = (Tools::isMultiShopActivated() && isset($field['visibility']) && $field['visibility'] > $this->context->shop->getContextType()) ? true : false;
$isDisabled = (Shop::isMultiShopActivated() && isset($field['visibility']) && $field['visibility'] > $this->context->shop->getContextType()) ? true : false;
/* Display the appropriate input type for each field */
switch ($field['type'])
+4 -6
View File
@@ -66,7 +66,6 @@ class AdminProducts extends AdminTab
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)';
$this->_filter = 'AND cp.`id_category` = '.(int)($this->_category->id);
$this->_select = 'cp.`position`, i.`id_image`, (a.`price` * ((100 + (t.`rate`))/100)) AS price_final, SUM(stock.quantity) AS quantity';
$this->_group = 'GROUP BY a.id_product';
parent::__construct();
}
@@ -1410,7 +1409,6 @@ class AdminProducts extends AdminTab
echo '<a href="'.self::$currentIndex.'&id_category='.$id_category.'&add'.$this->table.'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new product').'</a>';
echo '<div style="margin:10px;">';
$this->displayList($token);
$this->displayAssoShop();
echo '</div>';
}
@@ -2249,7 +2247,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;'.(!Tools::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::isMultiShopActivated() ? 'display:none;' : '').'">'.$this->l('Shop association:').'</td><td style="padding-bottom:5px;">';
$this->displayAssoShop();
echo '</td>
</tr>
@@ -3041,7 +3039,7 @@ class AdminProducts extends AdminTab
<th style="width: 100px;">'.$this->l('Image').'</th>
<th>&nbsp;</th>
<th>'.$this->l('Position').'</th>';
if (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
$shops = Shop::getShops();
echo '<script type="text/javascript">
@@ -3062,7 +3060,7 @@ class AdminProducts extends AdminTab
foreach ($images AS $k => $image)
{
if(Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
$imgObj = new Image((int)$image['id_image']);
$image_obj = new Image($image['id_image']);
$img_path = $image_obj->getExistingImgPath();
@@ -3092,7 +3090,7 @@ class AdminProducts extends AdminTab
<span>[ <a onclick="return hideLink();" href="'.self::$currentIndex.'&id_image='.$image['id_image'].'&imgPosition='.$image['position'].'&imgDirection=1&token='.($token ? $token : $this->token).'"><img src="../img/admin/up.gif" alt="" border="0"></a> ]</span>
<span>[ <a onclick="return hideLink();" href="'.self::$currentIndex.'&id_image='.$image['id_image'].'&imgPosition='.$image['position'].'&imgDirection=0&token='.($token ? $token : $this->token).'"><img src="../img/admin/down.gif" alt="" border="0"></a> ]</span>';
echo '</td>';
if(Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
foreach ($shops AS $shop)
echo '<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>';
echo '
+1 -1
View File
@@ -261,7 +261,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 (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
+16 -12
View File
@@ -36,8 +36,6 @@ class AdminScenes extends AdminTab
$this->lang = true;
$this->edit = true;
$this->delete = true;
$this->_group = 'GROUP BY a.id_scene';
$this->fieldImageSettings = array(
array('name' => 'image', 'dir' => 'scenes'),
@@ -226,17 +224,10 @@ class AdminScenes extends AdminTab
echo '<img id="large_scene_image" style="clear:both;border:1px solid black;" alt="" src="'._THEME_SCENE_DIR_.'thumbs/'.$obj->id.'-thumb_scene.jpg" /><br />';
echo '</div>
';
if (Tools::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
echo '</div>';
}
echo '<label>'.$this->l('Category:').' </label>
<div class="margin-form">
<div style="overflow: auto; min-height: 300px; padding-top: 0.6em;" id="categoryList">
<div style="overflow: auto; max-height: 300px; padding-top: 0.6em;" id="categoryList">
<table cellspacing="0" cellpadding="0" class="table" style="width: 600px;">
<tr>
<th><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'categories[]\', this.checked)" /></th>
@@ -257,6 +248,12 @@ class AdminScenes extends AdminTab
<p style="padding:0px; margin:0px 0px 10px 0px;">'.$this->l('Mark all checkbox(es) of the categories for which the image map is to appear.').'<sup> *</sup></p>
</div>
</div>';
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
echo '</div>';
}
echo '
<div id="save_scene" class="margin-form" '.(($obj->id && file_exists(_PS_SCENE_IMG_DIR_.$obj->id.'-large_scene.jpg')) ? '' : 'style="display:none;"') .'>
<input type="submit" name="save_image_map" value="'.$this->l('Save Image Map(s)').'" class="button" />
@@ -264,8 +261,15 @@ class AdminScenes extends AdminTab
}
else
{
echo '
<br/><span class="bold">'.$this->l('Please add a picture to continue mapping the image...').'</span><br/><br/>';
echo '<br/><span class="bold">'.$this->l('Please add a picture to continue mapping the image...').'</span><br/><br/>';
echo '</div>';
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
echo '</div>';
}
}
echo '
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
+6 -1
View File
@@ -40,7 +40,7 @@ class AdminShop extends AdminTab
$this->_select = 'gs.name group_shop_name, cl.name category_name';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'group_shop` gs ON (a.id_group_shop = gs.id_group_shop)
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.id_category = cl.id_category AND cl.id_lang='.(int)$this->context->language->id.')';
$this->_group = 'GROUP BY id_shop';
$this->_group = 'GROUP BY a.id_shop';
$this->fieldsDisplay = array(
'id_shop' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
@@ -189,4 +189,9 @@ class AdminShop extends AdminTab
</fieldset>
</form>';
}
protected function displayAddButton()
{
echo '<br /><a href="'.self::$currentIndex.'&add'.$this->table.'&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add new shop').'</a><br /><br />';
}
}
+16 -9
View File
@@ -92,14 +92,13 @@ class AdminShopUrl extends AdminTab
var domain = $('#domain').val();
var physical = $('#physical_uri').val();
var virtual = $('#virtual_uri').val();
var url = 'http://';
url += ((domain) ? domain : '???');
url = ((domain) ? domain : '???');
if (physical)
url += '/'+physical;
if (virtual)
url += '/'+virtual;
url = url.replace(/\/+/g, "/");
$('#final_url').val(url);
$('#final_url').val('http://'+url);
});
});
//]]>
@@ -121,14 +120,17 @@ EOF;
<label for="physical_uri">'.$this->l('Physical URI').'</label>
<div class="margin-form">
<input type="text" name="physical_uri" id="physical_uri" value="'.$this->getFieldValue($obj, 'physical_uri').'" />
<p>'.$this->l('Folder of your store ex: ipods for http://yourshopname.com/ipods/, leave empty if no folder.').'<br /><b>'.$this->l('URL Rewrite must be activated to use this feature.').'</b></p>
</div>
<label for="virtual_uri">'.$this->l('Virtual URI').'</label>
<p>'.$this->l('Physical folder of your store on your server. Leave this field empty if your store is installed on root path.').'</p>
</div>';
if (Shop::isMultiShopActivated())
{
echo '<label for="virtual_uri">'.$this->l('Virtual URI').'</label>
<div class="margin-form">
<input type="text" name="virtual_uri" id="virtual_uri" value="'.$this->getFieldValue($obj, 'virtual_uri').'" />
<p>'.$this->l('Folder of your store ex: ipods for http://yourshopname.com/ipods/, leave empty if no folder.').'<br /><b>'.$this->l('URL Rewrite must be activated to use this feature.').'</b></p>
</div>
<label>'.$this->l('Your final URL will be').'</label>
<p>'.$this->l('This virtual folder must not exist on your server and is used to associate an URI to a shop.').'<br /><b>'.$this->l('URL rewriting must be activated on your server to use this feature.').'</b></p>
</div>';
}
echo ' <label>'.$this->l('Your final URL will be').'</label>
<div class="margin-form">
<input type="text" readonly="readonly" id="final_url" style="width: 400px" value="'.$obj->getURL().'" />
</div>
@@ -168,4 +170,9 @@ EOF;
</fieldset>
</form>';
}
protected function displayAddButton()
{
echo '<br /><a href="'.self::$currentIndex.'&add'.$this->table.'&token='.$this->token.'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add new shop URL').'</a><br /><br />';
}
}
+1 -2
View File
@@ -47,7 +47,6 @@ class AdminStores extends AdminTab
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'state` st ON (st.`id_state` = a.`id_state`)';
$this->_group = 'GROUP BY a.id_store';
$countries = Country::getCountries($this->context->language->id);
foreach ($countries AS $country)
@@ -300,7 +299,7 @@ class AdminStores extends AdminTab
</table>
</div>
<div class="clear"></div>';
if (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoShop();
+2 -3
View File
@@ -38,7 +38,6 @@ 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->_group = 'GROUP BY a.`id_supplier`';
$this->fieldImageSettings = array('name' => 'logo', 'dir' => 'su');
@@ -196,10 +195,10 @@ 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 (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoGroupShop();
$this->displayAssoShop('group_shop');
echo '</div>';
}
echo '
+3 -6
View File
@@ -97,10 +97,10 @@ class AdminTaxRulesGroup extends AdminTab
<input type="radio" name="active" id="active_off" 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 (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('Shop association:').'</label><div class="margin-form">';
$this->displayAssoGroupShop();
$this->displayAssoShop('group_shop');
echo '</div>';
}
echo '
@@ -503,9 +503,7 @@ class AdminTaxRulesGroup extends AdminTab
$result = $object->update();
$this->afterUpdate($object);
}
if ($object->id)
$this->updateAssoGroupShop($object->id);
if (!$result)
$this->_errors[] = Tools::displayError('An error occurred while updating object.').' <b>'.$this->table.'</b> ('.Db::getInstance()->getMsgError().')';
elseif ($this->postImage($object->id) AND !sizeof($this->_errors))
@@ -548,7 +546,6 @@ class AdminTaxRulesGroup extends AdminTab
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
Tools::redirectAdmin(self::$currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$token);
$this->updateAssoGroupShop($object->id);
$id_product = (int)Tools::getValue('id_product');
if ($id_product)
Tools::redirectAdmin('?tab=AdminCatalog&id_product='.$id_product.'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)$this->context->employee->id));
+2 -5
View File
@@ -274,12 +274,9 @@ echo '
$this->includeSubTab('display');
$assos_shop = Shop::getAssoTables();
if (isset($assos_shop[$this->table]) AND $assos_shop[$this->table]['type'] == 'shop')
{
echo '<br/>';
$this->displayAssoShop('key');
}
$this->displayAssoShop();
elseif (isset($assos_shop[$this->table]) AND $assos_shop[$this->table]['type'] == 'group_shop')
$this->displayAssoGroupShop();
$this->displayAssoShop('group_shop');
$this->displayOptionsList();
}
}
+2 -2
View File
@@ -70,10 +70,10 @@ 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 (Tools::isMultiShopActivated())
if (Shop::isMultiShopActivated())
{
echo '<label>'.$this->l('GroupShop association:').'</label><div class="margin-form">';
$this->displayAssoGroupShop();
$this->displayAssoShop('group_shop');
echo '</div>';
}
echo '