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
    60,545
    Blog Entries
    4
    Plugin Contributions
    145

    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!
    Donations always welcome: www.zen-cart.com/donate

    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,783
    Blog Entries
    2
    Plugin Contributions
    1

    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. Modding the Categories Box
    By bodyjewelrystores in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 20 Nov 2007, 10:45 PM
  2. Modding an xampp cart - help?
    By Gladys_Pym in forum Installing on a Windows Server
    Replies: 4
    Last Post: 18 May 2007, 09:47 AM
  3. Modding an xampp cart - how?
    By Gladys_Pym in forum Installing on a Windows Server
    Replies: 4
    Last Post: 14 May 2007, 11:05 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
  •