lat9 / ga4-analytics

A plugin to provide GA4 analytics for Zen Cart stores
GNU General Public License v2.0
1 stars 2 forks source link

PHP Warning: Undefined array key "price" in includes/classes/observers/class.ga4_analytics.php #21

Closed torvista closed 12 months ago

torvista commented 1 year ago

zc158b/v2.0.0, php 8.3beta, strict reporting, declare(strict_types=1) in file (but it does it without it).

When viewing a Call for Price product:

0 includes/classes/observers/class.ga4_analytics.php(255): zen_debug_error_handler()

1 includes/classes/traits/NotifierManager.php(87): ga4_analytics->update()

2 includes/templates/motorvista5/common/tpl_main_page.php(255): base->notify()

3 index.php(94): require('D://OneDrive//Bus...')

--> PHP Warning: Undefined array key "price" in includes/classes/observers/class.ga4_analytics.php on line 251.

which is https://github.com/lat9/ga4-analytics/blob/212260c540604c27c628f45d236ca69a47790a43/includes/classes/observers/class.ga4_analytics.php#L251

lat9 commented 1 year ago

Since the 'price' property is optional, I'll just "not include" that for call-for-price products.

Also, no pricing for document_general products.

torvista commented 12 months ago

https://support.google.com/merchants/answer/6324371?hl=en Since price is a required property, I take that to imply that products with no price should not be in the feed.