$collection = Mage::getModel('cms/block')->getCollection();

The above collection brings cms block table fields. How to add filter in these collections.

  • what kind of filter you want to add? – Abhishek Panchal Feb 13 '18 at 14:47
  • id add yes no dropdown in cms block after status now i want filter collection on list page show thos cms blocks if dropwon yes – imtiaz Feb 13 '18 at 14:49

Here is a brief example of two filters you can use:

        ->addStoreFilter(YOURSTOREID, false)
        ->addFieldToFilter('is_active', 1);

This will get you all your active blocks on your Store.

You can add a order filter like this:

            ->addStoreFilter(YOURSTOREID, false)
            ->addFieldToFilter('is_active', 1)
            ->addAttributeToSort('name', 'DESC');

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.