How To Override Tpl That Already Overridden

Dear All,

The following file is the origin location;

/design/themes/responsive/templates/addons/step_by_step_checkout/overrides/views/checkout/components/steps/step_two.tpl

Now, I want to override the step_two file again in the following location;

/design/themes/responsive/templates/addons/my_changes/overrides/views/checkout/components/steps/step_two.tpl

How to achieve on this.

Can you kindly advise.

Thanks a lot.

Hello

Please try in your addon file addon.xml set 4294967295

Best regards

Robert

Dear Robert,

Thanks a lot for your reply.

I have modified the priority value in addon.xml under my_changes folder. But the website still doesn't take the file from my_changes add on.

Kindly advise. Thanks.

https://prnt.sc/tefx7w\

Regards,

Ram

After priority is changed, you should re-install the module. As alternative, find priority in the database and change it there. Then clear cache

Hi eComLabs,

Thanks for the reply.

Have re-installed the My_changes addon, but still doesn't reflect the step_two file from My_changes addon.

I guess, I have missed some steps. Since am new to a CS cart, Could you please explain in detail;

Step_by_step_checkout addon from app detail:

public_html/app/addons/step_by_step_checkout/addon.xml

screenshot: https://prnt.sc/tejaze

My_changes addon from app details:

/public_html/app/addons/my_changes/addon.xml

screenshot: https://prnt.sc/tejcdj

https://prnt.sc/tejd57

Kindly help. Thanks much.

Hello

Please check in table cscart_addons what priority my_changes addon has. Maybe some other addon overwrites the template ? Try to delete the /var/cache directory directly on the server.

Best regards

Robert

Hi Robert,

Please refer to the screenshot of cscart_addons table https://prnt.sc/tekdab

Yes, I always delete the cache directly on the server.

The following file only is always reflect on the page.

/design/themes/responsive/templates/addons/step_by_step_checkout/overrides/views/checkout/components/steps/step_two.tpl

But expected file is from the following path;

/design/themes/responsive/templates/addons/my_changes/overrides/views/checkout/components/steps/step_two.tpl

Kindly note: I have another tpl under my_changes which is working fine, but this is overriding once only under my_changes.

Please help.

Thanks.

What is the priority of the my_changes addon in your cscart_addons DB table? It should be the largest number in there. I.e. highest priority.

Good morning All,

Hi EZ,

Thank you for helping on this.

Confirmed that my_changes contains the highest value in the priority among others.

Pls refer the screenshot below;

https://prnt.sc/tekdab

Thanks

Hello

Please sort the addons by priority from the highest and show this list.

Best regards

Robert

Hi Robert,

Appreciate your help.

Have been trying to sort out the issue over 1 and half days. :) but no luck.

Please refer to the attached file as requested.

Kindly advise. Thanks a lot for the help.

cscart_addons.doc

Hi,

Have confirmed that my_changes addon contains the highest priority value in cscart_addons table and cleared the browser cache, server's cache, but no luck.

My expected changes appear properly, when I manually highlighted for the my_changes' folder path on the template file of step_by_step_checkout addon, but it is a bad practice for modifying on the original file.

Noticed that since this file is already overridden from other add on, I can't override again on the my_changes addon. Alternatively, how to override a template file on my_changes addon which is already an overridden template file from other addon?

Can I achieve this using hooks since I am unable to fix it by using override mechanism.

Kindly advise. Thanks

Hello

It depends what you want to do. If the hook includes the code you want to change then you can use it.

Best regards

Robert

Are you using an "override hook" or a tempalte override?

An override hook is applied in a cascading fashion. Hence the coder of the hook needs to include the hook for other addons to utilize it. Note that when an override hook is used, any 'pre' hooks of the same name are preserved but any 'post' hooks are discarded.

If you are using a template override file then the file is determined by the addon priority.

So if core file named views/ugh/cart_file.tpl code contains:

{hook name="foo:bar"}
this is original code
{/hook}

then using my_changes/hooks/foo/bar.override.tpl with code of\:

{hook name="foo:bar"}
this is my code
{/hook}

should produce output of "this is my code".

If you are overriding the template by using my_changes/overrides/ugh/cart_file.tpl

then it will have whatever content the priority of the my_changes addon provides in relation to other addons.

If it contains a

{hook name="foo:bar"}
my override code
{/hook}

Then another addon can pre, post or override that hook like the first examle.

Suggest you add some comments to your code to see what's going on. I.e.


            

Hi EZ,

Thanks so much for your valuable timing. I want to override a template only.

Understand from other thread that I can't override template file again which is already overridden by other addon. So, I will change to single checkout page instead of multiple checkout page, since I have encountered more issues.

https://forum.cs-cart.com/topic/32507-hook-path-question/?fromsearch=1

Thanks a lot for all of your help.

Thanks a lot to SoftSolid team for personally supported to fix on the override issue. Really very thankful for your support.

Understood my issue that I need to keep the priority value is 0 for the "my_changes" addon in the cscart_addons table. Then, it solves my override problem.

Thank you all for your valuable timing to help on this and thanks to SoftSolid team as well.

Hello

You are welcome :)

Best regards

Robert

Note that priorities have different results for php hooks and template hooks. Higher priority values have your php hook go first in the chain. And for templates, the higher priorites go first (which means they can be overwritten). So if you want my_changes hooks to always be dominant, use fn_register_hooks(array('place_order', [high priority number]) ) and have the priority in cscart_addons be zero.

Note that priorities have different results for php hooks and template hooks. Higher priority values have your php hook go first in the chain. And for templates, the higher priorites go first (which means they can be overwritten). So if you want my_changes hooks to always be dominant, use fn_register_hooks(array('place_order', [high priority number]) ) and have the priority in cscart_addons be zero.

Hi EZ,

Apologize for the delay.

Many thanks for your reply. Sure, I will try and follow up accordingly.