I am developing a mobile app using magento 1.9 SOAP API, I have integrated all the API endpoints and the functionality is almost complete. The issue I am facing is to implement layered navigation as it is displayed on magento website but there is no API endpoint to achieve this.

Can anyone please suggest me how we can handle this? as I am an android developer and trying to figure this out.

Thanks Shani

Update This is what I have achieved so far

    $categoryid = (int)$this->getRequest()->getParam('cid');
    $designid = $this->getRequest()->getParam('manufacturer');
    $sizeid = $this->getRequest()->getParam('size');
    $colorid = $this->getRequest()->getParam('color');
    $pricerange = $this->getRequest()->getParam('price');

    $layer = Mage::getSingleton("catalog/layer"); 
    $_category = Mage::getSingleton("catalog/category")->load($categoryid);
    $attributes = $layer->getFilterableAttributes();

    $attrs["design"]['label'] = __("Brands");
    $attributeCode = Mage::getStoreConfig('shopbybrand/general/attribute_code', $storeId);        
    $attrCode = $attributeCode ? $attributeCode : 'manufacturer';
    $attrs["design"]['code'] = $attrCode;
    $attrs["design"]['sort'] = 1;

    $attrs["color"]['label'] = __("Color");
    $attrs["color"]['code'] = __("color");
    $attrs["color"]['sort'] = 2;

    $attrs["size"]['label'] = __("Size");
    $attrs["size"]['code'] = __("size");
    $attrs["size"]['sort'] = 3;

    $attrs["price"]['label'] = __("Price");
    $attrs["price"]['code'] = __("price");
    $attrs["price"]['sort'] = 4;

    // print_r($attributes->getData());exit();
    $attributeCollection =array();

    $attributeCollection = array();
    foreach ($attributes as $attribute) {
    if($attribute->getAttributeCode() == 'price') {
     $filterBlockName = 'catalog/layer_filter_price';
    }elseif($attribute->getBackendType() == 'decimal'){
     $filterBlockName = 'catalog/layer_filter_decimal';
    $filterBlockName = 'catalog/layer_filter_attribute';
    $result = Mage::app()->getLayout()->createBlock($filterBlockName)->setLayer($layer)->setAttributeModel($attribute)->init();
    $attributeCollection[$i]['Code'] = $attribute->getAttributeCode();
    $attributeCollection[$i]['Label'] = $attribute->getStoreLabel();
    $attributeOptionCollection =array();
    foreach($result->getItems() as $option) {
        $val = $option->getValue();
            $attrs["price"]['options'][$j]['label'] = strip_tags($option->getLabel());
            if(trim($val) == ""){
                $val = $pricerange;
            $val_arr = explode(',',$val);
            $pricerange_arr = explode(',',$pricerange);
            if(strstr($pricerange,',') || strstr($val,',')){
                $val = array_merge(array_diff($val_arr, $pricerange_arr), array_diff($pricerange_arr, $val_arr));
                $val = $val[0];
            $attrs["price"]['options'][$j]['value'] = $val;
            $attrs["color"]['options'][$j]['label'] = $option->getLabel();
            if(trim($val) == ""){
                $val = $colorid;
            $val_arr = explode(',',$val);
            $colorid_arr = explode(',',$colorid);
            if(strstr($colorid,',') || strstr($val,',')){
                $val = array_merge(array_diff($val_arr, $colorid_arr), array_diff($colorid_arr, $val_arr));
                $val = $val[0];
            $attrs["color"]['options'][$j]['value'] = $val;
            $attrs["size"]['options'][$j]['label'] = $option->getLabel();
            if(trim($val) == ""){
                $val = $sizeid;
            $val_arr = explode(',',$val);
            $sizeid_arr = explode(',',$sizeid);
            if(strstr($sizeid,',') || strstr($val,',')){
                $val = array_merge(array_diff($val_arr, $sizeid_arr), array_diff($sizeid_arr, $val_arr));
                $val = $val[0];
            $attrs["size"]['options'][$j]['value'] = $val;
            $attrs["design"]['options'][$j]['label'] = $option->getLabel();
            if(trim($val) == ""){
                $val = $designid;
            $val_arr = explode(',',$val);
            $designid_arr = explode(',',$designid);
            if(strstr($designid,',') || strstr($val,',')){
                $val = array_merge(array_diff($val_arr, $designid_arr), array_diff($designid_arr, $val_arr));
                $val = $val[0];
        $attrs["design"]['options'][$j]['value'] = $val;
    //$attributeCollection[$i]['Options'] = $attributeOptionCollection;
    header("Content-Type: application/json");

1 Answer 1


You can not get direct leyer navigation value, you need to call on by one api for getting all the value in leyer navigation.

e.g in layer navigation you have Category tree and 4 attribute filter then you need to create 2 api, one for category tree and one for attribute list will value.

Hope so it's help you.

  • Okay, make sense. but the issue is how we can filter the attributes with selected values? like if user select color as "Red" then how I can filter the size and manufacturer so the display only the values that have red color available. Feb 27, 2017 at 8:11
  • That is managed from your end, for save attribute make one api that is save the value in magento side and get result in api call....And you used that value.
    – Dhrumin
    Feb 27, 2017 at 9:01
  • Actually I will call the API and get the attributes it's fine. but once user select a value from color How I can filter the remaining attributes based on the selected value so the size and manufacturer will only display the values that has color red associated with them Feb 27, 2017 at 9:53
  • every time you need to make API call for save selected value in magento side and get filterable product.....
    – Dhrumin
    Feb 28, 2017 at 9:59
  • it is possible to share some code example? Mar 1, 2017 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.