开发者

Magento - getTreeHtml() - where on earth is this method?

开发者 https://www.devze.com 2023-03-31 12:40 出处:网络
Hopefully somebody can help me with this one as I\'m a bit confused. I\'m trying to reverse engineer the product chooser widget so that I can trigger it off a button in the front end. I\'m making pro

Hopefully somebody can help me with this one as I'm a bit confused.

I'm trying to reverse engineer the product chooser widget so that I can trigger it off a button in the front end. I'm making progress, albeit slow.

One thi开发者_StackOverflowng that is confusing me though is one of the lines of code in the container.phtml file:

getTreeHtml() ?>

I just cant seem to see where this 'getTreeHtml' method is. I've looked in the template's associated block, the block that that inherits from, and all the way up the object hierarchy. I've also done a text search on the whole of the Magento directory but this method doesnt appear anywhere... Am I missing something here?

Grateful for any help, Ian


Its a non-declared field accessor (a 'magic' method). Whenever you call a setField(value) or getField() on a Varien_Object without really declaring this methods (they don't exist in the class), Varien_Object checks its $this->data array for a entry with a 'field' key. If such an entry exists it returns/sets the $this->data['field'] value.

The method is used in your Widget. Check out the file:

./Mage/Adminhtml/controllers/Catalog/Product/WidgetController.php:

Somewhere in it you can find this call:

setTreeHtml($categoriesTree->toHtml())

As you can see, the value is set in the controller, and later can be read in the template.

0

精彩评论

暂无评论...
验证码 换一张
取 消