0

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.

1 Answer 1

0

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
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.