Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2005
    Location
    Aurora, CO USA
    Posts
    75
    Plugin Contributions
    1

    Default 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?

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default 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
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2005
    Location
    Aurora, CO USA
    Posts
    75
    Plugin Contributions
    1

    Default 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.

  4. #4
    Join Date
    Jan 2005
    Location
    Aurora, CO USA
    Posts
    75
    Plugin Contributions
    1

    Default 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...

  5. #5
    Join Date
    Jan 2005
    Location
    Aurora, CO USA
    Posts
    75
    Plugin Contributions
    1

    Default 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.

  6. #6
    Join Date
    Jun 2003
    Location
    Newcastle UK
    Posts
    2,896
    Blog Entries
    2
    Plugin Contributions
    2

    Default 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.

  7. #7
    Join Date
    Jan 2005
    Location
    Aurora, CO USA
    Posts
    75
    Plugin Contributions
    1

    Default 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.

  8. #8
    Join Date
    Jan 2005
    Location
    Aurora, CO USA
    Posts
    75
    Plugin Contributions
    1

    Default 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.

 

 

Similar Threads

  1. image -- best practices questions
    By finlander in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 17 Oct 2010, 11:01 PM
  2. New York State Sales Tax-Best Practices?
    By berchman in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 18
    Last Post: 17 Mar 2010, 06:49 PM
  3. Upgrade best practices
    By swguy in forum Upgrading from 1.3.x to 1.3.9
    Replies: 3
    Last Post: 2 Nov 2006, 07:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR