spyrosel Posted April 5, 2019 Share Posted April 5, 2019 Hello! I have built a custom carrier module and a custom payment module as well. Is there a way to "link" them together in a way that the payment method will only be displayed if the specific carrier is selected? It would be great if this could be done within any of these two modules so the user won't have to install a third module. Thank you! Link to comment Share on other sites More sharing options...
ftardio Posted April 6, 2019 Share Posted April 6, 2019 In Prestashop 1.7 admin panel, at Payment -> Preferences, at the bottom of the page, you can make payment restrictions for payment methods related to carriers (and also with countries, customer groups and currency). It doesn't depends of custom modules, it's a Prestashop feature, but I think it can helps you. Link to comment Share on other sites More sharing options...
spyrosel Posted April 6, 2019 Author Share Posted April 6, 2019 (edited) Thank you @ftardio! This is useful indeed but I was looking for a solution for prestashop 1.6. Fortunately I have found one! I am getting the selected carrier in my payment module (in hookDisplayPayment method) and only display the payment method if my custom carrier is selected. Here it is in case someone else is looking for this: $carrier = new Carrier($this->context->cart->id_carrier); if ($carrier->external_module_name != 'my_custom_carrier_module_name') { return; } My problem now is how to hide the other payment methods when my custom carrier is selected... Any ideas? Edited April 6, 2019 by spyrosel (see edit history) Link to comment Share on other sites More sharing options...
ingrossoerisparmio Posted July 7, 2020 Share Posted July 7, 2020 Hi Spyrosel, have you found solution? I have same need. Thanks in advanced Donato On 4/6/2019 at 11:33 AM, spyrosel said: Thank you @ftardio! This is useful indeed but I was looking for a solution for prestashop 1.6. Fortunately I have found one! I am getting the selected carrier in my payment module (in hookDisplayPayment method) and only display the payment method if my custom carrier is selected. Here it is in case someone else is looking for this: $carrier = new Carrier($this->context->cart->id_carrier); if ($carrier->external_module_name != 'my_custom_carrier_module_name') { return; } My problem now is how to hide the other payment methods when my custom carrier is selected... Any ideas? Link to comment Share on other sites More sharing options...
spyrosel Posted July 7, 2020 Author Share Posted July 7, 2020 Hello @ingrossoerisparmio ! I didn't find any proper way to hide the other payment methods when my custom carrier is selected so I did hide them using javascript in my custom payment's view. Spyros Link to comment Share on other sites More sharing options...
ingrossoerisparmio Posted July 7, 2020 Share Posted July 7, 2020 Can you explain me how can i make this with javascript too ? thanks in advanced Link to comment Share on other sites More sharing options...
auroncaos Posted October 12, 2023 Share Posted October 12, 2023 hello there, sorry for reopen this old topics, can anyone give me a suggestion to create this function on 1.6 prestashop? I need to "hide" some payments methods if a specific carrier is selected. Link to comment Share on other sites More sharing options...
Yelish Posted October 18, 2023 Share Posted October 18, 2023 Create dependencies; if someone wants to install this module, the other one must be installed. On this page by the brilliant Victor Ródenas, they explain it in detail, much better than I can. Best regards, and have a great day! https://victor-rodenas.com/crear-dependencias-de-modulos-en-prestashop/ 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