Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to debug opencart project ? for example putting break points step into code etc?

I'm new one to opencart.is there any debug tools available for opencart ? .i don't know control flow of opencart execution.so i want to put break points,step into code,see variable values. please give any reference to that .thanks in advance.

like image 210
sivakumar Avatar asked Aug 02 '13 05:08

sivakumar


2 Answers

I wrote a super simple little function for the loader class that I use 100 times a day. It really helps and you can call it from just about anywhere.

OPEN:

system/engine/loader.php

Right before the closing brace for the class add this method:

// adding testing method
public function test ($items, $quit = true) {
    echo "<pre>";
    print_r ($items);
    echo "</pre>";

    if ($quit):
        exit;
    endif;
}

Now anytime after the Controller is instantiated you can call:

$this->load->test($results);

OR:

$this->load->test($results, false);

if you're in a loop and don't want the script to exit.

Obviously substitute $results for whatever array or variable you want to test.

It's been a huge help to me.

You can of course add this via vqmod if you don't want to modify the core.

like image 139
Vince Kronlein Avatar answered Sep 20 '22 08:09

Vince Kronlein


You are right. Opencart is very simple system. In addition you can use xDebug - very useful tool. Also, read system/logs/error.txt

error_reporting(E_ALL); // very helpful
die(print_r($_POST, true)); // print all POST data and break the code
like image 26
zoonman Avatar answered Sep 17 '22 08:09

zoonman