Working : Fixture : Product add default category
This commit is contained in:
@@ -73,6 +73,7 @@ class Product extends BaseI18nLoop
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
Argument::createIntListTypeArgument('category'),
|
Argument::createIntListTypeArgument('category'),
|
||||||
|
Argument::createIntListTypeArgument('category_default'),
|
||||||
Argument::createBooleanTypeArgument('new'),
|
Argument::createBooleanTypeArgument('new'),
|
||||||
Argument::createBooleanTypeArgument('promo'),
|
Argument::createBooleanTypeArgument('promo'),
|
||||||
Argument::createFloatTypeArgument('min_price'),
|
Argument::createFloatTypeArgument('min_price'),
|
||||||
@@ -170,9 +171,16 @@ class Product extends BaseI18nLoop
|
|||||||
}
|
}
|
||||||
|
|
||||||
$category = $this->getCategory();
|
$category = $this->getCategory();
|
||||||
|
$categoryDefault = $this->getCategoryDefault();
|
||||||
|
|
||||||
|
if (!is_null($category) ||!is_null($categoryDefault)) {
|
||||||
|
|
||||||
if (!is_null($category)) {
|
if (!is_null($category)) {
|
||||||
$categories = CategoryQuery::create()->filterById($category, Criteria::IN)->find();
|
$categories = CategoryQuery::create()->filterById($category, Criteria::IN)->find();
|
||||||
|
}
|
||||||
|
if (!is_null($categoryDefault)) {
|
||||||
|
$categories = CategoryQuery::create()->filterById($categoryDefault, Criteria::IN)->find();
|
||||||
|
}
|
||||||
|
|
||||||
$depth = $this->getDepth();
|
$depth = $this->getDepth();
|
||||||
|
|
||||||
|
|||||||
@@ -453,11 +453,16 @@ try {
|
|||||||
$con->rollBack();
|
$con->rollBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
function createProduct($faker, $category, $position, $template, &$productIdList)
|
function createProduct($faker, Thelia\Model\Category $category, $position, $template, &$productIdList)
|
||||||
{
|
{
|
||||||
$product = new Thelia\Model\Product();
|
$product = new Thelia\Model\Product();
|
||||||
$product->setRef($category->getId() . '_' . $position . '_' . $faker->randomNumber(8));
|
$product->setRef($category->getId() . '_' . $position . '_' . $faker->randomNumber(8));
|
||||||
$product->addCategory($category);
|
$product->addCategory($category);
|
||||||
|
$productCategories = $product->getProductCategories();
|
||||||
|
$productCategories[0]->setDefaultCategory(true);
|
||||||
|
$collection = new \Propel\Runtime\Collection\Collection();
|
||||||
|
$collection->append($productCategories[0]->setDefaultCategory(true));
|
||||||
|
$product->setProductCategories($collection);
|
||||||
$product->setVisible(rand(1, 10)>7 ? 0 : 1);
|
$product->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||||
$product->setPosition($position);
|
$product->setPosition($position);
|
||||||
$product->setTaxRuleId(1);
|
$product->setTaxRuleId(1);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ echo -e "\n\e[01;34m[INFO] Building Models file\e[00m\n"
|
|||||||
echo -e "\n\e[01;34m[INFO] Building SQL CREATE file\e[00m\n"
|
echo -e "\n\e[01;34m[INFO] Building SQL CREATE file\e[00m\n"
|
||||||
../../bin/propel sql:build -v --output-dir=../../install/
|
../../bin/propel sql:build -v --output-dir=../../install/
|
||||||
|
|
||||||
echo -e "\n\e[01;34m[INFO] Reloaded Thelia2 database\e[00m\n"
|
echo -e "\n\e[01;34m[INFO] Reloading Thelia2 database\e[00m\n"
|
||||||
cd ../..
|
cd ../..
|
||||||
rm install/sqldb.map
|
rm install/sqldb.map
|
||||||
php Thelia thelia:dev:reloadDB
|
php Thelia thelia:dev:reloadDB
|
||||||
|
|||||||
Reference in New Issue
Block a user