I want to check whether the "use default value" flag is set for a specific product attribute in the admin for a specific store view.
If I have the full product model, I can easily check it like that:
$product = Mage::getModel('catalog/product')->setStoreId($storeViewId)->load($productId);
$hasStoreViewSpecificValue = $product->getExistsStoreValueFlag('my_attribute');
Is it possible to get this information in a smart way without loading the whole product (optimally without any direct SQL queries, but if there is no other way…)?
Best Answer
Thanks @DavidManners for the hint. In the end, it was easier to look how it is done
Mage_Catalog_Model_Resource_Abstract::_setAttributeValue
though. I came up with the following script which checks if a product has the "Use Default Value" flag set for a specific attribute:I did not test it, but the second version should be much faster as the product does not have to be fully loaded.