0

I am currently developing an extension that is adding two select elements (City and District) that work the same way as the RegionUpdater. (When you choose a Country, the Region select populates, when you choose a Region the City select populates, etc...)

It is working fine, but now I would like to change all the address forms to make it appear everywhere.

I would like to make this extension available to everyone, so I would like to make it easy to integrate, and easy to modify. So what is the best practice ?

I will clearly not modify the template file from the default theme, but I was thinking about updating the layout, and changing all the template of an address form by the corresponding one in a folder of my extension, with the new fields added.

The main disadvantage is that if you are used to modify a certain template to modify the form, it will not work anymore.

I also thought about adding the new fields with Javascript, but it could become messy.

1

I have an extension which replaces the billing and shipping templates that was written by a well-respected Magento agency.

It rewrites the blocks for the shipping and billing address (and customer address edit). The new blocks, which inherit from the default core blocks, override getTemplate(). The new method checks if the extension is enabled, then checks the version of Magento, then returns the extensions template. If it's not enabled etc. it returns the default getTemplate()

There are a couple of problems with this approach, e.g. the rewrite could collide with another extension, I think it's done this way because of the way the checkout has changed in magento, and therefore they have different versions of their own templates, depending on the magento version.

  • I think I will go with that, even if my main concern is the "collide with another extension" problem. Many extensions seems to follow this approach. – hellimac Aug 10 '15 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.