Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Name convention confuse
 
nostrzak
Jr. Member
 
Avatar
Total Posts:  22
Joined:  2007-09-18
Wroclaw, Poland
 

Hey,

I think that in templates $this->getHelper() and $this->helper() are very confusing. $this->getHelper() should be sth like $this->getBlock() since this one receives block instance. Maybe I’m missing something here? smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

it thought it did follow the usual naming convention.....for instance:

<a href="<?php echo $this->helper('catalog/product')->getEmailToFriendUrl($_product) ?>"><?php echo $this->__('Email to a Friend'?></a><br />

//shouldn't the getHelper variety be like this?:
Mage::getHelper('catalog/product')->doSomething();
 
Magento Community Magento Community
Magento Community
Magento Community
 
nostrzak
Jr. Member
 
Avatar
Total Posts:  22
Joined:  2007-09-18
Wroclaw, Poland
 

Maybe I wasn’t clear enough. When you do such experiment:

echo(get_class($this->helper('checkout/cart')));
echo(
get_class($this->getHelper('checkout/cart')));

you’ll get such output:

Mage_Checkout_Helper_Cart
Mage_Checkout_Block_Cart

First one is helper instance, second one is block. The second function name is misleading since it’s talking about helpers, not blocks. It’s no problem since you know it, but took me some minutes to notice it smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 
nostrzak - 20 August 2008 09:11 PM

Maybe I wasn’t clear enough. When you do such experiment:

echo(get_class($this->helper('checkout/cart')));
echo(
get_class($this->getHelper('checkout/cart')));

you’ll get such output:

Mage_Checkout_Helper_Cart
Mage_Checkout_Block_Cart

First one is helper instance, second one is block. The second function name is misleading since it’s talking about helpers, not blocks. It’s no problem since you know it, but took me some minutes to notice it smile

that’s weird -

Possibly a bug? - perhaps the “getHelper” is being read using the magic __call function and isn’t recognized properly?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top