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

Where can i apply addItemRender-action? 
 
AquilaRapax
Jr. Member
 
Total Posts:  5
Joined:  2010-04-26
 

Hi folks,

sorry, if this is a stupid question, but i’m quite new to magento. I searched some time in the web and the forum to find a satisfying answer, but i didnt find one.
The question is, if i can apply the addItemRender-action to the Mage_Catalog_Block_Navigation-block, to specify the html for each “category-item”. I used this action for my cart and found it very useful.

checkout.xml

<reference name="top.menu">
<
block type="checkout/cart_sidebar" name="top.shoppingCart" as="topShoppingCart" after="top.wishlist" template="checkout/cart/topmenu/default.phtml">
<
action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/topmenu/item/default.phtml</template></action>
<
action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/topmenu/item/default.phtml</template></action>
<
action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block>    <template>checkout/cart/topmenu/item/default.phtml</template></action>
</
block>
</
reference>

Indeed the question is more general. I found an overview of possible actions on following site: Magento Layout Files Reference

How can i ascertain to which blocks i can add a specific action? Is (for the above example) the only clue, that i can add the addItemRender-action the existence of some Item_Render-blocks?

Thanks in advance… smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
AquilaRapax
Jr. Member
 
Total Posts:  5
Joined:  2010-04-26
 

Ahhh.... maybe i answered my question by myself. Is the action-tag in the xml files just a call to the appropriate function in the block that surrounds this action? I found the method \"addItemRender\" in the Mage_Checkout_Block_Cart_Abstract block. Can i call every method of the classes this way? But how do i know the argument names of this function? E.g. In the magento documentation the aforementioned block contains the function, which is defined as follows:

Add renderer for item product type

    
access: public

Mage_Checkout_Block_Cart_Abstract addItemRender (string $productTypestring $blockTypestring $template)

    * 
string $productType
    
string $blockType
    
string $template

BUT in my checkout.xml i wrote:

<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/topmenu/item/default.phtml</template></action>

The arguments are named completely different. So i conclude that it doesn\’t matter what the parameter tags are named?…

YES! I tried out a few seconds ago… smile it doesn\’t matter, how the parameter tags inside an action-tag are named. Great. Another little piece in the big magento-puzzle wink

Ok, there was no conversation, but maybe it helps someone… Cheers

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