I have a module that allow a user to add/edit an item via the admin panel. The admin add/edit page contains :

  • name (text field)
  • image (file upload)
  • a store to select (standard select for a store view)
  • link to a cms page (via a custom select)

I want to show to only the cms pages that belongs to the store the user select. So, my first idea was to reload the page once a store is selected, but I am also unable to do find out a way to do that...

How can I accomplish that?

  • did you store the cms page id? Commented Dec 14, 2015 at 5:43
  • I prepared my table with the cms_id field. My cms pages are set per store. So I would like to show only the pages that belongs to a store, in my select box. (not sure i am clear) Commented Dec 14, 2015 at 6:54
  • here is logic add your block with every cms page. and every cms page you will check your database value for current page and current store it the values match you will show that. Commented Dec 14, 2015 at 6:59
  • I was thinking about something more dynamic. Like if the user select store 1 in the list, then I update via ajax the listbox containing the cms pages. I found this stackoverflow.com/questions/19235203/… that helped me adding jquery to my edit page. Commented Dec 14, 2015 at 7:06
  • it will update auto no need for jquery that. because when the store change the page will be reload. some time user can change from product page or any other page. Commented Dec 14, 2015 at 7:08

1 Answer 1


You can use ajax & get CMS pages by below code for store filter:

$collection = Mage::getModel('cms/page')->getCollection();
         array('cms' => $collection->getTable('cms/page_store')),
               'cms.page_id = main_table.page_id AND cms.store_id != 0',
->columns(array('stores_count' => new Zend_Db_Expr('COUNT(cms.store_id)')))
->having('stores_count = ?', 1)
->having('cms.store_id = ?', 'YOUR_STORE_ID');

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.