Jose Eduardo Jose Eduardo - 1 year ago 68
PHP Question

Create Store_view check box on the grid - Magento

I noticed that the Product Catalog, there is an equal housing image to select the store view, it would be very useful in my case, however I do not find how to add this in my GRID.

Store Choose

Could you tell me how to do this?
Thank you

enter image description here

Just trying to be clearer, when used multistore in catalog_product page is shown a drop down box with all the store, I need to do the same, but on a custom page of my module.

Answer Source

From what I understood you want the drop down box to show the list of all stores. Then you need the source model of adminhtml/system_config_source_store

This is what you need and/or what you could do. Create a system.xml in the module you created. Add a field to it something like this.

<store_select translate="label comment">
    <label>Select Store</label>

The other options is to create your own source model

class [Namespace]_[Module]_Model_Store {
   public function toOptionArray() {
       return Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true);

And then replace the source model path of the system.xml with the one you just created.


My Github

Checkout the commits with message "091115 : Admin Controller Base". Again this is just the base where you could start. You still need to implement the logic for the select to work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download