0

Let´s say I have a store named "Megastore". How can I get the id of that specific store?

Can I do it by using some kind of filter?

Mage::getModel('core/store')->addFieldToFilter('name', 'Megastore');

2 Answers 2

1

What do you need the ID for? Are you writing code for a specific store? If so you can do

  <?php if (Mage::app()->getStore()->getCode() == 'default'){ ?>

Default being the store name.

0

Actually found the solution here: How to get the store id from the code

Mage::app()->getStore('Megastore')->getId()
1
  • 2
    Keep in mind that getStore() function will load your store by store code, not by store name. Feb 22, 2016 at 21:44

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.