2

I have a website having one store and one view. e.g) Main Website Main Store Main View so now i want to get Main View id from Main website id. how can i do that? Thank You

1 Answer 1

2

Let's say $website is the instance of your website entity.
You can get the store view ids for a website like this:

$storeIds = $website->getStoreIds();

This will return an array;
If you want the first store id (the only one in your case) use $storeIds[0].

[Edit]
If you have the website id, you can get the website object like this:

$website = Mage::getModel('core/website')->load($websiteId);

then use the code above.

2
  • Thanks Marius for reply but i need a something using $websiteid instead of $website.
    – umair ayub
    Commented Nov 14, 2014 at 10:15
  • @user3716220. See my update.
    – Marius
    Commented Nov 14, 2014 at 10:16

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.