Merge branch 'catalog'
Conflicts: core/lib/Thelia/Config/Resources/config.xml core/lib/Thelia/Config/Resources/routing/admin.xml core/lib/Thelia/Core/Template/Loop/Country.php core/lib/Thelia/Core/Template/Smarty/Plugins/Form.php core/lib/Thelia/Model/Country.php core/lib/Thelia/Model/Profile.php core/lib/Thelia/Model/ProfileQuery.php install/insert.sql install/thelia.sql local/config/schema.xml
This commit is contained in:
@@ -8,7 +8,9 @@ use Propel\Runtime\Propel;
|
||||
use Thelia\Core\Event\Country\CountryEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Base\Country as BaseCountry;
|
||||
|
||||
use Thelia\Model\Map\CountryTableMap;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
|
||||
class Country extends BaseCountry
|
||||
{
|
||||
@@ -79,4 +81,31 @@ class Country extends BaseCountry
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_DELETECOUNTRY, new CountryEvent($this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the default country
|
||||
*
|
||||
* @throws LogicException if no default country is defined
|
||||
*/
|
||||
public static function getDefaultCountry() {
|
||||
$dc = CountryQuery::create()->findOneByByDefault(true);
|
||||
|
||||
if ($dc == null)
|
||||
throw new \LogicException(Translator::getInstance()->trans("Cannot find a default country. Please define one."));
|
||||
|
||||
return $dc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the shop country
|
||||
*
|
||||
* @throws LogicException if no shop country is defined
|
||||
*/
|
||||
public static function getShopLocation() {
|
||||
$dc = CountryQuery::create()->findOneByShopCountry(true);
|
||||
|
||||
if ($dc == null)
|
||||
throw new \LogicException(Translator::getInstance()->trans("Cannot find the shop country. Please select a shop country."));
|
||||
|
||||
return $dc;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user