If I load a product's data in store view or website scope, every attribute set to "use default value" is populated with that default value. This is fine in most cases, but now I'm trying to find out which products have a price defined at website level and which ones don't.
Product X's price is £10 in "default values" and £9 at the website level.
Product Y's price is £12 in "default values" and not set at the website level.
I'm trying to get just the website-level data programmatically, i.e. 9.0000 and NULL, but whatever I try, the price for product Y comes back as £12.
This post - https://stackoverflow.com/a/6623565/1493346 - describes how to set / unset attributes at store view level, but it hasn't helped with getting them.
This is what I've tried:
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$_products = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect(array('price'))
->setStoreId(STORE_ID)
->addStoreFilter(STORE_ID);
foreach ($_products as $_product) {
echo $_product->getPrice(); // no good
$_product->setStoreId(STOREID)->load($_product->getId());
echo $_product->getPrice(); // still no good
}
Is there a way to do this without resorting to direct database queries?