I've noticed that in Mage/Checkout module's config.xml,there is not tag defining its helpers but it has three helper classes.

Please let me understand the scenario?


I think its not necessary to define helper class in config.xml[As per i know]

As per your question

When you call


It will first call

public static function helper($name)
        $registryKey = '_helper/' . $name;
        if (!self::registry($registryKey)) {
            $helperClass = self::getConfig()->getHelperClassName($name);
            self::register($registryKey, new $helperClass);
        return self::registry($registryKey);

then it will call

 public static function getConfig()
    return self::$_config;


 public function getHelperClassName($helperName)
    if (strpos($helperName, '/') === false) {
        $helperName .= '/data';
    return $this->getGroupedClassName('helper', $helperName);


 public function getGroupedClassName($groupType, $classId, $groupRootNode=null)
    if (empty($groupRootNode)) {
        $groupRootNode = 'global/'.$groupType.'s';

    $classArr = explode('/', trim($classId));
    $group = $classArr[0];
    $class = !empty($classArr[1]) ? $classArr[1] : null;

    if (isset($this->_classNameCache[$groupRootNode][$group][$class])) {
        return $this->_classNameCache[$groupRootNode][$group][$class];

    $config = $this->_xml->global->{$groupType.'s'}->{$group}; 

// here we get all config.xml object [We don't have helper define so we have only Mage_Core_Model_Config_Element object][If we have defined helper in config.xml then we got helper class name ]

    // 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 (isset($config->deprecatedNode)) {
            $deprecatedNode = $config->deprecatedNode;
            $configOld = $this->_xml->global->{$groupType.'s'}->$deprecatedNode;
            if (isset($configOld->rewrite->$class)) {
                $className = (string) $configOld->rewrite->$class;

    // Second - if entity is not rewritten then use class prefix to form class name
    if (empty($className)) { 
        if (!empty($config)) {
            $className = $config->getClassName(); 
        if (empty($className)) {
            $className = 'mage_'.$group.'_'.$groupType; 

[ we get mage_checkout_helper ] {{group is checkout and groupType is helper}}

        if (!empty($class)) {
            $className .= '_'.$class;

[ we get mage_checkout_helper_data]

        $className = uc_words($className);

[[ finaly we got Mage_Checkout_Helper_Data]]


    $this->_classNameCache[$groupRootNode][$group][$class] = $className;
    return $className;


i think helper tag add in config.xml because there are lots of helper class in helper [Not only data.php(By default is data.php)],,to call different helper class we have to define helper name in config.xml so we can call different helper.

I hope you clear now

  • I know that without defining in xml, we can access it, but is there any reason to have helpers tag in config.xml?This is what i would like to know. – Manikandan Arunachalam May 27 '15 at 15:51
  • check my edit @Manik – Keyur Shah May 27 '15 at 17:25
  • I saw your updated answer, Mage/Checkout/Helper directory has Cart.php,Data.php and Url.php , so this module has different helper class (as you said), then why this module not defining its helper in its config.xml. – Manikandan Arunachalam May 28 '15 at 5:51
  • Did you look at my previous comment? – Manikandan Arunachalam Jun 3 '15 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.