I am trying to set a product filter on the custom cms page.
for that, I have created a 1 cms page name test with two-column with left bar.
and inside it, I have called one template file
{{block class=”MagentoFrameworkViewElementTemplate”
template=”Magento_Theme::html/test.phtml”}}
in the layout update, I have placed this code
for calling product filter
inside the test.phtml file I have searched the products from the collection.
if(isset($_REQUEST["test"])) {
$productCollection = $objectManager->create('MagentoCatalogModelResourceModelProductCollectionFactory');
$imageHelper = $objectManager->get('MagentoCatalogHelperImage');
$collection = $productCollection->create()
->addAttributeToSelect('*')
->addAttributeToFilter('status',MagentoCatalogModelProductAttributeSourceStatus::STATUS_ENABLED)
->addAttributeToFilter('visibility', MagentoCatalogModelProductVisibility::VISIBILITY_BOTH)
->addAttributeToFilter('test', $_REQUEST["test"])
->load();
}
when I click on any of the filter options then my URL becomes
so can I get the filter request but it is a very tedious task to set a filter in collection manually.
and on the home page, I have set one search box for search products.
I know that this is not a standard way to do that but anyone can help
me to set this filter in custom cms page.
Any help would be appreciated.
Thanks in advance..!