3

For anybody who has seen / used Magento, can you please tell me where can I find the following 3 function's definitions of the Catalog Product's save action's Event Observer class:-

  1. setBundleOptionsData()
  2. setBundleSelectionsData()
  3. setCanSaveBundleSelections()

Please pardon me, for asking such a silly question, but I am really helpless. Any help is greatly appreciated.

The worst part is that these above 3 methods are being used for the product object in a nice way, & they are working too. But where are their definitions?

EDIT:-
Okay, I can understand that these are used by the "Varien_Object", and these are simple setter functions using the concept of Magic Methods. But can somebody please tell what is the coding flow, when the program counter arrives at such a function, in this case in the Event Observer class?

1 Answer 1

6

If you have run a search on all the files and can't find the definition then these are most likely using PHP's magic methods. Is this class inheriting (directly or indirectly) from Varien_Object? If so, then these are simple setter functions storing data in an array within the object.

To get these values back all you need to do is change the 'set' to 'get':

$this->setBundleOptionsData('whatever'); echo $this->getBundleOptionsData(); //Returns 'whatever' 

If you're interested in how this works, look inside class Varien_Object. I've also described the mechanism here.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for such an info. But I have some more queries. This class is inherited indirectly from Varien_Object.
I really must admit your answer as wow. But if possible, please tell whether the point, which you mentioned, is really taking place or not.
You'll also want to give var_dump($this->getData()) a try, or $this->getData('bundle_options_data')

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.