首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >当客户在结帐时输入增值税号码时Magento禁用税务

当客户在结帐时输入增值税号码时Magento禁用税务
EN

Stack Overflow用户
提问于 2013-09-16 09:19:40
回答 1查看 2.3K关注 0票数 1

我有Magento1.7网站,如果客户在结帐页面输入税号,我将厌倦从他们那里删除该税。

我有两个国家荷兰和比利时的税收规则都有10%的税收。,默认的国家是比利时

我需要删除增加的税收,当比利时客户进入那里的增值税号码在结帐页面。

我厌倦了使用税收规则,但没有运气。

任何人都知道如何使用magento后端或使用代码level.any答案,我很欣赏。谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-09-18 21:49:28

Over Magento的税务模型getRate()函数是我们做类似事情的方法。

代码语言:javascript
运行
复制
class My_Module_Model_Tax_Calculation extends Mage_Tax_Model_Calculation
{

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

        $country_id = $request->getCountryId();

        if ($country_id == 'BE' && $this->getCustomer() && $this->getCustomer()->getTaxvat()) {
            return 0;          
        }

        $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];
    }
}
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18824438

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档