Magento if tax is not included on configurable product

Posted on Updated on

if tax are not included on configurable product, You have to check following attributes if query does not include them itself.

tax_percent
tax_class_id

$products = Mage::getResourceModel(‘catalog/product_collection’);
$products->addAttributeToFilter(‘type_id’, array(‘eq’ => ‘configurable’));
$products->addAttributeToFilter(‘status’, 1);
$products->addAttributeToFilter(‘visibility’, 4);
$products->addAttributeToSelect(‘sku’);
$products->addAttributeToSelect(‘name’);
$products->addAttributeToSelect(‘description’);
$products->addAttributeToSelect(‘short_description’);
$products->addAttributeToSelect(‘url’);
$products->addAttributeToSelect(‘image’);
$products->addAttributeToSelect(‘price’);
$products->addAttributeToSelect(‘special_price’);
$products->addAttributeToSelect(‘manufacturer’);
$products->addAttributeToSelect(‘category_ids’);
$products->addAttributeToSelect(‘gender’);
$products->addAttributeToSelect(‘tax_percent’);
$products->addAttributeToSelect(‘tax_class_id’);

foreach ($products as $product) {
$currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();

//Original Price with Tax
echo number_format(Mage::helper(‘tax’)->getPrice($product, $product->getPrice()),2, ‘.’, ”).$currency_code;

//Special Price with Tax
$product_data[‘sale_price’] = number_format(Mage::helper(‘tax’)->getPrice($product, $product->getSpecialPrice()),2, ‘.’, ”).$currency_code;

}

Advertisements