Forums / General Questions / Stumped on notifiers, help?

Stumped on notifiers, help?

Locked

Started by s_mack on 8 Sep 2006, 7:35 PM · Views: 1,893

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
8 Sep 2006, 7:35 PM
#1
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Stumped on notifiers, help?

I read through the WIKI and I thought I got the general idea... but all I get is a blank page! I'm trying to get a message header when someone adds an item(s) to their cart.

this is what I have in /includes/classes/observers/class.addProductMessage.php

<?php
/**
 * Observer class used to add a free product to the cart if the user spends more than $x
 *
 */
class addProductMessage extends base {

  function addProductMessage() {
    $_SESSION['cart']->attach($this, array('NOTIFIER_CART_ADD_CART_END');
  }

  function update(&$class, $eventID) {
  $messageStack->add_session('header', 'test!', 'success');
  }
}
?>

And this is what I have in /includes/auto_loaders/config.addProductMessage.php```

<?php $autoLoadConfig[85][] = array('autoType'=>'class', 'loadFile'=>'observers/class.addProductMessage.php'); $autoLoadConfig[85][] = array('autoType'=>'classInstantiate', 'className'=>'addProductMessage', 'objectName'=>'addProductMessage'); ?>

From the examples given, I presumed this would work on the first shot because its so simple!  What am I doing wrong???

 - Steven
8 Sep 2006, 7:36 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Stumped on notifiers, help?

might try adding this to your update element:

global $messageStack;

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

8 Sep 2006, 8:00 PM
#3
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: Stumped on notifiers, help?

Well, that could explain why I might not get a proper output, but I'm getting no output. Ok, I found I was missing a ) in the function addProductMessage and thought that was the problem... and it was a problem. But still, not the only problem. But if I change the update function to simply ```
function update(&$class, $eventID) {
print "hello";
}


I still just get a blank screen.

 - Steven
8 Sep 2006, 9:22 PM
#4
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: Stumped on notifiers, help?

Well, now I'm even more confused. I got it to work but I'm not sure what I did. I tried your globals thing and that didn't do it. I found the rogue bracket, and that didn't do it. Then I changed some more stuff to no avail, but when I changed it back it works. So I'm not sure what I did. The above code with the missing ) put in works as expected now...

weird.

  • Steven
8 Sep 2006, 10:15 PM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,735
Plugin Contributions:
56

Re: Stumped on notifiers, help?

You probably know this, but just in case:

If you get a blank screen, then often (but not always!) your server log is a good place to look. You might see a message like this:

[client 127.0.0.1] PHP Parse error: parse error, unexpected ':', expecting ',' or ';' in /var/www/html/higher_1.3/includes/templates/custom/templates/tpl_product_info_display.php on line 291, referer: http://localhost/higher_1.3/index.php

This one shows us that l. 291 in tpl_product_info_display.php is broken.

/var/log/httpd/error_log on my FC4 box running Apache.

Good luck,
Scott

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

8 Sep 2006, 10:30 PM
#6
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: Stumped on notifiers, help?

Actually, I didn't know that :) Thanks.

But I don't know where to find the log. I'm running on a local windows server using apache2triad. I found a logs folder, and even an error file within that... but there are absolutely no parse errors in it, just file not found errors (and I know what was generating those).

I'd like to find the log you speak of.

  • Steven
8 Sep 2006, 10:34 PM
#7
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: Stumped on notifiers, help?

Found it! In a seperate php folder - how handy!

So for anyone in a similar setting... look here: C:\apache2triad\php\logs

Thanks for the tip.

  • Steven