Magento get price including tax in a none-template file

后端 未结 2 2002
清酒与你
清酒与你 2021-01-03 00:51

At the moment i am trying to get the product price including tax in a php file for my product feed. I have this code at the moment:

$_product = Mage::getMode         


        
相关标签:
2条回答
  • 2021-01-03 01:18

    You can get a helper-instance in any file using:

    Mage::helper('tax')
    

    Your full code is:

    $_product = Mage::getModel('catalog/product')->load($productId);
    $_priceIncludingTax = Mage::helper('tax')
        ->getPrice($_product, $_product->getFinalPrice());
    
    0 讨论(0)
  • 2021-01-03 01:23

    Thanks @Alex:

    If the product has FinalPrice special price is the final price of the product to access the most serious tax base price:

        $_product = Mage::getModel('catalog/product')->load($p->getId());
    
        $_specialPriceIncTax = Mage::helper('tax')
            ->getPrice($_product, $_product->getFinalPrice());
    
        $_priceTax = Mage::helper('tax')
            ->getPrice($_product, $_product->getPrice());
    
    0 讨论(0)
提交回复
热议问题