Question

We are using custom module to show "Search suggestion results". Those results were displaying in all pages.

but now "Search suggestion results" are not displaying only in home page in chrome & other browsers, but working in mozilla firefox....

Edit

system.log : Notice: Undefined variable: entityId in line $newProduct = Mage::getModel('catalog/product')->load($entityId); below is full code :

<?php

$catalogSearchHelper =  $this->helper('catalogsearch');
$catalogSearchHelper->getEscapedQueryText();
$url = $catalogSearchHelper->getResultUrl($catalogSearchHelper->getEscapedQueryText());
$_productCollection = $this->getProductCollection();
$_productCount = $_productCollection->count();
$_helper = $this->helper('catalog/output');
?>
<?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>

<?php $target = Mage::helper('searchsuggest')->getTarget(); ?>

<?php if($this->getMode() == 'list'): ?>
    <?php // List Mode ?>
    <ul class="products-list">
        <li id="autocomplete_hidden" class="autocomplete_hidden"><span style="text-align:center;"></li>
        <?php if($_productCount == 0): ?>
            <li class="notice-message"><?php echo Mage::helper('searchsuggest')->getNoticeMessage(); ?></li>
        <?php endif; ?>
        <?php $counter = 0;foreach ($_productCollection as $_product): ?>
            <?php
            if(!$_product->getSku()){
                $newProduct = Mage::getModel('catalog/product')->load($entityId);
                $sku = $newProduct->getSku();
                $_product->setData("sku",$sku);
            }
            $session=Mage::getSingleton('customer/session');
            if($_product->getMinimalPrice()){
                $_productprice = $_product->getMinimalPrice();
            }else{
                $_productprice = $_product->getFinalPrice();
            }
            if($session->isLoggedIn()){
                $groupPrices = $_product->getData('group_price');
                if(isset($groupPrices[$session->getCustomerGroupId()])){
                    $_productprice = $groupPrices[$session->getCustomerGroupId()]['price'];
                }
            }
            ?>
            <li class="<?php echo (++$counter + 1)%2?'odd':'even'?><?php if($counter==1){ echo ' first';}elseif($counter==$_productCollection->count()){ echo ' last';}  ?>">
                <a href="<?php echo $_product->getProductUrl(); ?>" target="<?php echo $target; ?>" style="text-decoration:none;">
                   <!-- <div class="img-box-area">
                        <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(80, 80); ?>" width="80" height="80" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"/>
                    </div>-->
                    <div class="content-box-area">
                        <h3><?php echo $_product->getName(); ?></h3>
                        <!--<p style="font-size:0.9em;line-height:1.4em;margin:2px 0 0;"></p>-->
                        <!--<div class="std">
                            <?php //echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
                        </div>-->
                        <!--
                        <div class="no-border price-box">
                            <span id="product-price-16" class="regular-price">
                                <span class="price-label"><?php // echo $this->__('Price:') ?></span>
                                <span class="price"><?php //echo Mage::helper('core')->currencyByStore($_productprice) ?></span>
                            </span>
                        </div>
                        -->
                        <!--<?php if($_product->getTypeID()=='bundle'): ?>
                        <div class="auto-fright" style="">
                        <div class="price-box">
                            <p class="price-from">
                                <span class="price-label">From:</span>
                                <span class="price"><?php  echo Mage::helper('core')->currencyByStore($_product->getMinPrice()) ?></span>
                            </p>
                            <p class="price-to">
                                <span class="price-label">To:</span>
                                <span class="price"><?php  echo Mage::helper('core')->currencyByStore($_product->getMaxPrice()) ?></span>
                            </p>
                        </div>
                           </div>
                        <?php else: ?>
                         <div class="auto-fright" style="">
                        <?php echo $this->getPriceHtml($_product, true) ?>
                         </div>
                        <?php endif; ?>-->
                        </div>
                    <div class="clear"></div>
                </a>
            </li>
            <?php //print_r($_product->getData()); ?>
        <?php endforeach; ?>
        <?php //exit; ?>
    </ul>
    <?php  if($_productCount): ?>
        <div align="center"><a href="<?php echo $url ?>">View All</a></div>
    <?php endif; ?>   

Edit 2

Issue is because of Banner slider that we are using in top , only in home page, once i disabled that module, now "Autocomplete serach suggestion" is working in all browsers, but is there any way to fix by enabling that module as it is already working in mozilla firefox....

Was it helpful?

Solution

You need to replace this line,

$newProduct = Mage::getModel('catalog/product')->load($entityId);

with

$newProduct = Mage::getModel('catalog/product')->load($_product->getEntityId());
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top