| @@ 1474-1486 (lines=13) @@ | ||
| 1471 | * @param $shop Shopware\Models\Shop\Shop |
|
| 1472 | * @return int|null |
|
| 1473 | */ |
|
| 1474 | public function getCountryByShop($shop) |
|
| 1475 | { |
|
| 1476 | $locale = $shop->getLocale()->getLocale(); |
|
| 1477 | $this->klarnaLog("Entering Bootstrap::getCountryByShop", 3); |
|
| 1478 | $locale = explode('_', $locale); |
|
| 1479 | $locale = isset($locale[1]) ? $locale[1] : $locale[0]; |
|
| 1480 | $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale,3); |
|
| 1481 | $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?'; |
|
| 1482 | $countryId = Shopware()->Db()->fetchOne($sql, array($locale)); |
|
| 1483 | $countryId = ($countryId) ? (int)$countryId : null; |
|
| 1484 | ||
| 1485 | return $countryId; |
|
| 1486 | } |
|
| 1487 | ||
| 1488 | /** |
|
| 1489 | * Get user country by country id |
|
| @@ 356-368 (lines=13) @@ | ||
| 353 | * @param $shop Shopware\Models\Shop\Shop |
|
| 354 | * @return int|null |
|
| 355 | */ |
|
| 356 | public function getCountryByShop($shop) |
|
| 357 | { |
|
| 358 | $locale = $shop->getLocale()->getLocale(); |
|
| 359 | $this->plugin->klarnaLog("Entering Bootstrap::getCountryByShop", 3); |
|
| 360 | $locale = explode('_', $locale); |
|
| 361 | $locale = isset($locale[1]) ? $locale[1] : $locale[0]; |
|
| 362 | $this->plugin->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale,3); |
|
| 363 | $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?'; |
|
| 364 | $countryId = Shopware()->Db()->fetchOne($sql, array($locale)); |
|
| 365 | $countryId = ($countryId) ? (int)$countryId : null; |
|
| 366 | ||
| 367 | return $countryId; |
|
| 368 | } |
|
| 369 | ||
| 370 | /** |
|
| 371 | * Add voucher to cart |
|