Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Hook Path Question Rate Topic   - - - - -

 
  • Galactica
  • Advanced Member
  • Members
  • Join Date: 20-Jun 13
  • 50 posts

Posted 01 August 2013 - 10:08 PM #1

I thought I had a pretty good grip on using TPL hooks, but I am baffled as to why the current hook I am trying to target isn't working. I am betting it's my path and I was hoping to get some feedback on where I might be going wrong.

I am trying to add a tiny bit of code right above the promo code input field on the cart page, and as luck would have it there is a hook for that particular block:

{hook name="checkout:discount_coupons"}

Now if I understand how hooks work ( and I must be making a mistake here somewhere ) the code that I would like executed before this hook should be created in the following directory:

themes/basic/templates/addons/my_changes/hooks/checkout/

The file that should be placed in the above location in my case should be:

discount_coupons.pre.tpl

This file would include whatever items I would like to appear before the hook.

I have created everything above, uploaded it, verified that is on the server, cleared my browsers cache, cleared the carts cache ( ?cc ) and yet nothing seems to get my simple html addition to display.

It was my understanding that if you are using a hook you would take the first part of the hook name, in this case "checkout" and that would be the directory you would create in the "hooks" folder. Then the file name would be based off of the 2nd part of the hook with either pre, post or override appended to the name...

I should also mention that I am using CS-Cart v4 and I have caching disabled.

Am I missing something or am I off on the wrong track here?

 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 01 August 2013 - 10:52 PM #2

All looks good to me. Both the path and filename are correct. Out of interest, do you get any different results if you use "discount_coupons.override.tpl" instead of 'pre'. Conventionally there should be no difference in terms of getting it to render, but I have experienced this before where a pre nor post would work, but override did. Why, I have no idea...and never got an answer from support on it either.

Might be a stupid question to ask, but is the my_changes addon actually enabled?
Hire StellarBytes for CS-Cart Design & Development Services

 
  • Galactica
  • Advanced Member
  • Members
  • Join Date: 20-Jun 13
  • 50 posts

Posted 02 August 2013 - 12:14 AM #3

All looks good to me. Both the path and filename are correct. Out of interest, do you get any different results if you use "discount_coupons.override.tpl" instead of 'pre'. Conventionally there should be no difference in terms of getting it to render, but I have experienced this before where a pre nor post would work, but override did. Why, I have no idea...and never got an answer from support on it either. Might be a stupid question to ask, but is the my_changes addon actually enabled?


Thanks for the quick reply StellarBytes!

I just now tried to use "post" and "override" and I cleared the site/store cache before each test. Unfortunately, it didn't yield any different results...

I am at a complete loss as to why this isn't working if my paths are correct. The addon My_Changes is activated and I have other hooks working as well.

 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 02 August 2013 - 11:35 AM #4

Have you tried:-
design/frontend/skins/1/basic/templates/addons/my_changes/hooks/checkout/discount_coupons.pre.tpl
Where '1' is active skin ID.

Are your other working hook pre/post/override in the same setup, ie:-
themes/basic/templates/addons/my_changes/hooks/index/blah.post.tpl

Hire StellarBytes for CS-Cart Design & Development Services

 
  • Galactica
  • Advanced Member
  • Members
  • Join Date: 20-Jun 13
  • 50 posts

Posted 02 August 2013 - 02:32 PM #5

Have you tried:-

design/frontend/skins/1/basic/templates/addons/my_changes/hooks/checkout/discount_coupons.pre.tpl
Where '1' is active skin ID.

Are your other working hook pre/post/override in the same setup, ie:-
themes/basic/templates/addons/my_changes/hooks/index/blah.post.tpl



Thank you for all of your suggestions so far, I really appreciate it!

I saw the first path in another forum post when I was trying to dig up some answers, but I thought that was only for cs-cart versions below 4? As the new version doesn't have the directories:

design/frontend/skins

cs-cart 4 has:

design/themes/[theme_name]

I did however try and add the theme files into a "1" directory and unfortunately it didn't work.

To answer your 2nd question all of my other hooks are set up the same way and work as they should (thankfully):

themes/basic/templates/addons/my_changes/hooks/index/styles.post.tpl

themes/basic/templates/addons/my_changes/hooks/buttons/add_to_cart.override.tpl

Could this be another addon/template overriding my changes that I can't see? I wish there were better docs for design/development, makes tracking these things down pretty damn tough...

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11766 posts

Posted 02 August 2013 - 06:32 PM #6

If another addon is doing an override and it's priority is higher than your addon then any pre, post or override will be thrown away and their override will establish a new "base" for further pre/post operations.
.
I believe that a standard cs-cart V4 configured to use one store will not use a store_id designator in the path. I.e. in my development environment there are no store id's in the theme paths.

