i am curious about opinions. in the past, i have stuck to the docs, with regards to updating values using an observer, ie $parm1 is read only and 2-9 are update-able. see:
https://docs.zen-cart.com/dev/code/notifiers/#update
so if one were to look at this observer:
PHP Code:
$zco_notifier->notify('NOTIFY_SEARCH_ORDERBY_STRING', $listing_sql);
the $listing_sql is NOT update-able as it is in $p1 position. however, if we were to add the $listing_sql to the global line in the update function, we can now change it, ie:
PHP Code:
public function update(&$class, $eventID, &$p1, &$p2, &$p3, &$p4)
{
global $listing_sql;
switch ($eventID) {
case 'NOTIFY_SEARCH_ORDERBY_STRING':
$listing_sql = 'whatever the bloody heck i like';
break;
}
}
i am curious what the downside may be on this approach as well as whether it is worthy of including in the docs.
best.
Bookmarks