newage Posted April 4, 2013 Share Posted April 4, 2013 Hello! On my prestashop store I have two carriers - courrier and regular mail. I have 3 payment opitons: By bank wire, Pay on Delivery, Credit card Surface mail is best for small packagkes, but they DO NOT offer Pay on Delivery service. SO, the question is - how can I disable the Pay on Delivery payment option when buyer selects surface mail as delivery option? Thank you in advance! Link to comment Share on other sites More sharing options...
vekia Posted April 4, 2013 Share Posted April 4, 2013 which version of prestashop you use? Link to comment Share on other sites More sharing options...
newage Posted April 4, 2013 Author Share Posted April 4, 2013 PrestaShop™ 1.4.9.0 Link to comment Share on other sites More sharing options...
vekia Posted April 4, 2013 Share Posted April 4, 2013 unfortunately i don't know any easy solutions for this. But of course - solution exists, you can edit tpl file of Pay on Delivery module, where you can add simple {if} statement which will hide pay on delivery when surface mail was chcecked as an delivery type. {if !id_delivery_type=id_surface_mail} code here {/if} Link to comment Share on other sites More sharing options...
newage Posted April 4, 2013 Author Share Posted April 4, 2013 (edited) unfortunately i don't know any easy solutions for this. But of course - solution exists, you can edit tpl file of Pay on Delivery module, where you can add simple {if} statement which will hide pay on delivery when surface mail was chcecked as an delivery type. {if !id_delivery_type=id_surface_mail} code here {/if} Thank you, vekia Where can I see the ID of the surface mail module? I noticed that payment options can be defined for different groups. Maybe I can assign a group to surface mail, how does it work? Edited April 4, 2013 by newage (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted April 4, 2013 Share Posted April 4, 2013 you can find id of carrier in your back office: Link to comment Share on other sites More sharing options...
newage Posted April 5, 2013 Author Share Posted April 5, 2013 (edited) I found a similar question here http://www.prestashop.com/forums/topic/233614-solved-hide-payment-method-based-on-id-carrier-using-in-php-function/ Edited April 5, 2013 by newage (see edit history) 1 Link to comment Share on other sites More sharing options...
vekia Posted April 7, 2013 Share Posted April 7, 2013 I found a similar question here http://www.prestasho...n-php-function/ yess! it works exactly as i said :-) thanks for the url, i don't know this thread Link to comment Share on other sites More sharing options...
newage Posted April 7, 2013 Author Share Posted April 7, 2013 (edited) I did not do it exactly as mentioned in the thread. In fact initially it did not work. This is exactly what I did: In the cashondelivery.php file, under public function hookPayment($params) { if (!$this->active) return ; global $smarty; I added: $cartski = $params['cart']; $carrierski = intval($cartski->id_carrier); if ($carrierski==20) return; where 20 is the carrier ID that does not support Cash On Delivery. And it works! Edited April 7, 2013 by newage (see edit history) 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