How to filter the store views so that only information for mobile stores will be saved?

magento.stackexchange https://magento.stackexchange.com/questions/225026

  •  08-01-2021
  •  | 
  •  

Domanda

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'

È stato utile?

Soluzione 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()) {
                    }
                 }
              }
           }
        }

Altri suggerimenti

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.
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top