// 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
+6 -28
View File
@@ -691,37 +691,15 @@ class ShopCore extends ObjectModel
}
/**
* Generate a sweet HTML list for shop selection
*
* @return string
* @return bool Return true if there is more than one shop
*/
public static function generateHtmlList()
public static function isMultiShopActivated()
{
$tree = Shop::getTree();
// Get default value
list($shopID, $shopGroupID) = Shop::getContext();
if ($shopID)
$value = 's-'.$shopID;
else if ($shopGroupID)
$value = 'g-'.$shopGroupID;
else
$value = '';
static $total = null;
// 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;
if (is_null($total))
$total = Shop::getTotalShops(true);
return ($total > 1) ? true : false;
}
public function copyShopData($old_id, $tables_import = false, $deleted = false)