Page 1 of 1

add_product override

Posted: Tue Dec 17, 2024 4:45 am
by frankl
Where to put a replacement for includes/actions/add-product.php so it overrides the standard file? I've tried a few places

includes/system/override
includes/system/override/includes/actions
templates/override/includes/includes
templates/override/includes/includes/actions

with no luck.

Re: add_product override

Posted: Tue Dec 17, 2024 7:52 am
by Kofod95
Not sure, but my guess would be that either
included/system/override/actions/add_product.php

Or

templates/override/includes/actions/add_product.php

should work?

//Daniel

Re: add_product override

Posted: Tue Dec 17, 2024 3:42 pm
by ecartz
You might want to dump the $GLOBALS['class_index'] variable and see where it has the file set.

If worst comes to worst, use $GLOBALS['class_index']->set to override the location directly.

Re: add_product override

Posted: Tue Dec 17, 2024 11:08 pm
by frankl
ecartz wrote: Tue Dec 17, 2024 3:42 pm You might want to dump the $GLOBALS['class_index'] variable and see where it has the file set.

If worst comes to worst, use $GLOBALS['class_index']->set to override the location directly.
Thanks Matt

I copied the amended file to includes/system/override/includes/actions/add_product.php

Created a system hook shop side with function:

Code: Select all

function listen_startApplication() {
		$GLOBALS['class_index']->set('phoenix\_actions\add_product', DIR_FS_CATALOG . 'includes/system/override/includes/actions/add_product.php');

    }
$GLOBALS['class_index'] dump shows:

Code: Select all

[files:protected] => Array
        (
		
 [phoenix\_actions\add_product] => /home/testsite/public_html/includes/system/override/includes/actions/add_product.php
 [add_product] => /home/testsite/public_html/includes/system/override/includes/actions/add_product.php

[actions:protected] => Array
        (
            [0] => Phoenix\Actions\add_product
but testing shows Phoenix is still using includes/actions/add_product.php

Re: add_product override

Posted: Wed Dec 18, 2024 1:34 am
by ecartz
frankl wrote: Tue Dec 17, 2024 11:08 pm Created a system hook shop side with function:
What's the name of the hook class? E.g. hook_shop_system__01_whatever

Re: add_product override

Posted: Wed Dec 18, 2024 4:13 am
by frankl
ecartz wrote: Wed Dec 18, 2024 1:34 am What's the name of the hook class? E.g. hook_shop_system__01_whatever
Just the hint I needed. Thanks Matt :)