Magento:Tablerate Shipping 是基于购物车总额计算的,含税还是不含税?

Magento: Is Tablerate Shipping based on the cart sum with or without taxes?

我有一家商店的产品税率不同。有些是 0%,有些是 19% 等等...

对于使用 Tablerates 的运输 im,例如:

最多 2000 欧元 = 10 欧元运费

2400 欧元或以上 = 15 欧元运费

现在开始我只是想了解一下,所以这里并没有真正要修复的错误。我只需要知道如何相应地计划我的 table费率。

我的订单总额超过 2400 欧元(含税),但客户仍然获得 10 欧元的运费。仅当系统使用不含税的价格来检查 table 费率时才会出现这种情况。因为只有这样价格才会在较低费率的表费率范围内。是的,我仔细检查了 Tablerates 设置(不是我第一次安装 Magento)。

1) 这个假设是否正确 table 税率是根据不含税的总额进行检查的?

2) 有没有办法设置table费率来检查购物车总额(含税)?

有人知道它在后台是如何工作的吗?我找不到任何东西,因为当您搜索该主题时,您通常会获得有关如何设置 table 费率的教程。

非常感谢任何提示或其他线程或位置,我可以查看有关其工作原理的详细信息。

注意:我使用 Magento 1.9.2.1

对于问题 1:

好像没有税。

Mage_Shipping_Model_Shipping::collectRatesByAddress 调用 setPackageValue 来设置费率请求的包值。 这会传递给 Mage_Shipping_Model_Carrier_Tablerate::collectRatescollectRates 从包裹价值中减去免费送货。

然后调用Mage_Shipping_Model_Carrier_Tablerate::getRate

$result = Mage::getModel('shipping/rate_result');
$rate = $this->getRate($request);

...

public function getRate(Mage_Shipping_Model_Rate_Request $request)
{
    return Mage::getResourceModel('shipping/carrier_tablerate')->getRate($request);
}

这调用 Mage_Shipping_Model_Resource_Carrier_Tablerate::getRate 将条件值绑定到查询。 (在您的情况下,条件名称应为 package_value)。

// Render condition by condition name
if (is_array($request->getConditionName())) {
    $orWhere = array();
    $i = 0;
    foreach ($request->getConditionName() as $conditionName) {
        $bindNameKey  = sprintf(':condition_name_%d', $i);
        $bindValueKey = sprintf(':condition_value_%d', $i);
        $orWhere[] = "(condition_name = {$bindNameKey} AND condition_value <= {$bindValueKey})";
        $bind[$bindNameKey] = $conditionName;
        $bind[$bindValueKey] = $request->getData($conditionName);
        $i++;
    }

    if ($orWhere) {
        $select->where(implode(' OR ', $orWhere));
    }
} else {
    $bind[':condition_name']  = $request->getConditionName();
    $bind[':condition_value'] = $request->getData($request->getConditionName());

    $select->where('condition_name = :condition_name');
    $select->where('condition_value <= :condition_value');
}

虽然可以修改顺序,但baseSubtotal应该是税前的。 请参阅 collectRatesByAddress:

$request->setBaseSubtotalInclTax($address->getBaseSubtotalInclTax()
    + $address->getBaseExtraTaxAmount());

关于你的问题2.

如上所述,我们有请求中的数据,但我们没有简单的接触点。

一个建议是重写 Mage_Shipping_Model_Carrier_Tablerate 并覆盖 getRate。您要做的是将 BaseSubtotal 设置为 BaseSubtotalInclTax,调用父级,然后重置请求。

public function getRate(Mage_Shipping_Model_Rate_Request $request)
{
    // TODO: wrap in try catch, to reset the value ??
    // TODO: clone the request ??
    // TODO: Test This
    $oldPackageValue = $request->getPackageValue();
    $request->setPackageValue($request->getBaseSubtotalInclTax());
    $returnvalue = Mage::getResourceModel('shipping/carrier_tablerate')->getRate($request);
    $request->setPackageValue($oldPackageValue);
    return $returnvalue;
}

这很老套,但侵入性很小。它应该能够承受不相关的更改,而不会强迫您修改代码。

另一种方法涉及重写和修改 Mage_Shipping_Model_Resource_Carrier_Tablerate::getRate 以使用您想要的值。

注意:这两种方法都没有经过测试。