Reputation: 3677
I've created (manually via Admin Panel) an attribute called att_by_website
which is scoped as 'Website' and I'm want to get its several values.
How can I do this? I'm able to set different values via Admin Panel, but at this time I'm only able to get the default value.
When I execute $this->getProduct()->getData('att_by_website')
it returns only the default value (where $this->getProduct()
returns an instance of Mage_Catalog_Model_Product
).
Thanks!
Upvotes: 2
Views: 7388
Reputation: 3677
It may not be the best approach, but solved the problem:
$value = Mage::getResourceModel('catalog/product')->getAttributeRawValue($productID, 'att_by_website', $storeId);
Upvotes: 5
Reputation: 5410
Try this:
foreach (Mage::app()->getWebsites() as $website) {
$websiteId = $website->getWebsiteId();
$storeId = $website->getDefaultGroup()->getDefaultStoreId();
Mage::app()->setCurrentStore($storeId);
echo $this->getProduct()->getData('att_by_website');
}
Upvotes: 1