I have added tax rule in

sales -> manage tax rules

and associate with customer tax class.

Now how can I programatically get this rules or fetch all the rules defined here ?

I tried this

$tax = Mage::getModel('tax/calculation')->getCollection();

            foreach($tax as $rr) {
                 echo $rr->getRuleName();
                 echo $rr->getRuleId();
                 echo '<br>';

but getting blank

2 Answers 2


Try this

$collection = Mage::getModel('tax/calculation_rule')->getCollection();
if($collection->getSize()) {
if($collection->getSize()) {
    foreach($collection as $rule) {

If you want to load by id:

$taxRule = Mage::getModel('tax/sales_order_tax')->load($id);

or get all:

$taxRules = Mage::getModel('tax/sales_order_tax')->getCollection();

foreach($taxRules as $taxRule){
    echo $taxRule->getId();

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.