Reputation: 175
im trying to show a list of products and i whant to filter so the 2 first products in my collection dosent show and control how meny products that will be loaded . The product are filterd by our_reviews and sorted by reviewdate. I want the first and second of the result to not show and start showing product 3 and so on.
This is what i have so far
$_productCollection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->addAttributeToFilter('our_reviews', array('neq' => ''))
->setOrder('reviewdate','DESC')
->setPage(1,10)
->load();
?>
Upvotes: 1
Views: 50
Reputation: 121
The following thread walks through how to limit the number of products returned in a product collection:
magento limiting number of returned items in product collection call
If you want to skip the first two products, that's easiest to do in your loop. Something like this would work:
<?php $skiptwo = 0; ?>
<?php foreach ($_productCollection as $_product): ?>
<?php if ($skiptwo < 2):
<?php $skiptwo++; ?>
<?php else: ?>
<?php echo $_product->getName() //do all the stuff you want here
<?php endif; ?>
<?php endforeach; ?>
Upvotes: 1