Given a product in Magento, how can I get a list of all the catalog price rules that apply to it? I know that I can use getFinalPrice()
to get the price after all rules were applied; however, I am more interested in the catalog price rule objects themselves that apply to a given object.
Add a comment
|
1 Answer
This solution would show you if a product has a rule applied maybe you can get which rule from this one somehow
$resource = Mage::getSingleton('core/resource');
$connection = $resource->getConnection('core_read');
$tableName = $resource->getTableName('catalogrule_product');
$count = $connection->fetchOne('SELECT COUNT(1) as c FROM '.$tableName.' WHERE product_id = '. $product->getId());
if ($count == 1) {
//you have a rule for the product
}