@@ -303,6 +303,10 @@ |
||
303 | 303 | return self::$_get_real_country_cache[$cacheKey]; |
304 | 304 | } |
305 | 305 | |
306 | + /** |
|
307 | + * @param string $countryOrCountryCodeA |
|
308 | + * @param string $countryOrCountryCodeB |
|
309 | + */ |
|
306 | 310 | public static function countries_belong_to_same_group($countryOrCountryCodeA, $countryOrCountryCodeB) |
307 | 311 | { |
308 | 312 | $countryA = EcommerceCountry::get_country_from_mixed_var($countryOrCountryCodeA); |
@@ -168,9 +168,9 @@ |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
171 | - * checks if the country has a distributor |
|
172 | - * and returns the primary country for the distributor. |
|
173 | - * If not, returns the default country. |
|
171 | + * checks if the country has a distributor |
|
172 | + * and returns the primary country for the distributor. |
|
173 | + * If not, returns the default country. |
|
174 | 174 | * |
175 | 175 | * @return EcommerceCountry |
176 | 176 | * |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | 'Root.FAQPage', |
89 | 89 | new LiteralField( |
90 | 90 | "FAQPageExplanation", |
91 | - "<p class=\"message warning\">FAQ information can only be added to the main country for a ". _t('Distributor.SINGULAR_NAME', 'Distributor') ."</p>" |
|
91 | + "<p class=\"message warning\">FAQ information can only be added to the main country for a "._t('Distributor.SINGULAR_NAME', 'Distributor')."</p>" |
|
92 | 92 | ) |
93 | 93 | ); |
94 | 94 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $originalCountry = $country; |
212 | 212 | |
213 | 213 | //no country provided |
214 | - if (! $country) { |
|
214 | + if (!$country) { |
|
215 | 215 | $urlCountryCode = CountryPrice_Translation::get_country_url_provider()->CurrentCountrySegment(); |
216 | 216 | |
217 | 217 | // 2. CHECK WHAT THE SYSTEM THINKS THE COUNTRY CHOULD BE |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | //if we still dont have a country then we use the standard e-commerce methods ... |
229 | - if (! $countryCode) { |
|
229 | + if (!$countryCode) { |
|
230 | 230 | $countryCode = EcommerceCountry::get_country(); |
231 | 231 | } |
232 | 232 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | if ( |
247 | 247 | ($country && $country->Code !== $urlCountryCode) |
248 | 248 | || |
249 | - ! $country |
|
249 | + !$country |
|
250 | 250 | |
251 | 251 | ) { |
252 | 252 | $country = DataObject::get_one('EcommerceCountry', ['Code' => $urlCountryCode]); |
@@ -307,17 +307,17 @@ discard block |
||
307 | 307 | { |
308 | 308 | $countryA = EcommerceCountry::get_country_from_mixed_var($countryOrCountryCodeA); |
309 | 309 | $countryB = EcommerceCountry::get_country_from_mixed_var($countryOrCountryCodeB); |
310 | - if($countryA && $countryB) { |
|
311 | - if($countryA->ID === $countryB->ID) { |
|
310 | + if ($countryA && $countryB) { |
|
311 | + if ($countryA->ID === $countryB->ID) { |
|
312 | 312 | return true; |
313 | 313 | } |
314 | - if($countryA->AlwaysTheSameAsID === $countryB->ID) { |
|
314 | + if ($countryA->AlwaysTheSameAsID === $countryB->ID) { |
|
315 | 315 | return true; |
316 | 316 | } |
317 | - if($countryA->ID === $countryB->AlwaysTheSameAsID) { |
|
317 | + if ($countryA->ID === $countryB->AlwaysTheSameAsID) { |
|
318 | 318 | return true; |
319 | 319 | } |
320 | - if($countryA->AlwaysTheSameAsID && $countryA->AlwaysTheSameAsID === $countryB->AlwaysTheSameAsID) { |
|
320 | + if ($countryA->AlwaysTheSameAsID && $countryA->AlwaysTheSameAsID === $countryB->AlwaysTheSameAsID) { |
|
321 | 321 | return true; |
322 | 322 | } |
323 | 323 | } |
@@ -333,9 +333,9 @@ discard block |
||
333 | 333 | public static function get_backup_country() |
334 | 334 | { |
335 | 335 | $obj = EcommerceCountry::get()->filter(array("IsBackupCountry" => true))->first(); |
336 | - if (! $obj) { |
|
336 | + if (!$obj) { |
|
337 | 337 | $obj = EcommerceCountry::get()->filter(array("Code" => EcommerceConfig::get('EcommerceCountry', 'default_country_code')))->first(); |
338 | - if (! $obj) { |
|
338 | + if (!$obj) { |
|
339 | 339 | $obj = EcommerceCountry::get()->first(); |
340 | 340 | } |
341 | 341 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $newCountryCode = strtoupper($newCountryCode); |
48 | 48 | $o = Shoppingcart::current_order(); |
49 | - if($o && $o->exists()) { |
|
49 | + if ($o && $o->exists()) { |
|
50 | 50 | $orderCountry = $o->getCountry(); |
51 | 51 | if ($orderCountry === $newCountryCode || CountryPrice_EcommerceCountry::countries_belong_to_same_group($orderCountry, $newCountryCode)) { |
52 | 52 | //nothing to see here, please move on! |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | //redirect now |
92 | 92 | if (isset($_GET['force']) && $_GET['force']) { |
93 | - return $this->redirect($this->Link($newCountryCode) . '?force-back-home'); |
|
93 | + return $this->redirect($this->Link($newCountryCode).'?force-back-home'); |
|
94 | 94 | } |
95 | 95 | if (isset($_GET['force-back-home']) && $_GET['force-back-home']) { |
96 | 96 | return $this->redirect(Director::baseURL('/')); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $action |
112 | 112 | ); |
113 | 113 | |
114 | - return $link . '/'; |
|
114 | + return $link.'/'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | |
166 | 166 | $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : ''; |
167 | 167 | |
168 | - $query = empty($query) ? '' : '?'. http_build_query($query); |
|
168 | + $query = empty($query) ? '' : '?'.http_build_query($query); |
|
169 | 169 | $newURL = |
170 | - $parsedUrl['scheme'] . |
|
171 | - '://' . |
|
170 | + $parsedUrl['scheme']. |
|
171 | + '://'. |
|
172 | 172 | Controller::join_links( |
173 | 173 | $parsedUrl['host'], |
174 | 174 | $parsedUrl['path'] |