Page 1 of 1

Overriding catalog actions in v1.0.8.1 and later

Posted: Mon Jul 11, 2022 6:05 pm
by edfaught
When updating from 8.0.1.0 I somehow lost my override functionality at /includes/system/override/actions/os_c__actions_add_product.php.
I would guess wildly that it has something to do with the name changes?

Re: Overriding catalog actions in v1.0.8.1 and later

Posted: Tue Jul 12, 2022 4:05 am
by ecartz
Try

Code: Select all

class hook_shop_system__22_actions {

  public function listen_startApplication() {
    $GLOBALS['class_index']->find_all_actions_under(DIR_FS_CATALOG . 'includes/system/override/actions');
  }

}
(doubled underscore is intentional) saved in includes/hooks/shop/system/_22_actions.php, rename the override files to something like add_product.php, and update the action file as done in https://github.com/CE-PhoenixCart/Phoen ... e018a5b558

At least one of Rainer's add-ons does this correctly. QTPro maybe?

Re: Overriding catalog actions in v1.0.8.1 and later

Posted: Tue Jul 12, 2022 7:37 pm
by edfaught
PHP Fatal error: Uncaught Error: Call to a member function find_all_actions_under() on null in \includes\hooks\shop\system\_22_actions.php:28
Stack trace:
#0 \includes\system\versioned\1.0.8.1\hooks.php(160): hook_shop_system__22_actions-
>listen_startApplication(Array)
#1 \includes\application_top.php(34): hooks->generate('startApplicatio...')
#2 \index.php(13): require('C:\\Users\\Ed_2\\M...')
#3 {main}
thrown in \includes\hooks\shop\system\_22_actions.php on line 28

I searched for this function and found it named tep_find_all_actions_under() in autoloader.php but renaming it here didn't fix the problem. I'm not even sure what the issue is...

Re: Overriding catalog actions in v1.0.8.1 and later

Posted: Tue Jul 12, 2022 8:43 pm
by ecartz
It says $class_index doesn't exist. You might have to update more. It looks like class_index was v1.0.8.3: https://github.com/CE-PhoenixCart/Phoen ... cf9d8b29dc

Re: Overriding catalog actions in v1.0.8.1 and later

Posted: Tue Jul 19, 2022 8:55 pm
by edfaught
My editor (Netbeans) shows this as syntax error also.

PHP Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting function (T_FUNCTION) or const (T_CONST) in \includes\system\override\actions\add_product.php on line 59

Code: Select all

    \Href::redirect(\Guarantor::ensure_global('Linker')
                    ->build($GLOBALS['goto'])
                    ->retain_parameters($GLOBALS['parameters']));
Phoenix 1.0.8.4

Re: Overriding catalog actions in v1.0.8.1 and later

Posted: Wed Jul 20, 2022 12:37 am
by ecartz
edfaught wrote: Tue Jul 19, 2022 8:55 pm PHP Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting function (T_FUNCTION) or const (T_CONST) in \includes\system\override\actions\add_product.php on line 59
This is the kind of thing that happens when you have a mismatched }. It's saying that it has the code you posted but is expecting a function or const. It would be expecting a function or const if it is outside a function. If it were inside a function (where it should be), it wouldn't give that error.