1

I want to set custom tax rate on magento checkout page. I have written below code but what will be next step i can't understood: i want if

taxt == 0 then i am able to apply tax 8% (custom)

<?php
class Sipping_Disable_Model_Observer
{
 public function salesQuoteCollectTotalsBefore(Varien_Event_Observer $observer)
    {
        /** @var Mage_Sales_Model_Quote $quote 778.78*/
            $quote = $observer->getQuote();
            $subTotal = $quote->getSubtotal();      
            $newSubTotal = (5/100) * $subTotal;         
            $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
            $tax = 0;
            if(isset($totals['tax']) ) {
                $tax = $totals['tax']->getValue();
            }
            $zip = $quote->getShippingAddress()->getPostcode();
            if($tax == 0){              
                $con = Mage::getSingleton('core/resource')->getConnection('core_read'); 
                $sale_rule_result = $con->fetchAll("SELECT rate FROM tax_calculation_rate where tax_postcode=".$zip);
                $tax_percentage = $sale_rule_result[0]['rate'];
                // update tax code goes here ??/


            }   
                 Mage::log($zip.'-t-'.$tax, null, 'shipping-price.log',true);       




    }
}
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.