Working on a site that has multiple stores and their own homepages. Im trying to update all of these homepages with new data via a data-upgrade script.
Here what i have so far:
$stores = Mage::app()->getStores();
foreach ($stores as $store){
Mage::app()->setCurrentStore($store->getStoreId());
$page = Mage::getModel('cms/page')->load('homepage-2012');
$page_content = file_get_contents(__DIR__ . '/markup-0.0.2/homepage/content.html');
$page->setContent($page_content)
->setRootTemplate('one_column_notcontained')
->save();
}
unset($page_content,$page,$stores);
The problem is the pages content and root template aren't updating on the stores.
I have used breakpoints to check the store ids are correct and the loop is working as it should and it seems to be doing what it should -> getting the store id, setting that store id as currentStore being used and then loading the cms homepage related to that store is and using the identifier set.
Any ideas why this might not be working?
Cheers