Get tax_calculation_rule_id from Tax class in mage

2019-08-29 13:33发布

问题:

How can i get the tax_calculation_rule_id if i have product tax class and customer tax class. Currently i am working on a module in which i am trying to extend magento API's for tax rules. I have customer tax class name and product class name, Is there any function which can give me tax_calculation_rule_id on the basis of these two

回答1:

Try following:

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

//Get the rate based on customer class
$customer_tax_class = '5';
$rates = $tax->load($customer_tax_class, 'customer_tax_class_id');
print_r($rates->getData());

//Get the rate based on product class
$product_tax_class = '2';
$rates = $tax->load($product_tax_class, 'product_tax_class_id');
print_r($rates->getData());


标签: php magento