Hooks for my_changes addon

I’m new to cs-cart or the smarty concept to be exact, I have made changes to cs-cart and saved them to my changes addon, but the problem is how to create hooks in order to view the changes moreover the concept of hooking addon I do not understand.

Please if there is resources you can provide me, share it with me.

The concept of hooks is described in CS-Cart documentation: Hooks — CS-Cart 4.16.x documentation

Best regards,
Robert

But if in case I have folders and inside folders files? how to so I’m just confused.

1 Like

Please give us an example what do you want to do so that we can advise something to you

Okay, first of all, I want to tell you what I did:

My objective is not to change the core files so I added my changes to a folder called my_changes addon.

The second thing I want to do is:
Is to create a hook for the my_changes addon in order to display those changes to the view

The third thing let’s say I managed to create a hook, what is the next step? do I need to install my hook? do I need to use some pre-build addon to add my hook? I have read about Hook and API, Zapier but I don’t have them in my admin panel, I searched for them. my cs-cart version is 4.16

If you have a directory design/backend/templates/addons/my_changes (for changes in admin panel), you should create there directory ‘hooks’, then directory with the name as the first part of the hook you want to plug into.

For example, if hook is “products:update_product_name” then you should create a folder ‘products’.

Then, you should create a file with the name of the second part of the hook. So in above example, it should be update_product_name.post.tpl. Code you put into this file will appear under the hook in the source file.

If that does not work:

  • make sure that My Changes add-on is installed
  • clean cache from your store

Best regards,
Robert

2 Likes

Thank you a lot, @soft-solid.

Also for example, find instruction how to add custom styles through hooks

2 Likes

Hello

You are welcome Aya :slight_smile:

Best regards
Robert

1 Like