2017-02-17 3 views
1

Ich muss den Steuerbetrag beschränken. also ging ich Mage/Tax/Model/Calculation.php Dann findet calcTaxAmount() Steueranwendungsfunktion. Ich brauche Steuer zu beschränken, die alle Steuern Umsatzsteuer ID in der Kasse OnePage Steuer sein sollte Null eingeben sind sogetQuote funktioniert nicht einige Geschäfte

public function calcTaxAmount($price, $taxRate, $priceIncludeTax = false, $round = true) 
    { 
     $billing = Mage::getModel('checkout/session')->getQuote()->getCustomerTaxvat(); 

     if($billing != "") 
     { 
      return 0; 
     } 
     $taxRate = $taxRate/100; 

     if ($priceIncludeTax) { 
      $amount = $price * (1 - 1/(1 + $taxRate)); 
     } else { 
      $amount = $price * $taxRate; 
     } 

     if ($round) { 
      return $this->round($amount); 
     } 

     return $amount; 
    } 

ich die neue Bedingung hinzugefügt. Es funktioniert einige Geschäfte von Multistores. Nur ein Geschäft kann nicht ordnungsgemäß funktionieren. Dies führt dazu, dass der Benutzer sich nicht registrieren kann, und addtocart funktioniert nicht für diesen bestimmten Speicher. Ich habe getQuote das Problem gefunden. Ich entferne die neue Bedingung wie unten gut funktioniert.

Old Funktion: -

public function calcTaxAmount($price, $taxRate, $priceIncludeTax = false, $round = true) 
    { 
     $taxRate = $taxRate/100; 

     if ($priceIncludeTax) { 
      $amount = $price * (1 - 1/(1 + $taxRate)); 
     } else { 
      $amount = $price * $taxRate; 
     } 

     if ($round) { 
      return $this->round($amount); 
     } 

     return $amount; 
    } 

Antwort

0

I wurde Below Fluss behoben: -

statt mit getQuote In Calculation.php Verwenden von Session-Variable

Mage/Checkout/Modell/Typ/Onepage.php

Funktionsname: - öffentliche Funktion saveBilling ($ data, $ customerAddressId)

 $assign = $this->getQuote()->getCustomerTaxvat(); 
     if ($assign !="") 
     { 
      $this->_checkoutSession->setVatSession($assign); 
     } 
     else 
     { 
      $this->_checkoutSession->unsVatSession(); 
     } 

Above-Code in der onepage.php hinzufügen vor return array();, die der Funktion zuletzt bedeutet.

Jetzt Below Holen Sie sich das Session Variable

Mage/Steuern/Model/Calculation.php

public function calcTaxAmount($price, $taxRate, $priceIncludeTax = false, $round = true) 
    { 
     $sessionaccess = Mage::getModel('checkout/session')->getVatSession(); 
     if($sessionaccess != "") 
     { 
      return 0; 
     } 
     $taxRate = $taxRate/100; 

     if ($priceIncludeTax) { 
      $amount = $price * (1 - 1/(1 + $taxRate)); 
     } else { 
      $amount = $price * $taxRate; 
     } 

     if ($round) { 
      return $this->round($amount); 
     } 

     return $amount; 
    } 
1

Try Code unten hoffe, das hilft.

public function calcTaxAmount($price, $taxRate, $priceIncludeTax = false, $round = true) 
    { 
     $currenQuoteId = Mage::getSingleton('checkout/session')->getQuoteId(); 
    $store = Mage::getSingleton('core/store')->load(Mage::app()->getStore()->getId()); 
      $quote = Mage::getModel('sales/quote')->setStore($store)->load($currenQuoteId); 
     $billing = $quote->getCustomerTaxvat(); 

     if($billing != "") 
     { 
      return 0; 
     } 
     $taxRate = $taxRate/100; 

     if ($priceIncludeTax) { 
      $amount = $price * (1 - 1/(1 + $taxRate)); 
     } else { 
      $amount = $price * $taxRate; 
     } 

     if ($round) { 
      return $this->round($amount); 
     } 

     return $amount; 
    } 
+0

Thanks @ user247217 Zugriff. Ich war behoben. und ich fügte die meine Antwort hinzu. – Crock

Verwandte Themen