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

yet another small question. 
 
schmelzgeist
Sr. Member
 
Total Posts:  92
Joined:  2008-05-27
Marzipane World Capital (Lübeck, Germany)
 

I want to display the short description of a product in the upsell template (category/product/list/upsell.phtml).
but i seem to fumble the syntax.

<?php echo substr(nl2br($_link->getShortDescription()),0,30?>
                <?php 
echo $this->helper('catalog/product')->getPriceHtml($_linktrue?>
                <?php 
echo $this->helper('review/product')->getSummaryHtml($_link?>

could anybody point me in the right direction,please?  smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
yshahin
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-05-14
 

i think you have to say $this->_link
not sure

 
Magento Community Magento Community
Magento Community
Magento Community
 
schmelzgeist
Sr. Member
 
Total Posts:  92
Joined:  2008-05-27
Marzipane World Capital (Lübeck, Germany)
 

thanks for the tip

but it didn’t worked :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

Your code should work if you add the following to app/code/core/Mage/Catalog/Block/Product/List/Upsell.php right after the other addAttributeToSelect lines:

->addAttributeToSelect('short_description')

Note that this is a core hack. To be able to update Magento in the future, you should make your own class that extends the Upsell block.

 
Magento Community Magento Community
Magento Community
Magento Community
 
schmelzgeist
Sr. Member
 
Total Posts:  92
Joined:  2008-05-27
Marzipane World Capital (Lübeck, Germany)
 
Anders Rasmussen - 26 June 2008 03:19 AM

Your code should work if you add the following to app/code/core/Mage/Catalog/Block/Product/List/Upsell.php right after the other addAttributeToSelect lines:

->addAttributeToSelect('short_description')

Note that this is a core hack. To be able to update Magento in the future, you should make your own class that extends the Upsell block.

thank you, as i have seen now this attribute is not in the returned object, so that ‘where do i’ would have been my next Question smile

now i will try to create an class for this smile

did you by chance have a nice thread or wiki to read?

 
Magento Community Magento Community
Magento Community
Magento Community
 
crius
Guru
 
Avatar
Total Posts:  623
Joined:  2007-10-16
Denmark
 

Two wiki pages about how to make your own module:

http://www.magentocommerce.com/wiki/how-to/customize_part_of_configuration
http://www.magentocommerce.com/wiki/groups/174/changing_and_customizing_magento_code

But you don’t have to make a whole module. You can just make a class that extends the Upsell class, put it somewhere like app/code/local/myupsell/ and put some rewrite xml in local.xml that tells Magento to use your class instead of the original one.

 
Magento Community Magento Community
Magento Community
Magento Community
 
schmelzgeist
Sr. Member
 
Total Posts:  92
Joined:  2008-05-27
Marzipane World Capital (Lübeck, Germany)
 

thanks again, will do so smile

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