Magento Expert Forum - Improve your Magento experience

Results 1 to 4 of 4

magento product

  1. #1

  2. #2
    Junior Member rocker's Avatar
    Join Date
    Mar 2013
    Posts
    106
    Thanks
    3
    Thanked 11 Times in 9 Posts

    Default

    Not sure what your mean "page". But if you want to know all of php/template files relate to home page process then you can turn on the debug mod of magento.

  3. #3
    New member
    Join Date
    Jul 2013
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hello
    Actually I wanted to know the complete flow of a magento view. Suppose i am viewing the home page, can I ask how the flow of control goes through the PHTML, XML and PHP files , in order to view the home page? Basically wanted to know the flow of control of magento.
    Well the magento version is 1.7.0.2. If you still have a doubt in understanding my query , please let me know.

    Regards

  4. #4
    Junior Member rocker's Avatar
    Join Date
    Mar 2013
    Posts
    106
    Thanks
    3
    Thanked 11 Times in 9 Posts

    Smile

    I think you want to enable Developer mode. Add this to your .htaccess file:

    Code:
    SetEnv MAGE_IS_DEVELOPER_MODE "true"
    You may also want to enable display errors in index.php:

    PHP Code:
    ini_set('display_errors'1); 
    The best way I have found to debug is with X-Debug in a local environment. You can also use log files to help debug in a production environment, if your unable to run X-Debug in the environment.

    I've got a more detailed posting here:

    http://www.molotovbliss.com/debuggin...gento-commerce

    Consider also installing XDebug

    Or in another way with printDebugBacktrace. printDebugBacktrace function looks like:

    PHP Code:
    public static function printDebugBacktrace($title 'Debug Backtrace:') {
        
    $output     "";
        
    $output .= "<hr /><div>" $title '<br /><table border="1" cellpadding="2" cellspacing="2">';
     
        
    $stacks     debug_backtrace();
     
        
    $output .= "<thead><tr><th><strong>File</strong></th><th><strong>Line</strong></th><th><strong>Function</strong></th>".
            
    "</tr></thead>";
        foreach(
    $stacks as $_stack)
        {
            if (!isset(
    $_stack['file'])) $_stack['file'] = '[PHP Kernel]';
            if (!isset(
    $_stack['line'])) $_stack['line'] = '';
     
            
    $output .=  "<tr><td>{$_stack["file"]}</td><td>{$_stack["line"]}</td>".
                
    "<td>{$_stack["function"]}</td></tr>";
        }
        
    $output .=  "</table></div><hr /></p>";
        return 
    $output;

    You need to put the above method in app/Mage.php.

    Note: As you see that above method utilizes the php’s debug_backtrace() method. But manually calling that function will give you very large string due to large no of complex properties & nested objects in magento classes and will be very difficult in tracing. So recommended to use the above mentioned utility function instead.

    Usage

    Suppose say you are trying to figure out the flow of Mage_Sales_Model_Quote_Address_Total_Shipping::col lect() method.
    Go to that class method and put the following line

    PHP Code:
    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        echo 
    Mage::printDebugBacktrace(); exit; //add this line just after the opening
        //Mage::log(Mage::printDebugBacktrace(), null, 'backtrace.log'); //or you can even log the backtrace 
    And when you load the page (my cart) in frontend then you will get the following output:


    Good luck with your debug

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •