[-] BO : Bug fixed related to #PSCFV-1354 - Specific price with multishop, groups/currencies/countries should vary in function of the selected shop

This commit is contained in:
fBrignoli
2012-05-16 15:51:22 +00:00
parent 604b572ed2
commit bf66f03fd7
5 changed files with 57 additions and 6 deletions
+11
View File
@@ -147,6 +147,17 @@ class CountryCore extends ObjectModel
return $countries;
}
public static function getCountriesByIdShop($id_shop, $id_lang)
{
$sql = 'SELECT *
FROM `'._DB_PREFIX_.'country` c
LEFT JOIN `'._DB_PREFIX_.'country_shop` cs ON (cs.`id_country`= c.`id_country`)
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$id_lang.')
WHERE `id_shop` = '.(int)$id_shop;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
}
/**
* Get a country ID with its iso code
*
+13
View File
@@ -212,6 +212,19 @@ class CurrencyCore extends ObjectModel
return $tab;
}
public static function getCurrenciesByIdShop($id_shop = 0)
{
$sql = 'SELECT *
FROM `'._DB_PREFIX_.'currency` c
LEFT JOIN `'._DB_PREFIX_.'currency_shop` cs ON (cs.`id_currency` = c.`id_currency`)
'.($id_shop != 0 ? ' WHERE cs.`id_shop` = '.(int)$id_shop : '').'
GROUP BY c.id_currency
ORDER BY `name` ASC';
return Db::getInstance()->executeS($sql);
}
public static function getPaymentCurrenciesSpecial($id_module, $id_shop = null)
{
if (is_null($id_shop))
+7 -1
View File
@@ -71,12 +71,18 @@ class GroupCore extends ObjectModel
protected $webserviceParameters = array();
public static function getGroups($id_lang)
public static function getGroups($id_lang, $id_shop = false)
{
$shop_criteria = '';
if ($id_shop)
$shop_criteria = 'LEFT JOIN `'._DB_PREFIX_.'group_shop` gs ON (gs.`id_group` = g.`id_group`)
WHERE `id_shop` = '.(int)$id_shop;
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT g.`id_group`, g.`reduction`, g.`price_display_method`, gl.`name`
FROM `'._DB_PREFIX_.'group` g
LEFT JOIN `'._DB_PREFIX_.'group_lang` AS gl ON (g.`id_group` = gl.`id_group` AND gl.`id_lang` = '.(int)$id_lang.')
'.$shop_criteria.'
ORDER BY g.`id_group` ASC');
}