// Replace shop->addSqlAssociation() by static call
This commit is contained in:
+4
-10
@@ -114,14 +114,11 @@ class CountryCore extends ObjectModel
|
||||
* @param boolean $active return only active coutries
|
||||
* @return array Countries and corresponding zones
|
||||
*/
|
||||
public static function getCountries($id_lang, $active = false, $contain_states = null, Shop $shop = null)
|
||||
public static function getCountries($id_lang, $active = false, $contain_states = null)
|
||||
{
|
||||
if (!Validate::isBool($active))
|
||||
die(Tools::displayError());
|
||||
|
||||
if (!$shop)
|
||||
$shop = Context::getContext()->shop;
|
||||
|
||||
$states = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT s.*
|
||||
FROM `'._DB_PREFIX_.'state` s
|
||||
@@ -129,7 +126,7 @@ class CountryCore extends ObjectModel
|
||||
|
||||
$sql = 'SELECT cl.*,c.*, cl.`name` AS country, z.`name` AS zone
|
||||
FROM `'._DB_PREFIX_.'country` c
|
||||
'.$shop->addSqlAssociation('country', 'c', false).'
|
||||
'.Shop::addSqlAssociation('country', 'c', false).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'zone` z ON z.`id_zone` = c.`id_zone`
|
||||
WHERE 1'
|
||||
@@ -275,17 +272,14 @@ class CountryCore extends ObjectModel
|
||||
return Context::getContext()->country->id;
|
||||
}
|
||||
|
||||
public static function getCountriesByZoneId($id_zone, $id_lang, Shop $shop = null)
|
||||
public static function getCountriesByZoneId($id_zone, $id_lang)
|
||||
{
|
||||
if (empty($id_zone) || empty($id_lang))
|
||||
die(Tools::displayError());
|
||||
|
||||
if (!$shop)
|
||||
$shop = Context::getContext()->shop;
|
||||
|
||||
$sql = ' SELECT DISTINCT c.*, cl.*
|
||||
FROM `'._DB_PREFIX_.'country` c
|
||||
'.$shop->addSqlAssociation('country', 'c', false).'
|
||||
'.Shop::addSqlAssociation('country', 'c', false).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_country` = c.`id_country`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country`)
|
||||
WHERE (c.`id_zone` = '.(int)$id_zone.' OR s.`id_zone` = '.(int)$id_zone.')
|
||||
|
||||
Reference in New Issue
Block a user