Get empty result when trying to get filterable attribute for particular category The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)create new product attribute returns fault code 104 (Incorrect attribute type)Proper Mobile API Implementation for Magento?Bespoke attribute filters for each category pagesHow to hide a custom attribute to category on particular category level?SOAP fault when trying to call API for third party moduleHow to get list of all the groups of particular attribute set using Soap API?How to add a custom page with cross-sell productsTrying to get custom product attributeRestrict a controller HTTP Request by Cutomer email and password?How to get all products collection for special category
Match Roman Numerals
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
The following signatures were invalid: EXPKEYSIG 1397BC53640DB551
How are presidential pardons supposed to be used?
Is there a writing software that you can sort scenes like slides in PowerPoint?
Would an alien lifeform be able to achieve space travel if lacking in vision?
Why not take a picture of a closer black hole?
How do I add random spotting to the same face in cycles?
Can smartphones with the same camera sensor have different image quality?
How does this infinite series simplify to an integral?
How should I replace vector<uint8_t>::const_iterator in an API?
Did God make two great lights or did He make the great light two?
Is this wall load bearing? Blueprints and photos attached
Simulating Exploding Dice
Am I ethically obligated to go into work on an off day if the reason is sudden?
I could not break this equation. Please help me
When did F become S in typeography, and why?
How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time
Didn't get enough time to take a Coding Test - what to do now?
Change bounding box of math glyphs in LuaTeX
Arduino Pro Micro - switch off LEDs
How to delete random line from file using Unix command?
Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?
A pet rabbit called Belle
Get empty result when trying to get filterable attribute for particular category
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)create new product attribute returns fault code 104 (Incorrect attribute type)Proper Mobile API Implementation for Magento?Bespoke attribute filters for each category pagesHow to hide a custom attribute to category on particular category level?SOAP fault when trying to call API for third party moduleHow to get list of all the groups of particular attribute set using Soap API?How to add a custom page with cross-sell productsTrying to get custom product attributeRestrict a controller HTTP Request by Cutomer email and password?How to get all products collection for special category
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I need to retrieve all filterable attributes for category. I'm using that snippet:
$category = Mage::getModel('catalog/category')->load($categoryId);
$layer = Mage::getModel('catalog/layer');
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();//$attributes now is empty array
Category has product with filterable attributes, also in categories options anchor was enabled. This code using in SOAP API.
Maybe someone know where I made mistake?
magento-1 filter soap layer
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
|
show 1 more comment
I need to retrieve all filterable attributes for category. I'm using that snippet:
$category = Mage::getModel('catalog/category')->load($categoryId);
$layer = Mage::getModel('catalog/layer');
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();//$attributes now is empty array
Category has product with filterable attributes, also in categories options anchor was enabled. This code using in SOAP API.
Maybe someone know where I made mistake?
magento-1 filter soap layer
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Try tovar_dump($category)
to see if everything is okay in general.
– michael
Jan 1 '15 at 15:43
You might asking the same thing here stackoverflow.com/questions/3157799/…
– Sukeshini
Jan 1 '15 at 16:36
I can't use var_dump because it's code for api and it return only values defined in wsdl.xml file. But I check category by pass it to one of this value. Category model is OK, and it seting to layer correct, and I can get it back by $layer->getCurrentCategory();P
– Quickerz
Jan 1 '15 at 16:44
You can try to addMage::log($collection->getSelect(), Zend_Log::INFO, 'blah.log', true);
inapp/code/core/Mage/Catalog/Model/Layer.php
->public function getFilterableAttributes()
beforereturn
and to run logged SQL query directly in the database or to compare it with the SQL query that is logged when you open the category through the site.
– michael
Jan 2 '15 at 10:22
getFilterableAttributes() return empty array because $setIds = $this->_getSetIds() return empty array. It happen because $this->getProductCollection() return empty collection. Maybe something else needed fo $layer to get product collection from it?
– Quickerz
Jan 5 '15 at 7:24
|
show 1 more comment
I need to retrieve all filterable attributes for category. I'm using that snippet:
$category = Mage::getModel('catalog/category')->load($categoryId);
$layer = Mage::getModel('catalog/layer');
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();//$attributes now is empty array
Category has product with filterable attributes, also in categories options anchor was enabled. This code using in SOAP API.
Maybe someone know where I made mistake?
magento-1 filter soap layer
I need to retrieve all filterable attributes for category. I'm using that snippet:
$category = Mage::getModel('catalog/category')->load($categoryId);
$layer = Mage::getModel('catalog/layer');
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();//$attributes now is empty array
Category has product with filterable attributes, also in categories options anchor was enabled. This code using in SOAP API.
Maybe someone know where I made mistake?
magento-1 filter soap layer
magento-1 filter soap layer
edited Nov 1 '18 at 6:21
Hitesh
1,2931423
1,2931423
asked Jan 1 '15 at 15:22
QuickerzQuickerz
361
361
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 2 days ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Try tovar_dump($category)
to see if everything is okay in general.
– michael
Jan 1 '15 at 15:43
You might asking the same thing here stackoverflow.com/questions/3157799/…
– Sukeshini
Jan 1 '15 at 16:36
I can't use var_dump because it's code for api and it return only values defined in wsdl.xml file. But I check category by pass it to one of this value. Category model is OK, and it seting to layer correct, and I can get it back by $layer->getCurrentCategory();P
– Quickerz
Jan 1 '15 at 16:44
You can try to addMage::log($collection->getSelect(), Zend_Log::INFO, 'blah.log', true);
inapp/code/core/Mage/Catalog/Model/Layer.php
->public function getFilterableAttributes()
beforereturn
and to run logged SQL query directly in the database or to compare it with the SQL query that is logged when you open the category through the site.
– michael
Jan 2 '15 at 10:22
getFilterableAttributes() return empty array because $setIds = $this->_getSetIds() return empty array. It happen because $this->getProductCollection() return empty collection. Maybe something else needed fo $layer to get product collection from it?
– Quickerz
Jan 5 '15 at 7:24
|
show 1 more comment
Try tovar_dump($category)
to see if everything is okay in general.
– michael
Jan 1 '15 at 15:43
You might asking the same thing here stackoverflow.com/questions/3157799/…
– Sukeshini
Jan 1 '15 at 16:36
I can't use var_dump because it's code for api and it return only values defined in wsdl.xml file. But I check category by pass it to one of this value. Category model is OK, and it seting to layer correct, and I can get it back by $layer->getCurrentCategory();P
– Quickerz
Jan 1 '15 at 16:44
You can try to addMage::log($collection->getSelect(), Zend_Log::INFO, 'blah.log', true);
inapp/code/core/Mage/Catalog/Model/Layer.php
->public function getFilterableAttributes()
beforereturn
and to run logged SQL query directly in the database or to compare it with the SQL query that is logged when you open the category through the site.
– michael
Jan 2 '15 at 10:22
getFilterableAttributes() return empty array because $setIds = $this->_getSetIds() return empty array. It happen because $this->getProductCollection() return empty collection. Maybe something else needed fo $layer to get product collection from it?
– Quickerz
Jan 5 '15 at 7:24
Try to
var_dump($category)
to see if everything is okay in general.– michael
Jan 1 '15 at 15:43
Try to
var_dump($category)
to see if everything is okay in general.– michael
Jan 1 '15 at 15:43
You might asking the same thing here stackoverflow.com/questions/3157799/…
– Sukeshini
Jan 1 '15 at 16:36
You might asking the same thing here stackoverflow.com/questions/3157799/…
– Sukeshini
Jan 1 '15 at 16:36
I can't use var_dump because it's code for api and it return only values defined in wsdl.xml file. But I check category by pass it to one of this value. Category model is OK, and it seting to layer correct, and I can get it back by $layer->getCurrentCategory();P
– Quickerz
Jan 1 '15 at 16:44
I can't use var_dump because it's code for api and it return only values defined in wsdl.xml file. But I check category by pass it to one of this value. Category model is OK, and it seting to layer correct, and I can get it back by $layer->getCurrentCategory();P
– Quickerz
Jan 1 '15 at 16:44
You can try to add
Mage::log($collection->getSelect(), Zend_Log::INFO, 'blah.log', true);
in app/code/core/Mage/Catalog/Model/Layer.php
-> public function getFilterableAttributes()
before return
and to run logged SQL query directly in the database or to compare it with the SQL query that is logged when you open the category through the site.– michael
Jan 2 '15 at 10:22
You can try to add
Mage::log($collection->getSelect(), Zend_Log::INFO, 'blah.log', true);
in app/code/core/Mage/Catalog/Model/Layer.php
-> public function getFilterableAttributes()
before return
and to run logged SQL query directly in the database or to compare it with the SQL query that is logged when you open the category through the site.– michael
Jan 2 '15 at 10:22
getFilterableAttributes() return empty array because $setIds = $this->_getSetIds() return empty array. It happen because $this->getProductCollection() return empty collection. Maybe something else needed fo $layer to get product collection from it?
– Quickerz
Jan 5 '15 at 7:24
getFilterableAttributes() return empty array because $setIds = $this->_getSetIds() return empty array. It happen because $this->getProductCollection() return empty collection. Maybe something else needed fo $layer to get product collection from it?
– Quickerz
Jan 5 '15 at 7:24
|
show 1 more comment
2 Answers
2
active
oldest
votes
Most probably you didn't set the store id, we need to do so since it's implemented in the api:
protected function _retrieve(){
$id = $this->getRequest()->getParam('id');
$store_id = $this->getRequest()->getParam('store_id');
$category = Mage::getModel("catalog/category")->load($id);
$category->setStoreId($store_id);
if (!($category->getId())) $this->_critical(self::RESOURCE_NOT_FOUND);
$layer = Mage::getModel("catalog/layer");
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();
add a comment |
following code is used to get filterable attributes and their options
$categoryId = '5'; // replace with your category id
$category = Mage::getModel("catalog/category")->load($categoryId);
$layer = Mage::getModel("catalog/layer");
$layer->setCurrentCategory($category);
$setIds = Mage::getModel('eav/entity_attribute_set')
->load($attrSetName, 'attribute_set_name')
->getAttributeSetId();
$attributes = Mage::getResourceModel('catalog/product_attribute_collection');
$attributes->setItemObjectClass('catalog/resource_eav_attribute')
->setAttributeSetFilter($setIds)
->addStoreLabel(Mage::app()->getStore()->getId())
->setOrder('position', 'ASC');
$attributes->addFieldToFilter('additional_table.is_filterable', array('gt' => 0));
$attributes->load();
foreach ($attributes as $attribute)
$filter_attr = array();
$filter_attr['title'] = $attribute->getFrontendLabel();
$filter_attr['code'] = $attribute->getAttributeCode();
if ($attribute->getAttributeCode() == 'price')
$filterBlockName = 'catalog/layer_filter_price';
elseif ($attribute->getBackendType() == 'decimal')
$filterBlockName = 'catalog/layer_filter_decimal';
else
$filterBlockName = 'catalog/layer_filter_attribute';
$result = Mage::app()->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();
$i=0;
foreach($result->getItems() as $option)
$attr_option = array();
if($attribute->getAttributeCode() == 'price')
$attr_option['label'] = str_replace(array('<span class="price">','</span>'),'',$option->getLabel());
else
$attr_option['label'] = $option->getLabel();
$attr_option['value'] = $option->getValue();
$attr_option['count'] = $option->getCount();
$i++;
$filter_attr['options'][] = $attr_option;
if($i!=0)
$filter_attributes[] = $filter_attr;
add a comment |
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%2f49891%2fget-empty-result-when-trying-to-get-filterable-attribute-for-particular-category%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
Most probably you didn't set the store id, we need to do so since it's implemented in the api:
protected function _retrieve(){
$id = $this->getRequest()->getParam('id');
$store_id = $this->getRequest()->getParam('store_id');
$category = Mage::getModel("catalog/category")->load($id);
$category->setStoreId($store_id);
if (!($category->getId())) $this->_critical(self::RESOURCE_NOT_FOUND);
$layer = Mage::getModel("catalog/layer");
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();
add a comment |
Most probably you didn't set the store id, we need to do so since it's implemented in the api:
protected function _retrieve(){
$id = $this->getRequest()->getParam('id');
$store_id = $this->getRequest()->getParam('store_id');
$category = Mage::getModel("catalog/category")->load($id);
$category->setStoreId($store_id);
if (!($category->getId())) $this->_critical(self::RESOURCE_NOT_FOUND);
$layer = Mage::getModel("catalog/layer");
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();
add a comment |
Most probably you didn't set the store id, we need to do so since it's implemented in the api:
protected function _retrieve(){
$id = $this->getRequest()->getParam('id');
$store_id = $this->getRequest()->getParam('store_id');
$category = Mage::getModel("catalog/category")->load($id);
$category->setStoreId($store_id);
if (!($category->getId())) $this->_critical(self::RESOURCE_NOT_FOUND);
$layer = Mage::getModel("catalog/layer");
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();
Most probably you didn't set the store id, we need to do so since it's implemented in the api:
protected function _retrieve(){
$id = $this->getRequest()->getParam('id');
$store_id = $this->getRequest()->getParam('store_id');
$category = Mage::getModel("catalog/category")->load($id);
$category->setStoreId($store_id);
if (!($category->getId())) $this->_critical(self::RESOURCE_NOT_FOUND);
$layer = Mage::getModel("catalog/layer");
$layer->setCurrentCategory($category);
$attributes = $layer->getFilterableAttributes();
answered Jul 19 '16 at 12:46
Yehia A.SalamYehia A.Salam
105420
105420
add a comment |
add a comment |
following code is used to get filterable attributes and their options
$categoryId = '5'; // replace with your category id
$category = Mage::getModel("catalog/category")->load($categoryId);
$layer = Mage::getModel("catalog/layer");
$layer->setCurrentCategory($category);
$setIds = Mage::getModel('eav/entity_attribute_set')
->load($attrSetName, 'attribute_set_name')
->getAttributeSetId();
$attributes = Mage::getResourceModel('catalog/product_attribute_collection');
$attributes->setItemObjectClass('catalog/resource_eav_attribute')
->setAttributeSetFilter($setIds)
->addStoreLabel(Mage::app()->getStore()->getId())
->setOrder('position', 'ASC');
$attributes->addFieldToFilter('additional_table.is_filterable', array('gt' => 0));
$attributes->load();
foreach ($attributes as $attribute)
$filter_attr = array();
$filter_attr['title'] = $attribute->getFrontendLabel();
$filter_attr['code'] = $attribute->getAttributeCode();
if ($attribute->getAttributeCode() == 'price')
$filterBlockName = 'catalog/layer_filter_price';
elseif ($attribute->getBackendType() == 'decimal')
$filterBlockName = 'catalog/layer_filter_decimal';
else
$filterBlockName = 'catalog/layer_filter_attribute';
$result = Mage::app()->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();
$i=0;
foreach($result->getItems() as $option)
$attr_option = array();
if($attribute->getAttributeCode() == 'price')
$attr_option['label'] = str_replace(array('<span class="price">','</span>'),'',$option->getLabel());
else
$attr_option['label'] = $option->getLabel();
$attr_option['value'] = $option->getValue();
$attr_option['count'] = $option->getCount();
$i++;
$filter_attr['options'][] = $attr_option;
if($i!=0)
$filter_attributes[] = $filter_attr;
add a comment |
following code is used to get filterable attributes and their options
$categoryId = '5'; // replace with your category id
$category = Mage::getModel("catalog/category")->load($categoryId);
$layer = Mage::getModel("catalog/layer");
$layer->setCurrentCategory($category);
$setIds = Mage::getModel('eav/entity_attribute_set')
->load($attrSetName, 'attribute_set_name')
->getAttributeSetId();
$attributes = Mage::getResourceModel('catalog/product_attribute_collection');
$attributes->setItemObjectClass('catalog/resource_eav_attribute')
->setAttributeSetFilter($setIds)
->addStoreLabel(Mage::app()->getStore()->getId())
->setOrder('position', 'ASC');
$attributes->addFieldToFilter('additional_table.is_filterable', array('gt' => 0));
$attributes->load();
foreach ($attributes as $attribute)
$filter_attr = array();
$filter_attr['title'] = $attribute->getFrontendLabel();
$filter_attr['code'] = $attribute->getAttributeCode();
if ($attribute->getAttributeCode() == 'price')
$filterBlockName = 'catalog/layer_filter_price';
elseif ($attribute->getBackendType() == 'decimal')
$filterBlockName = 'catalog/layer_filter_decimal';
else
$filterBlockName = 'catalog/layer_filter_attribute';
$result = Mage::app()->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();
$i=0;
foreach($result->getItems() as $option)
$attr_option = array();
if($attribute->getAttributeCode() == 'price')
$attr_option['label'] = str_replace(array('<span class="price">','</span>'),'',$option->getLabel());
else
$attr_option['label'] = $option->getLabel();
$attr_option['value'] = $option->getValue();
$attr_option['count'] = $option->getCount();
$i++;
$filter_attr['options'][] = $attr_option;
if($i!=0)
$filter_attributes[] = $filter_attr;
add a comment |
following code is used to get filterable attributes and their options
$categoryId = '5'; // replace with your category id
$category = Mage::getModel("catalog/category")->load($categoryId);
$layer = Mage::getModel("catalog/layer");
$layer->setCurrentCategory($category);
$setIds = Mage::getModel('eav/entity_attribute_set')
->load($attrSetName, 'attribute_set_name')
->getAttributeSetId();
$attributes = Mage::getResourceModel('catalog/product_attribute_collection');
$attributes->setItemObjectClass('catalog/resource_eav_attribute')
->setAttributeSetFilter($setIds)
->addStoreLabel(Mage::app()->getStore()->getId())
->setOrder('position', 'ASC');
$attributes->addFieldToFilter('additional_table.is_filterable', array('gt' => 0));
$attributes->load();
foreach ($attributes as $attribute)
$filter_attr = array();
$filter_attr['title'] = $attribute->getFrontendLabel();
$filter_attr['code'] = $attribute->getAttributeCode();
if ($attribute->getAttributeCode() == 'price')
$filterBlockName = 'catalog/layer_filter_price';
elseif ($attribute->getBackendType() == 'decimal')
$filterBlockName = 'catalog/layer_filter_decimal';
else
$filterBlockName = 'catalog/layer_filter_attribute';
$result = Mage::app()->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();
$i=0;
foreach($result->getItems() as $option)
$attr_option = array();
if($attribute->getAttributeCode() == 'price')
$attr_option['label'] = str_replace(array('<span class="price">','</span>'),'',$option->getLabel());
else
$attr_option['label'] = $option->getLabel();
$attr_option['value'] = $option->getValue();
$attr_option['count'] = $option->getCount();
$i++;
$filter_attr['options'][] = $attr_option;
if($i!=0)
$filter_attributes[] = $filter_attr;
following code is used to get filterable attributes and their options
$categoryId = '5'; // replace with your category id
$category = Mage::getModel("catalog/category")->load($categoryId);
$layer = Mage::getModel("catalog/layer");
$layer->setCurrentCategory($category);
$setIds = Mage::getModel('eav/entity_attribute_set')
->load($attrSetName, 'attribute_set_name')
->getAttributeSetId();
$attributes = Mage::getResourceModel('catalog/product_attribute_collection');
$attributes->setItemObjectClass('catalog/resource_eav_attribute')
->setAttributeSetFilter($setIds)
->addStoreLabel(Mage::app()->getStore()->getId())
->setOrder('position', 'ASC');
$attributes->addFieldToFilter('additional_table.is_filterable', array('gt' => 0));
$attributes->load();
foreach ($attributes as $attribute)
$filter_attr = array();
$filter_attr['title'] = $attribute->getFrontendLabel();
$filter_attr['code'] = $attribute->getAttributeCode();
if ($attribute->getAttributeCode() == 'price')
$filterBlockName = 'catalog/layer_filter_price';
elseif ($attribute->getBackendType() == 'decimal')
$filterBlockName = 'catalog/layer_filter_decimal';
else
$filterBlockName = 'catalog/layer_filter_attribute';
$result = Mage::app()->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();
$i=0;
foreach($result->getItems() as $option)
$attr_option = array();
if($attribute->getAttributeCode() == 'price')
$attr_option['label'] = str_replace(array('<span class="price">','</span>'),'',$option->getLabel());
else
$attr_option['label'] = $option->getLabel();
$attr_option['value'] = $option->getValue();
$attr_option['count'] = $option->getCount();
$i++;
$filter_attr['options'][] = $attr_option;
if($i!=0)
$filter_attributes[] = $filter_attr;
answered Jul 19 '16 at 12:56
Pradeep SankuPradeep Sanku
7,93113157
7,93113157
add a comment |
add a comment |
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%2f49891%2fget-empty-result-when-trying-to-get-filterable-attribute-for-particular-category%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
Try to
var_dump($category)
to see if everything is okay in general.– michael
Jan 1 '15 at 15:43
You might asking the same thing here stackoverflow.com/questions/3157799/…
– Sukeshini
Jan 1 '15 at 16:36
I can't use var_dump because it's code for api and it return only values defined in wsdl.xml file. But I check category by pass it to one of this value. Category model is OK, and it seting to layer correct, and I can get it back by $layer->getCurrentCategory();P
– Quickerz
Jan 1 '15 at 16:44
You can try to add
Mage::log($collection->getSelect(), Zend_Log::INFO, 'blah.log', true);
inapp/code/core/Mage/Catalog/Model/Layer.php
->public function getFilterableAttributes()
beforereturn
and to run logged SQL query directly in the database or to compare it with the SQL query that is logged when you open the category through the site.– michael
Jan 2 '15 at 10:22
getFilterableAttributes() return empty array because $setIds = $this->_getSetIds() return empty array. It happen because $this->getProductCollection() return empty collection. Maybe something else needed fo $layer to get product collection from it?
– Quickerz
Jan 5 '15 at 7:24