Hooking an addon tpl

Hello all,

I have read through the help and through the forum, but could not find an answer to my problem.

I would like to customize a code in a TPL that is generated by an addon. I already found out that the code is retrieved in the file vivashop / templates / blocks / product_tabs / description.tpl.

{** block-description:description **}
{if $product.full_description}
<div {live_edit name=“product:full_description:{$product.product_id}”}>{$product.full_description nofilter}
{else if $product.short_description}
<div {live_edit name=“product:short_description:{$product.product_id}”}>{$product.short_description nofilter}
{/if}

The plugin “my_changes” is active and I saved the new code in the description.override.tpl file.

{hook name=“block-description:description”}
Hello world.
{/hook}

But what is now the path under my_changes/ so that this change is taken into account?

I tried

  • my_changes/hooks/blocks/product_tabs/block-description/description.override.tpl
  • my_changes/hooks/product_tabs/block-description/description.override.tpl
  • my_changes/hooks/product_tabs/description.override.tpl
  • my_changes/hooks/description.override.tpl

Can someone please help me? Unfortunately i can’t figure it out.

Thanks
Ronny

The mentioned file does contain hooks. So you can only override the whole file

my_changes/overrides/blocks/product_tabs/description.tpl

Unfortunately, I have no success with that either.

In my “new” description.tpl file is the following content:

{** block-description:description **}
Hello world.
{if $product.full_description}

{$product.full_description nofilter} {else if $product.short_description}
{$product.short_description nofilter} {/if}

But “Hello world” is not showing up in the storefront :unamused:

Hi!

First of all I would like to recommend you to change the hook name to the one with using underscore instead of hyphen:

{hook name=“block_description:description”}

If you have already created the override for the mentioned template, then the path should the following:
design/themes/[THEME_NAME]/templates/addons/[ADDON_NAME]/hooks/block_description/description.[pre|post|override].tpl

In case the override has not been made yet, create it at the following path:
themes/[THEME_NAME]/templates/addons/[ADDON_NAME]/overrides/blocks/product_tabs/description.tpl/description.tpl

Do not forget to clear cache after new template is created

1 Like

I really can*t follow you guys. :pensive:

What do you mean with “If you have already created the override for the mentioned template” and “In case the override has not been made yet”?

Why is that so complicated?
And why is there no step-by-step instruction for that?

I thought the “hook-name” must be the same from the original file I want to override.

However, i created a file with followig content:

< h1 >Hello world</ h1 >

I tried

  • description.tpl in design/themes/vivashop/templates/addons/my_changes/overrides/blocks/product_tabs/
  • description.tpl in design/themes/vivashop/templates/addons/my_changes/overrides/blocks/product_tabs/ description.tpl/
  • description.override.tpl in design/themes/vivashop/templates/addons/my_changes/overrides/blocks/product_tabs/ description.tpl/
  • description.override.tpl in design/themes/vivashop/templates/addons/my_changes/hooks/block_description/

I also cleared the cache after every change. But my code doesn*t show up :pleading_face:

I tested another scenario with title.override.tpl in design/themes/vivashop/templates/addons/my_changes/hooks/index/ and it worked.

Maybe I can’t hook, what I want?

  • description.tpl in design/themes/vivashop/templates/addons/my_changes/overrides/blocks/product_tabs/

This variant should work.

  • clear cache
  • make sure that other module does not override the same template
1 Like

description.tpl in design/themes/vivashop/templates/addons/my_changes/overrides/blocks/product_tabs/

Now it worked. Thank you so much. :star_struck: :star_struck: :star_struck:

You have to clear the cache and apparently also set the option “Rebuild cache automatically” under admin.php?dispatch=themes.manage to “On” when testing. :thinking: :face_with_raised_eyebrow:

Because today I saw those test data that I tried yesterday. Only with clear cache AND “Rebuild cache automatically” my data from today was visible. Very strange.

Thanks a lot. :slightly_smiling_face:

1 Like