Magento Forum

   
Search Results Grid Different From Product Grid Listing
 
katiek648
Member
 
Total Posts:  33
Joined:  2008-04-10
 

Can someone help me out here?

I customized the product listing grid here: /template/catelog/product/list.pthml

Instead of showing the description, I am showing the ShortDescription so I modified the code to look like this:

<img src="/skin/frontend/default/default/images/product-divider.gif">
 
<?php echo nl2br($_product->getShortDescription()) ?>
 
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><span class="learnMore"><?php echo $this->__('Learn More'?></span></a>

It looks great on the homepage (http://shop.ode1.deasil.com/), but when I search for something, the Short Description doesn’t show up. As far as I can tell, it is pulling from the same page (/template/catelog/product/list.pthml).
http://shop.ode1.deasil.com/catalogsearch/result/?q=oil&x;=0&y;=0

Can anyone explain to me why the ShortDescription is not showing up in my search results?

Thanks,
Katie

 
Magento Community Magento Community
Magento Community
Magento Community
 
ralphie
Member
 
Total Posts:  59
Joined:  2007-12-20
London
 

good questions.. have the same issue..

 
Magento Community Magento Community
Magento Community
Magento Community
 
dan_w
Sr. Member
 
Total Posts:  290
Joined:  2008-01-04
 

From what I can see, it doesn’t look like the Result.php block loads the short description in the _getProductCollection function. The getShortDescription will work, but you just need to tell the block to load that info so that you can call it. Open up app->core->Mage->CatalogSearch->Block->Result.php. You should see the following function:

protected function _getProductCollection()
    
{
        
if (is_null($this->_productCollection)) {
            $this
->_productCollection $this->_getQuery()->getResultCollection()
                ->
addAttributeToSelect('url_key')
                ->
addAttributeToSelect('name')
                ->
addAttributeToSelect('price')
                ->
addAttributeToSelect('special_price')
                ->
addAttributeToSelect('special_from_date')
                ->
addAttributeToSelect('special_to_date')
                ->
addAttributeToSelect('description')
                ->
addAttributeToSelect('image')
                ->
addAttributeToSelect('small_image')
                ->
addAttributeToSelect('tax_class_id');

            
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($this->_productCollection);
            
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($this->_productCollection);
        
}

        
return $this->_productCollection;
    
}

As you can see, the short_description is not part of the select query. You can change ->addAttributeToSelect(’description’) to ->addAttributeToSelect(’short_description’), or you can add ->addAttributeTo Select(’short_description’) entirely. Of course, proper conventions would say that you should ammend the function via the local code pool as to preserve the integrity of your changes across future upgrades, but this’ll give you an idea as to how to get the short_description to show up. Hope that helps.

Dan

 
Magento Community Magento Community
Magento Community
Magento Community
 
ralphie
Member
 
Total Posts:  59
Joined:  2007-12-20
London
 

hi dan

thanks for that, nice one. i guess i will change this function then. however hope that in the future this field will be added in the core, don’t see a point why not?

cheers,

ralph

 
Magento Community Magento Community
Magento Community
Magento Community
 
wsib2bmarketing
Jr. Member
 
Total Posts:  1
Joined:  2012-04-27
 

I know this is an old thread, but I\\\’m having a similar issue. Could be somewhere in the core, but

have a customized product display page, grid with three columns, short description (actually the first bit of the description), and a custom \\\’details and customize\\\’ link.

HOWEVER,

on our search results page it is slightly different, no description and has an \\\’add to cart\\\’ link as opposed to what is on the category pages.

It looks as if the /list.phtml is powering everything, and all use the getProductListHtml call for the products.

Any ideas and help would be appreciated!!

Thanks, ben

 
Magento Community Magento Community
Magento Community
Magento Community
 
Volignyt
Jr. Member
 
Total Posts:  1
Joined:  2012-04-27
 

The opencart template comes with the products being listed as a ‘list view’ I am wanting to display it as a grid view.

http://www.zimbio.com/member/SherryAdriana/articles/DwzRgqROxOf/Pro+Cleanse+Colon+Cleanse+Review+Free+Trial

Image Attachments
girl_img2.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
 
Mirasvit
Guru
 
Avatar
Total Posts:  638
Joined:  2009-08-22
 

Hello.  As a variant, you can try the ready extension Search AutoComplete & Suggest Pro. Check this one http://mirasvit.com/magento-extensions/search-autocomplete-suggestions.html

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