Magento Forum

   
Where is this function’s definition ??? 
 
poulpillusion
Member
 
Avatar
Total Posts:  34
Joined:  2008-08-11
 

Hello,

I am in a big trouble : Magento is driving me crazy.

I can’t find the setCouponCode() function’s definition !

Could you help me ? Or trying to find this function’s definition would drive you crazy too wink

Thanks !

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

More than likely you are seeing the effects of using the __call magic method.  Lots of the Magento classes use it by extending Varien_Object.  If you track the parent classes of the class you are using, you will find that ultimately, the top level class is Varien_Object.  The parent class will allow you to store ANYTHING on a class.

For example:

$o  = new Varien_Object();
$o->setSuperCoolVariable(42);  //Edit: Apparently I didn't get enough coffee this morning!
$lifeUniverseEverything $o->getSuperCoolVariable();

if( 
$lifeUniverseEverthing === 42{
   
echo("What's the question???");
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
poulpillusion
Member
 
Avatar
Total Posts:  34
Joined:  2008-08-11
 

Thanks A LOT ! Your teached me something wink

For others people coming across this thread, I have corrected your code :

$o = new Varien_Object();
$o->setSuperCoolVariable(42);
$lifeUniverseEverything $o->getSuperCoolVariable();

if (
$lifeUniverseEverything === 42{
    
echo "What's the question???";
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Thanks for catching the bug, not enough coffee I think.

Just as a side note, Varien_Object also implements __get and __set, so the following should work as well:

$o  = new Varien_Object();
$o->superCoolVariable 42;
//$o->SuperCoolVariable = 42;
//$o->setSuperCoolVariable(42);
//$o->setsuperCoolVariable(42);

$lifeUniverseEverything $o->superCoolVariable;
//$lifeUniverseEverything = $o->SuperCoolVariable;
//$lifeUniverseEverything = $o->getSuperCoolVariable();

if( $lifeUniverseEverthing === 42 )  {
   
echo("What's the question???");
}

All the variations are the same.  Just watch out for child classes that implement a method that is named the same as one of your underlying variables.

In that case you could always use this:

$o->getData('super_cool_variable');

Funny thing is, they only need to add a few wrapper methods and they could implement ArrayAccess on Varien_Object.  then you could even use array access syntax.

 
Magento Community Magento Community
Magento Community
Magento Community
 
poulpillusion
Member
 
Avatar
Total Posts:  34
Joined:  2008-08-11
 

Thanks again… Now I understand what PHP interfaces are smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
hariharan1
Jr. Member
 
Total Posts:  7
Joined:  2011-02-21
 

hi eveyone

Can you help me.

I can’t find the setCouponCode() function’s definition !

thanks in advance

 
Magento Community Magento Community
Magento Community
Magento Community
 
poulpillusion
Member
 
Avatar
Total Posts:  34
Joined:  2008-08-11
 

Well, LeeSaferite answered this one… please read and understand the full thread : there is no such function definition.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hariharan1
Jr. Member
 
Total Posts:  7
Joined:  2011-02-21
 

hi poulpillusion,

Thanks. 

sales rule condition :

Mage/SalesRule/Model/Rule/Condition/Combine.php

I want to know about the sales rule condition query. I am at the above path now. I am not able to find. Help me.

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