Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22
  1. #11
    Join Date
    Dec 2006
    Posts
    163
    Plugin Contributions
    1

    Default Re: Help With Coding Challenge

    I realise I can but I am reluctant to edit any of the core files.

    Thanks for your well.

  2. #12
    Join Date
    Oct 2006
    Posts
    5,477
    Plugin Contributions
    11

    Default Re: Help With Coding Challenge

    Eventually, you will have to anyway. For example, files inside includes/modules/pages have not over-ride.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  3. #13
    Join Date
    Dec 2006
    Posts
    163
    Plugin Contributions
    1

    Default Re: Help With Coding Challenge

    For my own use, I have no hesitation and reluctance is for stuff I am thinking might be put up for general download.

    Anyway, I will be looking and the notifiers to understand how they work.

    Thanks for the pointer

  4. #14
    Join Date
    Dec 2006
    Posts
    163
    Plugin Contributions
    1

    Default Observer Class Help Needed

    Hello.

    This is a follow up to this thread http://www.zen-cart.com/forum/showthread.php?t=88191

    I decided to implement a custom notifier but no joy as the event does not seem to trigger my code.

    The aim is to edit the DB entries after a user clicks "update" in a payment module admin.

    What I have done so far is

    1) In module.php, I added

    PHP Code:
    $zco_notifier->notify('NOTIFY_MODULE_AFTER_ADMIN_SAVE_DB_UPDATE'); 
    after the while loop that includes....

    $db->Execute("update " . TABLE_CONFIGURATION . "
    set configuration_value = '" . $value . "'
    where configuration_key = '" . $key . "'");

    in the "save" switch section. This should call the notifier if I understand the process correctly.

    2) in includes/autoloaders, I created a file called config.mynewclass.php with the following code...
    PHP Code:
    <?php

    $autoLoadConfig
    [180][] = array('autoType'=>'class',
                                  
    'loadFile'=>'observers/class.mynewclass.php');
    $autoLoadConfig[180][] = array('autoType'=>'classInstantiate',
                                  
    'className'=>'mynewclass',
                                  
    'objectName'=>'mynewclass');
    ?>
    QUERY >> Not sure which breakpoint to use as the wiki is not clear on this. Any tips?

    3) In classes/observers, I created a file called class.mynewclass.php with the following code...
    PHP Code:
    <?php
     
    class mynewclass extends base {
       function 
    mynewclass() {
           global 
    $zco_notifier;
        
    $zco_notifier->attach($this, array('NOTIFY_MODULE_AFTER_ADMIN_SAVE_DB_UPDATE'));
       }
       
       function 
    update(&$callingClass$notifier$paramsArray) {
        
        
    My code.... 
           
       }
       
     }
     
    ?>
    QUERY >> Can anyone spot where I may have goofed?

    Thanks for your help

  5. #15
    Join Date
    Apr 2007
    Location
    Herts. UK
    Posts
    890
    Plugin Contributions
    4

    Default Re: Observer Class Help Needed

    Quote Originally Posted by Dayo View Post
    I decided to implement a custom notifier but no joy as the event does not seem to trigger my code.

    The aim is to edit the DB entries after a user clicks "update" in a payment module admin.
    As far as I am aware the notifier system is for the catalog side of Zen Cart. I don't think it works on the admin side. Could be wrong though.

    Regards,
    Christian.

  6. #16
    Join Date
    Dec 2006
    Posts
    163
    Plugin Contributions
    1

    Default Re: Observer Class Help Needed

    Quote Originally Posted by CJPinder View Post
    As far as I am aware the notifier system is for the catalog side of Zen Cart. I don't think it works on the admin side. Could be wrong though.

    Regards,
    Christian.
    That's probably the reason. All clicks into place.

    I wonder whether it is possible to trick it to work.

  7. #17
    Join Date
    Dec 2006
    Posts
    163
    Plugin Contributions
    1

    Default Re: Observer Class Help Needed

    After checking, I am not so sure it doesn't work in Admin as config.core.php in admin/includes instantiates zco_notifier.

    I will try to place my files in admin/includes/auto_loaders and admin/includes/classes/observers (after creating the observers folder) and see what happens.

  8. #18
    Join Date
    Dec 2006
    Posts
    163
    Plugin Contributions
    1

    Default Re: Observer Class Help Needed

    OK I can see there isn't the equivalent of class.base.php in admin which contains all the notifier functions.

    Wonder why zco_notifier is instantiated though.

    Perhaps one of the gurus can give a definitive answer on whether this is a goer or not.

  9. #19
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Help With Coding Challenge - Observer/Notfiers in admin?

    Support for observer/notifier functionality in the admin is limited.

    Additionally, the admin shares many catalog-side functions/classes files, including class.base.php etc.

    BTW ... your threads have been merged, due to similarities and same end goal.
    .

    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.

  10. #20
    Join Date
    Dec 2006
    Posts
    163
    Plugin Contributions
    1

    Default Re: Help With Coding Challenge - Observer/Notfiers in admin?

    OK thanks

    i found a way round my problem by restructuring what i am doing.

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Problems with Numinex Mod, can somebody help me with coding...
    By strugglingnovice in forum General Questions
    Replies: 5
    Last Post: 23 Sep 2013, 05:42 AM
  2. Require/Include Problems with custom coding in my Admin
    By g2ktcf in forum Code Collaboration
    Replies: 5
    Last Post: 28 Jan 2013, 06:12 PM
  3. Help with Coding Issues
    By karenkte in forum General Questions
    Replies: 2
    Last Post: 28 Dec 2012, 09:25 PM
  4. Help with coding
    By rbarbour in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 31 Aug 2011, 12:56 AM

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