Tweaking My_Changes .tpl Files (But No Hooks)

Hi there,

I'm trying to make sure the {$po.description nofilter} code I added to the product_options.tpl file stays there in the future.

I read up on hooks, but I don't see any hooks in this file that would work. Can I create a hook? How would I do this?

I created product_options.override.tpl and uploaded it into:

design/themes/MyTheme/templates/addons/my_changes/hooks/index/

and

design/themes/MyTheme/templates/addons/my_changes/hooks/product/

But neither worked.

What am I missing?

If you have to create a hook, it defeats the whole purpose. The only hooks I see in that file are for option modifiers so unless you request and they add a hook, you might as well just edit the original template.

Note that even if you create a hook, most possibly it will be deleted within the next upgrade

Thank you for your replies! I'm just trying to do this the smart way, and it just seems like this is one thing I have to remember when upgrading. No worries :)

You have a few options.

  1. You can create an override for the entire template and then modify your my_changes version to suit your needs (you will probably want to compare this to the original after upgrade to verify that you pick up any bugs that are fixed, etc.)
  2. You can add a hook into the existing template I.e. {hook name="products:options_data"}{/hook} and then request that this hook be added to a future release. If they don't, then at upgrade you will more than likely have to replace the hook tag.
  3. Add your changes directly into the standard template and then re-apply them as needed after next (and subsequent) upgrades.

Why can't you use the existing "products:product_option_content" hook in common/product_data.tpl or the "products:options_modifers" hook in views/products/components/product_options.tpl?

The first would be a description for all variants of the option and the second would be used for each variant.