mathdex Posted February 28, 2019 Share Posted February 28, 2019 Hi everyone, I'm making a module that adds two carriers, and depending on which one is selected at the checkout.I want a different function to run. I thought of doing it with some boolean or variables that change state, but isn't there a better way to identify carrier's (since id_carrier is relatable for that)? Have a nice day ! Link to comment Share on other sites More sharing options...
razaro Posted February 28, 2019 Share Posted February 28, 2019 Not sure but think you could use to variables from Carrier class: is_module and external_module_name . 1 Link to comment Share on other sites More sharing options...
mathdex Posted February 28, 2019 Author Share Posted February 28, 2019 So you mean I should retrieve them from db and create Carrier objects, right ? (thank you for your quick response!) Link to comment Share on other sites More sharing options...
mathdex Posted February 28, 2019 Author Share Posted February 28, 2019 10 minutes ago, razaro said: Not sure but think you could use to variables from Carrier class: is_module and external_module_name . Since they're made in the from the same module, I don't see how that makes them identifiable from each other. I've read a post about reference id's, maybe carriers should also have those 😕 ? Maybe they have something to do it but I really wouldn't know. Link to comment Share on other sites More sharing options...
razaro Posted February 28, 2019 Share Posted February 28, 2019 You are right, I thought you want to distinguish from other carriers. There is id_reference for carrier but that does not help much. Same with name as it can be changed. I did saw in some modules that additional custom table is used to map id_reference for carrier to name or service code so you can be certain what carrier you use. Check bit older module https://github.com/PrestaShop/fedexcarrier for 1.6 it have that idea I think. See sql-install and fedexcarrier.php and do not forget to use and register updateCarrier hook. Good luck. 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