Jump to content

Identify carriers made with module in checkout ?


Recommended Posts

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 :) !

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More