Page 1 of 1
Hooks
Posted: Sat Mar 06, 2021 11:12 am
by Nigel
Hooks
Does the program continue from the hook after the added code is completed ?
Having watched Zipurman's Hooks video, it's revealed just how much more can be done with Phoenix Cart than is initially obvious.
https://www.youtube.com/watch?v=bLd9m_uABYI&t=5s
Re: Hooks
Posted: Sat Mar 06, 2021 11:23 am
by heatherbell
Nigel wrote: ↑Sat Mar 06, 2021 11:12 am
Does the program continue from the hook after the added code is completed ?
Yes, from my amateur point of view, it's a bit like a module.
This might answer -
https://github.com/gburton/CE-Phoenix/wiki/Hooks
It is the pre-placed hook calls throughout the core that make Phoenix so flexible.
Of course, with the template system, you could also copy and edit a file to add your own hook calls.
Re: Hooks
Posted: Sat Mar 06, 2021 12:20 pm
by burt
A good example (that is fairly simplistic to learn from) is the MATC hook that exists in core code.
https://github.com/CE-PhoenixCart/Cart/ ... e/MATC.php
This Hook does two things;
1. It outputs a "Legal Agreements" checkbox
https://github.com/CE-PhoenixCart/Cart/ ... hp#L15-L35
which displays on the create_account (and other) pages:
https://phoenixcart.org/demo/create_account.php
2. It sets up a Modal window which pops up when someone clicks on either of the two links
https://github.com/CE-PhoenixCart/Cart/ ... hp#L37-L54
As you can see, it "injects" the data it makes into the create_account form, the form then continues and displays other hooks (if there are any), and the submit button etc.