Search code examples
phpdebuggingcs-cart

cs-cart extending core controllers - debugging


I'm trying to modify the user's address right after registration.

When you create a new user, The address needs to be modified and a trailing string needs to be added, such as this : ####.

I've created an addon, added the path /controllers/frontend/profiles.post.php, I've attached to the $mode == 'add' , That's where I'm stuck.

How can I know which variables are available to me, It seems there's no way to debug, var_dump or echo. nothing seems to work.

The file is executing because if I type some broken syntax the server returns 500 internal error,

So my main question :
How can you debug at all any CS-cart addon?


Solution

  • Patrick,

    To find out what variables do you have you can use fn_print_r($_REQUEST) where fn_print_r - good looking cs-cart wrapper of print_r

    Actually the variables from profiles.php are not available in profiles.post.php because these are different variable scopes.

    So most probably the only variables you will have is global PHP like $_REQUEST $_SERVER etc..

    Take a look at discussion or bestsellers add-on - they have products.post.php controllers which work absolutly the same ways a profiles.post.php and any other post controllers.