Question

How to add a filter to the following piece of code

    foreach($this->getStores() as $_store {
         $storeName = $this->__($this->htmlEscape($_store->getName()));
         $storeId = $_store->getId();
         $storeCode = $_store->getCode();
    }

in a way that magento will only get that info for mobile store views? The code for all mobile store views is $mageRunCode .= '_mobile'

Was it helpful?

Solution 2

Got is as follows:

        foreach (Mage::app()->getWebsites() as $website) {
           foreach ($website->getGroups() as $group) {
              $stores = $group->getStores();
              foreach ($stores as $_store) {

                 $storeCode = $_store->getCode();
                 $storeId = $_store->getId();
                 $storeName = $this->__($this->htmlEscape($_store->getName()));
                 if (strpos($storeCode, '_mobile') !== false) {
                    if ($_store->getIsActive()) {
                    }
                 }
              }
           }
        }

OTHER TIPS

You can try to adjust the store below way:

foreach($this->getStores() as $_store {
     $storeId = $_store->getId();
     Mage::app()->setCurrentStore($storeId);
     // after that get information of that store.
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top