Custom Product Collection not Getting Filtered by Layered NavigationSearch current store products onlyMagento 2 - Custom Product Collection not Getting Filtered by Layered NavigationHow to add attribute filter in product listing page in magento 1.9?Layered navigation filters for grouped products onlyLayered Navigation for Admin ReportLayered Navigation for Custom Product Collection filtered via Custom AttributeHow to apply a custom filter logic for selected filter layered navigation product countCustomize Layered Navigation and Catalog List BehaviourMagento 2 - Layered Navigation for Custom Product CollectionLayered navigation missing attributesMagento2 how to apply layered navigation filters at REST API Level?Filter on custom product collectionIncorrect product count in layered navigation after overriding list product collection
Why aren't rockets built with truss structures inside their fuel & oxidizer tanks to increase structural strength?
Is there a SQL/English like language that lets you define formulations given some data?
Can renaming a method preserve encapsulation?
Can the IPA represent all languages' tones?
What is a "soap"?
Does EU compensation apply to flights where the departure airport closes check-in counters during protests?
Telephone number in spoken words
How would you translate this? バタコチーズライス
How to Check all AD userers for "blank" password?
How would timezones work on a planet 100 times the size of our Earth
Installing Windows to flash BIOS, then reinstalling Ubuntu
Do beef farmed pastures net remove carbon emissions?
Heating Margarine in Pan = loss of calories?
Who invented Monoid?
Why is Python 2.7 still the default Python version in Ubuntu?
My cat is a houdini
Symbol: Put a smile symbol under a plus
Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?
Case Condition for two lines
Why is the Lucas test not recommended to differentiate higher alcohols?
Boss wants me to ignore a software API license prohibiting mass download
Are there any other rule mechanics that could grant Thieves' Cant?
What is the farthest a camera can see?
What are those bumps on top of the Antonov-225?
Custom Product Collection not Getting Filtered by Layered Navigation
Search current store products onlyMagento 2 - Custom Product Collection not Getting Filtered by Layered NavigationHow to add attribute filter in product listing page in magento 1.9?Layered navigation filters for grouped products onlyLayered Navigation for Admin ReportLayered Navigation for Custom Product Collection filtered via Custom AttributeHow to apply a custom filter logic for selected filter layered navigation product countCustomize Layered Navigation and Catalog List BehaviourMagento 2 - Layered Navigation for Custom Product CollectionLayered navigation missing attributesMagento2 how to apply layered navigation filters at REST API Level?Filter on custom product collectionIncorrect product count in layered navigation after overriding list product collection
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I had Overridden the product List.php Class & here is the code
protected function _getProductCollection()
if (is_null($this->_productCollection))
$result = array_unique($productIds);
$collection = Mage::getResourceModel('catalog/product_collection');
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection->addAttributeToSelect($attributes);
$collection->addIdFilter($result);
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
$this->_productCollection = $collection;
return $this->_productCollection;
working fine, I also had added Layered Navigation as mentioned here and layered navigation appeared as expected.
The only problem is, when I click on any filter in layered navigation, navigation gets updated and filter also get added to url, but product list won't get filtered by the selected filter. Please guide me how can I apply the filters on product collection
magento-1.8 layered-navigation
add a comment |
I had Overridden the product List.php Class & here is the code
protected function _getProductCollection()
if (is_null($this->_productCollection))
$result = array_unique($productIds);
$collection = Mage::getResourceModel('catalog/product_collection');
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection->addAttributeToSelect($attributes);
$collection->addIdFilter($result);
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
$this->_productCollection = $collection;
return $this->_productCollection;
working fine, I also had added Layered Navigation as mentioned here and layered navigation appeared as expected.
The only problem is, when I click on any filter in layered navigation, navigation gets updated and filter also get added to url, but product list won't get filtered by the selected filter. Please guide me how can I apply the filters on product collection
magento-1.8 layered-navigation
add a comment |
I had Overridden the product List.php Class & here is the code
protected function _getProductCollection()
if (is_null($this->_productCollection))
$result = array_unique($productIds);
$collection = Mage::getResourceModel('catalog/product_collection');
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection->addAttributeToSelect($attributes);
$collection->addIdFilter($result);
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
$this->_productCollection = $collection;
return $this->_productCollection;
working fine, I also had added Layered Navigation as mentioned here and layered navigation appeared as expected.
The only problem is, when I click on any filter in layered navigation, navigation gets updated and filter also get added to url, but product list won't get filtered by the selected filter. Please guide me how can I apply the filters on product collection
magento-1.8 layered-navigation
I had Overridden the product List.php Class & here is the code
protected function _getProductCollection()
if (is_null($this->_productCollection))
$result = array_unique($productIds);
$collection = Mage::getResourceModel('catalog/product_collection');
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection->addAttributeToSelect($attributes);
$collection->addIdFilter($result);
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
$this->_productCollection = $collection;
return $this->_productCollection;
working fine, I also had added Layered Navigation as mentioned here and layered navigation appeared as expected.
The only problem is, when I click on any filter in layered navigation, navigation gets updated and filter also get added to url, but product list won't get filtered by the selected filter. Please guide me how can I apply the filters on product collection
magento-1.8 layered-navigation
magento-1.8 layered-navigation
edited Sep 26 '14 at 4:40
Keyul Shah
6,6697 gold badges32 silver badges59 bronze badges
6,6697 gold badges32 silver badges59 bronze badges
asked Sep 26 '14 at 4:29
AhmedAhmed
5681 gold badge8 silver badges28 bronze badges
5681 gold badge8 silver badges28 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
For layered Navigation you have to:
Extend
app/code/core/Mage/CatalogSearch/Model/Layer.php
to your custom module.
And over ride prepare collection function:
public function prepareProductCollection($collection)
if(Mage::helper('catalogsearch')->getQuery()->getQueryText())
return parent::prepareProductCollection($collection);
else
$collection
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes());
$collection->setStore(Mage::app()->getStore())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addStoreFilter()
->addUrlRewrite();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
return $this;
Check this Reference URL
Let's say I have a widget with a custom product colleciton -- how can I use the above function?
– easymoden00b
Feb 26 '15 at 15:23
1
Hi TBI Infotech, im facing exactly the same issue in magento 2.0... i have overridden LayeredNavigation (MagentoLayeredNavigationBlockNavigation) class, but as above problem, filters come in URL, but they are not getting applied....I have also overridden Magentos Catalog's Block Product ListProduct's _getProductCollection().
– Sushivam
Sep 28 '16 at 11:41
I have updated the issue with code in Magento 2 here magento.stackexchange.com/questions/138474/…
– Sushivam
Sep 28 '16 at 13:44
What is the equivalent class in Magento2 for app/code/core/Mage/CatalogSearch/Model/Layer...?
– Sushivam
Sep 29 '16 at 10:17
add a comment |
You are using wrong method
protected function _getProductCollection()
if (is_null($this->_productCollection))
$result = array_unique($productIds);
$collection = Mage::getResourceModel('catalog/product_collection');
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection->addAttributeToSelect($attributes);
$collection->addAttributeToFilter('entity_id', array('in' => $result));
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
$this->_productCollection = $collection;
return $this->_productCollection;
So try the above code let me know if any comments.
$collection->addAttributeToFilter('entity_id', array('in' => $result));
made no difference, same result
– Ahmed
Sep 26 '14 at 4:46
Collection is filtering just fine, but the selected filter of layered navigation is not getting applied on him
– Ahmed
Sep 26 '14 at 4:48
then you have to check filter file i think layer.php
– Keyul Shah
Sep 26 '14 at 4:55
please correct me if I am wrong, but I think Layer.php is not responsible for filtering the product collection but it creates a layered navigation based on the product collection which it gets from the current category
– Ahmed
Sep 26 '14 at 5:15
public function getProductCollection() if(isset($this->_productCollections[$this->getCurrentCategory()->getId()])) $collection = $this->_productCollections[$this->getCurrentCategory()->getId()]; else $collection = $this->getCurrentCategory()->getProductCollection(); $this->prepareProductCollection($collection); $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection; return $collection;
– Ahmed
Sep 26 '14 at 5:16
|
show 2 more comments
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f37148%2fcustom-product-collection-not-getting-filtered-by-layered-navigation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
For layered Navigation you have to:
Extend
app/code/core/Mage/CatalogSearch/Model/Layer.php
to your custom module.
And over ride prepare collection function:
public function prepareProductCollection($collection)
if(Mage::helper('catalogsearch')->getQuery()->getQueryText())
return parent::prepareProductCollection($collection);
else
$collection
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes());
$collection->setStore(Mage::app()->getStore())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addStoreFilter()
->addUrlRewrite();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
return $this;
Check this Reference URL
Let's say I have a widget with a custom product colleciton -- how can I use the above function?
– easymoden00b
Feb 26 '15 at 15:23
1
Hi TBI Infotech, im facing exactly the same issue in magento 2.0... i have overridden LayeredNavigation (MagentoLayeredNavigationBlockNavigation) class, but as above problem, filters come in URL, but they are not getting applied....I have also overridden Magentos Catalog's Block Product ListProduct's _getProductCollection().
– Sushivam
Sep 28 '16 at 11:41
I have updated the issue with code in Magento 2 here magento.stackexchange.com/questions/138474/…
– Sushivam
Sep 28 '16 at 13:44
What is the equivalent class in Magento2 for app/code/core/Mage/CatalogSearch/Model/Layer...?
– Sushivam
Sep 29 '16 at 10:17
add a comment |
For layered Navigation you have to:
Extend
app/code/core/Mage/CatalogSearch/Model/Layer.php
to your custom module.
And over ride prepare collection function:
public function prepareProductCollection($collection)
if(Mage::helper('catalogsearch')->getQuery()->getQueryText())
return parent::prepareProductCollection($collection);
else
$collection
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes());
$collection->setStore(Mage::app()->getStore())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addStoreFilter()
->addUrlRewrite();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
return $this;
Check this Reference URL
Let's say I have a widget with a custom product colleciton -- how can I use the above function?
– easymoden00b
Feb 26 '15 at 15:23
1
Hi TBI Infotech, im facing exactly the same issue in magento 2.0... i have overridden LayeredNavigation (MagentoLayeredNavigationBlockNavigation) class, but as above problem, filters come in URL, but they are not getting applied....I have also overridden Magentos Catalog's Block Product ListProduct's _getProductCollection().
– Sushivam
Sep 28 '16 at 11:41
I have updated the issue with code in Magento 2 here magento.stackexchange.com/questions/138474/…
– Sushivam
Sep 28 '16 at 13:44
What is the equivalent class in Magento2 for app/code/core/Mage/CatalogSearch/Model/Layer...?
– Sushivam
Sep 29 '16 at 10:17
add a comment |
For layered Navigation you have to:
Extend
app/code/core/Mage/CatalogSearch/Model/Layer.php
to your custom module.
And over ride prepare collection function:
public function prepareProductCollection($collection)
if(Mage::helper('catalogsearch')->getQuery()->getQueryText())
return parent::prepareProductCollection($collection);
else
$collection
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes());
$collection->setStore(Mage::app()->getStore())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addStoreFilter()
->addUrlRewrite();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
return $this;
Check this Reference URL
For layered Navigation you have to:
Extend
app/code/core/Mage/CatalogSearch/Model/Layer.php
to your custom module.
And over ride prepare collection function:
public function prepareProductCollection($collection)
if(Mage::helper('catalogsearch')->getQuery()->getQueryText())
return parent::prepareProductCollection($collection);
else
$collection
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes());
$collection->setStore(Mage::app()->getStore())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addStoreFilter()
->addUrlRewrite();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
return $this;
Check this Reference URL
edited Aug 2 at 7:23
Rakesh Donga
3,0456 silver badges25 bronze badges
3,0456 silver badges25 bronze badges
answered Sep 26 '14 at 7:39
TBI InfotechTBI Infotech
4,6171 gold badge9 silver badges30 bronze badges
4,6171 gold badge9 silver badges30 bronze badges
Let's say I have a widget with a custom product colleciton -- how can I use the above function?
– easymoden00b
Feb 26 '15 at 15:23
1
Hi TBI Infotech, im facing exactly the same issue in magento 2.0... i have overridden LayeredNavigation (MagentoLayeredNavigationBlockNavigation) class, but as above problem, filters come in URL, but they are not getting applied....I have also overridden Magentos Catalog's Block Product ListProduct's _getProductCollection().
– Sushivam
Sep 28 '16 at 11:41
I have updated the issue with code in Magento 2 here magento.stackexchange.com/questions/138474/…
– Sushivam
Sep 28 '16 at 13:44
What is the equivalent class in Magento2 for app/code/core/Mage/CatalogSearch/Model/Layer...?
– Sushivam
Sep 29 '16 at 10:17
add a comment |
Let's say I have a widget with a custom product colleciton -- how can I use the above function?
– easymoden00b
Feb 26 '15 at 15:23
1
Hi TBI Infotech, im facing exactly the same issue in magento 2.0... i have overridden LayeredNavigation (MagentoLayeredNavigationBlockNavigation) class, but as above problem, filters come in URL, but they are not getting applied....I have also overridden Magentos Catalog's Block Product ListProduct's _getProductCollection().
– Sushivam
Sep 28 '16 at 11:41
I have updated the issue with code in Magento 2 here magento.stackexchange.com/questions/138474/…
– Sushivam
Sep 28 '16 at 13:44
What is the equivalent class in Magento2 for app/code/core/Mage/CatalogSearch/Model/Layer...?
– Sushivam
Sep 29 '16 at 10:17
Let's say I have a widget with a custom product colleciton -- how can I use the above function?
– easymoden00b
Feb 26 '15 at 15:23
Let's say I have a widget with a custom product colleciton -- how can I use the above function?
– easymoden00b
Feb 26 '15 at 15:23
1
1
Hi TBI Infotech, im facing exactly the same issue in magento 2.0... i have overridden LayeredNavigation (MagentoLayeredNavigationBlockNavigation) class, but as above problem, filters come in URL, but they are not getting applied....I have also overridden Magentos Catalog's Block Product ListProduct's _getProductCollection().
– Sushivam
Sep 28 '16 at 11:41
Hi TBI Infotech, im facing exactly the same issue in magento 2.0... i have overridden LayeredNavigation (MagentoLayeredNavigationBlockNavigation) class, but as above problem, filters come in URL, but they are not getting applied....I have also overridden Magentos Catalog's Block Product ListProduct's _getProductCollection().
– Sushivam
Sep 28 '16 at 11:41
I have updated the issue with code in Magento 2 here magento.stackexchange.com/questions/138474/…
– Sushivam
Sep 28 '16 at 13:44
I have updated the issue with code in Magento 2 here magento.stackexchange.com/questions/138474/…
– Sushivam
Sep 28 '16 at 13:44
What is the equivalent class in Magento2 for app/code/core/Mage/CatalogSearch/Model/Layer...?
– Sushivam
Sep 29 '16 at 10:17
What is the equivalent class in Magento2 for app/code/core/Mage/CatalogSearch/Model/Layer...?
– Sushivam
Sep 29 '16 at 10:17
add a comment |
You are using wrong method
protected function _getProductCollection()
if (is_null($this->_productCollection))
$result = array_unique($productIds);
$collection = Mage::getResourceModel('catalog/product_collection');
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection->addAttributeToSelect($attributes);
$collection->addAttributeToFilter('entity_id', array('in' => $result));
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
$this->_productCollection = $collection;
return $this->_productCollection;
So try the above code let me know if any comments.
$collection->addAttributeToFilter('entity_id', array('in' => $result));
made no difference, same result
– Ahmed
Sep 26 '14 at 4:46
Collection is filtering just fine, but the selected filter of layered navigation is not getting applied on him
– Ahmed
Sep 26 '14 at 4:48
then you have to check filter file i think layer.php
– Keyul Shah
Sep 26 '14 at 4:55
please correct me if I am wrong, but I think Layer.php is not responsible for filtering the product collection but it creates a layered navigation based on the product collection which it gets from the current category
– Ahmed
Sep 26 '14 at 5:15
public function getProductCollection() if(isset($this->_productCollections[$this->getCurrentCategory()->getId()])) $collection = $this->_productCollections[$this->getCurrentCategory()->getId()]; else $collection = $this->getCurrentCategory()->getProductCollection(); $this->prepareProductCollection($collection); $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection; return $collection;
– Ahmed
Sep 26 '14 at 5:16
|
show 2 more comments
You are using wrong method
protected function _getProductCollection()
if (is_null($this->_productCollection))
$result = array_unique($productIds);
$collection = Mage::getResourceModel('catalog/product_collection');
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection->addAttributeToSelect($attributes);
$collection->addAttributeToFilter('entity_id', array('in' => $result));
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
$this->_productCollection = $collection;
return $this->_productCollection;
So try the above code let me know if any comments.
$collection->addAttributeToFilter('entity_id', array('in' => $result));
made no difference, same result
– Ahmed
Sep 26 '14 at 4:46
Collection is filtering just fine, but the selected filter of layered navigation is not getting applied on him
– Ahmed
Sep 26 '14 at 4:48
then you have to check filter file i think layer.php
– Keyul Shah
Sep 26 '14 at 4:55
please correct me if I am wrong, but I think Layer.php is not responsible for filtering the product collection but it creates a layered navigation based on the product collection which it gets from the current category
– Ahmed
Sep 26 '14 at 5:15
public function getProductCollection() if(isset($this->_productCollections[$this->getCurrentCategory()->getId()])) $collection = $this->_productCollections[$this->getCurrentCategory()->getId()]; else $collection = $this->getCurrentCategory()->getProductCollection(); $this->prepareProductCollection($collection); $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection; return $collection;
– Ahmed
Sep 26 '14 at 5:16
|
show 2 more comments
You are using wrong method
protected function _getProductCollection()
if (is_null($this->_productCollection))
$result = array_unique($productIds);
$collection = Mage::getResourceModel('catalog/product_collection');
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection->addAttributeToSelect($attributes);
$collection->addAttributeToFilter('entity_id', array('in' => $result));
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
$this->_productCollection = $collection;
return $this->_productCollection;
So try the above code let me know if any comments.
You are using wrong method
protected function _getProductCollection()
if (is_null($this->_productCollection))
$result = array_unique($productIds);
$collection = Mage::getResourceModel('catalog/product_collection');
$attributes = Mage::getSingleton('catalog/config')->getProductAttributes();
$collection->addAttributeToSelect($attributes);
$collection->addAttributeToFilter('entity_id', array('in' => $result));
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
$this->_productCollection = $collection;
return $this->_productCollection;
So try the above code let me know if any comments.
answered Sep 26 '14 at 4:39
Keyul ShahKeyul Shah
6,6697 gold badges32 silver badges59 bronze badges
6,6697 gold badges32 silver badges59 bronze badges
$collection->addAttributeToFilter('entity_id', array('in' => $result));
made no difference, same result
– Ahmed
Sep 26 '14 at 4:46
Collection is filtering just fine, but the selected filter of layered navigation is not getting applied on him
– Ahmed
Sep 26 '14 at 4:48
then you have to check filter file i think layer.php
– Keyul Shah
Sep 26 '14 at 4:55
please correct me if I am wrong, but I think Layer.php is not responsible for filtering the product collection but it creates a layered navigation based on the product collection which it gets from the current category
– Ahmed
Sep 26 '14 at 5:15
public function getProductCollection() if(isset($this->_productCollections[$this->getCurrentCategory()->getId()])) $collection = $this->_productCollections[$this->getCurrentCategory()->getId()]; else $collection = $this->getCurrentCategory()->getProductCollection(); $this->prepareProductCollection($collection); $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection; return $collection;
– Ahmed
Sep 26 '14 at 5:16
|
show 2 more comments
$collection->addAttributeToFilter('entity_id', array('in' => $result));
made no difference, same result
– Ahmed
Sep 26 '14 at 4:46
Collection is filtering just fine, but the selected filter of layered navigation is not getting applied on him
– Ahmed
Sep 26 '14 at 4:48
then you have to check filter file i think layer.php
– Keyul Shah
Sep 26 '14 at 4:55
please correct me if I am wrong, but I think Layer.php is not responsible for filtering the product collection but it creates a layered navigation based on the product collection which it gets from the current category
– Ahmed
Sep 26 '14 at 5:15
public function getProductCollection() if(isset($this->_productCollections[$this->getCurrentCategory()->getId()])) $collection = $this->_productCollections[$this->getCurrentCategory()->getId()]; else $collection = $this->getCurrentCategory()->getProductCollection(); $this->prepareProductCollection($collection); $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection; return $collection;
– Ahmed
Sep 26 '14 at 5:16
$collection->addAttributeToFilter('entity_id', array('in' => $result));
made no difference, same result– Ahmed
Sep 26 '14 at 4:46
$collection->addAttributeToFilter('entity_id', array('in' => $result));
made no difference, same result– Ahmed
Sep 26 '14 at 4:46
Collection is filtering just fine, but the selected filter of layered navigation is not getting applied on him
– Ahmed
Sep 26 '14 at 4:48
Collection is filtering just fine, but the selected filter of layered navigation is not getting applied on him
– Ahmed
Sep 26 '14 at 4:48
then you have to check filter file i think layer.php
– Keyul Shah
Sep 26 '14 at 4:55
then you have to check filter file i think layer.php
– Keyul Shah
Sep 26 '14 at 4:55
please correct me if I am wrong, but I think Layer.php is not responsible for filtering the product collection but it creates a layered navigation based on the product collection which it gets from the current category
– Ahmed
Sep 26 '14 at 5:15
please correct me if I am wrong, but I think Layer.php is not responsible for filtering the product collection but it creates a layered navigation based on the product collection which it gets from the current category
– Ahmed
Sep 26 '14 at 5:15
public function getProductCollection() if(isset($this->_productCollections[$this->getCurrentCategory()->getId()])) $collection = $this->_productCollections[$this->getCurrentCategory()->getId()]; else $collection = $this->getCurrentCategory()->getProductCollection(); $this->prepareProductCollection($collection); $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection; return $collection;
– Ahmed
Sep 26 '14 at 5:16
public function getProductCollection() if(isset($this->_productCollections[$this->getCurrentCategory()->getId()])) $collection = $this->_productCollections[$this->getCurrentCategory()->getId()]; else $collection = $this->getCurrentCategory()->getProductCollection(); $this->prepareProductCollection($collection); $this->_productCollections[$this->getCurrentCategory()->getId()] = $collection; return $collection;
– Ahmed
Sep 26 '14 at 5:16
|
show 2 more comments
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f37148%2fcustom-product-collection-not-getting-filtered-by-layered-navigation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown