Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2009
    Posts
    417
    Plugin Contributions
    2

    Default zc_plugins and observers

    with the new plug-ins format. Do I still need to place the observers in include>classes>observers and set up a config file in the include>auto_loaders.
    This is for an admin add in but I cannot get it to use the observers if i place them under the zc_plugins directory. I did read the thread about encapsulated plugins require... which referred to auto loaders. This suggest that it may not work until 1.5.8 of zen cart. I just wanted to make sure I was not missing something and that observers will be in 1.5.8.
    Mark Brittain
    http:\\innerlightcrystals.co.uk\sales\

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,690
    Plugin Contributions
    9

    Default Re: zc_plugins and observers

    i was able to keep the complete plugin (including the observer) within the encapsulated directory structure. in addition, i was then able to use the observer set up from within that plugin in a script outside of that observer. so my observer was set up here:

    zc_plugins/myBloodyPlugin/1.0.0/admin/includes/classes/observers/myBloodyPlugin_observer.php
    zc_plugins/myBloodyPlugin/1.0.0/admin/includes/auto_loaders/config.myBloodyPlugin.php

    and my code within the auto_loaders was something like:

    PHP Code:
    $autoLoadConfig[210][] = [
            
    'autoType' => 'class',
            
    'classPath' => 'includes/classes/observers/',
            
    'loadFile' => 'myBloodyPlugin_observer.php',
        ];
        
    $autoLoadConfig[210][] = [
            
    'autoType' => 'classInstantiate',
            
    'className' => 'myBloodyPluginObserver',
            
    'objectName' => 'myBloodyPluginObserver'
        
    ]; 
    it was definitely tricky at the time and @mc definitely provided great help in getting that done.

    if you use the debugging turned on (DEBUG_AUTOLOAD), you can see if it is in fact getting loaded.

    i do not think the auto loaders discussion relates to the issue you may be experiencing. the auto loaders would eliminate the need for the auto_loader file providing you have the file named correctly. that (according to zcwilt) is slated for v158. but using an observer from within the encapsulated directory is definitely supported in v157, but I thought it felt a little tricky to get working....

    hope that helps.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 

Similar Threads

  1. How to know which plugins can be put in the zc_plugins directory for install
    By shrimp-gumbo-mmmhhh in forum Code Collaboration
    Replies: 8
    Last Post: 25 Mar 2021, 08:24 PM
  2. using observers...
    By carlwhat in forum Code Collaboration
    Replies: 2
    Last Post: 26 Jul 2020, 09:42 PM
  3. Observers and Session Objects - not getting notified
    By avibodha in forum General Questions
    Replies: 2
    Last Post: 27 Feb 2011, 02:20 AM
  4. Writing observers and the &$class parameter
    By audleman in forum Basic Configuration
    Replies: 2
    Last Post: 15 Oct 2008, 07:08 PM
  5. Observers and redirects
    By audleman in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 10 Sep 2008, 05:19 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