Hi,
In m'y PrestaShop version 1.7.6.0
Module ps_facetedsearch v3.2.1
it's impossible to override file located in modules/ps_facetedsearch/views/templates/front/catalog/active-filters.tpl
from my template in respecting exactly the same folders path.
It cames from the /modules/ps_facetedsearch/src/Product/SearchProvider.php
in lines method renderActiveFilters
public function renderActiveFilters(ProductSearchContext $context, ProductSearchResult $result)
{
list($activeFilters) = $this->prepareActiveFiltersForRender($context, $result);
return $this->module->render(
'views/templates/front/catalog/active-filters.tpl',
[
'activeFilters' => $activeFilters,
'clear_all_link' => $this->updateQueryString(
[
'q' => null,
'page' => null,
]
),
]
);
}
I've tried to change by using fetch method from module, but still not working:
public function renderActiveFilters(ProductSearchContext $context, ProductSearchResult $result)
{
list($activeFilters) = $this->prepareActiveFiltersForRender($context, $result);
return $this->module->fetch(
'module:ps_facetedsearch/views/templates/front/catalog/active-filters.tpl',
[
'activeFilters' => $activeFilters,
'clear_all_link' => $this->updateQueryString(
[
'q' => null,
'page' => null,
]
),
]
);
}
So, every template can't override this file.
Thanks.
Hi @PrestaSafe,
I did not manage to reproduce the issue with PS1.7.6.1 & ps_facetedesarch v3.2.1.
I used this method
public function renderActiveFilters(ProductSearchContext $context, ProductSearchResult $result)
{
list($activeFilters) = $this->prepareActiveFiltersForRender($context, $result);
return $this->module->fetch(
'module:ps_facetedsearch/views/templates/front/catalog/active-filters.tpl',
[
'activeFilters' => $activeFilters,
'clear_all_link' => $this->updateQueryString(
[
'q' => null,
'page' => null,
]
),
]
);
}
=> it is well working in my case.
I attached a screen record
https://drive.google.com/file/d/1xpgqRQ6QHsZEUtcy6fcijYL-ETKUJgTw/view
Thanks to check & feedback.
i'll try an update to 1.7.6.1 and test it again, but still, the SearchProvider.php need to be updated for add fetch method with new path 'module:ps_facetedsearch/views/...' instead of render on all methods who rendering smarty views.
It's now working on 1.7.6.1 but i think it was my cache.
How to make a PR for modify the SearchProvider.php ?
Ping @PierreRambaud what do you think?
@PrestaSafe, you can follow this link: https://devdocs.prestashop.com/1.7/contribute/contribution-guidelines/
If you change this line
return $this->module->fetch(
'views/templates/front/catalog/active-filters.tpl',
[
I have an error 500.
Thanks!
return $this->module->fetch(
'views/templates/front/catalog/active-filters.tpl',
[
you need to prefix the path
return $this->module->fetch(
'module:ps_facetedsearch/views/templates/front/catalog/active-filters.tpl',
[
i've make a PR for the module
https://github.com/PrestaShop/ps_facetedsearch/pull/134
@PrestaSafe, thanks!
Yes, in my case using this method
public function renderActiveFilters(ProductSearchContext $context, ProductSearchResult $result)
{
list($activeFilters) = $this->prepareActiveFiltersForRender($context, $result);
return $this->module->render(
'views/templates/front/catalog/active-filters.tpl',
[
'activeFilters' => $activeFilters,
'clear_all_link' => $this->updateQueryString(
[
'q' => null,
'page' => null,
]
),
]
);
}
Template will not be overrided.
Thanks!
Yes you need to prefix ;)
Closed with https://github.com/PrestaShop/ps_facetedsearch/pull/135
Will be released in 3.3.0