@@ -121,19 +121,31 @@ public function hasProductInCart(int $product_id, array $option = [], int $subsc
121121 }
122122
123123 public function getCountry (int $ country_id ): array {
124- $ query = $ this ->db ->query ("SELECT *, c.name FROM ` " . DB_PREFIX . "country` c LEFT JOIN ` " . DB_PREFIX . "address_format` af ON (`c`.`address_format_id` = `af`.`address_format_id`) WHERE `c`.`country_id` = ' " . (int )$ country_id . "' AND `c`.`status` = '1' " );
125-
124+ if (version_compare (VERSION , '4.1.0.1 ' , '>= ' )) {
125+ $ query = $ this ->db ->query ("SELECT *, cd.name FROM " . DB_PREFIX . "country c LEFT JOIN " . DB_PREFIX . "country_description cd ON (c.country_id = cd.country_id) LEFT JOIN " . DB_PREFIX . "address_format af ON (c.address_format_id = af.address_format_id) WHERE c.country_id = ' " . (int )$ country_id . "' AND cd.language_id = ' " . (int )$ this ->config ->get ('config_language_id ' ) . "' AND c.status = '1' " );
126+ } else {
127+ $ query = $ this ->db ->query ("SELECT *, c.name FROM " . DB_PREFIX . "country c LEFT JOIN " . DB_PREFIX . "address_format af ON (c.address_format_id = af.address_format_id) WHERE c.country_id = ' " . (int )$ country_id . "' AND c.status = '1' " );
128+ }
129+
126130 return $ query ->row ;
127131 }
128132
129133 public function getCountryByCode (string $ code ): array {
130- $ query = $ this ->db ->query ("SELECT *, c.name FROM " . DB_PREFIX . "country c LEFT JOIN " . DB_PREFIX . "address_format af ON (c.address_format_id = af.address_format_id) WHERE c.iso_code_2 = ' " . $ this ->db ->escape ($ code ) . "' AND c.status = '1' " );
134+ if (version_compare (VERSION , '4.1.0.1 ' , '>= ' )) {
135+ $ query = $ this ->db ->query ("SELECT *, cd.name FROM " . DB_PREFIX . "country c LEFT JOIN " . DB_PREFIX . "country_description cd ON (c.country_id = cd.country_id) LEFT JOIN " . DB_PREFIX . "address_format af ON (c.address_format_id = af.address_format_id) WHERE c.iso_code_2 = ' " . $ this ->db ->escape ($ code ) . "' AND cd.language_id = ' " . (int )$ this ->config ->get ('config_language_id ' ) . "' AND c.status = '1' " );
136+ } else {
137+ $ query = $ this ->db ->query ("SELECT *, c.name FROM " . DB_PREFIX . "country c LEFT JOIN " . DB_PREFIX . "address_format af ON (c.address_format_id = af.address_format_id) WHERE c.iso_code_2 = ' " . $ this ->db ->escape ($ code ) . "' AND c.status = '1' " );
138+ }
131139
132140 return $ query ->row ;
133141 }
134142
135143 public function getZoneByCode (int $ country_id , string $ code ): array {
136- $ query = $ this ->db ->query ("SELECT * FROM " . DB_PREFIX . "zone WHERE country_id = ' " . (int )$ country_id . "' AND (code = ' " . $ this ->db ->escape ($ code ) . "' OR name = ' " . $ this ->db ->escape ($ code ) . "') AND status = '1' " );
144+ if (version_compare (VERSION , '4.1.0.1 ' , '>= ' )) {
145+ $ query = $ this ->db ->query ("SELECT * FROM " . DB_PREFIX . "zone z LEFT JOIN " . DB_PREFIX . "zone_description zd ON (z.zone_id = zd.zone_id) WHERE z.country_id = ' " . (int )$ country_id . "' AND zd.language_id = ' " . (int )$ this ->config ->get ('config_language_id ' ) . "' AND (z.code = ' " . $ this ->db ->escape ($ code ) . "' OR zd.name = ' " . $ this ->db ->escape ($ code ) . "') AND z.status = '1' " );
146+ } else {
147+ $ query = $ this ->db ->query ("SELECT * FROM " . DB_PREFIX . "zone z WHERE z.country_id = ' " . (int )$ country_id . "' AND (z.code = ' " . $ this ->db ->escape ($ code ) . "' OR z.name = ' " . $ this ->db ->escape ($ code ) . "') AND z.status = '1' " );
148+ }
137149
138150 return $ query ->row ;
139151 }
0 commit comments