Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2008
    Posts
    49
    Plugin Contributions
    0

    Default Using Observers instantiated from application-top.php?

    Hey,

    I'm trying to make an observer that checks a condition, and adds a product to the cart if the condition is true. However, I can't even get the skeleton of the concept to work. I put my config.classname.php in auto-loaders and the class.classname.php in includers/classes/observers The best I get is it puking the source of the class above the page, at one point the page wouldnt load.
    Here is the code:

    config
    PHP Code:
    <?php
    $autoLoadConfig
    [90][] = array('autoType'=>'class',
                                  
    'loadFile'=>'observers/class.platinum.php');
    $autoLoadConfig[90][] = array('autoType'=>'classInstantiate',
                                  
    'className'=>'platinum',
                                  
    'objectName'=>'platinum');

    ?>
    And the class...

    PHP Code:
    class platinum extends base 
    {

        function 
    myplatinum()
        {
             
    $this->attach($this,array('NOTIFIER_CART_ADD_CART_END'));
        }
        
        function 
    update(&$callingClass$notifier$paramsArray
        {
            echo 
    "BIG OBNOXIOUS LETTERS<br><br><br><hr>";
        }


  2. #2
    Join Date
    Jan 2008
    Posts
    49
    Plugin Contributions
    0

    Default Re: Using Observers instantiated from application-top.php?

    Wrap your class with <?php ?> tags. DOH!

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

    Default Re: Using Observers instantiated from application-top.php?

    Quote Originally Posted by enigmabomb View Post
    PHP Code:
        function myplatinum()
        {
             
    $this->attach($this,array('NOTIFIER_CART_ADD_CART_END'));
        } 
    Should be...
    PHP Code:
        function platinum()
        {
            
    $_SESSION['cart']->attach($this,array('NOTIFIER_CART_ADD_CART_END'));
        } 
    ...and as you've already worked out, you need the php start and end tags

    Regards,
    Christian.

  4. #4
    Join Date
    Jan 2008
    Posts
    49
    Plugin Contributions
    0

    Default Re: Using Observers instantiated from application-top.php?

    Oh yeah That too.

    Any idea why I can't send echo statements from the update function?

    Josh

  5. #5
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Using Observers instantiated from application-top.php?

    Quote Originally Posted by enigmabomb View Post
    Oh yeah That too.

    Any idea why I can't send echo statements from the update function?
    Probably because there's a page redirect happening, which dumps the echo'd data into a black hole. Use die('INFO HERE'); instead of echo() if you want to halt execution and see what's happening. Remember that die() halts execution though.
    .

    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.

  6. #6
    Join Date
    Jan 2008
    Posts
    49
    Plugin Contributions
    0

    Default Re: Using Observers instantiated from application-top.php?

    Yeah. Also, I was using the wrong notifiers. START notifiers aren't going to display anything. END notifiers are the money. Because they signal that data will be usually displayed shortly thereafter.

    THANK YOU for the help. Its unlike me to need hand holding. Then again, its unlike me to be a and forget php tags. Just one of those Days!

  7. #7
    Join Date
    Jan 2008
    Posts
    49
    Plugin Contributions
    0

    Default actionAddProduct Examples?

    Hey,

    I'm trying to add a product the the session cart. I've found the definition of actionaddproduct, but for the life of me cant find any documentation about what it needs in the param array, or what Im supposed to give $goto.

    Anyone care to make an example for me?

    Thanks,

    Josh
    PS On a scary note, I google for application-top.php and some other terms and see a guy with a thread about class problems. Then I look closer, that guy was me. Google sucks up new stuff FAST!

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

    Default Re: actionAddProduct Examples?

    Quote Originally Posted by enigmabomb View Post
    I'm trying to add a product the the session cart.
    Have a look here....
    http://www.zen-cart.com/wiki/index.p..._World_Example

    Regards,
    Christian.

 

 

Similar Threads

  1. v154 application/x-httpd-php html_header.php PHP script text
    By Parafanaylya in forum General Questions
    Replies: 3
    Last Post: 29 Aug 2015, 03:06 PM
  2. Replies: 0
    Last Post: 27 Dec 2008, 05:30 AM
  3. PHP as CGI application
    By ecw in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 12 Apr 2007, 09:58 AM

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