Merge branch 'cart'
Conflicts: composer.lock core/lib/Thelia/Model/Base/Attribute.php core/lib/Thelia/Model/Base/AttributeAv.php core/lib/Thelia/Model/Base/AttributeCombination.php core/lib/Thelia/Model/Base/AttributeCombinationQuery.php core/lib/Thelia/Model/Base/Cart.php core/lib/Thelia/Model/Base/CartItem.php core/lib/Thelia/Model/Base/CartItemQuery.php core/lib/Thelia/Model/Base/Currency.php core/lib/Thelia/Model/Base/CurrencyQuery.php core/lib/Thelia/Model/Base/Product.php core/lib/Thelia/Model/Base/ProductPrice.php core/lib/Thelia/Model/Base/ProductPriceQuery.php core/lib/Thelia/Model/Map/AttributeCombinationTableMap.php core/lib/Thelia/Model/Map/CartItemTableMap.php core/lib/Thelia/Model/Map/CurrencyTableMap.php core/lib/Thelia/Model/Map/ProductPriceTableMap.php core/lib/Thelia/Model/Map/ProductTableMap.php install/thelia.sql local/config/schema.xml
This commit is contained in:
@@ -7,6 +7,9 @@ $faker = Faker\Factory::create();
|
||||
|
||||
$con = \Propel\Runtime\Propel::getConnection(Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
||||
$con->beginTransaction();
|
||||
|
||||
$currency = \Thelia\Model\CurrencyQuery::create()->filterByCode('EUR')->findOne();
|
||||
|
||||
try {
|
||||
|
||||
$category = Thelia\Model\CategoryQuery::create()
|
||||
@@ -52,13 +55,25 @@ try {
|
||||
$product->addCategory($sweet);
|
||||
$product->setTitle($faker->bs);
|
||||
$product->setDescription($faker->text(250));
|
||||
$product->setQuantity($faker->randomNumber(1,50));
|
||||
$product->setPrice($faker->randomFloat(2, 20, 2500));
|
||||
/* $product->setQuantity($faker->randomNumber(1,50));
|
||||
$product->setPrice($faker->randomFloat(2, 20, 2500));*/
|
||||
$product->setVisible(1);
|
||||
$product->setPosition($i);
|
||||
$product->setRef($faker->text(255));
|
||||
$product->save();
|
||||
|
||||
$stock = new \Thelia\Model\Stock();
|
||||
$stock->setProduct($product);
|
||||
$stock->setQuantity($faker->randomNumber(1,50));
|
||||
$stock->setPromo($faker->randomNumber(0,1));
|
||||
$stock->save();
|
||||
|
||||
$productPrice = new \Thelia\Model\ProductPrice();
|
||||
$productPrice->setStock($stock);
|
||||
$productPrice->setCurrency($currency);
|
||||
$productPrice->setPrice($faker->randomFloat(2, 20, 2500));
|
||||
$productPrice->save();
|
||||
|
||||
}
|
||||
|
||||
for ($i=1; $i <= 5; $i++) {
|
||||
@@ -66,13 +81,25 @@ try {
|
||||
$product->addCategory($jeans);
|
||||
$product->setTitle($faker->bs);
|
||||
$product->setDescription($faker->text(250));
|
||||
$product->setQuantity($faker->randomNumber(1,50));
|
||||
$product->setPrice($faker->randomFloat(2, 20, 2500));
|
||||
/* $product->setQuantity($faker->randomNumber(1,50));
|
||||
$product->setPrice($faker->randomFloat(2, 20, 2500));*/
|
||||
$product->setVisible(1);
|
||||
$product->setPosition($i);
|
||||
$product->setRef($faker->text(255));
|
||||
$product->save();
|
||||
|
||||
$stock = new \Thelia\Model\Stock();
|
||||
$stock->setProduct($product);
|
||||
$stock->setQuantity($faker->randomNumber(1,50));
|
||||
$stock->setPromo($faker->randomNumber(0,1));
|
||||
$stock->save();
|
||||
|
||||
$productPrice = new \Thelia\Model\ProductPrice();
|
||||
$productPrice->setStock($stock);
|
||||
$productPrice->setCurrency($currency);
|
||||
$productPrice->setPrice($faker->randomFloat(2, 20, 2500));
|
||||
$productPrice->save();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ INSERT INTO `lang`(`id`,`title`,`code`,`locale`,`url`,`by_default`,`created_at`,
|
||||
(4, 'Italiano', 'it', 'it_IT', '','0', NOW(), NOW());
|
||||
|
||||
INSERT INTO `config` (`name`, `value`, `secured`, `hidden`, `created_at`, `updated_at`) VALUES
|
||||
('session_config.default', '1', 1, 1, NOW(), NOW());
|
||||
('session_config.default', '1', 1, 1, NOW(), NOW()),
|
||||
('verifyStock', '1', 1, 0, NOW(), NOW());
|
||||
|
||||
INSERT INTO `module` (`code`, `type`, `activate`, `position`, `created_at`, `updated_at`) VALUES ('test', '1', '1', '1', NOW(), NOW());
|
||||
|
||||
@@ -22,6 +23,19 @@ INSERT INTO `customer_title_i18n` (`id`, `locale`, `short`, `long`) VALUES
|
||||
(3, 'en_US', 'Miss', 'Miss'),
|
||||
(3, 'fr_FR', 'Mlle', 'Madamemoiselle');
|
||||
|
||||
INSERT INTO `currency` (`id` ,`code` ,`symbol` ,`rate` ,`by_default` ,`created_at` ,`updated_at`)
|
||||
VALUES
|
||||
(1, 'EUR', '€', '1', '1', NOW() , NOW()),
|
||||
(2, 'USD', '$', '1.26', '0', NOW(), NOW()),
|
||||
(3, 'GBP', '£', '0.89', '0', NOW(), NOW());
|
||||
|
||||
INSERT INTO `currency_i18n` (`id` ,`locale` ,`name`)
|
||||
VALUES
|
||||
(1, 'en_US', 'euro'),
|
||||
(2, 'en_US', 'dollar'),
|
||||
(3, 'en_US', 'pound');
|
||||
|
||||
|
||||
INSERT INTO `country` (`id`, `area_id`, `isocode`, `isoalpha2`, `isoalpha3`, `created_at`, `updated_at`) VALUES
|
||||
(1, NULL, '4', 'AF', 'AFG', NOW(), NOW()),
|
||||
(2, NULL, '710', 'ZA', 'ZAF', NOW(), NOW()),
|
||||
@@ -1080,4 +1094,4 @@ INSERT INTO `country_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `po
|
||||
(267, 'fr_FR', 'Wallis-et-Futuna', '', '', ''),
|
||||
(268, 'en_US', 'USA - Alabama', '', '', ''),
|
||||
(268, 'es_ES', 'USA - Alabama', '', '', ''),
|
||||
(268, 'fr_FR', 'USA - Alabama', '', '', '');
|
||||
(268, 'fr_FR', 'USA - Alabama', '', '', '');
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Sqlfile -> Database map
|
||||
thelia.sql=thelia
|
||||
@@ -64,8 +64,8 @@ CREATE TABLE `product_category`
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`product_id`,`category_id`),
|
||||
INDEX `fk_product_has_category_category1_idx` (`category_id`),
|
||||
INDEX `fk_product_has_category_product1_idx` (`product_id`),
|
||||
INDEX `idx_product_has_category_category1` (`category_id`),
|
||||
INDEX `idx_product_has_category_product1` (`product_id`),
|
||||
CONSTRAINT `fk_product_has_category_product1`
|
||||
FOREIGN KEY (`product_id`)
|
||||
REFERENCES `product` (`id`)
|
||||
@@ -320,13 +320,13 @@ CREATE TABLE `attribute_combination`
|
||||
(
|
||||
`attribute_id` INTEGER NOT NULL,
|
||||
`attribute_av_id` INTEGER NOT NULL,
|
||||
`stock_id` INTEGER NOT NULL,
|
||||
`product_sale_elements_id` INTEGER NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`attribute_id`,`attribute_av_id`,`stock_id`),
|
||||
PRIMARY KEY (`attribute_id`,`attribute_av_id`,`product_sale_elements_id`),
|
||||
INDEX `idx_attribute_combination_attribute_id` (`attribute_id`),
|
||||
INDEX `idx_attribute_combination_attribute_av_id` (`attribute_av_id`),
|
||||
INDEX `idx_attribute_combination_stock_id` (`stock_id`),
|
||||
INDEX `idx_attribute_combination_product_sale_elements_id` (`product_sale_elements_id`),
|
||||
CONSTRAINT `fk_attribute_combination_attribute_id`
|
||||
FOREIGN KEY (`attribute_id`)
|
||||
REFERENCES `attribute` (`id`)
|
||||
@@ -337,22 +337,21 @@ CREATE TABLE `attribute_combination`
|
||||
REFERENCES `attribute_av` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_attribute_combination_stock_id`
|
||||
FOREIGN KEY (`stock_id`)
|
||||
REFERENCES `stock` (`id`)
|
||||
CONSTRAINT `fk_attribute_combination_product_sale_elements_id`
|
||||
FOREIGN KEY (`product_sale_elements_id`)
|
||||
REFERENCES `product_sale_elements` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- stock
|
||||
-- product_sale_elements
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `stock`;
|
||||
DROP TABLE IF EXISTS `product_sale_elements`;
|
||||
|
||||
CREATE TABLE `stock`
|
||||
CREATE TABLE `product_sale_elements`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`product_id` INTEGER NOT NULL,
|
||||
`increase` FLOAT,
|
||||
`quantity` FLOAT NOT NULL,
|
||||
`promo` TINYINT DEFAULT 0,
|
||||
`newness` TINYINT DEFAULT 0,
|
||||
@@ -360,8 +359,8 @@ CREATE TABLE `stock`
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_stock_product_id` (`product_id`),
|
||||
CONSTRAINT `fk_stock_product_id`
|
||||
INDEX `idx_product_sale_element_product_id` (`product_id`),
|
||||
CONSTRAINT `fk_product_sale_element_product_id`
|
||||
FOREIGN KEY (`product_id`)
|
||||
REFERENCES `product` (`id`)
|
||||
ON UPDATE RESTRICT
|
||||
@@ -760,7 +759,6 @@ DROP TABLE IF EXISTS `currency`;
|
||||
CREATE TABLE `currency`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(45),
|
||||
`code` VARCHAR(45),
|
||||
`symbol` VARCHAR(45),
|
||||
`rate` FLOAT,
|
||||
@@ -1073,8 +1071,8 @@ CREATE TABLE `group_module`
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `id_idx` (`group_id`),
|
||||
INDEX `id_idx1` (`module_id`),
|
||||
INDEX `idx_group_module_group_id` (`group_id`),
|
||||
INDEX `idx_group_module_module_id` (`module_id`),
|
||||
CONSTRAINT `fk_group_module_group_id`
|
||||
FOREIGN KEY (`group_id`)
|
||||
REFERENCES `group` (`id`)
|
||||
@@ -1251,8 +1249,8 @@ CREATE TABLE `content_folder`
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`content_id`,`folder_id`),
|
||||
INDEX `fk__idx` (`content_id`),
|
||||
INDEX `fk_content_folder_folder_id_idx` (`folder_id`),
|
||||
INDEX `idx_content_folder_content_id` (`content_id`),
|
||||
INDEX `idx_content_folder_folder_id` (`folder_id`),
|
||||
CONSTRAINT `fk_content_folder_content_id`
|
||||
FOREIGN KEY (`content_id`)
|
||||
REFERENCES `content` (`id`)
|
||||
@@ -1313,22 +1311,22 @@ CREATE TABLE `cart_item`
|
||||
`cart_id` INTEGER NOT NULL,
|
||||
`product_id` INTEGER NOT NULL,
|
||||
`quantity` FLOAT DEFAULT 1,
|
||||
`stock_id` INTEGER NOT NULL,
|
||||
`product_sale_elements_id` INTEGER NOT NULL,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_cart_item_cart_id` (`cart_id`),
|
||||
INDEX `idx_cart_item_product_id` (`product_id`),
|
||||
INDEX `idx_cart_item_stock_id` (`stock_id`),
|
||||
INDEX `idx_cart_item_product_sale_elements_id` (`product_sale_elements_id`),
|
||||
CONSTRAINT `fk_cart_item_cart_id`
|
||||
FOREIGN KEY (`cart_id`)
|
||||
REFERENCES `cart` (`id`),
|
||||
CONSTRAINT `fk_cart_item_product_id`
|
||||
FOREIGN KEY (`product_id`)
|
||||
REFERENCES `product` (`id`),
|
||||
CONSTRAINT `fk_cart_item_stock_id`
|
||||
FOREIGN KEY (`stock_id`)
|
||||
REFERENCES `stock` (`id`)
|
||||
CONSTRAINT `fk_cart_item_product_sale_elements_id`
|
||||
FOREIGN KEY (`product_sale_elements_id`)
|
||||
REFERENCES `product_sale_elements` (`id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
@@ -1340,18 +1338,18 @@ DROP TABLE IF EXISTS `product_price`;
|
||||
CREATE TABLE `product_price`
|
||||
(
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`stock_id` INTEGER NOT NULL,
|
||||
`product_sale_elements_id` INTEGER NOT NULL,
|
||||
`currency_id` INTEGER NOT NULL,
|
||||
`price` FLOAT NOT NULL,
|
||||
`promo_price` FLOAT,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_product_price_stock_id` (`stock_id`),
|
||||
INDEX `idx_product_price_product_sale_elements_id` (`product_sale_elements_id`),
|
||||
INDEX `idx_product_price_currency_id` (`currency_id`),
|
||||
CONSTRAINT `fk_product_price_stock_id`
|
||||
FOREIGN KEY (`stock_id`)
|
||||
REFERENCES `stock` (`id`),
|
||||
CONSTRAINT `fk_product_price_product_sale_elements_id`
|
||||
FOREIGN KEY (`product_sale_elements_id`)
|
||||
REFERENCES `product_sale_elements` (`id`),
|
||||
CONSTRAINT `fk_product_price_currency_id`
|
||||
FOREIGN KEY (`currency_id`)
|
||||
REFERENCES `currency` (`id`)
|
||||
@@ -1664,6 +1662,24 @@ CREATE TABLE `document_i18n`
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- currency_i18n
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS `currency_i18n`;
|
||||
|
||||
CREATE TABLE `currency_i18n`
|
||||
(
|
||||
`id` INTEGER NOT NULL,
|
||||
`locale` VARCHAR(5) DEFAULT 'en_US' NOT NULL,
|
||||
`name` VARCHAR(45),
|
||||
PRIMARY KEY (`id`,`locale`),
|
||||
CONSTRAINT `currency_i18n_FK_1`
|
||||
FOREIGN KEY (`id`)
|
||||
REFERENCES `currency` (`id`)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- order_status_i18n
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user