You might try adding a {debug} tag in your hooked file along with a comment like:
<!-- my hook file -->
and then view the page source to see if it shows.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Galactica
  • Advanced Member
  • Members
  • Join Date: 20-Jun 13
  • 50 posts

Posted 02 August 2013 - 09:34 PM #7

If another addon is doing an override and it's priority is higher than your addon then any pre, post or override will be thrown away and their override will establish a new "base" for further pre/post operations.
.
I believe that a standard cs-cart V4 configured to use one store will not use a store_id designator in the path. I.e. in my development environment there are no store id's in the theme paths.

You might try adding a {debug} tag in your hooked file along with a comment like:
<!-- my hook file -->
and then view the page source to see if it shows.


Gave {debug} and <!-- MY HOOKED FILE --> a shot, but unfortunately it didn't return anything either on the page or in the source code. I was really hoping that would give me a clue... On the upside, I didn't know about the smarty debug tag :-)

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11766 posts

Posted 04 August 2013 - 06:37 PM #8

It sounds like your file is being overridden by another addon. Generally the priority of my_changes is the highest. But if someone created an addon with the same priority and it's name would sort first (ascending) then it will override the my_changes hooks.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • rmsilver7
  • Junior Member
  • Members
  • Join Date: 30-Mar 10
  • 204 posts

Posted 10 October 2013 - 06:53 PM #9

Thank you all for this post, I was having the same issue with the same hook and I discovered it was the Gift Certificate addon overriding the whole hook in my case. I would have never through to look at other addons!
Riika Magnus
Silver-Logic Web & Print Services
http://www.silver-logic.com
(503) 213-3551

I offer Website Design, Management, Hosting and Graphic Design services. I'm located in Portland, OR and have been using CS-Cart since 2009 and doing Website design since 2003. I would love to hear about your next project!

 
  • muthu.amr
  • Member
  • Members
  • Join Date: 05-Jul 20
  • 18 posts

Posted 10 July 2020 - 11:38 AM #10

Thank you all for this post, I was having the same issue with the same hook and I discovered it was the Gift Certificate addon overriding the whole hook in my case. I would have never through to look at other addons!

 

 

May I know how did you achieve on this. I too encounter the issue that I am unable to override a template file on My_changes which the same file is overridden by another addon.

 

Please advise. Thanks a lot.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20936 posts

Posted 10 July 2020 - 01:42 PM #11

May I know how did you achieve on this. I too encounter the issue that I am unable to override a template file on My_changes which the same file is overridden by another addon.

 

Please advise. Thanks a lot.

 

I am afraid, you cannot override override 


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • muthu.amr
  • Member
  • Members
  • Join Date: 05-Jul 20
  • 18 posts

Posted 11 July 2020 - 07:52 AM #12

I am afraid, you cannot override override 

 

Ooh! I see..Is there any other way for override to override tpl?

 

Thanks a lot.



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 20936 posts

Posted 13 July 2020 - 06:11 AM #13

Ooh! I see..Is there any other way for override to override tpl?

 

Thanks a lot.

 

As it was mentioned earlier, play with addons priority. Not sure why it does not work in your case, but we solved such issues with priority settings


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • muthu.amr
  • Member
  • Members
  • Join Date: 05-Jul 20
  • 18 posts

Posted 13 July 2020 - 06:31 AM #14

As it was mentioned earlier, play with addons priority. Not sure why it does not work in your case, but we solved such issues with priority settings

 

Hi eComLabs,

 

Thanks a lot for the reply.

 

Since it is not working priority based addon at my side, I have switched to Single page checkout layout.

 

Thanks much again for the support.



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11766 posts

Posted 13 July 2020 - 07:27 PM #15

But if the priority of your template is higher then your override should be the one that is used.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • muthu.amr
  • Member
  • Members
  • Join Date: 05-Jul 20
  • 18 posts

Posted 16 July 2020 - 08:56 AM #16

Hi EZ,

 

Thanks much for your suggestion.

 

As you mentioned, understood 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 with personal help of SoftSolid team.

 

Thanks all for sharing your time to help on this and thanks to SoftSolid team as well.



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11766 posts

Posted 16 July 2020 - 06:39 PM #17

See other post.  Any php hooks you may use, you may want to run them with an explicit high priority call to fn_register_hooks() to ensure my_changes gets priority for both php and template hooks.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • muthu.amr
  • Member
  • Members
  • Join Date: 05-Jul 20
  • 18 posts

Posted 12 August 2020 - 10:03 AM #18

See other post.  Any php hooks you may use, you may want to run them with an explicit high priority call to fn_register_hooks() to ensure my_changes gets priority for both php and template hooks.

 

Hi EZ,

 

Sorry for the late reply. 

 

Awesome, I will try accordingly.

 

Thanks.