1

I'm getting my active filters like this:

$filters = Mage::getSingleton('catalog/layer')->getState()->getFilters();

When $filters[0]->debug() I can tell the information I want, min/max values is saved in there, but I don't know how to access it.

The output looks like this (I deleted some meta information but maintained the original structure)

    array(4) {
  ["filter (Amasty_Shopby_Model_Catalog_Layer_Filter_Category)"]=>
  array(1) {
    ["layer (ModifiedLayer_Plugin_Model_Layer)"]=>
    array(2) {
      ["current_category (Mage_Catalog_Model_Category)"]=>
      array(20) {
        ["level"]=>
        string(1) "1"
        ["children_count"]=>
        string(2) "11"
        ["is_anchor"]=>
        string(1) "0"
      }
      ["state (Mage_Catalog_Model_Layer_State)"]=>
      array(1) {
        ["filters"]=>
        array(3) {
          ["0 (Amasty_Shopby_Model_Catalog_Layer_Filter_Item)"]=>
          string(17) "*** RECURSION ***"
          ["1 (Amasty_Shopby_Model_Catalog_Layer_Filter_Item)"]=>
          array(4) {
            ["filter (Amasty_Shopby_Model_Catalog_Layer_Filter_Decimal)"]=>
            array(4) {
              ["layer (ModifiedLayer_Plugin_Model_Layer)"]=>
              string(17) "*** RECURSION ***"
              ["attribute_model (Mage_Catalog_Model_Resource_Eav_Attribute)"]=>
              array(28) {
                ["entity_type_id"]=>
                string(1) "4"
                ["attribute_code"]=>
                string(10) "laenge_int"
                ["backend_model"]=>
                string(39) "catalog/product_attribute_backend_price"
                ["backend_type"]=>
                string(7) "decimal"
                ["store_label"]=>
                string(6) "Attribute"
              }
              ["max_value"]=>
              string(7) "55.0000"
              ["min_value"]=>
              string(7) "13.0000"
            }
            ["label"]=>
            string(12) "17 - 17"
            ["value"]=>
            string(5) "17-17"
            ["count"]=>
            int(0)
          }
        }
      }
    }
  }
  ["label"]=>
  string(19) "Label"
  ["value"]=>
  int(354)
  ["count"]=>
  int(0)
}

I should mention that I want a solution using magento functions and not some array accesses as far as possible.

Thanks

1

What you're seeing is specific to Price filters. The abstract filter doesn't have a minimum and maximum defined, which totally makes sense as filters are more often then not based on a selection of predefined string values.

Numeric filters have the minimum and maximum support built into their concrete classes:

  • Mage_Catalog_Model_Layer_Filter_Decimal::getMaxValue() for decimal based attributes
  • The price filter is special, it works with a pricing Algorithm and you can look at Mage_Catalog_Model_Layer_Filter_Price::_getCalculatedItemsData for some details.

Hope this helps you along.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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