Ever since we added an extra Store View (called Wholesale) to our Megento store, my custom Observer code that used to change a product custom attribute have stopped working properly.
Before adding this new Store View, there is only “All Store View” and “Default Store View”, and everytime my Observer is triggered it updates a custom attribute on a product in *assumed to be* “All Store View”, and “Default Store View” will *assumed to* inherited these updated default values.
After adding this new Store View, sometimes my code updates products in “All Store View” and sometimes “Default Store View”, and the attribute values are no longer the same between “All Store View” and “Default Store View” (might be “8” in All Store View and “10” in Default Store View).
I’ve tried to use:
$websites = Mage::app()->getWebsites();
$defaultStore = $websites->getDefaultStore();
To set the current store but it doesn’t work..
Is there a methoed that could do similar to a fictional setCurrentStoreView("Default_Store_View") ? So I can guarantee that I’m consistently changing the value of custom attribute on the correct Store View?