Forums / Contribution-Writing Guidelines / Trying to trace down what went wrong with this observer...

Trying to trace down what went wrong with this observer...

Views: 144

Results 1 to 5 of 5
1 Aug 2026, 2:43 PM
#1
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Trying to trace down what went wrong with this observer...

So rather than make a separate call to the table of products, I figured I would join on the same call that the Product class uses and call the extra product information from the related database table. this was working all up to this morning and I cannot figure out what I changed or didn't change to the point where this observer is no longer functioning (ie, the merge that should be taking place on the instantiation of the Product class, is take place but somehow isn't)

I know the product data from the separate table is being pulled up (I can debug dump $data in the observer class file and see the fields) but the fields don't make their way over to the product_info view. (I know I could probably just load the product data directly by using /includes/modules/pages/____/main_template_vars_product_type.php but wanted to avoid duplicating the same code over and over again.) It did work up to a point and then suddenly, the class no longer pushes the merged $data to the product info page.

I would appreciate any help or advice with this as possible.

(This is for PHP 8.5 and ZC 2.2.2)

https://gist.github.com/retched/a08f8af812d398b73e174886aca01c53

1 Aug 2026, 4:22 PM
#2
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,972
Plugin Contributions:
8

Re: Trying to trace down what went wrong with this observer...

retched:

So rather than make a separate call to the table of products, I figured I would join on the same call that the Product class uses and call the extra product information from the related database table. this was working all up to this morning and I cannot figure out what I changed or didn't change to the point where this observer is no longer functioning (ie, the merge that should be taking place on the instantiation of the Product class, is take place but somehow isn't)

I know the product data from the separate table is being pulled up (I can debug dump $data in the observer class file and see the fields) but the fields don't make their way over to the product_info view. (I know I could probably just load the product data directly by using /includes/modules/pages/____/main_template_vars_product_type.php but wanted to avoid duplicating the same code over and over again.) It did work up to a point and then suddenly, the class no longer pushes the merged $data to the product info page.

I would appreciate any help or advice with this as possible.

(This is for PHP 8.5 and ZC 2.2.2)

https://gist.github.com/retched/a08f8af812d398b73e174886aca01c53

i do not see a call to the product class in your main template vars script.

in the base refer to this section of code on github.

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

1 Aug 2026, 10:23 PM
#3
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Trying to trace down what went wrong with this observer...

carlwhat:

i do not see a call to the product class in your main template vars script.

in the base refer to this section of code on github.

best.

Yeah, I called that notifier off of the handler in the Product class itself is instantiated. (The one found on line 373 in /includes/classes/Product.php) The odd thing is like I said, it worked at some point but I'm trying to figure out what I did that caused it to stop working.

1 Aug 2026, 10:53 PM
#4
marcopolo avatar

marcopolo

Totally Zenned

Join Date:
May 2008
Location:
United States
Posts:
522
Plugin Contributions:
2

Re: Trying to trace down what went wrong with this observer...

The two files in your gist check out fine against 2.2.2 core, so the problem is likely in a file you haven't posted. Are there more files to this? If so, can you provide a complete zip, ideally including:

  • includes/modules/pages/product_cards_digi_info/ (header_php.php and main_template_vars.php especially)
  • your tpl_product_cards_digi_display.php template
  • the extra_datafiles and language files for the card tables

Plus any myDEBUG-*.log files from /logs/ from today. That should be enough to pin down where the merged fields are getting lost.

marcopolo
Zen Cart 2.2.2 | PHP 8.5.11 | MariaDB 10.11.14

2 Aug 2026, 12:27 AM
#5
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,972
Plugin Contributions:
8

Re: Trying to trace down what went wrong with this observer...

retched:

Yeah, I called that notifier off of the handler in the Product class itself is instantiated. (The one found on line 373 in /includes/classes/Product.php) The odd thing is like I said, it worked at some point but I'm trying to figure out what I did that caused it to stop working.

i'm just taking stabs at it. if the product_info is there, but your extra data is not, it is entirely possible that the product class is getting instantiated PRIOR to the autoloading infastructure for your observer.

i have found that to be an issue when dealing with usu.

you might try adding an entry into the auto_loaders directory, something like:

    $autoLoadConfig[95][] = [
        'autoType'=>'class',
        'loadFile'=>'observers/early_observer.php',
    ];

and then renaming your observer.

but i'm just taking stabs at it at this point.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.