Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for parent attribute of Category loop, and new exclude_parent attribute #1759

Merged
merged 1 commit into from Oct 31, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions core/lib/Thelia/Core/Template/Loop/Category.php
Expand Up @@ -47,6 +47,7 @@
* {@inheritdoc}
* @method int[] getId()
* @method int getParent()
* @method int getExcludeParent()
* @method int getProduct()
* @method int getExcludeProduct()
* @method bool getCurrent()
Expand All @@ -70,7 +71,8 @@ protected function getArgDefinitions()
{
return new ArgumentCollection(
Argument::createIntListTypeArgument('id'),
Argument::createIntTypeArgument('parent'),
Argument::createIntListTypeArgument('parent'),
Argument::createIntListTypeArgument('exclude_parent'),
Argument::createIntTypeArgument('product'),
Argument::createIntTypeArgument('exclude_product'),
Argument::createBooleanTypeArgument('current'),
Expand Down Expand Up @@ -129,7 +131,13 @@ public function buildModelCriteria()
$parent = $this->getParent();

if (!is_null($parent)) {
$search->filterByParent($parent);
$search->filterByParent($parent, Criteria::IN);
}

$excludeParent = $this->getExcludeParent();

if (!is_null($excludeParent)) {
$search->filterByParent($excludeParent, Criteria::NOT_IN);
}

$current = $this->getCurrent();
Expand Down