我正在尝试逐页获取产品以进行收藏。我在下面的代码中获得了产品集合的计数。我已将页面大小设置为1,但显示的产品数量为2。请帮助我解决此问题。谢谢。
$wishlist1 = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer, true)
->setCurPage($page_num)
->setPageSize(1)
->load();
foreach($wishlist1->getItemCollection() as $product){
$_product = Mage::getModel('catalog/product')->load($product['product_id']);//product id here
echo $product['product_id'];
}
答案 0 :(得分:0)
请尝试使用以下代码:
<?php
$customer = Mage::getModel("customer/customer")->setWebsiteId(Mage::app()->getStore()->getWebsiteId())->loadByEmail('mohit@streammarket.co.uk');
$wishlistItems = Mage::getModel('wishlist/item')->getCollection()
->setWebsiteId($customer->getWebsiteId())
->setCustomerGroupId($customer->getGroupId())
->setCurPage(1)
->setPageSize(1)
->load();
?>