Это то, что я сделал для этого. Должен оказаться весьма полезным. Скопируйте это приложение файл/код/ядро / Mage/Tax/Модель/Calculation.php к приложению/код/местные/Mage/Налоги/модель/Calculation.php затем по линии 178 Theres эта функция
public function getRate($request)
{
if (!$request->getCountryId() || !$request->getCustomerClassId() || !$request->getProductClassId()) {
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];
}
Я я изменил это на это. Его жестко закодированный код скидка и идентификационный код продукта на основе моих требований к этому проекту.
public function getRate($request)
{
if (!$request->getCountryId() || !$request->getCustomerClassId() || !$request->getProductClassId()) {
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']);
$thisDiscountCode = Mage::getSingleton('checkout/session')->getQuote()->getCouponCode();
$thisProductClassCode = $request->getProductClassId();
if($thisDiscountCode == "0000" && $thisProductClassCode == "5"):
$this->setRateValue(0);
else:
$this->setRateValue($rateInfo['value']);
endif;
} else {
$this->setCalculationProcess($this->_formCalculationProcess());
}
$this->_rateCache[$cacheKey] = $this->getRateValue();
$this->_rateCalculationProcess[$cacheKey] = $this->getCalculationProcess();
}
return $this->_rateCache[$cacheKey];
}
Приветствие для помощи на этом
не Если ставка налога устанавливается в стране и продукт, а не клиент? –
В этом случае клиент в этом случае должен указать, что они не облагаются налогом на эти определенные продукты. – Knade