add_product override

Open to all! Ask other shopowners for help.
Post Reply
frankl
Builder
Posts: 159
Joined: Tue Feb 23, 2021 8:39 pm
Phoenix Version: v1.1.0.4
Has thanked: 17 times
Been thanked: 26 times

add_product override

Post 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.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: add_product override

Post 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
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: add_product override

Post 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.
frankl
Builder
Posts: 159
Joined: Tue Feb 23, 2021 8:39 pm
Phoenix Version: v1.1.0.4
Has thanked: 17 times
Been thanked: 26 times

Re: add_product override

Post 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
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: add_product override

Post 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
frankl
Builder
Posts: 159
Joined: Tue Feb 23, 2021 8:39 pm
Phoenix Version: v1.1.0.4
Has thanked: 17 times
Been thanked: 26 times

Re: add_product override

Post 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 :)


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply