As the title says. I don't want the ID of the current website, I want the ID of any website by supplying only that websites name.
I have this code:
$siteModel = Mage::getResourceModel( 'core/website_collection' )->addFieldToFilter( 'name', $site )->getFirstItem();
$siteId = $siteModel->getId();
But $siteId
ends up empty.
If all i have the name of a website, then how can i get its ids?
Best Answer
You need debug the collection by
->getSelect()->__toString()
for checking it give right value or not.
Update:
Use load():
for this case you need to call
load()
function ofresource model
ofcore/website
for getting proper collectionNow you can get id of first store by using below code: