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

Get additional info in products list
 
yugyn_lonewolf
Sr. Member
 
Total Posts:  108
Joined:  2008-05-31
 

Hi,

the function “$this->getChildHtml(’additional’)” into the “template\catalog\product\view.phtml” file, return me the table of additionals attributes.

But the same function into the “"template\catalog\product\list.phtml" file, return me an empty string.

I need to use this function intho the “list.phtml” file.
I imagine that the problem is that I haven’t the block type into a section of XML file, but i don’t understand where and what add this information.

Any idea for help me?
Thanks…

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageParts
Guru
 
Avatar
Total Posts:  415
Joined:  2007-11-18
 

getChildHtml() refers to a block located in the directory with the same name (and location) as the file which the call came from. In this instance app/code/core/Mage/Catalog/Product/View.php calls to its child located at app/code/core/Mage/Catalog/Product/View/Additional.php.

So all you need to do here is to copy app/code/core/Mage/Catalog/Product/View/Additional.php to app/code/core/Mage/Catalog/Product/List/Additional.php. Then change the class declaration in app/code/core/MAge/Catalog/Product/View/Additional.php from

class Mage_Catalog_Block_Product_View_Additional extends Mage_Core_Block_Template

To

class Mage_Catalog_Block_Product_List_Additional extends Mage_Core_Block_Template

Hope that helps ^^

 
Magento Community Magento Community
Magento Community
Magento Community
 
yugyn_lonewolf
Sr. Member
 
Total Posts:  108
Joined:  2008-05-31
 

Hi,

thanks for your answer.
But… is it a good idea???
If I change the core files of Magento, when I update the release I lose this modify, it’s true?

See you soon.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageParts
Guru
 
Avatar
Total Posts:  415
Joined:  2007-11-18
 

You don’t wanna modify the core files, as I said above you copy the file, then modify the copied one. Put all of your custom files in app/code/lcoal instead of app/code/core. Then they won’t be lost when you update your Magento (as far as I know, though you should test it to be sure). So just create app/code/local/Mage/Catalog/Block/Product/List, put the file in there, make the modifications I suggested above in that file and that sohuld be it smile.

 
Magento Community Magento Community
Magento Community
Magento Community
 
yugyn_lonewolf
Sr. Member
 
Total Posts:  108
Joined:  2008-05-31
 

Ah, well, now I understand smile

For resolve my problem, I have added into app\design\frontend\*\*\layout\catalog xml this code:

<action method="addAttribute"><attribute>aw_friend_coupon</attribute></action>

in this block:

<reference name="content">
            <
block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
                <
block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                    <
action method="addAttribute"><attribute>aw_friend_coupon</attribute></action>

In my case, I need know only an attribute.

Into the file app\design\frontend\*\*\template\catalog\product\list.phtml I use this function

$_product->getResource()->getAttribute('aw_friend_coupon')->getFrontend()->getValue($_product))

to know the value of this attibute.

Thanks for your answer smile

See you soon

 
Magento Community Magento Community
Magento Community
Magento Community
 
vinoth321
Jr. Member
 
Total Posts:  12
Joined:  2009-02-08
 

Hi,

I want to list additional information (custom attributes) in catalog search result page, how can i do that. how can i list those details.

th

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