This repository has been archived by the owner on Oct 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from EmicoEcommerce/feat/category-filter-type…
…-tweakwise Feat/category filter type tweakwise
- Loading branch information
Showing
11 changed files
with
167 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
Block/LayeredNavigation/RenderLayered/LinkRenderer/ItemRenderer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
/** | ||
* Tweakwise & Emico (https://www.tweakwise.com/ & https://www.emico.nl/) - All Rights Reserved | ||
* | ||
* @copyright Copyright (c) 2017-2017 Tweakwise.com B.V. (https://www.tweakwise.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
namespace Emico\Tweakwise\Block\LayeredNavigation\RenderLayered\LinkRenderer; | ||
|
||
use Emico\Tweakwise\Block\LayeredNavigation\RenderLayered\LinkRenderer; | ||
use Emico\Tweakwise\Model\Catalog\Layer\Filter\Item; | ||
|
||
/** | ||
* Class ItemRenderer | ||
* @package Emico\Tweakwise\Block\LayeredNavigation\RenderLayered\LinkRenderer | ||
*/ | ||
class ItemRenderer extends LinkRenderer | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
protected $_template = 'Emico_Tweakwise::product/layered/link/item.phtml'; | ||
|
||
/** | ||
* @var Item | ||
*/ | ||
protected $item; | ||
|
||
/** | ||
* @return Item | ||
*/ | ||
public function getItem() | ||
{ | ||
return $this->item; | ||
} | ||
|
||
/** | ||
* @param Item $item | ||
* @return $this | ||
*/ | ||
public function setItem(Item $item) | ||
{ | ||
$this->item = $item; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function hasChildren() | ||
{ | ||
return $this->item->hasChildren(); | ||
} | ||
|
||
/** | ||
* @return Item[] | ||
*/ | ||
public function getChildren() | ||
{ | ||
// When rendering link items we need to remove everything after the first nesting | ||
// because "link view (linkweergave)" has a max of 1 nesting | ||
foreach ($this->item->getChildren() as $child) { | ||
$child->setChildren([]); | ||
} | ||
return $this->item->getChildren(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/** | ||
* Tweakwise & Emico (https://www.tweakwise.com/ & https://www.emico.nl/) - All Rights Reserved | ||
* | ||
* @copyright Copyright (c) 2017-2017 Tweakwise.com B.V. (https://www.tweakwise.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
use Emico\Tweakwise\Block\LayeredNavigation\RenderLayered\TreeRenderer; | ||
|
||
/** @var $block \Emico\Tweakwise\Block\LayeredNavigation\RenderLayered\LinkRenderer */ | ||
?> | ||
<ol class="items link-attribute"> | ||
<?php foreach ($block->getItems() as $item): ?> | ||
<?=$block->renderLinkItem($item)?> | ||
<?php endforeach; ?> | ||
</ol> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* Tweakwise & Emico (https://www.tweakwise.com/ & https://www.emico.nl/) - All Rights Reserved | ||
* | ||
* @copyright Copyright (c) 2017-2017 Tweakwise.com B.V. (https://www.tweakwise.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
use Emico\Tweakwise\Block\LayeredNavigation\RenderLayered\LinkRenderer\ItemRenderer; | ||
|
||
/** @var $block ItemRenderer */ | ||
$item = $block->getItem(); | ||
?> | ||
|
||
<li class="item"> | ||
<a href="<?=$block->escapeUrl($item->getUrl())?>"> | ||
<?=$block->getItemPrefix()?> | ||
<?=$block->escapeHtml($item->getLabel())?> | ||
<?=$block->getItemPostfix()?> | ||
|
||
<?php if ($block->shouldDisplayProductCountOnLayer()): ?> | ||
<span class="count"> | ||
<?=htmlentities($item->getCount())?> | ||
<span class="filter-count-label"> | ||
<?php if ($item->getCount() == 1):?> | ||
<?=__('item')?> | ||
<?php else:?> | ||
<?=__('items')?> | ||
<?php endif;?> | ||
</span> | ||
</span> | ||
<?php endif; ?> | ||
</a> | ||
|
||
<?php if ($block->hasChildren()): ?> | ||
<ol class="items child-items"> | ||
<?php foreach ($block->getChildren() as $child): ?> | ||
<?=$block->renderLinkItem($child)?> | ||
<?php endforeach; ?> | ||
</ol> | ||
<?php endif; ?> | ||
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters