【问题标题】:Magento Tax Rate Based on Shipping Destination基于送货目的地的 Magento 税率
【发布时间】:2016-03-17 13:16:26
【问题描述】:

结帐时更改送货目的地时如何更改税率?

我没有在后端找到设置(如果我错了,请纠正我)所以我想我必须用自己的模块来解决这个问题。

我应该从哪里开始这个项目?

示例-目标:

  • 德国商店(19% 增值税)
  • 瑞士客户(从德国出口到非欧盟国家:0% 增值税)
  • 运送到德国-瑞士边境以节省运费 => 我必须计算 19% 的增值税,因为产品(尚未)离开该国,即使客户在瑞士,仍然从 Magento 获得 0% 的增值税)

有什么想法,必须为此更改哪些类和方法?

提前致谢。

【问题讨论】:

    标签: magento-1.9


    【解决方案1】:

    我解决了我的任务。

    我重写了 Mage_Tax_Model_Calculation 方法 getRateRequest。 在这里,我可以在使用 $basedOn 分配 $address 的 switch 语句之前添加自己的逻辑。

        //override basedOn
        $basedOn = 'billing';
        if ($shippingAddress != null && $billingAddress != null) {
            if ($shippingAddress->getData('country_id') != $billingAddress->getData('country_id') && $shippingAddress->getData('country_id') == 'DE') {
                $basedOn = 'shipping';
            }
        }
        // needed to still work if one of both addresses is null
        if ($shippingAddress == null || $billingAddress == null) {
            $basedOn = 'default';
        }
        else  {
            $ship = $shippingAddress->getData('country_id');
            $bill = $billingAddress->getData('country_id');
            if(empty($ship) || empty($bill))  {
                $basedOn = 'default';
            }
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-09
      • 1970-01-01
      相关资源
      最近更新 更多