+ * $query->filterByShopCountry(true); // WHERE shop_country = true
+ * $query->filterByShopCountry('yes'); // WHERE shop_country = true
+ *
+ *
+ * @param boolean|string $shopCountry The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildCountryQuery The current query, for fluid interface
+ */
+ public function filterByShopCountry($shopCountry = null, $comparison = null)
+ {
+ if (is_string($shopCountry)) {
+ $shop_country = in_array(strtolower($shopCountry), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(CountryTableMap::SHOP_COUNTRY, $shopCountry, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Base/ProductPrice.php b/core/lib/Thelia/Model/Base/ProductPrice.php
index dc177ad1b..363244e07 100644
--- a/core/lib/Thelia/Model/Base/ProductPrice.php
+++ b/core/lib/Thelia/Model/Base/ProductPrice.php
@@ -82,6 +82,13 @@ abstract class ProductPrice implements ActiveRecordInterface
*/
protected $promo_price;
+ /**
+ * The value for the from_default_currency field.
+ * Note: this column has a database default value of: false
+ * @var boolean
+ */
+ protected $from_default_currency;
+
/**
* The value for the created_at field.
* @var string
@@ -112,11 +119,24 @@ abstract class ProductPrice implements ActiveRecordInterface
*/
protected $alreadyInSave = false;
+ /**
+ * Applies default values to this object.
+ * This method should be called from the object's constructor (or
+ * equivalent initialization method).
+ * @see __construct()
+ */
+ public function applyDefaultValues()
+ {
+ $this->from_default_currency = false;
+ }
+
/**
* Initializes internal state of Thelia\Model\Base\ProductPrice object.
+ * @see applyDefaults()
*/
public function __construct()
{
+ $this->applyDefaultValues();
}
/**
@@ -414,6 +434,17 @@ abstract class ProductPrice implements ActiveRecordInterface
return $this->promo_price;
}
+ /**
+ * Get the [from_default_currency] column value.
+ *
+ * @return boolean
+ */
+ public function getFromDefaultCurrency()
+ {
+
+ return $this->from_default_currency;
+ }
+
/**
* Get the [optionally formatted] temporal [created_at] column value.
*
@@ -546,6 +577,35 @@ abstract class ProductPrice implements ActiveRecordInterface
return $this;
} // setPromoPrice()
+ /**
+ * Sets the value of the [from_default_currency] column.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ *
+ * @param boolean|integer|string $v The new value
+ * @return \Thelia\Model\ProductPrice The current object (for fluent API support)
+ */
+ public function setFromDefaultCurrency($v)
+ {
+ if ($v !== null) {
+ if (is_string($v)) {
+ $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ } else {
+ $v = (boolean) $v;
+ }
+ }
+
+ if ($this->from_default_currency !== $v) {
+ $this->from_default_currency = $v;
+ $this->modifiedColumns[] = ProductPriceTableMap::FROM_DEFAULT_CURRENCY;
+ }
+
+
+ return $this;
+ } // setFromDefaultCurrency()
+
/**
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
*
@@ -598,6 +658,10 @@ abstract class ProductPrice implements ActiveRecordInterface
*/
public function hasOnlyDefaultValues()
{
+ if ($this->from_default_currency !== false) {
+ return false;
+ }
+
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
@@ -637,13 +701,16 @@ abstract class ProductPrice implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ProductPriceTableMap::translateFieldName('PromoPrice', TableMap::TYPE_PHPNAME, $indexType)];
$this->promo_price = (null !== $col) ? (double) $col : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductPriceTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : ProductPriceTableMap::translateFieldName('FromDefaultCurrency', TableMap::TYPE_PHPNAME, $indexType)];
+ $this->from_default_currency = (null !== $col) ? (boolean) $col : null;
+
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductPriceTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
- $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductPriceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
+ $col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductPriceTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
if ($col === '0000-00-00 00:00:00') {
$col = null;
}
@@ -656,7 +723,7 @@ abstract class ProductPrice implements ActiveRecordInterface
$this->ensureConsistency();
}
- return $startcol + 6; // 6 = ProductPriceTableMap::NUM_HYDRATE_COLUMNS.
+ return $startcol + 7; // 7 = ProductPriceTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductPrice object", 0, $e);
@@ -911,6 +978,9 @@ abstract class ProductPrice implements ActiveRecordInterface
if ($this->isColumnModified(ProductPriceTableMap::PROMO_PRICE)) {
$modifiedColumns[':p' . $index++] = 'PROMO_PRICE';
}
+ if ($this->isColumnModified(ProductPriceTableMap::FROM_DEFAULT_CURRENCY)) {
+ $modifiedColumns[':p' . $index++] = 'FROM_DEFAULT_CURRENCY';
+ }
if ($this->isColumnModified(ProductPriceTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
}
@@ -940,6 +1010,9 @@ abstract class ProductPrice implements ActiveRecordInterface
case 'PROMO_PRICE':
$stmt->bindValue($identifier, $this->promo_price, PDO::PARAM_STR);
break;
+ case 'FROM_DEFAULT_CURRENCY':
+ $stmt->bindValue($identifier, (int) $this->from_default_currency, PDO::PARAM_INT);
+ break;
case 'CREATED_AT':
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
break;
@@ -1014,9 +1087,12 @@ abstract class ProductPrice implements ActiveRecordInterface
return $this->getPromoPrice();
break;
case 4:
- return $this->getCreatedAt();
+ return $this->getFromDefaultCurrency();
break;
case 5:
+ return $this->getCreatedAt();
+ break;
+ case 6:
return $this->getUpdatedAt();
break;
default:
@@ -1052,8 +1128,9 @@ abstract class ProductPrice implements ActiveRecordInterface
$keys[1] => $this->getCurrencyId(),
$keys[2] => $this->getPrice(),
$keys[3] => $this->getPromoPrice(),
- $keys[4] => $this->getCreatedAt(),
- $keys[5] => $this->getUpdatedAt(),
+ $keys[4] => $this->getFromDefaultCurrency(),
+ $keys[5] => $this->getCreatedAt(),
+ $keys[6] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1114,9 +1191,12 @@ abstract class ProductPrice implements ActiveRecordInterface
$this->setPromoPrice($value);
break;
case 4:
- $this->setCreatedAt($value);
+ $this->setFromDefaultCurrency($value);
break;
case 5:
+ $this->setCreatedAt($value);
+ break;
+ case 6:
$this->setUpdatedAt($value);
break;
} // switch()
@@ -1147,8 +1227,9 @@ abstract class ProductPrice implements ActiveRecordInterface
if (array_key_exists($keys[1], $arr)) $this->setCurrencyId($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setPrice($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setPromoPrice($arr[$keys[3]]);
- if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]);
- if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]);
+ if (array_key_exists($keys[4], $arr)) $this->setFromDefaultCurrency($arr[$keys[4]]);
+ if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
+ if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
}
/**
@@ -1164,6 +1245,7 @@ abstract class ProductPrice implements ActiveRecordInterface
if ($this->isColumnModified(ProductPriceTableMap::CURRENCY_ID)) $criteria->add(ProductPriceTableMap::CURRENCY_ID, $this->currency_id);
if ($this->isColumnModified(ProductPriceTableMap::PRICE)) $criteria->add(ProductPriceTableMap::PRICE, $this->price);
if ($this->isColumnModified(ProductPriceTableMap::PROMO_PRICE)) $criteria->add(ProductPriceTableMap::PROMO_PRICE, $this->promo_price);
+ if ($this->isColumnModified(ProductPriceTableMap::FROM_DEFAULT_CURRENCY)) $criteria->add(ProductPriceTableMap::FROM_DEFAULT_CURRENCY, $this->from_default_currency);
if ($this->isColumnModified(ProductPriceTableMap::CREATED_AT)) $criteria->add(ProductPriceTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ProductPriceTableMap::UPDATED_AT)) $criteria->add(ProductPriceTableMap::UPDATED_AT, $this->updated_at);
@@ -1240,6 +1322,7 @@ abstract class ProductPrice implements ActiveRecordInterface
$copyObj->setCurrencyId($this->getCurrencyId());
$copyObj->setPrice($this->getPrice());
$copyObj->setPromoPrice($this->getPromoPrice());
+ $copyObj->setFromDefaultCurrency($this->getFromDefaultCurrency());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($makeNew) {
@@ -1380,10 +1463,12 @@ abstract class ProductPrice implements ActiveRecordInterface
$this->currency_id = null;
$this->price = null;
$this->promo_price = null;
+ $this->from_default_currency = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
+ $this->applyDefaultValues();
$this->resetModified();
$this->setNew(true);
$this->setDeleted(false);
diff --git a/core/lib/Thelia/Model/Base/ProductPriceQuery.php b/core/lib/Thelia/Model/Base/ProductPriceQuery.php
index 9790d00ef..1ea364459 100644
--- a/core/lib/Thelia/Model/Base/ProductPriceQuery.php
+++ b/core/lib/Thelia/Model/Base/ProductPriceQuery.php
@@ -25,6 +25,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
* @method ChildProductPriceQuery orderByCurrencyId($order = Criteria::ASC) Order by the currency_id column
* @method ChildProductPriceQuery orderByPrice($order = Criteria::ASC) Order by the price column
* @method ChildProductPriceQuery orderByPromoPrice($order = Criteria::ASC) Order by the promo_price column
+ * @method ChildProductPriceQuery orderByFromDefaultCurrency($order = Criteria::ASC) Order by the from_default_currency column
* @method ChildProductPriceQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildProductPriceQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
@@ -32,6 +33,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
* @method ChildProductPriceQuery groupByCurrencyId() Group by the currency_id column
* @method ChildProductPriceQuery groupByPrice() Group by the price column
* @method ChildProductPriceQuery groupByPromoPrice() Group by the promo_price column
+ * @method ChildProductPriceQuery groupByFromDefaultCurrency() Group by the from_default_currency column
* @method ChildProductPriceQuery groupByCreatedAt() Group by the created_at column
* @method ChildProductPriceQuery groupByUpdatedAt() Group by the updated_at column
*
@@ -54,6 +56,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
* @method ChildProductPrice findOneByCurrencyId(int $currency_id) Return the first ChildProductPrice filtered by the currency_id column
* @method ChildProductPrice findOneByPrice(double $price) Return the first ChildProductPrice filtered by the price column
* @method ChildProductPrice findOneByPromoPrice(double $promo_price) Return the first ChildProductPrice filtered by the promo_price column
+ * @method ChildProductPrice findOneByFromDefaultCurrency(boolean $from_default_currency) Return the first ChildProductPrice filtered by the from_default_currency column
* @method ChildProductPrice findOneByCreatedAt(string $created_at) Return the first ChildProductPrice filtered by the created_at column
* @method ChildProductPrice findOneByUpdatedAt(string $updated_at) Return the first ChildProductPrice filtered by the updated_at column
*
@@ -61,6 +64,7 @@ use Thelia\Model\Map\ProductPriceTableMap;
* @method array findByCurrencyId(int $currency_id) Return ChildProductPrice objects filtered by the currency_id column
* @method array findByPrice(double $price) Return ChildProductPrice objects filtered by the price column
* @method array findByPromoPrice(double $promo_price) Return ChildProductPrice objects filtered by the promo_price column
+ * @method array findByFromDefaultCurrency(boolean $from_default_currency) Return ChildProductPrice objects filtered by the from_default_currency column
* @method array findByCreatedAt(string $created_at) Return ChildProductPrice objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildProductPrice objects filtered by the updated_at column
*
@@ -151,7 +155,7 @@ abstract class ProductPriceQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
- $sql = 'SELECT PRODUCT_SALE_ELEMENTS_ID, CURRENCY_ID, PRICE, PROMO_PRICE, CREATED_AT, UPDATED_AT FROM product_price WHERE PRODUCT_SALE_ELEMENTS_ID = :p0 AND CURRENCY_ID = :p1';
+ $sql = 'SELECT PRODUCT_SALE_ELEMENTS_ID, CURRENCY_ID, PRICE, PROMO_PRICE, FROM_DEFAULT_CURRENCY, CREATED_AT, UPDATED_AT FROM product_price WHERE PRODUCT_SALE_ELEMENTS_ID = :p0 AND CURRENCY_ID = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -420,6 +424,33 @@ abstract class ProductPriceQuery extends ModelCriteria
return $this->addUsingAlias(ProductPriceTableMap::PROMO_PRICE, $promoPrice, $comparison);
}
+ /**
+ * Filter the query on the from_default_currency column
+ *
+ * Example usage:
+ *
+ * $query->filterByFromDefaultCurrency(true); // WHERE from_default_currency = true
+ * $query->filterByFromDefaultCurrency('yes'); // WHERE from_default_currency = true
+ *
+ *
+ * @param boolean|string $fromDefaultCurrency The value to use as filter.
+ * Non-boolean arguments are converted using the following rules:
+ * * 1, '1', 'true', 'on', and 'yes' are converted to boolean true
+ * * 0, '0', 'false', 'off', and 'no' are converted to boolean false
+ * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
+ * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
+ *
+ * @return ChildProductPriceQuery The current query, for fluid interface
+ */
+ public function filterByFromDefaultCurrency($fromDefaultCurrency = null, $comparison = null)
+ {
+ if (is_string($fromDefaultCurrency)) {
+ $from_default_currency = in_array(strtolower($fromDefaultCurrency), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
+ }
+
+ return $this->addUsingAlias(ProductPriceTableMap::FROM_DEFAULT_CURRENCY, $fromDefaultCurrency, $comparison);
+ }
+
/**
* Filter the query on the created_at column
*
diff --git a/core/lib/Thelia/Model/Country.php b/core/lib/Thelia/Model/Country.php
index d30f2d281..5646496da 100755
--- a/core/lib/Thelia/Model/Country.php
+++ b/core/lib/Thelia/Model/Country.php
@@ -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;
+ }
}
diff --git a/core/lib/Thelia/Model/Map/CountryTableMap.php b/core/lib/Thelia/Model/Map/CountryTableMap.php
index 752f2b34a..d1f1a8a18 100644
--- a/core/lib/Thelia/Model/Map/CountryTableMap.php
+++ b/core/lib/Thelia/Model/Map/CountryTableMap.php
@@ -57,7 +57,7 @@ class CountryTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 8;
+ const NUM_COLUMNS = 9;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class CountryTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 8;
+ const NUM_HYDRATE_COLUMNS = 9;
/**
* the column name for the ID field
@@ -99,6 +99,11 @@ class CountryTableMap extends TableMap
*/
const BY_DEFAULT = 'country.BY_DEFAULT';
+ /**
+ * the column name for the SHOP_COUNTRY field
+ */
+ const SHOP_COUNTRY = 'country.SHOP_COUNTRY';
+
/**
* the column name for the CREATED_AT field
*/
@@ -130,12 +135,12 @@ class CountryTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('Id', 'AreaId', 'Isocode', 'Isoalpha2', 'Isoalpha3', 'ByDefault', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'isocode', 'isoalpha2', 'isoalpha3', 'byDefault', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(CountryTableMap::ID, CountryTableMap::AREA_ID, CountryTableMap::ISOCODE, CountryTableMap::ISOALPHA2, CountryTableMap::ISOALPHA3, CountryTableMap::BY_DEFAULT, CountryTableMap::CREATED_AT, CountryTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'ISOCODE', 'ISOALPHA2', 'ISOALPHA3', 'BY_DEFAULT', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('id', 'area_id', 'isocode', 'isoalpha2', 'isoalpha3', 'by_default', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
+ self::TYPE_PHPNAME => array('Id', 'AreaId', 'Isocode', 'Isoalpha2', 'Isoalpha3', 'ByDefault', 'ShopCountry', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('id', 'areaId', 'isocode', 'isoalpha2', 'isoalpha3', 'byDefault', 'shopCountry', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(CountryTableMap::ID, CountryTableMap::AREA_ID, CountryTableMap::ISOCODE, CountryTableMap::ISOALPHA2, CountryTableMap::ISOALPHA3, CountryTableMap::BY_DEFAULT, CountryTableMap::SHOP_COUNTRY, CountryTableMap::CREATED_AT, CountryTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('ID', 'AREA_ID', 'ISOCODE', 'ISOALPHA2', 'ISOALPHA3', 'BY_DEFAULT', 'SHOP_COUNTRY', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('id', 'area_id', 'isocode', 'isoalpha2', 'isoalpha3', 'by_default', 'shop_country', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -145,12 +150,12 @@ class CountryTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'Isocode' => 2, 'Isoalpha2' => 3, 'Isoalpha3' => 4, 'ByDefault' => 5, 'CreatedAt' => 6, 'UpdatedAt' => 7, ),
- self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'byDefault' => 5, 'createdAt' => 6, 'updatedAt' => 7, ),
- self::TYPE_COLNAME => array(CountryTableMap::ID => 0, CountryTableMap::AREA_ID => 1, CountryTableMap::ISOCODE => 2, CountryTableMap::ISOALPHA2 => 3, CountryTableMap::ISOALPHA3 => 4, CountryTableMap::BY_DEFAULT => 5, CountryTableMap::CREATED_AT => 6, CountryTableMap::UPDATED_AT => 7, ),
- self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'ISOCODE' => 2, 'ISOALPHA2' => 3, 'ISOALPHA3' => 4, 'BY_DEFAULT' => 5, 'CREATED_AT' => 6, 'UPDATED_AT' => 7, ),
- self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'by_default' => 5, 'created_at' => 6, 'updated_at' => 7, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, )
+ self::TYPE_PHPNAME => array('Id' => 0, 'AreaId' => 1, 'Isocode' => 2, 'Isoalpha2' => 3, 'Isoalpha3' => 4, 'ByDefault' => 5, 'ShopCountry' => 6, 'CreatedAt' => 7, 'UpdatedAt' => 8, ),
+ self::TYPE_STUDLYPHPNAME => array('id' => 0, 'areaId' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'byDefault' => 5, 'shopCountry' => 6, 'createdAt' => 7, 'updatedAt' => 8, ),
+ self::TYPE_COLNAME => array(CountryTableMap::ID => 0, CountryTableMap::AREA_ID => 1, CountryTableMap::ISOCODE => 2, CountryTableMap::ISOALPHA2 => 3, CountryTableMap::ISOALPHA3 => 4, CountryTableMap::BY_DEFAULT => 5, CountryTableMap::SHOP_COUNTRY => 6, CountryTableMap::CREATED_AT => 7, CountryTableMap::UPDATED_AT => 8, ),
+ self::TYPE_RAW_COLNAME => array('ID' => 0, 'AREA_ID' => 1, 'ISOCODE' => 2, 'ISOALPHA2' => 3, 'ISOALPHA3' => 4, 'BY_DEFAULT' => 5, 'SHOP_COUNTRY' => 6, 'CREATED_AT' => 7, 'UPDATED_AT' => 8, ),
+ self::TYPE_FIELDNAME => array('id' => 0, 'area_id' => 1, 'isocode' => 2, 'isoalpha2' => 3, 'isoalpha3' => 4, 'by_default' => 5, 'shop_country' => 6, 'created_at' => 7, 'updated_at' => 8, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
@@ -174,7 +179,8 @@ class CountryTableMap extends TableMap
$this->addColumn('ISOCODE', 'Isocode', 'VARCHAR', true, 4, null);
$this->addColumn('ISOALPHA2', 'Isoalpha2', 'VARCHAR', false, 2, null);
$this->addColumn('ISOALPHA3', 'Isoalpha3', 'VARCHAR', false, 4, null);
- $this->addColumn('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, null);
+ $this->addColumn('BY_DEFAULT', 'ByDefault', 'TINYINT', false, null, 0);
+ $this->addColumn('SHOP_COUNTRY', 'ShopCountry', 'BOOLEAN', true, 1, false);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -358,6 +364,7 @@ class CountryTableMap extends TableMap
$criteria->addSelectColumn(CountryTableMap::ISOALPHA2);
$criteria->addSelectColumn(CountryTableMap::ISOALPHA3);
$criteria->addSelectColumn(CountryTableMap::BY_DEFAULT);
+ $criteria->addSelectColumn(CountryTableMap::SHOP_COUNTRY);
$criteria->addSelectColumn(CountryTableMap::CREATED_AT);
$criteria->addSelectColumn(CountryTableMap::UPDATED_AT);
} else {
@@ -367,6 +374,7 @@ class CountryTableMap extends TableMap
$criteria->addSelectColumn($alias . '.ISOALPHA2');
$criteria->addSelectColumn($alias . '.ISOALPHA3');
$criteria->addSelectColumn($alias . '.BY_DEFAULT');
+ $criteria->addSelectColumn($alias . '.SHOP_COUNTRY');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Map/ProductPriceTableMap.php b/core/lib/Thelia/Model/Map/ProductPriceTableMap.php
index 86a22b680..7a80d2e12 100644
--- a/core/lib/Thelia/Model/Map/ProductPriceTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProductPriceTableMap.php
@@ -57,7 +57,7 @@ class ProductPriceTableMap extends TableMap
/**
* The total number of columns
*/
- const NUM_COLUMNS = 6;
+ const NUM_COLUMNS = 7;
/**
* The number of lazy-loaded columns
@@ -67,7 +67,7 @@ class ProductPriceTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
- const NUM_HYDRATE_COLUMNS = 6;
+ const NUM_HYDRATE_COLUMNS = 7;
/**
* the column name for the PRODUCT_SALE_ELEMENTS_ID field
@@ -89,6 +89,11 @@ class ProductPriceTableMap extends TableMap
*/
const PROMO_PRICE = 'product_price.PROMO_PRICE';
+ /**
+ * the column name for the FROM_DEFAULT_CURRENCY field
+ */
+ const FROM_DEFAULT_CURRENCY = 'product_price.FROM_DEFAULT_CURRENCY';
+
/**
* the column name for the CREATED_AT field
*/
@@ -111,12 +116,12 @@ class ProductPriceTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
- self::TYPE_PHPNAME => array('ProductSaleElementsId', 'CurrencyId', 'Price', 'PromoPrice', 'CreatedAt', 'UpdatedAt', ),
- self::TYPE_STUDLYPHPNAME => array('productSaleElementsId', 'currencyId', 'price', 'promoPrice', 'createdAt', 'updatedAt', ),
- self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, ProductPriceTableMap::CURRENCY_ID, ProductPriceTableMap::PRICE, ProductPriceTableMap::PROMO_PRICE, ProductPriceTableMap::CREATED_AT, ProductPriceTableMap::UPDATED_AT, ),
- self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID', 'CURRENCY_ID', 'PRICE', 'PROMO_PRICE', 'CREATED_AT', 'UPDATED_AT', ),
- self::TYPE_FIELDNAME => array('product_sale_elements_id', 'currency_id', 'price', 'promo_price', 'created_at', 'updated_at', ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
+ self::TYPE_PHPNAME => array('ProductSaleElementsId', 'CurrencyId', 'Price', 'PromoPrice', 'FromDefaultCurrency', 'CreatedAt', 'UpdatedAt', ),
+ self::TYPE_STUDLYPHPNAME => array('productSaleElementsId', 'currencyId', 'price', 'promoPrice', 'fromDefaultCurrency', 'createdAt', 'updatedAt', ),
+ self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID, ProductPriceTableMap::CURRENCY_ID, ProductPriceTableMap::PRICE, ProductPriceTableMap::PROMO_PRICE, ProductPriceTableMap::FROM_DEFAULT_CURRENCY, ProductPriceTableMap::CREATED_AT, ProductPriceTableMap::UPDATED_AT, ),
+ self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID', 'CURRENCY_ID', 'PRICE', 'PROMO_PRICE', 'FROM_DEFAULT_CURRENCY', 'CREATED_AT', 'UPDATED_AT', ),
+ self::TYPE_FIELDNAME => array('product_sale_elements_id', 'currency_id', 'price', 'promo_price', 'from_default_currency', 'created_at', 'updated_at', ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
@@ -126,12 +131,12 @@ class ProductPriceTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
- self::TYPE_PHPNAME => array('ProductSaleElementsId' => 0, 'CurrencyId' => 1, 'Price' => 2, 'PromoPrice' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ),
- self::TYPE_STUDLYPHPNAME => array('productSaleElementsId' => 0, 'currencyId' => 1, 'price' => 2, 'promoPrice' => 3, 'createdAt' => 4, 'updatedAt' => 5, ),
- self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID => 0, ProductPriceTableMap::CURRENCY_ID => 1, ProductPriceTableMap::PRICE => 2, ProductPriceTableMap::PROMO_PRICE => 3, ProductPriceTableMap::CREATED_AT => 4, ProductPriceTableMap::UPDATED_AT => 5, ),
- self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID' => 0, 'CURRENCY_ID' => 1, 'PRICE' => 2, 'PROMO_PRICE' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ),
- self::TYPE_FIELDNAME => array('product_sale_elements_id' => 0, 'currency_id' => 1, 'price' => 2, 'promo_price' => 3, 'created_at' => 4, 'updated_at' => 5, ),
- self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, )
+ self::TYPE_PHPNAME => array('ProductSaleElementsId' => 0, 'CurrencyId' => 1, 'Price' => 2, 'PromoPrice' => 3, 'FromDefaultCurrency' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
+ self::TYPE_STUDLYPHPNAME => array('productSaleElementsId' => 0, 'currencyId' => 1, 'price' => 2, 'promoPrice' => 3, 'fromDefaultCurrency' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
+ self::TYPE_COLNAME => array(ProductPriceTableMap::PRODUCT_SALE_ELEMENTS_ID => 0, ProductPriceTableMap::CURRENCY_ID => 1, ProductPriceTableMap::PRICE => 2, ProductPriceTableMap::PROMO_PRICE => 3, ProductPriceTableMap::FROM_DEFAULT_CURRENCY => 4, ProductPriceTableMap::CREATED_AT => 5, ProductPriceTableMap::UPDATED_AT => 6, ),
+ self::TYPE_RAW_COLNAME => array('PRODUCT_SALE_ELEMENTS_ID' => 0, 'CURRENCY_ID' => 1, 'PRICE' => 2, 'PROMO_PRICE' => 3, 'FROM_DEFAULT_CURRENCY' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
+ self::TYPE_FIELDNAME => array('product_sale_elements_id' => 0, 'currency_id' => 1, 'price' => 2, 'promo_price' => 3, 'from_default_currency' => 4, 'created_at' => 5, 'updated_at' => 6, ),
+ self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
);
/**
@@ -154,6 +159,7 @@ class ProductPriceTableMap extends TableMap
$this->addForeignPrimaryKey('CURRENCY_ID', 'CurrencyId', 'INTEGER' , 'currency', 'ID', true, null, null);
$this->addColumn('PRICE', 'Price', 'FLOAT', true, null, null);
$this->addColumn('PROMO_PRICE', 'PromoPrice', 'FLOAT', false, null, null);
+ $this->addColumn('FROM_DEFAULT_CURRENCY', 'FromDefaultCurrency', 'BOOLEAN', true, 1, false);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
@@ -371,6 +377,7 @@ class ProductPriceTableMap extends TableMap
$criteria->addSelectColumn(ProductPriceTableMap::CURRENCY_ID);
$criteria->addSelectColumn(ProductPriceTableMap::PRICE);
$criteria->addSelectColumn(ProductPriceTableMap::PROMO_PRICE);
+ $criteria->addSelectColumn(ProductPriceTableMap::FROM_DEFAULT_CURRENCY);
$criteria->addSelectColumn(ProductPriceTableMap::CREATED_AT);
$criteria->addSelectColumn(ProductPriceTableMap::UPDATED_AT);
} else {
@@ -378,6 +385,7 @@ class ProductPriceTableMap extends TableMap
$criteria->addSelectColumn($alias . '.CURRENCY_ID');
$criteria->addSelectColumn($alias . '.PRICE');
$criteria->addSelectColumn($alias . '.PROMO_PRICE');
+ $criteria->addSelectColumn($alias . '.FROM_DEFAULT_CURRENCY');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
diff --git a/core/lib/Thelia/Model/Map/ProfileModuleTableMap.php b/core/lib/Thelia/Model/Map/ProfileModuleTableMap.php
index 2ed417f75..a0b17ba64 100644
--- a/core/lib/Thelia/Model/Map/ProfileModuleTableMap.php
+++ b/core/lib/Thelia/Model/Map/ProfileModuleTableMap.php
@@ -147,7 +147,7 @@ class ProfileModuleTableMap extends TableMap
// columns
$this->addForeignPrimaryKey('PROFILE_ID', 'ProfileId', 'INTEGER' , 'profile', 'ID', true, null, null);
$this->addForeignPrimaryKey('MODULE_ID', 'ModuleId', 'INTEGER' , 'module', 'ID', true, null, null);
- $this->addColumn('ACCESS', 'Access', 'INTEGER', true, null, 0);
+ $this->addColumn('ACCESS', 'Access', 'TINYINT', false, null, 0);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
diff --git a/core/lib/Thelia/Model/Product.php b/core/lib/Thelia/Model/Product.php
index f48f9e75e..5ec2abf4c 100755
--- a/core/lib/Thelia/Model/Product.php
+++ b/core/lib/Thelia/Model/Product.php
@@ -12,6 +12,7 @@ use Thelia\Core\Event\Product\ProductEvent;
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Propel;
use Thelia\Model\Map\ProductTableMap;
+use Thelia\Model\ProductSaleElementsQuery;
class Product extends BaseProduct
{
@@ -47,6 +48,20 @@ class Product extends BaseProduct
return $taxCalculator->load($this, $country)->getTaxedPrice($this->getRealLowestPrice());
}
+ /**
+ * Return the default PSE for this product.
+ */
+ public function getDefaultSaleElements() {
+ return ProductSaleElementsQuery::create()->filterByProductId($this->id)->filterByIsDefault(true)->find();
+ }
+
+ /**
+ * Return PSE count fir this product.
+ */
+ public function countSaleElements() {
+ return ProductSaleElementsQuery::create()->filterByProductId($this->id)->filterByIsDefault(true)->count();
+ }
+
/**
* @return the current default category ID for this product
*/
@@ -100,7 +115,7 @@ class Product extends BaseProduct
;
if ($productCategory == null || $productCategory->getCategoryId() != $defaultCategoryId) {
- exit;
+
// Delete the old default category
if ($productCategory !== null) $productCategory->delete();
@@ -131,10 +146,10 @@ class Product extends BaseProduct
$con = Propel::getWriteConnection(ProductTableMap::DATABASE_NAME);
$con->beginTransaction();
-
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEPRODUCT, new ProductEvent($this));
try {
+
// Create the product
$this->save($con);
@@ -146,29 +161,8 @@ class Product extends BaseProduct
$this->setTaxRuleId($taxRuleId);
- // Create an empty product sale element
- $sale_elements = new ProductSaleElements();
-
- $sale_elements
- ->setProduct($this)
- ->setRef($this->getRef())
- ->setPromo(0)
- ->setNewness(0)
- ->setWeight($baseWeight)
- ->setIsDefault(true)
- ->save($con)
- ;
-
- // Create an empty product price in the default currency
- $product_price = new ProductPrice();
-
- $product_price
- ->setProductSaleElements($sale_elements)
- ->setPromoPrice($basePrice)
- ->setPrice($basePrice)
- ->setCurrencyId($priceCurrencyId)
- ->save($con)
- ;
+ // Create the default product sale element of this product
+ $sale_elements = $this->createDefaultProductSaleElement($con, $baseWeight, $basePrice, $priceCurrencyId, true);
// Store all the stuff !
$con->commit();
@@ -183,6 +177,38 @@ class Product extends BaseProduct
}
}
+ /**
+ * Create a basic product sale element attached to this product.
+ */
+ public function createDefaultProductSaleElement(ConnectionInterface $con, $weight, $basePrice, $currencyId, $isDefault) {
+
+ // Create an empty product sale element
+ $sale_elements = new ProductSaleElements();
+
+ $sale_elements
+ ->setProduct($this)
+ ->setRef($this->getRef())
+ ->setPromo(0)
+ ->setNewness(0)
+ ->setWeight($weight)
+ ->setIsDefault($isDefault)
+ ->save($con)
+ ;
+
+ // Create an empty product price in the default currency
+ $product_price = new ProductPrice();
+
+ $product_price
+ ->setProductSaleElements($sale_elements)
+ ->setPromoPrice($basePrice)
+ ->setPrice($basePrice)
+ ->setCurrencyId($currencyId)
+ ->save($con)
+ ;
+
+ return $sale_elements;
+ }
+
/**
* Calculate next position relative to our default category
*/
diff --git a/core/lib/Thelia/Model/Profile.php b/core/lib/Thelia/Model/Profile.php
index 8f3a61edd..b140146f3 100644
--- a/core/lib/Thelia/Model/Profile.php
+++ b/core/lib/Thelia/Model/Profile.php
@@ -1,5 +1,4 @@
. */
+/* */
+/*************************************************************************************/
+
+namespace Thelia\Tools;
+
+use Symfony\Component\HttpFoundation\Request;
+
+class NumberFormat
+{
+ protected $request;
+
+ public function __construct(Request $request)
+ {
+ $this->request = $request;
+ }
+
+ public static function getInstance(Request $request)
+ {
+ return new NumberFormat($request);
+ }
+
+ public function format($number, $decimals = null, $decPoint = null, $thousandsSep = null)
+ {
+ $lang = $this->request->getSession()->getLang();
+
+ if ($decimals == null) $decimals = $lang->getDecimals();
+ if ($decPoint == null) $decPoint = $lang->getDecimalSeparator();
+ if ($thousandsSep == null) $thousandsSep = $lang->getThousandsSeparator();
+
+ return number_format($number, $decimals, $decPoint, $thousandsSep);
+ }
+}
\ No newline at end of file
diff --git a/install/insert.sql b/install/insert.sql
index 89454096b..bf9022df4 100755
--- a/install/insert.sql
+++ b/install/insert.sql
@@ -91,270 +91,271 @@ INSERT INTO `area` (`id`, `name`, `postage`, `created_at`, `updated_at`) VALUES
INSERT INTO `area_delivery_module` (`id`, `area_id`, `delivery_module_id`, `created_at`, `updated_at`) VALUES
(1, 1, 2, NOW(), NOW());
-INSERT INTO `country` (`id`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `by_default`, `created_at`, `updated_at`) VALUES
-(1, NULL, '4', 'AF', 'AFG', 0, NOW(), NOW()),
-(2, NULL, '710', 'ZA', 'ZAF', 0, NOW(), NOW()),
-(3, NULL, '8', 'AL', 'ALB', 0, NOW(), NOW()),
-(4, NULL, '12', 'DZ', 'DZA', 0, NOW(), NOW()),
-(5, NULL, '276', 'DE', 'DEU', 0, NOW(), NOW()),
-(6, NULL, '20', 'AD', 'AND', 0, NOW(), NOW()),
-(7, NULL, '24', 'AO', 'AGO', 0, NOW(), NOW()),
-(8, NULL, '28', 'AG', 'ATG', 0, NOW(), NOW()),
-(9, NULL, '682', 'SA', 'SAU', 0, NOW(), NOW()),
-(10, NULL, '32', 'AR', 'ARG', 0, NOW(), NOW()),
-(11, NULL, '51', 'AM', 'ARM', 0, NOW(), NOW()),
-(12, NULL, '36', 'AU', 'AUS', 0, NOW(), NOW()),
-(13, NULL, '40', 'AT', 'AUT', 0, NOW(), NOW()),
-(14, NULL, '31', 'AZ', 'AZE', 0, NOW(), NOW()),
-(15, NULL, '44', 'BS', 'BHS', 0, NOW(), NOW()),
-(16, NULL, '48', 'BR', 'BHR', 0, NOW(), NOW()),
-(17, NULL, '50', 'BD', 'BGD', 0, NOW(), NOW()),
-(18, NULL, '52', 'BB', 'BRB', 0, NOW(), NOW()),
-(19, NULL, '585', 'PW', 'PLW', 0, NOW(), NOW()),
-(20, NULL, '56', 'BE', 'BEL', 0, NOW(), NOW()),
-(21, NULL, '84', 'BL', 'BLZ', 0, NOW(), NOW()),
-(22, NULL, '204', 'BJ', 'BEN', 0, NOW(), NOW()),
-(23, NULL, '64', 'BT', 'BTN', 0, NOW(), NOW()),
-(24, NULL, '112', 'BY', 'BLR', 0, NOW(), NOW()),
-(25, NULL, '104', 'MM', 'MMR', 0, NOW(), NOW()),
-(26, NULL, '68', 'BO', 'BOL', 0, NOW(), NOW()),
-(27, NULL, '70', 'BA', 'BIH', 0, NOW(), NOW()),
-(28, NULL, '72', 'BW', 'BWA', 0, NOW(), NOW()),
-(29, NULL, '76', 'BR', 'BRA', 0, NOW(), NOW()),
-(30, NULL, '96', 'BN', 'BRN', 0, NOW(), NOW()),
-(31, NULL, '100', 'BG', 'BGR', 0, NOW(), NOW()),
-(32, NULL, '854', 'BF', 'BFA', 0, NOW(), NOW()),
-(33, NULL, '108', 'BI', 'BDI', 0, NOW(), NOW()),
-(34, NULL, '116', 'KH', 'KHM', 0, NOW(), NOW()),
-(35, NULL, '120', 'CM', 'CMR', 0, NOW(), NOW()),
-(37, NULL, '132', 'CV', 'CPV', 0, NOW(), NOW()),
-(38, NULL, '152', 'CL', 'CHL', 0, NOW(), NOW()),
-(39, NULL, '156', 'CN', 'CHN', 0, NOW(), NOW()),
-(40, NULL, '196', 'CY', 'CYP', 0, NOW(), NOW()),
-(41, NULL, '170', 'CO', 'COL', 0, NOW(), NOW()),
-(42, NULL, '174', 'KM', 'COM', 0, NOW(), NOW()),
-(43, NULL, '178', 'CG', 'COG', 0, NOW(), NOW()),
-(44, NULL, '184', 'CK', 'COK', 0, NOW(), NOW()),
-(45, NULL, '408', 'KP', 'PRK', 0, NOW(), NOW()),
-(46, NULL, '410', 'KR', 'KOR', 0, NOW(), NOW()),
-(47, NULL, '188', 'CR', 'CRI', 0, NOW(), NOW()),
-(48, NULL, '384', 'CI', 'CIV', 0, NOW(), NOW()),
-(49, NULL, '191', 'HR', 'HRV', 0, NOW(), NOW()),
-(50, NULL, '192', 'CU', 'CUB', 0, NOW(), NOW()),
-(51, NULL, '208', 'DK', 'DNK', 0, NOW(), NOW()),
-(52, NULL, '262', 'DJ', 'DJI', 0, NOW(), NOW()),
-(53, NULL, '212', 'DM', 'DMA', 0, NOW(), NOW()),
-(54, NULL, '818', 'EG', 'EGY', 0, NOW(), NOW()),
-(55, NULL, '784', 'AE', 'ARE', 0, NOW(), NOW()),
-(56, NULL, '218', 'EC', 'ECU', 0, NOW(), NOW()),
-(57, NULL, '232', 'ER', 'ERI', 0, NOW(), NOW()),
-(58, NULL, '724', 'ES', 'ESP', 0, NOW(), NOW()),
-(59, NULL, '233', 'EE', 'EST', 0, NOW(), NOW()),
-(61, NULL, '231', 'ET', 'ETH', 0, NOW(), NOW()),
-(62, NULL, '242', 'FJ', 'FJI', 0, NOW(), NOW()),
-(63, NULL, '246', 'FI', 'FIN', 0, NOW(), NOW()),
-(64, 1, '250', 'FR', 'FRA', 1, NOW(), NOW()),
-(65, NULL, '266', 'GA', 'GAB', 0, NOW(), NOW()),
-(66, NULL, '270', 'GM', 'GMB', 0, NOW(), NOW()),
-(67, NULL, '268', 'GE', 'GEO', 0, NOW(), NOW()),
-(68, NULL, '288', 'GH', 'GHA', 0, NOW(), NOW()),
-(69, NULL, '300', 'GR', 'GRC', 0, NOW(), NOW()),
-(70, NULL, '308', 'GD', 'GRD', 0, NOW(), NOW()),
-(71, NULL, '320', 'GT', 'GTM', 0, NOW(), NOW()),
-(72, NULL, '324', 'GN', 'GIN', 0, NOW(), NOW()),
-(73, NULL, '624', 'GW', 'GNB', 0, NOW(), NOW()),
-(74, NULL, '226', 'GQ', 'GNQ', 0, NOW(), NOW()),
-(75, NULL, '328', 'GY', 'GUY', 0, NOW(), NOW()),
-(76, NULL, '332', 'HT', 'HTI', 0, NOW(), NOW()),
-(77, NULL, '340', 'HN', 'HND', 0, NOW(), NOW()),
-(78, NULL, '348', 'HU', 'HUN', 0, NOW(), NOW()),
-(79, NULL, '356', 'IN', 'IND', 0, NOW(), NOW()),
-(80, NULL, '360', 'ID', 'IDN', 0, NOW(), NOW()),
-(81, NULL, '364', 'IR', 'IRN', 0, NOW(), NOW()),
-(82, NULL, '368', 'IQ', 'IRQ', 0, NOW(), NOW()),
-(83, NULL, '372', 'IE', 'IRL', 0, NOW(), NOW()),
-(84, NULL, '352', 'IS', 'ISL', 0, NOW(), NOW()),
-(85, NULL, '376', 'IL', 'ISR', 0, NOW(), NOW()),
-(86, NULL, '380', 'IT', 'ITA', 0, NOW(), NOW()),
-(87, NULL, '388', 'JM', 'JAM', 0, NOW(), NOW()),
-(88, NULL, '392', 'JP', 'JPN', 0, NOW(), NOW()),
-(89, NULL, '400', 'JO', 'JOR', 0, NOW(), NOW()),
-(90, NULL, '398', 'KZ', 'KAZ', 0, NOW(), NOW()),
-(91, NULL, '404', 'KE', 'KEN', 0, NOW(), NOW()),
-(92, NULL, '417', 'KG', 'KGZ', 0, NOW(), NOW()),
-(93, NULL, '296', 'KI', 'KIR', 0, NOW(), NOW()),
-(94, NULL, '414', 'KW', 'KWT', 0, NOW(), NOW()),
-(95, NULL, '418', 'LA', 'LAO', 0, NOW(), NOW()),
-(96, NULL, '426', 'LS', 'LSO', 0, NOW(), NOW()),
-(97, NULL, '428', 'LV', 'LVA', 0, NOW(), NOW()),
-(98, NULL, '422', 'LB', 'LBN', 0, NOW(), NOW()),
-(99, NULL, '430', 'LR', 'LBR', 0, NOW(), NOW()),
-(100, NULL, '343', 'LY', 'LBY', 0, NOW(), NOW()),
-(101, NULL, '438', 'LI', 'LIE', 0, NOW(), NOW()),
-(102, NULL, '440', 'LT', 'LTU', 0, NOW(), NOW()),
-(103, NULL, '442', 'LU', 'LUX', 0, NOW(), NOW()),
-(104, NULL, '807', 'MK', 'MKD', 0, NOW(), NOW()),
-(105, NULL, '450', 'MD', 'MDG', 0, NOW(), NOW()),
-(106, NULL, '458', 'MY', 'MYS', 0, NOW(), NOW()),
-(107, NULL, '454', 'MW', 'MWI', 0, NOW(), NOW()),
-(108, NULL, '462', 'MV', 'MDV', 0, NOW(), NOW()),
-(109, NULL, '466', 'ML', 'MLI', 0, NOW(), NOW()),
-(110, NULL, '470', 'MT', 'MLT', 0, NOW(), NOW()),
-(111, NULL, '504', 'MA', 'MAR', 0, NOW(), NOW()),
-(112, NULL, '584', 'MH', 'MHL', 0, NOW(), NOW()),
-(113, NULL, '480', 'MU', 'MUS', 0, NOW(), NOW()),
-(114, NULL, '478', 'MR', 'MRT', 0, NOW(), NOW()),
-(115, NULL, '484', 'MX', 'MEX', 0, NOW(), NOW()),
-(116, NULL, '583', 'FM', 'FSM', 0, NOW(), NOW()),
-(117, NULL, '498', 'MD', 'MDA', 0, NOW(), NOW()),
-(118, NULL, '492', 'MC', 'MCO', 0, NOW(), NOW()),
-(119, NULL, '496', 'MN', 'MNG', 0, NOW(), NOW()),
-(120, NULL, '508', 'MZ', 'MOZ', 0, NOW(), NOW()),
-(121, NULL, '516', 'NA', 'NAM', 0, NOW(), NOW()),
-(122, NULL, '520', 'NR', 'NRU', 0, NOW(), NOW()),
-(123, NULL, '524', 'NP', 'NPL', 0, NOW(), NOW()),
-(124, NULL, '558', 'NI', 'NIC', 0, NOW(), NOW()),
-(125, NULL, '562', 'NE', 'NER', 0, NOW(), NOW()),
-(126, NULL, '566', 'NG', 'NGA', 0, NOW(), NOW()),
-(127, NULL, '570', 'NU', 'NIU', 0, NOW(), NOW()),
-(128, NULL, '578', 'NO', 'NOR', 0, NOW(), NOW()),
-(129, NULL, '554', 'NZ', 'NZL', 0, NOW(), NOW()),
-(130, NULL, '512', 'OM', 'OMN', 0, NOW(), NOW()),
-(131, NULL, '800', 'UG', 'UGA', 0, NOW(), NOW()),
-(132, NULL, '860', 'UZ', 'UZB', 0, NOW(), NOW()),
-(133, NULL, '586', 'PK', 'PAK', 0, NOW(), NOW()),
-(134, NULL, '591', 'PA', 'PAN', 0, NOW(), NOW()),
-(135, NULL, '598', 'PG', 'PNG', 0, NOW(), NOW()),
-(136, NULL, '600', 'PY', 'PRY', 0, NOW(), NOW()),
-(137, NULL, '528', 'NL', 'NLD', 0, NOW(), NOW()),
-(138, NULL, '604', 'PE', 'PER', 0, NOW(), NOW()),
-(139, NULL, '608', 'PH', 'PHL', 0, NOW(), NOW()),
-(140, NULL, '616', 'PL', 'POL', 0, NOW(), NOW()),
-(141, NULL, '620', 'PT', 'PRT', 0, NOW(), NOW()),
-(142, NULL, '634', 'QA', 'QAT', 0, NOW(), NOW()),
-(143, NULL, '140', 'CF', 'CAF', 0, NOW(), NOW()),
-(144, NULL, '214', 'DO', 'DOM', 0, NOW(), NOW()),
-(145, NULL, '203', 'CZ', 'CZE', 0, NOW(), NOW()),
-(146, NULL, '642', 'RO', 'ROU', 0, NOW(), NOW()),
-(147, NULL, '826', 'GB', 'GBR', 0, NOW(), NOW()),
-(148, NULL, '643', 'RU', 'RUS', 0, NOW(), NOW()),
-(149, NULL, '646', 'RW', 'RWA', 0, NOW(), NOW()),
-(150, NULL, '659', 'KN', 'KNA', 0, NOW(), NOW()),
-(151, NULL, '662', 'LC', 'LCA', 0, NOW(), NOW()),
-(152, NULL, '674', 'SM', 'SMR', 0, NOW(), NOW()),
-(153, NULL, '670', 'VC', 'VCT', 0, NOW(), NOW()),
-(154, NULL, '90', 'SB', 'SLB', 0, NOW(), NOW()),
-(155, NULL, '222', 'SV', 'SLV', 0, NOW(), NOW()),
-(156, NULL, '882', 'WS', 'WSM', 0, NOW(), NOW()),
-(157, NULL, '678', 'ST', 'STP', 0, NOW(), NOW()),
-(158, NULL, '686', 'SN', 'SEN', 0, NOW(), NOW()),
-(159, NULL, '690', 'SC', 'SYC', 0, NOW(), NOW()),
-(160, NULL, '694', 'SL', 'SLE', 0, NOW(), NOW()),
-(161, NULL, '702', 'SG', 'SGP', 0, NOW(), NOW()),
-(162, NULL, '703', 'SK', 'SVK', 0, NOW(), NOW()),
-(163, NULL, '705', 'SI', 'SVN', 0, NOW(), NOW()),
-(164, NULL, '706', 'SO', 'SOM', 0, NOW(), NOW()),
-(165, NULL, '729', 'SD', 'SDN', 0, NOW(), NOW()),
-(166, NULL, '144', 'LK', 'LKA', 0, NOW(), NOW()),
-(167, NULL, '752', 'SE', 'SWE', 0, NOW(), NOW()),
-(168, NULL, '756', 'CH', 'CHE', 0, NOW(), NOW()),
-(169, NULL, '740', 'SR', 'SUR', 0, NOW(), NOW()),
-(170, NULL, '748', 'SZ', 'SWZ', 0, NOW(), NOW()),
-(171, NULL, '760', 'SY', 'SYR', 0, NOW(), NOW()),
-(172, NULL, '762', 'TJ', 'TJK', 0, NOW(), NOW()),
-(173, NULL, '834', 'TZ', 'TZA', 0, NOW(), NOW()),
-(174, NULL, '148', 'TD', 'TCD', 0, NOW(), NOW()),
-(175, NULL, '764', 'TH', 'THA', 0, NOW(), NOW()),
-(176, NULL, '768', 'TG', 'TGO', 0, NOW(), NOW()),
-(177, NULL, '776', 'TO', 'TON', 0, NOW(), NOW()),
-(178, NULL, '780', 'TT', 'TTO', 0, NOW(), NOW()),
-(179, NULL, '788', 'TN', 'TUN', 0, NOW(), NOW()),
-(180, NULL, '795', 'TM', 'TKM', 0, NOW(), NOW()),
-(181, NULL, '792', 'TR', 'TUR', 0, NOW(), NOW()),
-(182, NULL, '798', 'TV', 'TUV', 0, NOW(), NOW()),
-(183, NULL, '804', 'UA', 'UKR', 0, NOW(), NOW()),
-(184, NULL, '858', 'UY', 'URY', 0, NOW(), NOW()),
-(185, NULL, '336', 'VA', 'VAT', 0, NOW(), NOW()),
-(186, NULL, '548', 'VU', 'VUT', 0, NOW(), NOW()),
-(187, NULL, '862', 'VE', 'VEN', 0, NOW(), NOW()),
-(188, NULL, '704', 'VN', 'VNM', 0, NOW(), NOW()),
-(189, NULL, '887', 'YE', 'YEM', 0, NOW(), NOW()),
-(191, NULL, '180', 'CD', 'COD', 0, NOW(), NOW()),
-(192, NULL, '894', 'ZM', 'ZMB', 0, NOW(), NOW()),
-(193, NULL, '716', 'ZW', 'ZWE', 0, NOW(), NOW()),
-(196, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(197, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(198, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(199, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(200, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(201, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(202, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(203, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(204, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(205, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(206, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(207, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(208, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(209, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(210, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(211, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(212, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(213, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(214, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(215, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(216, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(217, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(218, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(219, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(220, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(221, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(222, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(223, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(224, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(225, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(226, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(227, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(228, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(229, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(230, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(231, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(232, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(233, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(234, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(235, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(236, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(237, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(238, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(239, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(240, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(241, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(242, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(243, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(244, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(245, NULL, '840', 'US', 'USA', 0, NOW(), NOW()),
-(246, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(247, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(248, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(249, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(250, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(251, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(252, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(253, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(254, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(255, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(256, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(257, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(258, NULL, '124', 'CA', 'CAN', 0, NOW(), NOW()),
-(259, NULL, '312', 'GP', 'GLP', 0, NOW(), NOW()),
-(260, NULL, '254', 'GF', 'GUF', 0, NOW(), NOW()),
-(261, NULL, '474', 'MQ', 'MTQ', 0, NOW(), NOW()),
-(262, NULL, '175', 'YT', 'MYT', 0, NOW(), NOW()),
-(263, NULL, '638', 'RE', 'REU', 0, NOW(), NOW()),
-(264, NULL, '666', 'PM', 'SPM', 0, NOW(), NOW()),
-(265, NULL, '540', 'NC', 'NCL', 0, NOW(), NOW()),
-(266, NULL, '258', 'PF', 'PYF', 0, NOW(), NOW()),
-(267, NULL, '876', 'WF', 'WLF', 0, NOW(), NOW()),
-(268, NULL, '840', 'US', 'USA', 0, NOW(), NOW());
+INSERT INTO `country` (`id`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `by_default`, `shop_country`, `created_at`, `updated_at`) VALUES
+(1, NULL, '4', 'AF', 'AFG', 0, 0, NOW(), NOW()),
+(2, NULL, '710', 'ZA', 'ZAF', 0, 0, NOW(), NOW()),
+(3, NULL, '8', 'AL', 'ALB', 0, 0, NOW(), NOW()),
+(4, NULL, '12', 'DZ', 'DZA', 0, 0, NOW(), NOW()),
+(5, NULL, '276', 'DE', 'DEU', 0, 0, NOW(), NOW()),
+(6, NULL, '20', 'AD', 'AND', 0, 0, NOW(), NOW()),
+(7, NULL, '24', 'AO', 'AGO', 0, 0, NOW(), NOW()),
+(8, NULL, '28', 'AG', 'ATG', 0, 0, NOW(), NOW()),
+(9, NULL, '682', 'SA', 'SAU', 0, 0, NOW(), NOW()),
+(10, NULL, '32', 'AR', 'ARG', 0, 0, NOW(), NOW()),
+(11, NULL, '51', 'AM', 'ARM', 0, 0, NOW(), NOW()),
+(12, NULL, '36', 'AU', 'AUS', 0, 0, NOW(), NOW()),
+(13, NULL, '40', 'AT', 'AUT', 0, 0, NOW(), NOW()),
+(14, NULL, '31', 'AZ', 'AZE', 0, 0, NOW(), NOW()),
+(15, NULL, '44', 'BS', 'BHS', 0, 0, NOW(), NOW()),
+(16, NULL, '48', 'BR', 'BHR', 0, 0, NOW(), NOW()),
+(17, NULL, '50', 'BD', 'BGD', 0, 0, NOW(), NOW()),
+(18, NULL, '52', 'BB', 'BRB', 0, 0, NOW(), NOW()),
+(19, NULL, '585', 'PW', 'PLW', 0, 0, NOW(), NOW()),
+(20, NULL, '56', 'BE', 'BEL', 0, 0, NOW(), NOW()),
+(21, NULL, '84', 'BL', 'BLZ', 0, 0, NOW(), NOW()),
+(22, NULL, '204', 'BJ', 'BEN', 0, 0, NOW(), NOW()),
+(23, NULL, '64', 'BT', 'BTN', 0, 0, NOW(), NOW()),
+(24, NULL, '112', 'BY', 'BLR', 0, 0, NOW(), NOW()),
+(25, NULL, '104', 'MM', 'MMR', 0, 0, NOW(), NOW()),
+(26, NULL, '68', 'BO', 'BOL', 0, 0, NOW(), NOW()),
+(27, NULL, '70', 'BA', 'BIH', 0, 0, NOW(), NOW()),
+(28, NULL, '72', 'BW', 'BWA', 0, 0, NOW(), NOW()),
+(29, NULL, '76', 'BR', 'BRA', 0, 0, NOW(), NOW()),
+(30, NULL, '96', 'BN', 'BRN', 0, 0, NOW(), NOW()),
+(31, NULL, '100', 'BG', 'BGR', 0, 0, NOW(), NOW()),
+(32, NULL, '854', 'BF', 'BFA', 0, 0, NOW(), NOW()),
+(33, NULL, '108', 'BI', 'BDI', 0, 0, NOW(), NOW()),
+(34, NULL, '116', 'KH', 'KHM', 0, 0, NOW(), NOW()),
+(35, NULL, '120', 'CM', 'CMR', 0, 0, NOW(), NOW()),
+(37, NULL, '132', 'CV', 'CPV', 0, 0, NOW(), NOW()),
+(38, NULL, '152', 'CL', 'CHL', 0, 0, NOW(), NOW()),
+(39, NULL, '156', 'CN', 'CHN', 0, 0, NOW(), NOW()),
+(40, NULL, '196', 'CY', 'CYP', 0, 0, NOW(), NOW()),
+(41, NULL, '170', 'CO', 'COL', 0, 0, NOW(), NOW()),
+(42, NULL, '174', 'KM', 'COM', 0, 0, NOW(), NOW()),
+(43, NULL, '178', 'CG', 'COG', 0, 0, NOW(), NOW()),
+(44, NULL, '184', 'CK', 'COK', 0, 0, NOW(), NOW()),
+(45, NULL, '408', 'KP', 'PRK', 0, 0, NOW(), NOW()),
+(46, NULL, '410', 'KR', 'KOR', 0, 0, NOW(), NOW()),
+(47, NULL, '188', 'CR', 'CRI', 0, 0, NOW(), NOW()),
+(48, NULL, '384', 'CI', 'CIV', 0, 0, NOW(), NOW()),
+(49, NULL, '191', 'HR', 'HRV', 0, 0, NOW(), NOW()),
+(50, NULL, '192', 'CU', 'CUB', 0, 0, NOW(), NOW()),
+(51, NULL, '208', 'DK', 'DNK', 0, 0, NOW(), NOW()),
+(52, NULL, '262', 'DJ', 'DJI', 0, 0, NOW(), NOW()),
+(53, NULL, '212', 'DM', 'DMA', 0, 0, NOW(), NOW()),
+(54, NULL, '818', 'EG', 'EGY', 0, 0, NOW(), NOW()),
+(55, NULL, '784', 'AE', 'ARE', 0, 0, NOW(), NOW()),
+(56, NULL, '218', 'EC', 'ECU', 0, 0, NOW(), NOW()),
+(57, NULL, '232', 'ER', 'ERI', 0, 0, NOW(), NOW()),
+(58, NULL, '724', 'ES', 'ESP', 0, 0, NOW(), NOW()),
+(59, NULL, '233', 'EE', 'EST', 0, 0, NOW(), NOW()),
+(61, NULL, '231', 'ET', 'ETH', 0, 0, NOW(), NOW()),
+(62, NULL, '242', 'FJ', 'FJI', 0, 0, NOW(), NOW()),
+(63, NULL, '246', 'FI', 'FIN', 0, 0, NOW(), NOW()),
+(64, 1, '250', 'FR', 'FRA', 1, 1, NOW(), NOW()),
+(65, NULL, '266', 'GA', 'GAB', 0, 0, NOW(), NOW()),
+(66, NULL, '270', 'GM', 'GMB', 0, 0, NOW(), NOW()),
+(67, NULL, '268', 'GE', 'GEO', 0, 0, NOW(), NOW()),
+(68, NULL, '288', 'GH', 'GHA', 0, 0, NOW(), NOW()),
+(69, NULL, '300', 'GR', 'GRC', 0, 0, NOW(), NOW()),
+(70, NULL, '308', 'GD', 'GRD', 0, 0, NOW(), NOW()),
+(71, NULL, '320', 'GT', 'GTM', 0, 0, NOW(), NOW()),
+(72, NULL, '324', 'GN', 'GIN', 0, 0, NOW(), NOW()),
+(73, NULL, '624', 'GW', 'GNB', 0, 0, NOW(), NOW()),
+(74, NULL, '226', 'GQ', 'GNQ', 0, 0, NOW(), NOW()),
+(75, NULL, '328', 'GY', 'GUY', 0, 0, NOW(), NOW()),
+(76, NULL, '332', 'HT', 'HTI', 0, 0, NOW(), NOW()),
+(77, NULL, '340', 'HN', 'HND', 0, 0, NOW(), NOW()),
+(78, NULL, '348', 'HU', 'HUN', 0, 0, NOW(), NOW()),
+(79, NULL, '356', 'IN', 'IND', 0, 0, NOW(), NOW()),
+(80, NULL, '360', 'ID', 'IDN', 0, 0, NOW(), NOW()),
+(81, NULL, '364', 'IR', 'IRN', 0, 0, NOW(), NOW()),
+(82, NULL, '368', 'IQ', 'IRQ', 0, 0, NOW(), NOW()),
+(83, NULL, '372', 'IE', 'IRL', 0, 0, NOW(), NOW()),
+(84, NULL, '352', 'IS', 'ISL', 0, 0, NOW(), NOW()),
+(85, NULL, '376', 'IL', 'ISR', 0, 0, NOW(), NOW()),
+(86, NULL, '380', 'IT', 'ITA', 0, 0, NOW(), NOW()),
+(87, NULL, '388', 'JM', 'JAM', 0, 0, NOW(), NOW()),
+(88, NULL, '392', 'JP', 'JPN', 0, 0, NOW(), NOW()),
+(89, NULL, '400', 'JO', 'JOR', 0, 0, NOW(), NOW()),
+(90, NULL, '398', 'KZ', 'KAZ', 0, 0, NOW(), NOW()),
+(91, NULL, '404', 'KE', 'KEN', 0, 0, NOW(), NOW()),
+(92, NULL, '417', 'KG', 'KGZ', 0, 0, NOW(), NOW()),
+(93, NULL, '296', 'KI', 'KIR', 0, 0, NOW(), NOW()),
+(94, NULL, '414', 'KW', 'KWT', 0, 0, NOW(), NOW()),
+(95, NULL, '418', 'LA', 'LAO', 0, 0, NOW(), NOW()),
+(96, NULL, '426', 'LS', 'LSO', 0, 0, NOW(), NOW()),
+(97, NULL, '428', 'LV', 'LVA', 0, 0, NOW(), NOW()),
+(98, NULL, '422', 'LB', 'LBN', 0, 0, NOW(), NOW()),
+(99, NULL, '430', 'LR', 'LBR', 0, 0, NOW(), NOW()),
+(100, NULL, '343', 'LY', 'LBY', 0, 0, NOW(), NOW()),
+(101, NULL, '438', 'LI', 'LIE', 0, 0, NOW(), NOW()),
+(102, NULL, '440', 'LT', 'LTU', 0, 0, NOW(), NOW()),
+(103, NULL, '442', 'LU', 'LUX', 0, 0, NOW(), NOW()),
+(104, NULL, '807', 'MK', 'MKD', 0, 0, NOW(), NOW()),
+(105, NULL, '450', 'MD', 'MDG', 0, 0, NOW(), NOW()),
+(106, NULL, '458', 'MY', 'MYS', 0, 0, NOW(), NOW()),
+(107, NULL, '454', 'MW', 'MWI', 0, 0, NOW(), NOW()),
+(108, NULL, '462', 'MV', 'MDV', 0, 0, NOW(), NOW()),
+(109, NULL, '466', 'ML', 'MLI', 0, 0, NOW(), NOW()),
+(110, NULL, '470', 'MT', 'MLT', 0, 0, NOW(), NOW()),
+(111, NULL, '504', 'MA', 'MAR', 0, 0, NOW(), NOW()),
+(112, NULL, '584', 'MH', 'MHL', 0, 0, NOW(), NOW()),
+(113, NULL, '480', 'MU', 'MUS', 0, 0, NOW(), NOW()),
+(114, NULL, '478', 'MR', 'MRT', 0, 0, NOW(), NOW()),
+(115, NULL, '484', 'MX', 'MEX', 0, 0, NOW(), NOW()),
+(116, NULL, '583', 'FM', 'FSM', 0, 0, NOW(), NOW()),
+(117, NULL, '498', 'MD', 'MDA', 0, 0, NOW(), NOW()),
+(118, NULL, '492', 'MC', 'MCO', 0, 0, NOW(), NOW()),
+(119, NULL, '496', 'MN', 'MNG', 0, 0, NOW(), NOW()),
+(120, NULL, '508', 'MZ', 'MOZ', 0, 0, NOW(), NOW()),
+(121, NULL, '516', 'NA', 'NAM', 0, 0, NOW(), NOW()),
+(122, NULL, '520', 'NR', 'NRU', 0, 0, NOW(), NOW()),
+(123, NULL, '524', 'NP', 'NPL', 0, 0, NOW(), NOW()),
+(124, NULL, '558', 'NI', 'NIC', 0, 0, NOW(), NOW()),
+(125, NULL, '562', 'NE', 'NER', 0, 0, NOW(), NOW()),
+(126, NULL, '566', 'NG', 'NGA', 0, 0, NOW(), NOW()),
+(127, NULL, '570', 'NU', 'NIU', 0, 0, NOW(), NOW()),
+(128, NULL, '578', 'NO', 'NOR', 0, 0, NOW(), NOW()),
+(129, NULL, '554', 'NZ', 'NZL', 0, 0, NOW(), NOW()),
+(130, NULL, '512', 'OM', 'OMN', 0, 0, NOW(), NOW()),
+(131, NULL, '800', 'UG', 'UGA', 0, 0, NOW(), NOW()),
+(132, NULL, '860', 'UZ', 'UZB', 0, 0, NOW(), NOW()),
+(133, NULL, '586', 'PK', 'PAK', 0, 0, NOW(), NOW()),
+(134, NULL, '591', 'PA', 'PAN', 0, 0, NOW(), NOW()),
+(135, NULL, '598', 'PG', 'PNG', 0, 0, NOW(), NOW()),
+(136, NULL, '600', 'PY', 'PRY', 0, 0, NOW(), NOW()),
+(137, NULL, '528', 'NL', 'NLD', 0, 0, NOW(), NOW()),
+(138, NULL, '604', 'PE', 'PER', 0, 0, NOW(), NOW()),
+(139, NULL, '608', 'PH', 'PHL', 0, 0, NOW(), NOW()),
+(140, NULL, '616', 'PL', 'POL', 0, 0, NOW(), NOW()),
+(141, NULL, '620', 'PT', 'PRT', 0, 0, NOW(), NOW()),
+(142, NULL, '634', 'QA', 'QAT', 0, 0, NOW(), NOW()),
+(143, NULL, '140', 'CF', 'CAF', 0, 0, NOW(), NOW()),
+(144, NULL, '214', 'DO', 'DOM', 0, 0, NOW(), NOW()),
+(145, NULL, '203', 'CZ', 'CZE', 0, 0, NOW(), NOW()),
+(146, NULL, '642', 'RO', 'ROU', 0, 0, NOW(), NOW()),
+(147, NULL, '826', 'GB', 'GBR', 0, 0, NOW(), NOW()),
+(148, NULL, '643', 'RU', 'RUS', 0, 0, NOW(), NOW()),
+(149, NULL, '646', 'RW', 'RWA', 0, 0, NOW(), NOW()),
+(150, NULL, '659', 'KN', 'KNA', 0, 0, NOW(), NOW()),
+(151, NULL, '662', 'LC', 'LCA', 0, 0, NOW(), NOW()),
+(152, NULL, '674', 'SM', 'SMR', 0, 0, NOW(), NOW()),
+(153, NULL, '670', 'VC', 'VCT', 0, 0, NOW(), NOW()),
+(154, NULL, '90', 'SB', 'SLB', 0, 0, NOW(), NOW()),
+(155, NULL, '222', 'SV', 'SLV', 0, 0, NOW(), NOW()),
+(156, NULL, '882', 'WS', 'WSM', 0, 0, NOW(), NOW()),
+(157, NULL, '678', 'ST', 'STP', 0, 0, NOW(), NOW()),
+(158, NULL, '686', 'SN', 'SEN', 0, 0, NOW(), NOW()),
+(159, NULL, '690', 'SC', 'SYC', 0, 0, NOW(), NOW()),
+(160, NULL, '694', 'SL', 'SLE', 0, 0, NOW(), NOW()),
+(161, NULL, '702', 'SG', 'SGP', 0, 0, NOW(), NOW()),
+(162, NULL, '703', 'SK', 'SVK', 0, 0, NOW(), NOW()),
+(163, NULL, '705', 'SI', 'SVN', 0, 0, NOW(), NOW()),
+(164, NULL, '706', 'SO', 'SOM', 0, 0, NOW(), NOW()),
+(165, NULL, '729', 'SD', 'SDN', 0, 0, NOW(), NOW()),
+(166, NULL, '144', 'LK', 'LKA', 0, 0, NOW(), NOW()),
+(167, NULL, '752', 'SE', 'SWE', 0, 0, NOW(), NOW()),
+(168, NULL, '756', 'CH', 'CHE', 0, 0, NOW(), NOW()),
+(169, NULL, '740', 'SR', 'SUR', 0, 0, NOW(), NOW()),
+(170, NULL, '748', 'SZ', 'SWZ', 0, 0, NOW(), NOW()),
+(171, NULL, '760', 'SY', 'SYR', 0, 0, NOW(), NOW()),
+(172, NULL, '762', 'TJ', 'TJK', 0, 0, NOW(), NOW()),
+(173, NULL, '834', 'TZ', 'TZA', 0, 0, NOW(), NOW()),
+(174, NULL, '148', 'TD', 'TCD', 0, 0, NOW(), NOW()),
+(175, NULL, '764', 'TH', 'THA', 0, 0, NOW(), NOW()),
+(176, NULL, '768', 'TG', 'TGO', 0, 0, NOW(), NOW()),
+(177, NULL, '776', 'TO', 'TON', 0, 0, NOW(), NOW()),
+(178, NULL, '780', 'TT', 'TTO', 0, 0, NOW(), NOW()),
+(179, NULL, '788', 'TN', 'TUN', 0, 0, NOW(), NOW()),
+(180, NULL, '795', 'TM', 'TKM', 0, 0, NOW(), NOW()),
+(181, NULL, '792', 'TR', 'TUR', 0, 0, NOW(), NOW()),
+(182, NULL, '798', 'TV', 'TUV', 0, 0, NOW(), NOW()),
+(183, NULL, '804', 'UA', 'UKR', 0, 0, NOW(), NOW()),
+(184, NULL, '858', 'UY', 'URY', 0, 0, NOW(), NOW()),
+(185, NULL, '336', 'VA', 'VAT', 0, 0, NOW(), NOW()),
+(186, NULL, '548', 'VU', 'VUT', 0, 0, NOW(), NOW()),
+(187, NULL, '862', 'VE', 'VEN', 0, 0, NOW(), NOW()),
+(188, NULL, '704', 'VN', 'VNM', 0, 0, NOW(), NOW()),
+(189, NULL, '887', 'YE', 'YEM', 0, 0, NOW(), NOW()),
+(190, NULL, '807', 'MK', 'MKD', 0, 0, NOW(), NOW()),
+(191, NULL, '180', 'CD', 'COD', 0, 0, NOW(), NOW()),
+(192, NULL, '894', 'ZM', 'ZMB', 0, 0, NOW(), NOW()),
+(193, NULL, '716', 'ZW', 'ZWE', 0, 0, NOW(), NOW()),
+(196, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(197, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(198, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(199, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(200, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(201, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(202, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(203, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(204, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(205, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(206, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(207, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(208, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(209, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(210, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(211, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(212, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(213, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(214, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(215, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(216, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(217, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(218, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(219, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(220, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(221, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(222, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(223, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(224, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(225, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(226, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(227, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(228, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(229, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(230, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(231, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(232, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(233, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(234, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(235, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(236, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(237, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(238, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(239, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(240, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(241, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(242, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(243, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(244, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(245, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW()),
+(246, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(247, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(248, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(249, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(250, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(251, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(252, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(253, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(254, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(255, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(256, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(257, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(258, NULL, '124', 'CA', 'CAN', 0, 0, NOW(), NOW()),
+(259, NULL, '312', 'GP', 'GLP', 0, 0, NOW(), NOW()),
+(260, NULL, '254', 'GF', 'GUF', 0, 0, NOW(), NOW()),
+(261, NULL, '474', 'MQ', 'MTQ', 0, 0, NOW(), NOW()),
+(262, NULL, '175', 'YT', 'MYT', 0, 0, NOW(), NOW()),
+(263, NULL, '638', 'RE', 'REU', 0, 0, NOW(), NOW()),
+(264, NULL, '666', 'PM', 'SPM', 0, 0, NOW(), NOW()),
+(265, NULL, '540', 'NC', 'NCL', 0, 0, NOW(), NOW()),
+(266, NULL, '258', 'PF', 'PYF', 0, 0, NOW(), NOW()),
+(267, NULL, '876', 'WF', 'WLF', 0, 0, NOW(), NOW()),
+(268, NULL, '840', 'US', 'USA', 0, 0, NOW(), NOW());
INSERT INTO `country_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
(1, 'en_US', 'Afghanistan', '', '', ''),
diff --git a/install/thelia.sql b/install/thelia.sql
index 23c828ba8..7fa114536 100755
--- a/install/thelia.sql
+++ b/install/thelia.sql
@@ -98,7 +98,8 @@ CREATE TABLE `country`
`isocode` VARCHAR(4) NOT NULL,
`isoalpha2` VARCHAR(2),
`isoalpha3` VARCHAR(4),
- `by_default` TINYINT,
+ `by_default` TINYINT DEFAULT 0,
+ `shop_country` TINYINT(1) DEFAULT 0 NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
@@ -983,7 +984,7 @@ CREATE TABLE `admin`
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
- INDEX `fk_admin_profile_id` (`profile_id`),
+ INDEX `idx_admin_profile_id` (`profile_id`),
CONSTRAINT `fk_admin_profile_id`
FOREIGN KEY (`profile_id`)
REFERENCES `profile` (`id`)
@@ -1029,7 +1030,7 @@ CREATE TABLE `profile_module`
(
`profile_id` INTEGER NOT NULL,
`module_id` INTEGER NOT NULL,
- `access` INTEGER DEFAULT 0 NOT NULL,
+ `access` TINYINT DEFAULT 0,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`profile_id`,`module_id`),
@@ -1257,6 +1258,7 @@ CREATE TABLE `product_price`
`currency_id` INTEGER NOT NULL,
`price` FLOAT NOT NULL,
`promo_price` FLOAT,
+ `from_default_currency` TINYINT(1) DEFAULT 0 NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`product_sale_elements_id`,`currency_id`),
diff --git a/local/config/schema.xml b/local/config/schema.xml
index a1b189a3a..61c4aabf5 100755
--- a/local/config/schema.xml
+++ b/local/config/schema.xml
@@ -1,1252 +1,1254 @@
-
-{intl l='Attribute Combinations'}
+ {if $has_at_least_one_combination == false} +{intl l='Attribute Combinations'}
-