Jump to content

SOLVED - Changing calculation of shipping fee range in HT instead of TTC


krymeleroy

Recommended Posts

Hello everyone!

 

I hit a problem for a few days on my 1.4.9 benefits:

 

Finding: The calculation of price ranges for shipping fees are calculated from the taxes included price of my products and not the price before tax. This is very embarrassing for me who lives in North America where each province / state has diferents tax rate and where we show our prices excluding VAT.

 

My config: prestashop 1.4.9

 

Price Range $ 0 - $ 60: Shipping = $ 8

 

Price range $ 60 - $ 1000: shipping = $ 0

 

My problem is that this "barrier" of $ 60 is TAX INCLUDED while all my prices are based and showed BEFORE TAX.

 

My clients who buy for $ 59 BEFORE TAXES are offered the free shipping whereas it is supposed to be free has $ 60 EXCLUDING TAXES ...

 

NB: It is impossible to show my prices including VAT like in Europe because we have a more than 50 different tax rates ...

 

MY GOAL : to transform this barrier of $ 60 TAXES INCLUDED to $ 60 TAXES EXCLUDED

 

I'm at your disposal for more details ...

 

thank you !!

Edited by krymeleroy (see edit history)
Link to comment
Share on other sites

SOLVED BY BROCELIANDE

Here is his response :

 

Sur la 1.4.9, le calcul du total avant appel au calcul par tranches de prix est fait à la ligne 1059 de /classes/Cart.php :

 

$order_total = $this->getOrderTotal(true, Cart::ONLY_PHYSICAL_PRODUCTS_WITHOUT_SHIPPING);

 

 

 

C'est le premier paramètre qui te fiche dans l'eau : true , qui signifie en gros ttc...

 

Si tu mets false à la place, et en supposant (je n'ai pas testé mais il semble que ce soit ok) , que la variable $order_total ne soit utilisée que pour le calcul des tranches dans ce contexte, alors tu auras le résultat souhaité.

 

Après évidemment si tu veux faire propre on pourra dire qu'il est mieux de faire une override etc .... mais dans ton cas , si tu changes de version de presta au dela de la 1.4.9, il y a fort à parier que ton override ne sera plus correcte.

 

Je dirais donc que dans ton cas, une modif core de la ligne 1059 de cette classe en :

$order_total = $this->getOrderTotal(false, Cart::ONLY_PHYSICAL_PRODUCTS_WITHOUT_SHIPPING);

 

résoudra ton affaire.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...