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....


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


$catalogSearchHelper =  $this->helper('catalogsearch');
$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): ?>
                $newProduct = Mage::getModel('catalog/product')->load($entityId);
                $sku = $newProduct->getSku();
                $_productprice = $_product->getMinimalPrice();
                $_productprice = $_product->getFinalPrice();
                $groupPrices = $_product->getData('group_price');
                    $_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 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 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>
                        <!--<?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 class="price-to">
                                <span class="price-label">To:</span>
                                <span class="price"><?php  echo Mage::helper('core')->currencyByStore($_product->getMaxPrice()) ?></span>
                        <?php else: ?>
                         <div class="auto-fright" style="">
                        <?php echo $this->getPriceHtml($_product, true) ?>
                        <?php endif; ?>-->
                    <div class="clear"></div>
            <?php //print_r($_product->getData()); ?>
        <?php endforeach; ?>
        <?php //exit; ?>
    <?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....

  • on home page search result comes after some time but not able to populate into autocomplete frame. may be js issue Jan 17, 2017 at 6:29
  • @GopalPatel but there is no console errors..... also please check edit part in question..... Jan 17, 2017 at 6:32
  • Why you are using $entityId and you can write this code more optimize Jan 17, 2017 at 6:45
  • @GopalPatel that is the kodematix extension we using Jan 17, 2017 at 6:47
  • provide block, controller and template code Jan 17, 2017 at 6:52

1 Answer 1


You need to replace this line,

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


$newProduct = Mage::getModel('catalog/product')->load($_product->getEntityId());
  • i updated your code in demo site , sorry that didt worked for me..... cleared cache, tried in private window..... link Jan 17, 2017 at 6:26
  • dubug the data of $_product object, In which key you get product-Id. Jan 17, 2017 at 6:28
  • its working fine in mozilla firefox but not in other browsers like chrome & opera..... Jan 17, 2017 at 9:09
  • this is the php script, that not depend on browser. For browser you need to check some css issue may be there. Jan 17, 2017 at 9:16
  • please check edit 2 part in question..... Jan 17, 2017 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.