0
產品閱讀坐落於此:Magento的1.7添加分頁熱門圖片不能正常工作
App/code/local/Mage/Reports/Block/Product/Viewed.php
我加入以下代碼:
class Mage_Reports_Block_Product_Viewed extends Mage_Reports_Block_Product_Abstract{
...
protected function _prepareLayout()
{
parent::_prepareLayout();
$toolbar = $this->getLayout()->createBlock('catalog/product_list_toolbar', microtime())
->setCollection($this->getProductCollection());
$pager = $this->getLayout()->createBlock('page/html_pager', microtime());
$toolbar->setChild('product_list_toolbar_pager', $pager);
$this->setChild('toolbar', $toolbar);
$this->getProductCollection()->load();
return $this;
}
public function getPagerHtml()
{
return $this->getChildHtml('toolbar');
}
}
我的模板應該是這樣的:
<?php if ($_products = $this->getRecentlyViewedProducts()): ?>
<!-- top pagination -->
<?php echo $this->getPagerHtml(); ?>
<?php if($_collection->getSize()): ?>
...
<?php foreach ($_collection as $_item): ?>
...
<?php endforeach; ?>
<?php endif ?>
<!-- bottom pagination -->
<?php echo $this->getPagerHtml(); ?>
<?php endif ?>
我加入的代碼不在Viewed.php
中。有人可以幫我解決這個問題嗎?
任何幫助將不勝感激。
如何在這個類中添加分頁'Mage_Reports_Block_Product_Viewed'? – 2013-05-11 03:50:34