Jump to content

Best way to add custom hook / override functionality


mdomski

Recommended Posts

Hello

 

I would like to know what's the best approach to:
- add custom hook in desired place in template file,

- override controller function (with awareness that other modules can do the same).

For example I want to add some extra fields in renderStepOne function (AdminCarrierWizardController). I've done this by overriding AdminCarrierWizardController methods: renderStepOne and getStepOneFieldsValues with appropriate content without calling parent method because it's not possible. But what will happen if someone's else module will do the same or my module will override someone's else override (due to I have to copy AdminCarrierWizardController from my module to root->override->controllers->admin during installation). Is there simple way to modify carrier wizard behaviour just adding some necessary fields with hook or something?

 

Another thing is I need to add my own hook in specific place for eg. in order-carrier template. Let's say I want to put something like this <td>{hook h='myHook'}</td> (additional table column for each delivery method) in delivery options table. So again I need to override core template. But what will happen if other module overrides this file? Can I add my simple line programmatically without inserting whole template code and overriding someone's else code?

 

In brief: I want to add my own functionallity, let's say button which triggers map next to all of custom presta carriers which passes specific criteria without affecting other modules code. How it should be done when there're no in-built hooks?

 

Regards

Link to comment
Share on other sites

  • 2 months later...
  • 4 months later...

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...