jassy Posted June 10, 2012 Share Posted June 10, 2012 (edited) dear All actually this is a repeated discussion. but due to the original discussion took place 3yrs ago, the tips are no longer applicable to me. here's the former forum link solution provided by Ion_cannon: http://www.prestasho...e-carrier-only/ despite 3yrs already, i noticed prestashop still has not decided to include this feature, the present version im using (1.4.8.2) still has the free shipping feature (whether by weight or by price) implemented to all carriers. here's the php code for my version: classes/Cart.php find //Free fees: // Free fees $free_fees_price = 0; if (isset($configuration['PS_SHIPPING_FREE_PRICE'])) $free_fees_price = Tools::convertPrice((float)($configuration['PS_SHIPPING_FREE_PRICE']), Currency::getCurrencyInstance((int)($this->id_currency))); $orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING); if ($orderTotalwithDiscounts >= (float)($free_fees_price) AND (float)($free_fees_price) > 0) return $shipping_cost; if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0) return $shipping_cost; i hv 2 carriers now, 1) carrier in local country (carrier ID: 37) & 2) carrier to my neighbour country (carrier ID: 36) could anyone pls advise me how to configure free shipping for 1) carrier in local country (carrier ID: 37) & no free shipping applicable to 2) carrier to my neighbour country (carrier ID: 36). then in the event i hv more carriers for countries that has no free shipping, what do i do as well? highly appreciate some assistance here. rgds jassy Edited June 20, 2012 by jassy (see edit history) 1 Link to comment Share on other sites More sharing options...
jassy Posted June 12, 2012 Author Share Posted June 12, 2012 anyone could help pls....desperately needed help....only few steps away from launching my store... appreciate that... rgds jassy Link to comment Share on other sites More sharing options...
PrestaMonster Posted June 13, 2012 Share Posted June 13, 2012 i would be interested in this fix or module as well 1 Link to comment Share on other sites More sharing options...
jassy Posted June 13, 2012 Author Share Posted June 13, 2012 unfortunately no one is replying, i dont know why... is there any other channel to get assistance. pls advise & keep me posted should you find a solution. appreciate that. 2 Link to comment Share on other sites More sharing options...
genix Posted June 16, 2012 Share Posted June 16, 2012 (edited) Hello, I'm currently developing an module, that extends the freeshipping capabilities of prestashop. It will be able to provide the functionalities you want and many more. http://www.prestasho...d-free-shipping Keep looking into that thread, I will update as soon as it is releasable. Till then, here a quick fix for your problem. First get the carrier id for the carrier you want to deactivate freeshipping (I will refer to this ID as 'A-ID' in the code) for. You can get this id by going to the admin panel -> carriers and clicking edit on the carrier, then look at the address on top and extract "id_carrier=xx", the "xx" is the carrier id. Now look for the code: $free_fees_price = 0; if (isset($configuration['PS_SHIPPING_FREE_PRICE'])) $free_fees_price = Tools::convertPrice((float)($configuration['PS_SHIPPING_FREE_PRICE']), Currency::getCurrencyInstance((int)($this->id_currency))); $orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING); if ($orderTotalwithDiscounts >= (float)($free_fees_price) AND (float)($free_fees_price) > 0) return $shipping_cost; if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0) return $shipping_cost; and replace it with this: Replace A-ID with the corresponding carrier id. $disable_freeshipping = array(A-ID); $free_fees_price = 0; if (isset($configuration['PS_SHIPPING_FREE_PRICE'])) $free_fees_price = Tools::convertPrice((float)($configuration['PS_SHIPPING_FREE_PRICE']), Currency::getCurrencyInstance((int)($this->id_currency))); $orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING); if ($orderTotalwithDiscounts >= (float)($free_fees_price) AND (float)($free_fees_price) > 0) return $shipping_cost; if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND !in_array($id_carrier, $disable_freeshipping) AND $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0) return $shipping_cost; Everytime you edit the carrier in the admin panel now, the ID of the carrier will change, so you will have to update the ID in the code above by changing the variable $disable_freeshipping accordingly. By adding more carriers to $disable_freeshipping (so it'll look something like $disable_freeshipping = array(A-ID, 3, 32, 23)), each of these carrier's will be deactivated for freeshipping. I hope it works. Edited June 16, 2012 by genix (see edit history) 4 Link to comment Share on other sites More sharing options...
taohi01 Posted June 17, 2012 Share Posted June 17, 2012 Hello, I'm currently developing an module, that extends the freeshipping capabilities of prestashop. It will be able to provide the functionalities you want and many more. http://www.prestasho...d-free-shipping Keep looking into that thread, I will update as soon as it is releasable. Till then, here a quick fix for your problem. First get the carrier id for the carrier you want to deactivate freeshipping (I will refer to this ID as 'A-ID' in the code) for. You can get this id by going to the admin panel -> carriers and clicking edit on the carrier, then look at the address on top and extract "id_carrier=xx", the "xx" is the carrier id. Now look for the code: $free_fees_price = 0; if (isset($configuration['PS_SHIPPING_FREE_PRICE'])) $free_fees_price = Tools::convertPrice((float)($configuration['PS_SHIPPING_FREE_PRICE']), Currency::getCurrencyInstance((int)($this->id_currency))); $orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING); if ($orderTotalwithDiscounts >= (float)($free_fees_price) AND (float)($free_fees_price) > 0) return $shipping_cost; if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0) return $shipping_cost; and replace it with this: Replace A-ID with the corresponding carrier id. $disable_freeshipping = array(A-ID); $free_fees_price = 0; if (isset($configuration['PS_SHIPPING_FREE_PRICE'])) $free_fees_price = Tools::convertPrice((float)($configuration['PS_SHIPPING_FREE_PRICE']), Currency::getCurrencyInstance((int)($this->id_currency))); $orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING); if ($orderTotalwithDiscounts >= (float)($free_fees_price) AND (float)($free_fees_price) > 0) return $shipping_cost; if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND !in_array($id_carrier, $disable_freeshipping) AND $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0) return $shipping_cost; Everytime you edit the carrier in the admin panel now, the ID of the carrier will change, so you will have to update the ID in the code above by changing the variable $disable_freeshipping accordingly. By adding more carriers to $disable_freeshipping (so it'll look something like $disable_freeshipping = array(A-ID, 3, 32, 23)), each of these carrier's will be deactivated for freeshipping. I hope it works. I hope you will have it prepared soon... I´m looking forward having a tool like yours Klaus Link to comment Share on other sites More sharing options...
jassy Posted June 17, 2012 Author Share Posted June 17, 2012 hi genix, good evening to you. so glad to see someone has actually revert to me on this & apologised for the late reply as i hv not been feeling well the last few days. i hv gone thru your recommended thread i.e. the freeshipping.exe. however, this module is not applicable to me for the time being because i hv had fewer product range at the moment & thus need not have to hv too many different free shipping condition for different category or product. nevertheless, i had like to try out your above html codes. im trying to locate the platform to change these codes, my guess is i should be looking thru the public_html/modules/ & look for the original prestashop shipping estimation module. but i hadnt found anything with that similar name other than the carriercompare folder & carriercompare.php file. could you pls advise me the right platform to locate your stated codes. highly appreciate that. rgds jassy Link to comment Share on other sites More sharing options...
genix Posted June 17, 2012 Share Posted June 17, 2012 Hi, the fix I provided was for classes/Cart.php. You do not have to change anything in modules. Regards, genix. Link to comment Share on other sites More sharing options...
jassy Posted June 19, 2012 Author Share Posted June 19, 2012 dear genix i hv tried replacing your codes, but it doesnt give any sort of difference to my website. the following is what i hv done: 1) using file manager to locate public_html/classes/cart.php 2) copy your fix to replace the original (starting from line approx. 1145) 3) change carrier id from A-ID to no. 40 (the carrier i didnt want to hv free shipping) 4) save changes 5) go to BO/Preferences/Performance/set force compile yes & cache no 6) view my shop, check, it's is still the same meaning the carrier i didnt want to hv free shipping is still providing free shipping like my default carrier. appreciate your further advise on this matter. Link to comment Share on other sites More sharing options...
genix Posted June 19, 2012 Share Posted June 19, 2012 (edited) Hello, Ok, I forgot something, didn't test the code, but this should work now: $disable_freeshipping = array(A-ID); $free_fees_price = 0; if (isset($configuration['PS_SHIPPING_FREE_PRICE'])) $free_fees_price = Tools::convertPrice((float)($configuration['PS_SHIPPING_FREE_PRICE']), Currency::getCurrencyInstance((int)($this->id_currency))); $orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING); if ($orderTotalwithDiscounts >= (float)($free_fees_price) AND (float)($free_fees_price) > 0 AND !in_array($id_carrier, $disable_freeshipping)) return $shipping_cost; if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND !in_array($id_carrier, $disable_freeshipping) AND $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0) return $shipping_cost; Just replace the previous code, with the above one. Good luck. Edited June 19, 2012 by genix (see edit history) 3 Link to comment Share on other sites More sharing options...
yves1986 Posted June 20, 2012 Share Posted June 20, 2012 Hi genix, your fix works fine for me, thanks a lot! Just one thing: when the customer applys a free shipping voucher, he can still see all shipping options.... what can I do about that? Link to comment Share on other sites More sharing options...
jassy Posted June 20, 2012 Author Share Posted June 20, 2012 dear genix, this is perfect, tq v much. rgds jassy Link to comment Share on other sites More sharing options...
maesal Posted June 20, 2012 Share Posted June 20, 2012 Hi genix, your fix works fine for me, thanks a lot! Just one thing: when the customer applys a free shipping voucher, he can still see all shipping options.... what can I do about that? The same for me. I have free shipping expending 80 or more € and 3 carriers, and I want to offer free shipping with 1 or 2, not with all. In this case I offer the 24 h for free. Obviously, the 72 h is also free, but it appears as free also the 14 h. Link to comment Share on other sites More sharing options...
oicnow Posted June 27, 2012 Share Posted June 27, 2012 Im using PS ver 1.4.3 and did everything as above but its still not working. Any reason as to why its not working? thanks Link to comment Share on other sites More sharing options...
mr10 Posted July 4, 2012 Share Posted July 4, 2012 hi, i use 1.4.4 and the classes/Cart.php edit works perfect. (one remark: when you edit a carrier in the backend, it saves the edit as a new iD! so make sure to edit the ID in the code when you edited the carrier in the backend - probably this is a bug and is fixed in newer versions...) anyone has a solution for the 'free shipping voucher'? we use this kind of voucher a lot, but this should not be valid for 'express delivery option', which costs us much more... thank you Link to comment Share on other sites More sharing options...
Inarus Posted November 16, 2012 Share Posted November 16, 2012 Genix unfortunately your module dosn`t work on 1.4.7.3 but hack is awsome! Thanks 1 Link to comment Share on other sites More sharing options...
UKclearancecentre Posted February 13, 2013 Share Posted February 13, 2013 thanks for this hack, with it being relatively easy to do i am suprised this has not been included in prestashop by default. It could just be a tick box next to the carrier saying 'disable from free shipping' Link to comment Share on other sites More sharing options...
paulormf Posted September 5, 2013 Share Posted September 5, 2013 thanks for this hack, with it being relatively easy to do i am suprised this has not been included in prestashop by default. It could just be a tick box next to the carrier saying 'disable from free shipping' ---- in ps 1.5 not work, someone can help me pls?? in ps 1.5 this is original code: // Free fees $free_fees_price = 0; if (isset($configuration['PS_SHIPPING_FREE_PRICE'])) $free_fees_price = Tools::convertPrice((float)$configuration['PS_SHIPPING_FREE_PRICE'], Currency::getCurrencyInstance((int)$this->id_currency)); $orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, null, null, false); if ($orderTotalwithDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0) { Cache::store($cache_id, $shipping_cost); return $shipping_cost; } Link to comment Share on other sites More sharing options...
Husar Posted November 2, 2013 Share Posted November 2, 2013 1.5.6: // Free fees $disable_freeshipping = array('7'); $free_fees_price = 0; if (isset($configuration['PS_SHIPPING_FREE_PRICE'])) $free_fees_price = Tools::convertPrice((float)$configuration['PS_SHIPPING_FREE_PRICE'], Currency::getCurrencyInstance((int)$this->id_currency)); $orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, null, null, false); if ($orderTotalwithDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0 && !in_array($id_carrier, $disable_freeshipping)) { Cache::store($cache_id, $shipping_cost); return $shipping_cost; } if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) && $this->getTotalWeight() >= (float)$configuration['PS_SHIPPING_FREE_WEIGHT'] && (float)$configuration['PS_SHIPPING_FREE_WEIGHT'] > 0 && !in_array($id_carrier, $disable_freeshipping)) { Cache::store($cache_id, $shipping_cost); return $shipping_cost; } 1 Link to comment Share on other sites More sharing options...
AlexFL Posted February 9, 2015 Share Posted February 9, 2015 (edited) Husar changes works like a charm. Just to explain exactly what you have to do: Add this (change the number 7 with your carrier's id that you don't want to have free shipping) $disable_freeshipping = array('7'); before this $free_fees_price = 0; and before this && (float)($free_fees_price) > 0) add this && !in_array($id_carrier, $disable_freeshipping) If you just want to have free shipping only on one carrier (the method above could be used for multiple carriers) just add this (change the 1 with the id of the carrier you want to have free shipping) AND $id_carrier==1 before this && (float)($free_fees_price) > 0) Edited February 9, 2015 by AlexFL (see edit history) Link to comment Share on other sites More sharing options...
foxskav Posted July 20, 2016 Share Posted July 20, 2016 Hello,It works when I set free delivery at preferences but.If I set voucher for free delivery it doesn't works. Link to comment Share on other sites More sharing options...
Recommended Posts