我有这个代码,我需要一些帮助来为这段代码添加分页。
function __construct() {
$category = Mage::getModel('catalog/category');
$products = Mage::getResourceModel('catalog/product_collection')
->AddAttributeToSelect('name')
->addAttributeToSelect('price')
->addFinalPrice()
->addAttributeToSelect('small_image')
->addAttributeToSelect('image')
->addAttributeToSelect('thumbnail')
->addUrlRewrite()
->AddCategoryFilter($category);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);
$currencyCode = Mage::app()->getStore()->getBaseCurrencyCode();
foreach($products as $product){
echo $product->getId()."<br>";
echo $product->getName()."<br>";
echo Mage::helper('core')->currency($product->getPrice(), true, false)."<br>"; //." ".$currencyCode,
echo $product->getProductUrl()."<br>";
echo "<img src='".(string)Mage::helper('catalog/image')->init($product, 'thumbnail')."' alt='product'><br><hr>";
}
}
如何添加分页?谢谢)