to creating custom toolbar in magento get error Call to a member function setCurPage() on a non-object -


i display manufacturer image slider on home page block. there put view link, on clicking link display manufacurer in new pahe category page. created manufacturer.php under

<?php class bc_manufacturer_block_manufacturerpage extends mage_core_block_template { public function _preparelayout() {     return parent::_preparelayout(); }  public function getmanufacturer()      {      if (!$this->hasdata('manufacturer')) {         $this->setdata('manufacturer', mage::registry('manufacturer'));     }     return $this->getdata('manufacturer');     } public function gettoolbarhtml() {      $this->settoolbar($this->getlayout()->createblock('catalog/product_list_toolbar', 'toolbar'));      $toolbar = $this->gettoolbar();      $toolbar->enableexpanded();      $toolbar->setavailableorders(array(              'ordered_qty' => $this->__('position'),              'name' => $this->__('name'),              'price' => $this->__('price')          ))          ->setdefaultdirection('desc')          ->setcollection($this->_productcollection);       $pager = $this->getlayout()->createblock('page/html_pager', 'pager');      $pager->setcollection($this->_productcollection);      $toolbar->setchild('product_list_toolbar_pager', $pager);      return $toolbar->_tohtml();  }  } 

also call gettoolbarhtml() function in manufacurerpage.phtml file under gettoolbarhtml() ?>

    <div class="grid-type-full">         <?php foreach($maufacturers $manufacturer): ?>             <?php if(mage::getmodel('eav/entity_attribute_source_table')->setattribute(mage::getmodel('eav/entity_attribute')->load(mage::getmodel('eav/entity_attribute')->getidbycode('catalog_product',"manufacturer")))->getoptiontext($manufacturer->getmenufecturername())): ?>                  <?php if ($i++%$_columncount==0): ?>                     <ul class="products-grid">                 <?php endif ?>                         <li style="position: relative; float: left; display: inline-block; " class="item<?php if(($i-1)%$_columncount==0): ?> first<?php elseif($i%$_columncount==0): ?> last<?php endif; ?>">                             <a href="<?php echo $this->getbaseurl()."catalogsearch/advanced/result/?manufacturer[]=".$manufacturer->getmenufecturername() ?>">                                 <?php echo $this->getlayout()->createblock('core/template')->setmanufacturerimage($manufacturer->getfilename())->setlegend($manufacturer->getlegend())->setlistpageflag(1)->settemplate('manufacturer/manufacturer_resize.phtml')->tohtml(); ?>                                 <div class="manufacturer-name">                                     <?php echo mage::getmodel('eav/entity_attribute_source_table')->setattribute(mage::getmodel('eav/entity_attribute')->load(mage::getmodel('eav/entity_attribute')->getidbycode('catalog_product',"manufacturer")))->getoptiontext($manufacturer->getmenufecturername()) ?>                                 </div>                             </a>                         </li>                  <?php if ($i%$_columncount==0 && $i!=count($maufacturers)): ?>                     </ul>                 <?php endif ?>             <?php endif ?>         <?php endforeach ?>         <script type="text/javascript">decorategeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>     </div>  <div class="toolbar-bottom">     <?php echo $this->gettoolbarhtml() ?> </div> 

after run got error under

fatal error: call member function setcurpage() on non-object in c:\wamp\www\magento\jumbostore\app\code\core\mage\catalog\block\product\list\toolbar.php on line 225

any 1 have solution please me...

thank you..

though late response , had faced similar issue , found out setcollection() not getting product collection.

you can find code @ path app\code\core\mage\catalog\block\product\list\toolbar.php @ around line no 221.

 <?php    public function setcollection($collection) {     $this->_collection = $collection;      $this->_collection->setcurpage($this->getcurrentpage()); //*****here      // need set pagination if passed value integer , more 0     $limit = (int)$this->getlimit();     if ($limit) {         $this->_collection->setpagesize($limit);     }     if ($this->getcurrentorder()) {         $this->_collection->setorder($this->getcurrentorder(), $this->getcurrentdirection());     }     return $this; } ?> 

please try checking whether function getting collection or not. hope help!!!


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -