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.
- Loading branch information
Showing
88 changed files
with
2,846 additions
and
871 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,24 @@ | ||
## 0.1.0-beta (2017-02-01) | ||
## 3.0.0 | ||
1) Ajax filtering implemented | ||
2) methods and property visibility updated to "protected" (to allow easier preferences). | ||
|
||
Features: | ||
- Supported Magento versions 100.1.*|100.0.*, | ||
BC breaks: | ||
1) Template src/view/frontend/templates/product/navigation/view.phtml moved to src/view/frontend/templates/layer/view.phtml | ||
as that is the template it replaces | ||
2) Complete overhaul of js components, if you have any changes in those you will need to redo them. | ||
3) Overhauled slider template: src/view/frontend/templates/product/layered/slider.phtml the javascript part has been moved to a separate js component, namely | ||
src/view/frontend/web/js/navigation-slider.js | ||
4) Removed deprecated methods from src/Block/LayeredNavigation/RenderLayered/SliderRenderer.php | ||
5) All data-mage-init statements now go through model: src/Model/NavigationConfig.php this class will resolve the correct js components based on your configuration | ||
This means yet more bc breaks on your template overrides (if any) | ||
6) References to "Zend\Http\Request as HttpRequest" have been removed, we now depend on the concrete magento request object. This is because of the move from zend to laminas. | ||
7) Added methods | ||
```php | ||
public function getClearUrl(MagentoHttpRequest $request, array $activeFilterItems): string; | ||
public function buildFilterUrl(MagentoHttpRequest $request, array $filters = []): string; | ||
``` | ||
To interface UrlInterface to facilitate ajax filtering | ||
|
||
Furthermore: various code style fixes, simplifications and general "cleanup". | ||
|
||
|
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 was deleted.
Oops, something went wrong.
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,112 @@ | ||
<?php | ||
|
||
/** | ||
* @author : Edwin Jacobs, email: ejacobs@emico.nl. | ||
* @copyright : Copyright Emico B.V. 2020. | ||
*/ | ||
|
||
namespace Emico\Tweakwise\Block\LayeredNavigation\Navigation; | ||
|
||
use Emico\Tweakwise\Model\Catalog\Layer\Filter\Item; | ||
use Emico\Tweakwise\Model\Client\Request\ProductSearchRequest; | ||
use Emico\Tweakwise\Model\Client\Type\FacetType\SettingsType; | ||
use Emico\Tweakwise\Model\Config; | ||
use Emico\Tweakwise\Model\Catalog\Layer\Url; | ||
use Emico\Tweakwise\Model\Catalog\Layer\NavigationContext\CurrentContext; | ||
use Magento\Catalog\Model\Layer\Resolver; | ||
use Magento\Framework\View\Element\Template\Context; | ||
use Magento\LayeredNavigation\Block\Navigation\State as MagentoStateBlock; | ||
|
||
class State extends MagentoStateBlock | ||
{ | ||
/** | ||
* @var Config | ||
*/ | ||
protected $config; | ||
|
||
/** | ||
* @var Url | ||
*/ | ||
protected $url; | ||
|
||
/** | ||
* State constructor. | ||
* @param Context $context | ||
* @param Resolver $layerResolver | ||
* @param Config $config | ||
* @param Url $url | ||
* @param CurrentContext $currentContext | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Resolver $layerResolver, | ||
Config $config, | ||
Url $url, | ||
CurrentContext $currentContext, | ||
array $data = [] | ||
) { | ||
parent::__construct( | ||
$context, | ||
$layerResolver, | ||
$data | ||
); | ||
|
||
$this->config = $config; | ||
$this->url = $url; | ||
$this->updateTemplate($currentContext); | ||
} | ||
|
||
/** | ||
* Use our template if applicable | ||
* If you want to change this behaviour use a plugin on afterGetTemplate | ||
* | ||
* @param CurrentContext $currentContext | ||
*/ | ||
protected function updateTemplate(CurrentContext $currentContext) | ||
{ | ||
if ($this->config->getUseDefaultLinkRenderer()) { | ||
return; | ||
} | ||
|
||
$searchEnabled = $this->config->isSearchEnabled(); | ||
$navigationEnabled = $this->config->isLayeredEnabled(); | ||
|
||
$isSearch = $currentContext->getRequest() instanceof ProductSearchRequest; | ||
$isNavigation = !$isSearch; | ||
|
||
if ($isSearch && $searchEnabled) { | ||
$this->_template = 'Emico_Tweakwise::layer/state.phtml'; | ||
} | ||
|
||
if ($isNavigation && $navigationEnabled) { | ||
$this->_template = 'Emico_Tweakwise::layer/state.phtml'; | ||
} | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getClearUrl() | ||
{ | ||
if (!$this->config->isLayeredEnabled()) { | ||
return parent::getClearUrl(); | ||
} | ||
|
||
return $this->url->getClearUrl($this->getActiveFilters()); | ||
} | ||
|
||
/** | ||
* @param Item $item | ||
* @return string|void | ||
*/ | ||
public function getActiveFilterCssId(Item $item) | ||
{ | ||
$facetSettings = $item->getFilter()->getFacet()->getFacetSettings(); | ||
if ($facetSettings->getSelectionType() === SettingsType::SELECTION_TYPE_SLIDER) { | ||
return 'slider-' . $facetSettings->getUrlKey(); | ||
} | ||
|
||
return spl_object_hash($item); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.