从magento的Tax类中获取tax_calculation_rule_id

时间:2014-07-15 04:32:39

标签: php magento

如果我有产品税级和客户税级,我如何获得tax_calculation_rule_id。目前我正在研究一个模块,我正在努力扩展magento API的税收规则。我有customer tax class nameproduct class name,是否有任何功能可以在{2}的基础上给我tax_calculation_rule_id

1 个答案:

答案 0 :(得分:3)

请尝试以下操作:

$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());