Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. //$cateinstance is the instance of MagentoCatalogModelCategoryFactory
  2. $collection = $cateinstance->create()->load($cateid)->getProductCollection()->addAttributeToSelect('*')
  3.  
  4. $collection->addAttributeToSort('price', 'ASC');
  5.  
  6. $collection
  7. ->setPageSize(1) // only get 10 products
  8. ->setCurPage(1);
  9.  
  10. $lowest_price_product = $collection->getFirstItem();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement