Hooks

Open to all! Ask other shopowners for help.
Post Reply
Nigel
Contributor
Posts: 114
Joined: Mon Jan 11, 2021 1:39 am
Phoenix Version:
Has thanked: 29 times
Been thanked: 8 times

Hooks

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: Hooks

Post 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.
User avatar
burt
Core Team
Posts: 4546
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Hooks

Post 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.
I am not here to build for you.
I am here to build with you. Let's help each other.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply