1
A
回答
3
我做了一些非常相似的事情,我已經覆蓋app/code/core/Mage/Tax/Model/Calculation.php作爲app/code/local/Mage/Tax/Model/Calculation.php和根據會話值添加評論下方顯示的聲明以將稅率設置爲0。這是在結賬時實時計算的。
public function getRate($request)
{
if (!$request->getCountryId() || !$request->getCustomerClassId() || !$request->getProductClassId()) {
return 0;
}
$cacheKey = "{$request->getProductClassId()}|{$request->getCustomerClassId()}|{$request->getCountryId()}|{$request->getRegionId()}|{$request->getPostcode()}";
if (!isset($this->_rateCache[$cacheKey])) {
$this->unsRateValue();
$this->unsCalculationProcess();
$this->unsEventModuleId();
Mage::dispatchEvent('tax_rate_data_fetch', array('request'=>$this));
if (!$this->hasRateValue()) {
$this->setCalculationProcess($this->_getResource()->getCalculationProcess($request));
$this->setRateValue($this->_getResource()->getRate($request));
} else {
$this->setCalculationProcess($this->_formCalculationProcess());
}
$this->_rateCache[$cacheKey] = $this->getRateValue();
$this->_rateCalculationProcess[$cacheKey] = $this->getCalculationProcess();
}
//this is the bit you're looking for down here
if (Mage::getStoreConfig('tax/calculation/calc_rate_zero')) {
$_taxvat = Mage::getSingleton('checkout/session')->getQuote()->getCustomerTaxvat();
if ($_taxvat != null && $_taxvat != ' ') {
$this->setRateValue(0);
$this->_rateCache[$cacheKey] = $this->getrateValue();
$this->_rateCalculationProcess[$cacheKey]= $this->getCalculationProcess();
}
}
return $this->_rateCache[$cacheKey];
}
相關問題
- 1. 會話值顯示舊值結賬
- 2. 會話的條件
- 3. 根據會話選擇
- 4. 刪除所有會話,除1會話
- 5. 結束會話/清除Cookies
- 6. .net會話清除php會話
- 7. 會話條件不正常
- 8. 結賬加入免稅形式woocommerce
- 9. PayPal快速結賬後缺少會話數據
- 10. 根據R會話是否交互來切換條件
- 11. PHP自定義會話路徑:是否會根據我的意願刪除我的會話文件?
- 12. 會話結束事件
- 13. 會話結束事件
- 14. 會話類中的清除會話變量數據
- 15. PHP會話與數據庫會話
- 16. iOS:數據會話與短暫會話
- 17. 避免ssh會話超時
- 18. Symfony的會話避免_sf2_attributes
- 19. PHP結束會話?
- 20. window.open()清除會話
- 21. 會話刪除mysqli
- 22. 清除Facebook會話
- 23. C#清除會話
- 24. IE清除會話
- 25. ASP.net會話清除
- 26. 清除powershell會話
- 27. 催化劑插件在使用之前會話刪除會話
- 28. 根據會話隱藏並顯示div
- 29. MVC 3 - RequiredAttribute - 根據會話覆蓋
- 30. 根據PHPSESSID值破壞WordPress PHP會話
我試着添加這個作爲模塊重寫,它不會工作。我做到了,因爲你做到了,而且工作得很好。爲什麼模塊不能重載?你有什麼想法嗎? – Chris 2012-07-24 15:42:26
@Chris請解釋你做了什麼來試圖覆蓋它。 – Sturm 2012-07-24 16:09:28
我使用Models和etc文件夾創建了一個新模塊。我還將相應的配置文件添加到etc/modules。基本上我把它設置爲一個標準的自定義模塊。我使用這種機制來覆蓋其他幾個模型。 – Chris 2012-07-24 19:53:26