How to get all cms blocks ids where “is_slider” = true?
-
31-12-2020 - |
题
Modyfying current slider system to make it a little bit more autonomous as in it's original form I must manually remove code from list if specific products is already gone or promotion is over so I added additional attribute into table "is_slider", "start_date" and "end_date" but my collection does not work. What I've done wrong ?
$collection = Mage::getModel('cms/block')->getCollection()
->addAttributeToSelect('*')
->addFieldToFilter('is_slider', '1')
->getAllIds()
;
Of course this code should select only ids where "is_slider" is true, regardless what date is but it is not important for now.
How to get only those Ids where "is_slider" = true?
OMG I'm blind ...... Yes of course it does work after I changed it from "page" to "block"
解决方案
You are using Mage::getModel('cms/page')
CMS Pages model.
Use Mage::getModel('cms/block')
Static block model.