Zen Cart Logo
Forums / General Questions / Notifier stopped working between 1.3.7 and 1.3.8?

Notifier stopped working between 1.3.7 and 1.3.8?

Locked

Views: 1,274

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
29 Oct 2008, 5:01 PM
#1
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Notifier stopped working between 1.3.7 and 1.3.8?

If Kim or another xpert is around ...
I have an observer that was using a simple notifier generated in v137's page, advanced_search, header_php.php

But Kim's been in that file for V138, in between coffee's, and changed the notifiers in that header_php.php, and put the call that creates the advanced search results, in that file now.. so v137 / v138 has changed there..

NOTIFY_HEADER_END_ADVANCED_SEARCH_RESULTS has been invaded by NOTIFY_SEARCH_ORDERBY_STRING

138 header_php.php has

  $zco_notifier->notify('NOTIFY_SEARCH_ORDERBY_STRING', $listing_sql);

//then the product search listing is created/called
////then later, at end of file..

$zco_notifier->notify('NOTIFY_HEADER_END_ADVANCED_SEARCH_RESULTS', $keywords);

I was using the first notifier to add to the search sql, it worked.. but it doesn't in v138.., now I'm flummoxed..

If I use NOTIFY_SEARCH_ORDERBY_STRING instead in my observer, my observer update function still doesn't kick in, and also theres a parameter after that new notifier in the header_php/php, wot I don't know to do with

Sorry this is a bit technical

Basically my 137 observer class v1for 137 used NOTIFY_HEADER_END_ADVANCED_SEARCH_RESULTS
but now the same observer refuses to kick in, although the observer class is still instantiated correctly, the function update section in my observer class no longer works (i.e is not called), whichever notifier above, that I use

Yes I know I'm a dumbo, but I can't locate a simple 138 version of an observer class, the purpose of the extra 'new' parameter after the actual notifier 'constant name' in the header_php.php is unexplained.. and why does my observer class hibernate in 138.. where it worked in v137..

29 Oct 2008, 6:28 PM
#2
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Re: Notifier stopped working between 1.3.7 and 1.3.8?

Just to clarify, (or confuse further) my 137 observer just used
'NOTIFY_HEADER_END_ADVANCED_SEARCH_RESULTS
and the update function in the observer will echo a text into my 137 site page

Its a sort of, where do I go from there, to get to a working 138 version, given the new notifier parameter and the fact that so far, even changing my observer to use 'NOTIFY_SEARCH_ORDERBY_STRING' for the 138 version, seems not to give me an echo output on the 138 site, from the update function in the modded observer.

That means the observer is blind in 138, it can't do its stuff

29 Oct 2008, 6:46 PM
#3
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,859
Plugin Contributions:
3

Re: Notifier stopped working between 1.3.7 and 1.3.8?

hi,

can u post the code you are using for the v1.3.8 version

29 Oct 2008, 6:47 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Notifier stopped working between 1.3.7 and 1.3.8?

I'm not sure why the notifier is not firing.

But ... I'm unclear about what exactly your observer is doing when it does (or is supposed to) fire. You said it "will echo a text into my site page". How? via MessageStack? some other means? What's this message about? Is that all it does?

29 Oct 2008, 10:27 PM
#5
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Re: Notifier stopped working between 1.3.7 and 1.3.8?

Hi
Its part of the book product type I inherited from moku and developed...
The code used is (disallow the echo)

 class productBookSearch extends base {
  function productBookSearch() {
    global $zco_notifier;
    $zco_notifier->attach($this, array('NOTIFY_HEADER_END_ADVANCED_SEARCH_RESULTS'));
  }
  function update(&$class, $eventID) {
echo "IN HERE";
    switch ($eventID) {
      case 'NOTIFY_HEADER_END_ADVANCED_SEARCH_RESULTS': 
//..do stuff 

The echo is just a test, it produces an output on my 137 test site,
the 'do stuff' adds to the search sql of the main zencart search box, can't put all that here its too long

In 137 this observer file allows people to search for book authors, genre etc via the zencart searcjbox, the book data is in other tables not looked at by the standard advanced search code, so this observer modifies the sql.

So in my ongoing 137 version book site you can (if you wait long enough!) search authors from the top box, try patterson
http://www.jphuk.co.uk/zc/

But in my 138 test site you can't do that search for author, apparently because the observer update function is not triggered.
The echo in the above code is shown at top of page, if included in the observer running on the 137 site, but I get no echo in the test 138 site, so my logic is assuming the update function isn't triggering.

So what I need, is a version of the above code, that matches the notifier format now used in the 138 header_php.php that runs the advance search process. as i said, that file's notifiers have been altered significantly at the end. The echo does appear if its put in the earlier observer code section that instantiates the observer's class. So the update function is the part thats not working. And it doesn't work even if I change the notifier to 'NOTIFY_SEARCH_ORDERBY_STRING' Which is the new one in the 138 advanced search file.

I bet that all makes it 100% less clear..

29 Oct 2008, 10:51 PM
#6
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Re: Notifier stopped working between 1.3.7 and 1.3.8?

Just musing,
is it anything to do with the parameter being added into the new 138 version's notifier definition?

I can't find any info on the purpose of that extra parameter inside the notifier definition in the 138 version header_php.php file.

If there is now a parameter there, do I need to change my observer notifier coding, to match it.

30 Oct 2008, 7:57 AM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Notifier stopped working between 1.3.7 and 1.3.8?

It should have nothing to do with the passed-parameters. Those are merely there to allow the data in those parameters to be accessible inside the observer class since the notifier is being triggered in a procedural manner instead oop.

30 Oct 2008, 7:58 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Notifier stopped working between 1.3.7 and 1.3.8?

Did you try using "DIE" instead of "ECHO"?

30 Oct 2008, 11:52 AM
#9
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Re: Notifier stopped working between 1.3.7 and 1.3.8?

hi
weird and wonderful, its now sprung into life!
During testing I tried changing the notifier again, in the observer, to use the new NOTIFY_SEARCH_ORDERBY_STRING instead

Its now triggering the observer update function, and my authors search works!

Thanks so much for getting me to run through it again!... must have not done it quite right first time..

I wonder if header_php.php code always gets to the final notifier NOTIFY_HEADER_END_ADVANCED_SEARCH_RESULTS
there is a conditional redirect switch if no products are found...

Anyway, prob solved, it just needed the notifier name updating for v138
Thanks Dr Byte