dro59505 2017-01-14 03:08
浏览 93

当用户输入增值税时,Magento 1.9在结账时取消税

I'm trying to make magento modification when user enter vat number on checkout remove tax from order.

I found a code on stackoverflow which support on magento older version but it not work with new version 1.9,

I made few modifications for work the condition and return 0,even it return 0 checkout still shows tax.

here is my code which is on file

/app/code/core/Mage/Tax/Model/Calculation.php line number 268



    public function getRate($request)
        {
            if (!$request->getCountryId() || !$request->getCustomerClassId() || !$request->getProductClassId()) {
                return 0;
            } 


           //my code
            $ctax= Mage::getSingleton('checkout/session')->getQuote()->getCustomerTaxvat();


            if ($this->getCustomer() && $ctax !='') {
                //echo 'test';
                return 0;          
            }
        //end my code   


            $cacheKey = $this->_getRequestCacheKey($request);
            if (!isset($this->_rateCache[$cacheKey])) {
                $this->unsRateValue();
                $this->unsCalculationProcess();
                $this->unsEventModuleId();
                Mage::dispatchEvent('tax_rate_data_fetch', array(
                    'request' => $request));
                if (!$this->hasRateValue()) {
                    $rateInfo = $this->_getResource()->getRateInfo($request);
                    $this->setCalculationProcess($rateInfo['process']);
                    $this->setRateValue($rateInfo['value']);
                } else {
                    $this->setCalculationProcess($this->_formCalculationProcess());
                }
                $this->_rateCache[$cacheKey] = $this->getRateValue();
                $this->_rateCalculationProcess[$cacheKey] = $this->getCalculationProcess();
            }
            return $this->_rateCache[$cacheKey];
        }

Anyone can help me to make tax 0 when user enters vat number on checkout, Thanks a lot

  • 写回答

3条回答 默认 最新

  • dongzhou1865 2017-01-17 12:06
    关注

    You can use sales_quote_collect_totals_before event.

    then you have to define logic for remove tax on checkout page.

    This link you can refer.

    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?