ZeusMaximus Posted December 18, 2016 Share Posted December 18, 2016 (edited) Salutare tuturor, Doresc sa setez o taxa generala de transport in functie de valoarea comenzii, nu in functie de cantitate sau greutate. Cum pot face asta? Multumesc! Edited December 18, 2016 by ZeusMaximus (see edit history) Link to comment Share on other sites More sharing options...
ZeusMaximus Posted December 18, 2016 Author Share Posted December 18, 2016 M-am tot uitat prin panoul de administrare, nu am gasit nimic relevant, probabil nu exista implementata o astfel de optiune. Solutia problemei mele este dupa cum urmeaza. Am accesat folderul classes/Cart.php si am editat fisierul astfel: Am cautat functia (aproximativ liniile 2652-2675): public function getTotalShippingCost($delivery_option = null, $use_tax = true, Country $default_country = null) { if (isset(Context::getContext()->cookie->id_country)) { $default_country = new Country(Context::getContext()->cookie->id_country); } if (is_null($delivery_option)) { $delivery_option = $this->getDeliveryOption($default_country, false, false); } $total_shipping = 0; $delivery_option_list = $this->getDeliveryOptionList($default_country); foreach ($delivery_option as $id_address => $key) { if (!isset($delivery_option_list[$id_address]) || !isset($delivery_option_list[$id_address][$key])) { continue; } if ($use_tax) { $total_shipping += $delivery_option_list[$id_address][$key]['total_price_with_tax']; } else { $total_shipping += $delivery_option_list[$id_address][$key]['total_price_without_tax']; } } return $total_shipping; } Am inlocuit-o cu: public function getTotalShippingCost($delivery_option = null, $use_tax = true, Country $default_country = null, $total_price = null) { if (isset(Context::getContext()->cookie->id_country)) { $default_country = new Country(Context::getContext()->cookie->id_country); } if (is_null($delivery_option)) { $delivery_option = $this->getDeliveryOption($default_country, false, false); } $total_price = $this->getOrderTotal(true, Cart::ONLY_PRODUCTS); if ($total_price >= 1 && $total_price <= 4.99) { $total_shipping = 1; } else if ($total_price >= 5 && $total_price <= 9.99) { $total_shipping = 2; } else if ($total_price >= 10 && $total_price <= 24.99) { $total_shipping = 3; } else if ($total_price >= 25 && $total_price <= 39.99) { $total_shipping = 4; } else { $total_shipping = 0; // Free Shipping } return $total_shipping; } $total_price - reprezinta pretul total; $total_shipping - reprezinta valoarea pretului transportului. TIn sa precizez ca versiunea mea de prestashop este 1.6.1.9. Link to comment Share on other sites More sharing options...
zaurus Posted December 18, 2016 Share Posted December 18, 2016 Bravo, ai reusit sa faci in asa fel incat modificarea sa se buseasca la urmatorul update. Si evident ai ales varianta complicata. Ai in admin > livrare > transportatori > 3 locatii si costuri de livrare > iti definesti acolo intervare de greutate/valoare cate vrei... 1 Link to comment Share on other sites More sharing options...
seocom Posted January 10, 2017 Share Posted January 10, 2017 Poti intradevar sa le faci manual, dar la urmatorul update se pierd informatiile Link to comment Share on other sites More sharing options...
horiab Posted September 10, 2017 Share Posted September 10, 2017 ok, deci nu e recomandabil sa modifici direct in sursa; dar cum fac daca clientul zice de ex. taxa transport 100 de lei pentru greutatea livrarii pina la 100 kg, si pentru de depaseste 100kg, cate 2 lei pentru fiecare kilogram. cum procedez, cu sper ca nu sunt obligat sa definesc un interval pentru fiecare kiliogram ?? multumesc Link to comment Share on other sites More sharing options...
Geo Burlibasa Posted September 15, 2017 Share Posted September 15, 2017 ok, deci nu e recomandabil sa modifici direct in sursa; dar cum fac daca clientul zice de ex. taxa transport 100 de lei pentru greutatea livrarii pina la 100 kg, si pentru de depaseste 100kg, cate 2 lei pentru fiecare kilogram. cum procedez, cu sper ca nu sunt obligat sa definesc un interval pentru fiecare kiliogram ?? multumesc Ba cam da, sau poti folosi un modul. L-am gasit pe addons, nu l-am folosit, dar pare sa faca ce vrei: https://addons.prestashop.com/en/shipping-costs/21245-additional-shipping-costs.html Sau faci un override daca ai cunostinte de programare. Link to comment Share on other sites More sharing options...
Marius05 Posted September 22, 2017 Share Posted September 22, 2017 Salut! Am facut un astfel de modul in care ai posibilitatea sa introduci formula prin care vrei sa fie calculat transportul catre curier in functie de total cos, greutate, pret pe kg in plus, procent din suma cos, suma fixa perceputa de firma de curierat... etc. Un exemplu de formula pentru calcul transport: tx_livrare + ((greutate - 1) * pr_kg) + tx_retur + (valoare_cumparaturi * pc_din_total / 100). Formula este doar ca exemplu, fiecare poate seta formula de calcul a transportului pe care o doreste si poate folosi doar o parte din parametrii. Mai jos aveti si o imagine cu acesti parametrii si cum se seteaza in modul: Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now