New to modding ZC- best practices?
I am new to modding for Zen Cart, but have experience modding for phpbb3.
My Zen Cart mod will need to perform extra actions using the info from the form fields when a new user registers (create_account.php) and when a user changes their account info (I've created a new module/pages/mymod folder and a tpl_mymod_default.php for this part).
For the action that happens on new user registration will I need to modify the core files or can I create a separate file somewhere that can be loaded between create_account and create_account_success?
Re: New to modding ZC- best practices?
Depending on what you're ultimately trying to do, you can probably hook into an existing notifier, and have an observer class do the custom work you require in the background. Related documentation: http://www.zen-cart.com/wiki/index.p...Observer_Class
Re: New to modding ZC- best practices?
Thank you for the info and that link! That looks very promising for what I'm trying to do.
Re: New to modding ZC- best practices?
Just read the observer stuff. It's way over my head, I guess, cuz it makes no sense to me at all. Oh well...
Re: New to modding ZC- best practices?
And there weren't any notifiers before the attributes get 'built', which is what I would need to modify. I'll just try hacking the code. :frusty:
Re: New to modding ZC- best practices?
Hi,
It depends on exactly what you are trying to achieve.
If you want to manipulate the Form data, before it gets saved to the database then look for
NOTIFY_MODULE_START_CREATE_ACCOUNT
This notifier at the top of the Create Account page so you would have to check if a form submit had occurred
e.g.
if (isset($_POST['action']) && ($_POST['action'] == 'process'))
alternatively there are a couple of other notifiers that occur when the database has been updated
i.e.
NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_CUSTOMER_RECORD
NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_ADDRESS_BOOK_RECORD
and you could intercept these, and update the database based on what ever your mod needs.
or you could intercept that notifier on the create account success page,
As I said, it very much depends on what exactly your mod is trying to achieve.
Re: New to modding ZC- best practices?
Thanks wilt. I actually confused myself - I have 2 mods I'd like to attempt,
one that deals with newsletter subscription actions: specifically to use the Constant Contact API to handle newsletter subscriptions,
and one that can make certain product's attributes required and use mootools.js for attractive form validation during the 'add to cart' shopping process.
I have the constant contact newsletter thing working, but I did so by editing core files. I was hoping to use the notifier/observer system instead as I'd like to be able to release my mods to the community.
The mootools.js form validation requires that each form element (in this case the product attributes) that will pass through validation, have to have the <input> or <select> tags modified to add 'class="validate[blahblah];"' as well as some javascript code blocks.
But the fact is I don't understand the notifier/observer or the autoloading thing well enough to use them at this time. Is there a 'Hello world' level tutorial out there for using notifiers, as the examples given in the wiki were not helpful to me.
Re: New to modding ZC- best practices?
OK, I just read through the Observer class wiki bit again, and I'm not ready to give up yet! I believe I can get the Observer class to work for my Constant contact integration idea.
Not sure about using it for modifying the product attribute form html code, as I don't see a notifier that 'hooks' in at the product attribute area. I may have to modify the zen_draw_something function and maybe add a field or two to the db. :cool: