Skip to main content
added 53 characters in body
Source Link
Alana Storm
  • 44.4k
  • 35
  • 169
  • 354

The single most important place to debug a Magento rewrite is right here

#File: app/code/core/Mage/Core/Model/Config.php
public function getGroupedClassName($groupType, $classId, $groupRootNode=null)
{
    //...    
    $config = $this->_xml->global->{$groupType.'s'}->{$group};

    // First - check maybe the entity class was rewritten
    $className = null;
    if (isset($config->rewrite->$class)) {
        $className = (string)$config->rewrite->$class;
    } else {
        /**
         * Backwards compatibility for pre-MMDB extensions.
         * In MMDB release resource nodes <..._mysql4> were renamed to <..._resource>. So <deprecatedNode> is left
         * to keep name of previously used nodes, that still may be used by non-updated extensions.
         */
        if ($config->deprecatedNode) {
            $deprecatedNode = $config->deprecatedNode;
            $configOld = $this->_xml->global->{$groupType.'s'}->$deprecatedNode;
            if (isset($configOld->rewrite->$class)) {
                $className = (string) $configOld->rewrite->$class;
            }
        }
    }
    
    //...
}

This is where Magento dives into your configuration to look for a rewrite node, and if it finds one, rewrite the class. Add some temporary conditional debugging code here that prints or logs the information Magento's fetching from the config and you'll get the bottom of most rewrite problems.

The single most important place to debug a Magento rewrite is right here

public function getGroupedClassName($groupType, $classId, $groupRootNode=null)
{
    //...    
    $config = $this->_xml->global->{$groupType.'s'}->{$group};

    // First - check maybe the entity class was rewritten
    $className = null;
    if (isset($config->rewrite->$class)) {
        $className = (string)$config->rewrite->$class;
    } else {
        /**
         * Backwards compatibility for pre-MMDB extensions.
         * In MMDB release resource nodes <..._mysql4> were renamed to <..._resource>. So <deprecatedNode> is left
         * to keep name of previously used nodes, that still may be used by non-updated extensions.
         */
        if ($config->deprecatedNode) {
            $deprecatedNode = $config->deprecatedNode;
            $configOld = $this->_xml->global->{$groupType.'s'}->$deprecatedNode;
            if (isset($configOld->rewrite->$class)) {
                $className = (string) $configOld->rewrite->$class;
            }
        }
    }
    
    //...
}

This is where Magento dives into your configuration to look for a rewrite node, and if it finds one, rewrite the class. Add some temporary conditional debugging code here that prints or logs the information Magento's fetching from the config and you'll get the bottom of most rewrite problems.

The single most important place to debug a Magento rewrite is right here

#File: app/code/core/Mage/Core/Model/Config.php
public function getGroupedClassName($groupType, $classId, $groupRootNode=null)
{
    //...    
    $config = $this->_xml->global->{$groupType.'s'}->{$group};

    // First - check maybe the entity class was rewritten
    $className = null;
    if (isset($config->rewrite->$class)) {
        $className = (string)$config->rewrite->$class;
    } else {
        /**
         * Backwards compatibility for pre-MMDB extensions.
         * In MMDB release resource nodes <..._mysql4> were renamed to <..._resource>. So <deprecatedNode> is left
         * to keep name of previously used nodes, that still may be used by non-updated extensions.
         */
        if ($config->deprecatedNode) {
            $deprecatedNode = $config->deprecatedNode;
            $configOld = $this->_xml->global->{$groupType.'s'}->$deprecatedNode;
            if (isset($configOld->rewrite->$class)) {
                $className = (string) $configOld->rewrite->$class;
            }
        }
    }
    
    //...
}

This is where Magento dives into your configuration to look for a rewrite node, and if it finds one, rewrite the class. Add some temporary conditional debugging code here that prints or logs the information Magento's fetching from the config and you'll get the bottom of most rewrite problems.

Source Link
Alana Storm
  • 44.4k
  • 35
  • 169
  • 354

The single most important place to debug a Magento rewrite is right here

public function getGroupedClassName($groupType, $classId, $groupRootNode=null)
{
    //...    
    $config = $this->_xml->global->{$groupType.'s'}->{$group};

    // First - check maybe the entity class was rewritten
    $className = null;
    if (isset($config->rewrite->$class)) {
        $className = (string)$config->rewrite->$class;
    } else {
        /**
         * Backwards compatibility for pre-MMDB extensions.
         * In MMDB release resource nodes <..._mysql4> were renamed to <..._resource>. So <deprecatedNode> is left
         * to keep name of previously used nodes, that still may be used by non-updated extensions.
         */
        if ($config->deprecatedNode) {
            $deprecatedNode = $config->deprecatedNode;
            $configOld = $this->_xml->global->{$groupType.'s'}->$deprecatedNode;
            if (isset($configOld->rewrite->$class)) {
                $className = (string) $configOld->rewrite->$class;
            }
        }
    }
    
    //...
}

This is where Magento dives into your configuration to look for a rewrite node, and if it finds one, rewrite the class. Add some temporary conditional debugging code here that prints or logs the information Magento's fetching from the config and you'll get the bottom of most rewrite problems.