0

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'

2
  • your question is not clear May 7, 2018 at 17:21
  • As the code is already, I would get the name, id and code of all store views (including desktop stores), so my question is how to adjust the code in a way that I get that info only for mobiel stores views which code is $mageRunCode .= '_mobile' May 7, 2018 at 17:34

2 Answers 2

0

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.
}
2
  • Hi Prasanta. The foreach loop that I pasted in the post is part of a dropdown that should only get the information from the mobile store views (identified by the code $mageRunCode .= '_mobile' ) so I want to know how to create a check that would only get that info for the mobile store views May 8, 2018 at 13:34
  • Please provide the actual code to see how you are trying to do? May 8, 2018 at 14:12
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.