Merge branch 'loops'
This commit is contained in:
@@ -9,11 +9,13 @@
|
|||||||
<loop class="Thelia\Core\Template\Loop\Address" name="address"/>
|
<loop class="Thelia\Core\Template\Loop\Address" name="address"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Auth" name="auth"/>
|
<loop class="Thelia\Core\Template\Loop\Auth" name="auth"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Category" name="category"/>
|
<loop class="Thelia\Core\Template\Loop\Category" name="category"/>
|
||||||
|
<loop class="Thelia\Core\Template\Loop\Content" name="content"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Country" name="country"/>
|
<loop class="Thelia\Core\Template\Loop\Country" name="country"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Customer" name="customer"/>
|
<loop class="Thelia\Core\Template\Loop\Customer" name="customer"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Feature" name="feature"/>
|
<loop class="Thelia\Core\Template\Loop\Feature" name="feature"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\FeatureAvailable" name="feature_available"/>
|
<loop class="Thelia\Core\Template\Loop\FeatureAvailable" name="feature_available"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\FeatureValue" name="feature_value"/>
|
<loop class="Thelia\Core\Template\Loop\FeatureValue" name="feature_value"/>
|
||||||
|
<loop class="Thelia\Core\Template\Loop\Folder" name="folder"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\Order" name="order"/>
|
<loop class="Thelia\Core\Template\Loop\Order" name="order"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/>
|
<loop class="Thelia\Core\Template\Loop\OrderStatus" name="order-status"/>
|
||||||
<loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/>
|
<loop class="Thelia\Core\Template\Loop\CategoryPath" name="category-path"/>
|
||||||
|
|||||||
@@ -161,11 +161,13 @@ class Category extends BaseLoop
|
|||||||
|
|
||||||
$categories = $this->search($search, $pagination);
|
$categories = $this->search($search, $pagination);
|
||||||
|
|
||||||
|
$notEmpty = $this->getNot_empty();
|
||||||
|
|
||||||
$loopResult = new LoopResult();
|
$loopResult = new LoopResult();
|
||||||
|
|
||||||
foreach ($categories as $category) {
|
foreach ($categories as $category) {
|
||||||
|
|
||||||
if ($this->not_empty && $category->countAllProducts() == 0) continue;
|
if ($notEmpty && $category->countAllProducts() == 0) continue;
|
||||||
|
|
||||||
$loopResultRow = new LoopResultRow();
|
$loopResultRow = new LoopResultRow();
|
||||||
|
|
||||||
|
|||||||
238
core/lib/Thelia/Core/Template/Loop/Content.php
Executable file
238
core/lib/Thelia/Core/Template/Loop/Content.php
Executable file
@@ -0,0 +1,238 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Propel\Runtime\ActiveQuery\Join;
|
||||||
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
|
||||||
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
use Thelia\Log\Tlog;
|
||||||
|
|
||||||
|
use Thelia\Model\Base\FeatureContentQuery;
|
||||||
|
use Thelia\Model\FolderQuery;
|
||||||
|
use Thelia\Model\Map\ContentTableMap;
|
||||||
|
use Thelia\Model\ContentFolderQuery;
|
||||||
|
use Thelia\Model\ContentQuery;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
|
use Thelia\Type\TypeCollection;
|
||||||
|
use Thelia\Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Content loop
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Class Content
|
||||||
|
* @package Thelia\Core\Template\Loop
|
||||||
|
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class Content extends BaseLoop
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return ArgumentCollection
|
||||||
|
*/
|
||||||
|
protected function getArgDefinitions()
|
||||||
|
{
|
||||||
|
return new ArgumentCollection(
|
||||||
|
Argument::createIntListTypeArgument('id'),
|
||||||
|
Argument::createIntListTypeArgument('folder'),
|
||||||
|
Argument::createBooleanTypeArgument('current'),
|
||||||
|
Argument::createBooleanTypeArgument('current_folder'),
|
||||||
|
Argument::createIntTypeArgument('depth', 1),
|
||||||
|
Argument::createBooleanTypeArgument('visible', 1),
|
||||||
|
new Argument(
|
||||||
|
'order',
|
||||||
|
new TypeCollection(
|
||||||
|
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual_reverse', 'random', 'given_id'))
|
||||||
|
),
|
||||||
|
'alpha'
|
||||||
|
),
|
||||||
|
Argument::createIntListTypeArgument('exclude'),
|
||||||
|
Argument::createIntListTypeArgument('exclude_folder')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $pagination
|
||||||
|
*
|
||||||
|
* @return LoopResult
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function exec(&$pagination)
|
||||||
|
{
|
||||||
|
$search = ContentQuery::create();
|
||||||
|
|
||||||
|
$id = $this->getId();
|
||||||
|
|
||||||
|
if (!is_null($id)) {
|
||||||
|
$search->filterById($id, Criteria::IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
$folder = $this->getFolder();
|
||||||
|
|
||||||
|
if (!is_null($folder)) {
|
||||||
|
$folders = FolderQuery::create()->filterById($folder, Criteria::IN)->find();
|
||||||
|
|
||||||
|
$depth = $this->getDepth();
|
||||||
|
|
||||||
|
if(null !== $depth) {
|
||||||
|
foreach(FolderQuery::findAllChild($folder, $depth) as $subFolder) {
|
||||||
|
$folders->prepend($subFolder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$search->filterByFolder(
|
||||||
|
$folders,
|
||||||
|
Criteria::IN
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$current = $this->getCurrent();
|
||||||
|
|
||||||
|
if ($current === true) {
|
||||||
|
$search->filterById($this->request->get("content_id"));
|
||||||
|
} elseif($current === false) {
|
||||||
|
$search->filterById($this->request->get("content_id"), Criteria::NOT_IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
$current_folder = $this->getCurrent_folder();
|
||||||
|
|
||||||
|
if ($current_folder === true) {
|
||||||
|
$search->filterByFolder(
|
||||||
|
FolderQuery::create()->filterByContent(
|
||||||
|
ContentFolderQuery::create()->filterByContentId(
|
||||||
|
$this->request->get("content_id"),
|
||||||
|
Criteria::EQUAL
|
||||||
|
)->find(),
|
||||||
|
Criteria::IN
|
||||||
|
)->find(),
|
||||||
|
Criteria::IN
|
||||||
|
);
|
||||||
|
} elseif($current_folder === false) {
|
||||||
|
$search->filterByFolder(
|
||||||
|
FolderQuery::create()->filterByContent(
|
||||||
|
ContentFolderQuery::create()->filterByContentId(
|
||||||
|
$this->request->get("content_id"),
|
||||||
|
Criteria::EQUAL
|
||||||
|
)->find(),
|
||||||
|
Criteria::IN
|
||||||
|
)->find(),
|
||||||
|
Criteria::NOT_IN
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$visible = $this->getVisible();
|
||||||
|
|
||||||
|
$search->filterByVisible($visible);
|
||||||
|
|
||||||
|
$orders = $this->getOrder();
|
||||||
|
|
||||||
|
foreach($orders as $order) {
|
||||||
|
switch ($order) {
|
||||||
|
case "alpha":
|
||||||
|
$search->addAscendingOrderByColumn(\Thelia\Model\Map\ContentI18nTableMap::TITLE);
|
||||||
|
break;
|
||||||
|
case "alpha_reverse":
|
||||||
|
$search->addDescendingOrderByColumn(\Thelia\Model\Map\ContentI18nTableMap::TITLE);
|
||||||
|
break;
|
||||||
|
case "manual":
|
||||||
|
if(null === $folder || count($folder) != 1)
|
||||||
|
throw new \InvalidArgumentException('Manual order cannot be set without single folder argument');
|
||||||
|
$search->orderByPosition(Criteria::ASC);
|
||||||
|
break;
|
||||||
|
case "manual_reverse":
|
||||||
|
if(null === $folder || count($folder) != 1)
|
||||||
|
throw new \InvalidArgumentException('Manual order cannot be set without single folder argument');
|
||||||
|
$search->orderByPosition(Criteria::DESC);
|
||||||
|
break;
|
||||||
|
case "given_id":
|
||||||
|
if(null === $id)
|
||||||
|
throw new \InvalidArgumentException('Given_id order cannot be set without `id` argument');
|
||||||
|
foreach($id as $singleId) {
|
||||||
|
$givenIdMatched = 'given_id_matched_' . $singleId;
|
||||||
|
$search->withColumn(ContentTableMap::ID . "='$singleId'", $givenIdMatched);
|
||||||
|
$search->orderBy($givenIdMatched, Criteria::DESC);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "random":
|
||||||
|
$search->clearOrderByColumns();
|
||||||
|
$search->addAscendingOrderByColumn('RAND()');
|
||||||
|
break(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$exclude = $this->getExclude();
|
||||||
|
|
||||||
|
if (!is_null($exclude)) {
|
||||||
|
$search->filterById($exclude, Criteria::NOT_IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
$exclude_folder = $this->getExclude_folder();
|
||||||
|
|
||||||
|
if (!is_null($exclude_folder)) {
|
||||||
|
$search->filterByFolder(
|
||||||
|
FolderQuery::create()->filterById($exclude_folder, Criteria::IN)->find(),
|
||||||
|
Criteria::NOT_IN
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation.
|
||||||
|
*
|
||||||
|
* @todo : verify here if we want results for row without translations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$search->joinWithI18n(
|
||||||
|
$this->request->getSession()->getLocale(),
|
||||||
|
(ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN
|
||||||
|
);
|
||||||
|
|
||||||
|
$search->groupBy(ContentTableMap::ID);
|
||||||
|
|
||||||
|
$contents = $this->search($search, $pagination);
|
||||||
|
|
||||||
|
$loopResult = new LoopResult();
|
||||||
|
|
||||||
|
foreach ($contents as $content) {
|
||||||
|
$loopResultRow = new LoopResultRow();
|
||||||
|
|
||||||
|
$loopResultRow->set("ID", $content->getId())
|
||||||
|
->set("TITLE",$content->getTitle())
|
||||||
|
->set("CHAPO", $content->getChapo())
|
||||||
|
->set("DESCRIPTION", $content->getDescription())
|
||||||
|
->set("POSTSCRIPTUM", $content->getPostscriptum())
|
||||||
|
->set("POSITION", $content->getPosition())
|
||||||
|
;
|
||||||
|
|
||||||
|
$loopResult->addRow($loopResultRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $loopResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
179
core/lib/Thelia/Core/Template/Loop/Folder.php
Executable file
179
core/lib/Thelia/Core/Template/Loop/Folder.php
Executable file
@@ -0,0 +1,179 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace Thelia\Core\Template\Loop;
|
||||||
|
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
|
use Thelia\Core\Template\Element\BaseLoop;
|
||||||
|
use Thelia\Core\Template\Element\LoopResult;
|
||||||
|
use Thelia\Core\Template\Element\LoopResultRow;
|
||||||
|
|
||||||
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||||
|
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||||
|
use Thelia\Log\Tlog;
|
||||||
|
|
||||||
|
use Thelia\Model\FolderQuery;
|
||||||
|
use Thelia\Model\ConfigQuery;
|
||||||
|
use Thelia\Type\TypeCollection;
|
||||||
|
use Thelia\Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Folder
|
||||||
|
*
|
||||||
|
* @package Thelia\Core\Template\Loop
|
||||||
|
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class Folder extends BaseLoop
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return ArgumentCollection
|
||||||
|
*/
|
||||||
|
protected function getArgDefinitions()
|
||||||
|
{
|
||||||
|
return new ArgumentCollection(
|
||||||
|
Argument::createIntListTypeArgument('id'),
|
||||||
|
Argument::createIntTypeArgument('parent'),
|
||||||
|
Argument::createBooleanTypeArgument('current'),
|
||||||
|
Argument::createBooleanTypeArgument('not_empty', 0),
|
||||||
|
Argument::createBooleanTypeArgument('visible', 1),
|
||||||
|
new Argument(
|
||||||
|
'order',
|
||||||
|
new TypeCollection(
|
||||||
|
new Type\EnumListType(array('alpha', 'alpha_reverse', 'manual', 'manual-reverse', 'random'))
|
||||||
|
),
|
||||||
|
'manual'
|
||||||
|
),
|
||||||
|
Argument::createIntListTypeArgument('exclude')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $pagination
|
||||||
|
*
|
||||||
|
* @return \Thelia\Core\Template\Element\LoopResult
|
||||||
|
*/
|
||||||
|
public function exec(&$pagination)
|
||||||
|
{
|
||||||
|
$search = FolderQuery::create();
|
||||||
|
|
||||||
|
$id = $this->getId();
|
||||||
|
|
||||||
|
if (!is_null($id)) {
|
||||||
|
$search->filterById($id, Criteria::IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
$parent = $this->getParent();
|
||||||
|
|
||||||
|
if (!is_null($parent)) {
|
||||||
|
$search->filterByParent($parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$current = $this->getCurrent();
|
||||||
|
|
||||||
|
if ($current === true) {
|
||||||
|
$search->filterById($this->request->get("folder_id"));
|
||||||
|
} elseif ($current === false) {
|
||||||
|
$search->filterById($this->request->get("folder_id"), Criteria::NOT_IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$exclude = $this->getExclude();
|
||||||
|
|
||||||
|
if (!is_null($exclude)) {
|
||||||
|
$search->filterById($exclude, Criteria::NOT_IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
$search->filterByVisible($this->getVisible() ? 1 : 0);
|
||||||
|
|
||||||
|
$orders = $this->getOrder();
|
||||||
|
|
||||||
|
foreach($orders as $order) {
|
||||||
|
switch ($order) {
|
||||||
|
case "alpha":
|
||||||
|
$search->addAscendingOrderByColumn(\Thelia\Model\Map\FolderI18nTableMap::TITLE);
|
||||||
|
break;
|
||||||
|
case "alpha_reverse":
|
||||||
|
$search->addDescendingOrderByColumn(\Thelia\Model\Map\FolderI18nTableMap::TITLE);
|
||||||
|
break;
|
||||||
|
case "manual-reverse":
|
||||||
|
$search->orderByPosition(Criteria::DESC);
|
||||||
|
break;
|
||||||
|
case "manual":
|
||||||
|
$search->orderByPosition(Criteria::ASC);
|
||||||
|
break;
|
||||||
|
case "random":
|
||||||
|
$search->clearOrderByColumns();
|
||||||
|
$search->addAscendingOrderByColumn('RAND()');
|
||||||
|
break(2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \Criteria::INNER_JOIN in second parameter for joinWithI18n exclude query without translation.
|
||||||
|
*
|
||||||
|
* @todo : verify here if we want results for row without translations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$search->joinWithI18n(
|
||||||
|
$this->request->getSession()->getLocale(),
|
||||||
|
(ConfigQuery::read("default_lang_without_translation", 1)) ? Criteria::LEFT_JOIN : Criteria::INNER_JOIN
|
||||||
|
);
|
||||||
|
|
||||||
|
$folders = $this->search($search, $pagination);
|
||||||
|
|
||||||
|
$notEmpty = $this->getNot_empty();
|
||||||
|
|
||||||
|
$loopResult = new LoopResult();
|
||||||
|
|
||||||
|
foreach ($folders as $folder) {
|
||||||
|
|
||||||
|
if ($notEmpty && $folder->countAllProducts() == 0) continue;
|
||||||
|
|
||||||
|
$loopResultRow = new LoopResultRow();
|
||||||
|
|
||||||
|
$loopResultRow
|
||||||
|
->set("ID", $folder->getId())
|
||||||
|
->set("TITLE",$folder->getTitle())
|
||||||
|
->set("CHAPO", $folder->getChapo())
|
||||||
|
->set("DESCRIPTION", $folder->getDescription())
|
||||||
|
->set("POSTSCRIPTUM", $folder->getPostscriptum())
|
||||||
|
->set("PARENT", $folder->getParent())
|
||||||
|
->set("CONTENT_COUNT", $folder->countChild())
|
||||||
|
->set("VISIBLE", $folder->getVisible() ? "1" : "0")
|
||||||
|
->set("POSITION", $folder->getPosition())
|
||||||
|
|
||||||
|
->set("CREATE_DATE", $folder->getCreatedAt())
|
||||||
|
->set("UPDATE_DATE", $folder->getUpdatedAt())
|
||||||
|
->set("VERSION", $folder->getVersion())
|
||||||
|
->set("VERSION_DATE", $folder->getVersionCreatedAt())
|
||||||
|
->set("VERSION_AUTHOR", $folder->getVersionCreatedBy())
|
||||||
|
;
|
||||||
|
|
||||||
|
$loopResult->addRow($loopResultRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $loopResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -109,6 +109,7 @@ class Product extends BaseLoop
|
|||||||
* @param $pagination
|
* @param $pagination
|
||||||
*
|
*
|
||||||
* @return \Thelia\Core\Template\Element\LoopResult
|
* @return \Thelia\Core\Template\Element\LoopResult
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function exec(&$pagination)
|
public function exec(&$pagination)
|
||||||
{
|
{
|
||||||
@@ -402,11 +403,11 @@ class Product extends BaseLoop
|
|||||||
->set("CHAPO", $product->getChapo())
|
->set("CHAPO", $product->getChapo())
|
||||||
->set("DESCRIPTION", $product->getDescription())
|
->set("DESCRIPTION", $product->getDescription())
|
||||||
->set("POSTSCRIPTUM", $product->getPostscriptum())
|
->set("POSTSCRIPTUM", $product->getPostscriptum())
|
||||||
->set("PRICE", $product->getPrice())
|
//->set("PRICE", $product->getPrice())
|
||||||
->set("PROMO_PRICE", $product->getPrice2())
|
//->set("PROMO_PRICE", $product->getPrice2())
|
||||||
->set("WEIGHT", $product->getWeight())
|
//->set("WEIGHT", $product->getWeight())
|
||||||
->set("PROMO", $product->getPromo())
|
//->set("PROMO", $product->getPromo())
|
||||||
->set("NEW", $product->getNewness())
|
//->set("NEW", $product->getNewness())
|
||||||
->set("POSITION", $product->getPosition())
|
->set("POSITION", $product->getPosition())
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,37 @@ namespace Thelia\Model;
|
|||||||
|
|
||||||
use Thelia\Model\Base\Folder as BaseFolder;
|
use Thelia\Model\Base\Folder as BaseFolder;
|
||||||
|
|
||||||
class Folder extends BaseFolder {
|
class Folder extends BaseFolder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return int number of contents for the folder
|
||||||
|
*/
|
||||||
|
public function countChild()
|
||||||
|
{
|
||||||
|
return FolderQuery::countChild($this->getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* count all products for current category and sub categories
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function countAllContents()
|
||||||
|
{
|
||||||
|
$children = FolderQuery::findAllChild($this->getId());
|
||||||
|
array_push($children, $this);
|
||||||
|
|
||||||
|
$contentsCount = 0;
|
||||||
|
|
||||||
|
foreach($children as $child)
|
||||||
|
{
|
||||||
|
$contentsCount += ProductQuery::create()
|
||||||
|
->filterByCategory($child)
|
||||||
|
->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $contentsCount;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,52 @@ use Thelia\Model\Base\FolderQuery as BaseFolderQuery;
|
|||||||
* long as it does not already exist in the output directory.
|
* long as it does not already exist in the output directory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class FolderQuery extends BaseFolderQuery {
|
class FolderQuery extends BaseFolderQuery
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* count how many direct contents a folder has
|
||||||
|
*
|
||||||
|
* @param int $parent folder id
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public static function countChild($parent)
|
||||||
|
{
|
||||||
|
return self::create()->filterByParent($parent)->count();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* find all contents for a given folder.
|
||||||
|
*
|
||||||
|
* @param $folderId the folder id or an array of id
|
||||||
|
* @param int $depth max depth you want to search
|
||||||
|
* @param int $currentPosition don't change this param, it is used for recursion
|
||||||
|
* @return \Thelia\Model\Folder[]
|
||||||
|
*/
|
||||||
|
public static function findAllChild($folderId, $depth = 0, $currentPosition = 0)
|
||||||
|
{
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
if(is_array($folderId)) {
|
||||||
|
foreach($folderId as $folderSingleId) {
|
||||||
|
$result = array_merge($result, (array) self::findAllChild($folderSingleId, $depth, $currentPosition));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$currentPosition++;
|
||||||
|
|
||||||
|
if($depth == $currentPosition && $depth != 0) return;
|
||||||
|
|
||||||
|
$categories = self::create()
|
||||||
|
->filterByParent($folderId)
|
||||||
|
->find();
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($categories as $folder) {
|
||||||
|
array_push($result, $folder);
|
||||||
|
$result = array_merge($result, (array) self::findAllChild($folder->getId(), $depth, $currentPosition));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
} // FolderQuery
|
} // FolderQuery
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ class CurrencyTableMap extends TableMap
|
|||||||
{
|
{
|
||||||
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), 'SET NULL', 'RESTRICT', 'Orders');
|
$this->addRelation('Order', '\\Thelia\\Model\\Order', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), 'SET NULL', 'RESTRICT', 'Orders');
|
||||||
$this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), null, null, 'Carts');
|
$this->addRelation('Cart', '\\Thelia\\Model\\Cart', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), null, null, 'Carts');
|
||||||
$this->addRelation('ProductPrice', '\\Thelia\\Model\\ProductPrice', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), null, null, 'ProductPrices');
|
$this->addRelation('ProductPrice', '\\Thelia\\Model\\ProductPrice', RelationMap::ONE_TO_MANY, array('id' => 'currency_id', ), 'CASCADE', null, 'ProductPrices');
|
||||||
$this->addRelation('CurrencyI18n', '\\Thelia\\Model\\CurrencyI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CurrencyI18ns');
|
$this->addRelation('CurrencyI18n', '\\Thelia\\Model\\CurrencyI18n', RelationMap::ONE_TO_MANY, array('id' => 'id', ), 'CASCADE', null, 'CurrencyI18ns');
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
@@ -205,6 +205,7 @@ class CurrencyTableMap extends TableMap
|
|||||||
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
OrderTableMap::clearInstancePool();
|
OrderTableMap::clearInstancePool();
|
||||||
|
ProductPriceTableMap::clearInstancePool();
|
||||||
CurrencyI18nTableMap::clearInstancePool();
|
CurrencyI18nTableMap::clearInstancePool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,8 +169,8 @@ class ProductPriceTableMap extends TableMap
|
|||||||
*/
|
*/
|
||||||
public function buildRelations()
|
public function buildRelations()
|
||||||
{
|
{
|
||||||
$this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::MANY_TO_ONE, array('product_sale_elements_id' => 'id', ), null, null);
|
$this->addRelation('ProductSaleElements', '\\Thelia\\Model\\ProductSaleElements', RelationMap::MANY_TO_ONE, array('product_sale_elements_id' => 'id', ), 'CASCADE', null);
|
||||||
$this->addRelation('Currency', '\\Thelia\\Model\\Currency', RelationMap::MANY_TO_ONE, array('currency_id' => 'id', ), null, null);
|
$this->addRelation('Currency', '\\Thelia\\Model\\Currency', RelationMap::MANY_TO_ONE, array('currency_id' => 'id', ), 'CASCADE', null);
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ class ProductSaleElementsTableMap extends TableMap
|
|||||||
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
$this->addRelation('Product', '\\Thelia\\Model\\Product', RelationMap::MANY_TO_ONE, array('product_id' => 'id', ), 'CASCADE', 'RESTRICT');
|
||||||
$this->addRelation('AttributeCombination', '\\Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), null, null, 'AttributeCombinations');
|
$this->addRelation('AttributeCombination', '\\Thelia\\Model\\AttributeCombination', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), null, null, 'AttributeCombinations');
|
||||||
$this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), null, null, 'CartItems');
|
$this->addRelation('CartItem', '\\Thelia\\Model\\CartItem', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), null, null, 'CartItems');
|
||||||
$this->addRelation('ProductPrice', '\\Thelia\\Model\\ProductPrice', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), null, null, 'ProductPrices');
|
$this->addRelation('ProductPrice', '\\Thelia\\Model\\ProductPrice', RelationMap::ONE_TO_MANY, array('id' => 'product_sale_elements_id', ), 'CASCADE', null, 'ProductPrices');
|
||||||
} // buildRelations()
|
} // buildRelations()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,6 +193,15 @@ class ProductSaleElementsTableMap extends TableMap
|
|||||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||||
);
|
);
|
||||||
} // getBehaviors()
|
} // getBehaviors()
|
||||||
|
/**
|
||||||
|
* Method to invalidate the instance pool of all tables related to product_sale_elements * by a foreign key with ON DELETE CASCADE
|
||||||
|
*/
|
||||||
|
public static function clearRelatedInstancePool()
|
||||||
|
{
|
||||||
|
// Invalidate objects in ".$this->getClassNameFromBuilder($joinedTableTableMapBuilder)." instance pool,
|
||||||
|
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||||
|
ProductPriceTableMap::clearInstancePool();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
|
||||||
|
|||||||
51
core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php
Executable file
51
core/lib/Thelia/Tests/Core/Template/Loop/ContentTest.php
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace Thelia\Tests\Core\Template\Loop;
|
||||||
|
|
||||||
|
use Thelia\Tests\Core\Template\Element\BaseLoopTestor;
|
||||||
|
|
||||||
|
use Thelia\Core\Template\Loop\Content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class ContentTest extends BaseLoopTestor
|
||||||
|
{
|
||||||
|
public function getTestedClassName()
|
||||||
|
{
|
||||||
|
return 'Thelia\Core\Template\Loop\Content';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTestedInstance()
|
||||||
|
{
|
||||||
|
return new Content($this->request, $this->dispatcher, $this->securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMandatoryArguments()
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
}
|
||||||
51
core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php
Executable file
51
core/lib/Thelia/Tests/Core/Template/Loop/FolderTest.php
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
/*************************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Thelia */
|
||||||
|
/* */
|
||||||
|
/* Copyright (c) OpenStudio */
|
||||||
|
/* email : info@thelia.net */
|
||||||
|
/* web : http://www.thelia.net */
|
||||||
|
/* */
|
||||||
|
/* This program is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public License as published by */
|
||||||
|
/* the Free Software Foundation; either version 3 of the License */
|
||||||
|
/* */
|
||||||
|
/* This program is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
/* */
|
||||||
|
/*************************************************************************************/
|
||||||
|
|
||||||
|
namespace Thelia\Tests\Core\Template\Loop;
|
||||||
|
|
||||||
|
use Thelia\Tests\Core\Template\Element\BaseLoopTestor;
|
||||||
|
|
||||||
|
use Thelia\Core\Template\Loop\Folder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class FolderTest extends BaseLoopTestor
|
||||||
|
{
|
||||||
|
public function getTestedClassName()
|
||||||
|
{
|
||||||
|
return 'Thelia\Core\Template\Loop\Folder';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTestedInstance()
|
||||||
|
{
|
||||||
|
return new Folder($this->request, $this->dispatcher, $this->securityContext);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMandatoryArguments()
|
||||||
|
{
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,13 +20,21 @@ try {
|
|||||||
->find();
|
->find();
|
||||||
$product->delete();
|
$product->delete();
|
||||||
|
|
||||||
|
$folder = Thelia\Model\FolderQuery::create()
|
||||||
|
->find();
|
||||||
|
$folder->delete();
|
||||||
|
|
||||||
|
$content = Thelia\Model\ContentQuery::create()
|
||||||
|
->find();
|
||||||
|
$content->delete();
|
||||||
|
|
||||||
//first category
|
//first category
|
||||||
$sweet = new Thelia\Model\Category();
|
$sweet = new Thelia\Model\Category();
|
||||||
$sweet->setParent(0);
|
$sweet->setParent(0);
|
||||||
$sweet->setVisible(1);
|
$sweet->setVisible(1);
|
||||||
$sweet->setPosition(1);
|
$sweet->setPosition(1);
|
||||||
$sweet->setDescription($faker->text(255));
|
$sweet->setDescription($faker->text(255));
|
||||||
$sweet->setTitle($faker->bs);
|
$sweet->setTitle($faker->text(20));
|
||||||
|
|
||||||
$sweet->save();
|
$sweet->save();
|
||||||
|
|
||||||
@@ -36,7 +44,7 @@ try {
|
|||||||
$jeans->setVisible(1);
|
$jeans->setVisible(1);
|
||||||
$jeans->setPosition(2);
|
$jeans->setPosition(2);
|
||||||
$jeans->setDescription($faker->text(255));
|
$jeans->setDescription($faker->text(255));
|
||||||
$jeans->setTitle($faker->bs);
|
$jeans->setTitle($faker->text(20));
|
||||||
|
|
||||||
$jeans->save();
|
$jeans->save();
|
||||||
|
|
||||||
@@ -46,14 +54,14 @@ try {
|
|||||||
$other->setVisible(1);
|
$other->setVisible(1);
|
||||||
$other->setPosition(3);
|
$other->setPosition(3);
|
||||||
$other->setDescription($faker->text(255));
|
$other->setDescription($faker->text(255));
|
||||||
$other->setTitle($faker->bs);
|
$other->setTitle($faker->text(20));
|
||||||
|
|
||||||
$other->save();
|
$other->save();
|
||||||
|
|
||||||
for ($i=1; $i <= 5; $i++) {
|
for ($i=1; $i <= 5; $i++) {
|
||||||
$product = new \Thelia\Model\Product();
|
$product = new \Thelia\Model\Product();
|
||||||
$product->addCategory($sweet);
|
$product->addCategory($sweet);
|
||||||
$product->setTitle($faker->bs);
|
$product->setTitle($faker->text(20));
|
||||||
$product->setDescription($faker->text(250));
|
$product->setDescription($faker->text(250));
|
||||||
/* $product->setQuantity($faker->randomNumber(1,50));
|
/* $product->setQuantity($faker->randomNumber(1,50));
|
||||||
$product->setPrice($faker->randomFloat(2, 20, 2500));*/
|
$product->setPrice($faker->randomFloat(2, 20, 2500));*/
|
||||||
@@ -79,7 +87,7 @@ try {
|
|||||||
for ($i=1; $i <= 5; $i++) {
|
for ($i=1; $i <= 5; $i++) {
|
||||||
$product = new \Thelia\Model\Product();
|
$product = new \Thelia\Model\Product();
|
||||||
$product->addCategory($jeans);
|
$product->addCategory($jeans);
|
||||||
$product->setTitle($faker->bs);
|
$product->setTitle($faker->text(20));
|
||||||
$product->setDescription($faker->text(250));
|
$product->setDescription($faker->text(250));
|
||||||
/* $product->setQuantity($faker->randomNumber(1,50));
|
/* $product->setQuantity($faker->randomNumber(1,50));
|
||||||
$product->setPrice($faker->randomFloat(2, 20, 2500));*/
|
$product->setPrice($faker->randomFloat(2, 20, 2500));*/
|
||||||
@@ -102,6 +110,60 @@ try {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//folders and contents
|
||||||
|
for($i=0; $i<4; $i++) {
|
||||||
|
$folder = new Thelia\Model\Folder();
|
||||||
|
$folder->setParent(0);
|
||||||
|
$folder->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||||
|
$folder->setPosition($i);
|
||||||
|
$folder->setTitle($faker->text(20));
|
||||||
|
$folder->setDescription($faker->text(255));
|
||||||
|
|
||||||
|
$folder->save();
|
||||||
|
|
||||||
|
for($j=0; $j<rand(0, 4); $j++) {
|
||||||
|
$subfolder = new Thelia\Model\Folder();
|
||||||
|
$subfolder->setParent($folder->getId());
|
||||||
|
$subfolder->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||||
|
$subfolder->setPosition($j);
|
||||||
|
$subfolder->setTitle($faker->text(20));
|
||||||
|
$subfolder->setDescription($faker->text(255));
|
||||||
|
|
||||||
|
$subfolder->save();
|
||||||
|
|
||||||
|
for($k=0; $k<rand(1, 5); $k++) {
|
||||||
|
$content = new Thelia\Model\Content();
|
||||||
|
$content->addFolder($subfolder);
|
||||||
|
$content->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||||
|
$content->setPosition($k);
|
||||||
|
$content->setTitle($faker->text(20));
|
||||||
|
$content->setDescription($faker->text(255));
|
||||||
|
|
||||||
|
$content->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//features and features_av
|
||||||
|
for($i=0; $i<4; $i++) {
|
||||||
|
$feature = new Thelia\Model\Feature();
|
||||||
|
$feature->setVisible(rand(1, 10)>7 ? 0 : 1);
|
||||||
|
$feature->setPosition($i);
|
||||||
|
$feature->setTitle($faker->text(20));
|
||||||
|
$feature->setDescription($faker->text(50));
|
||||||
|
|
||||||
|
$feature->save();
|
||||||
|
|
||||||
|
for($j=0; $j<rand(1, 5); $j++) {
|
||||||
|
$featureAv = new Thelia\Model\FeatureAv();
|
||||||
|
$featureAv->setFeature($feature);
|
||||||
|
$featureAv->setPosition($j);
|
||||||
|
$featureAv->setTitle($faker->text(20));
|
||||||
|
$featureAv->setDescription($faker->text(255));
|
||||||
|
|
||||||
|
$featureAv->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
@@ -1349,10 +1349,12 @@ CREATE TABLE `product_price`
|
|||||||
INDEX `idx_product_price_currency_id` (`currency_id`),
|
INDEX `idx_product_price_currency_id` (`currency_id`),
|
||||||
CONSTRAINT `fk_product_price_product_sale_elements_id`
|
CONSTRAINT `fk_product_price_product_sale_elements_id`
|
||||||
FOREIGN KEY (`product_sale_elements_id`)
|
FOREIGN KEY (`product_sale_elements_id`)
|
||||||
REFERENCES `product_sale_elements` (`id`),
|
REFERENCES `product_sale_elements` (`id`)
|
||||||
|
ON DELETE CASCADE,
|
||||||
CONSTRAINT `fk_product_price_currency_id`
|
CONSTRAINT `fk_product_price_currency_id`
|
||||||
FOREIGN KEY (`currency_id`)
|
FOREIGN KEY (`currency_id`)
|
||||||
REFERENCES `currency` (`id`)
|
REFERENCES `currency` (`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<database defaultIdMethod="native" name="thelia">
|
<database defaultIdMethod="native" name="thelia">
|
||||||
<table name="category" namespace="Thelia\Model">
|
<table name="category" namespace="Thelia\Model">
|
||||||
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
<column autoIncrement="true" name="id" primaryKey="true" required="true" type="INTEGER" />
|
||||||
@@ -990,10 +990,10 @@
|
|||||||
<column name="currency_id" required="true" type="INTEGER" />
|
<column name="currency_id" required="true" type="INTEGER" />
|
||||||
<column name="price" required="true" type="FLOAT" />
|
<column name="price" required="true" type="FLOAT" />
|
||||||
<column name="promo_price" type="FLOAT" />
|
<column name="promo_price" type="FLOAT" />
|
||||||
<foreign-key foreignTable="product_sale_elements" name="fk_product_price_product_sale_elements_id">
|
<foreign-key foreignTable="product_sale_elements" name="fk_product_price_product_sale_elements_id" onDelete="CASCADE">
|
||||||
<reference foreign="id" local="product_sale_elements_id" />
|
<reference foreign="id" local="product_sale_elements_id" />
|
||||||
</foreign-key>
|
</foreign-key>
|
||||||
<foreign-key foreignTable="currency" name="fk_product_price_currency_id">
|
<foreign-key foreignTable="currency" name="fk_product_price_currency_id" onDelete="CASCADE">
|
||||||
<reference foreign="id" local="currency_id" />
|
<reference foreign="id" local="currency_id" />
|
||||||
</foreign-key>
|
</foreign-key>
|
||||||
<index name="idx_product_price_product_sale_elements_id">
|
<index name="idx_product_price_product_sale_elements_id">
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
{loop name="cat" type="category" id="99999"}
|
|
||||||
{loop name="prod" type="product" category="#ID"}
|
|
||||||
{/loop}
|
|
||||||
{/loop}
|
|
||||||
16
templates/default/folder.html
Executable file
16
templates/default/folder.html
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
{loop name="folder0" type="folder" parent="0" order="alpha_reverse"}
|
||||||
|
<div style="border: solid 4px blue; padding: 20px; margin: 10px;">
|
||||||
|
<h2>FOLDER : #TITLE</h2>
|
||||||
|
{loop name="folder1" type="folder" parent="#ID"}
|
||||||
|
<div style="border: double 4px lightseagreen; padding: 20px; margin: 10px;">
|
||||||
|
<h3>SUBFOLDER : #TITLE (#LOOP_COUNT / #LOOP_TOTAL)</h3>
|
||||||
|
{loop name="content" type="content" folder="#ID"}
|
||||||
|
<div style="border: solid 1px green; padding: 20px; margin: 10px;">
|
||||||
|
<h3>CONTENT : #TITLE</h3>
|
||||||
|
<p>#DESCRIPTION</p>
|
||||||
|
</div>
|
||||||
|
{/loop}
|
||||||
|
</div>
|
||||||
|
{/loop}
|
||||||
|
</div>
|
||||||
|
{/loop}
|
||||||
Reference in New Issue
Block a user