/** * Get Products from the Category with Paging * * @param int $page * @param int $itemsPerPage * @param array $sort * @return \Zend_Paginator * @throws \Zend_Paginator_Exception */ public function getProductsPaging($page = 0, $itemsPerPage = 10, $sort = array("name" => "name", "direction" => "asc")) { $list = new Object\CoreShopProduct\Listing(); $list->setCondition("enabled = 1 AND categories LIKE '%," . $this->getId() . ",%'"); $list->setOrderKey($sort['name']); $list->setOrder($sort['direction']); $paginator = \Zend_Paginator::factory($list); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($itemsPerPage); return $paginator; }
/** * Get latest Products * * @param int $limit * @return array|mixed */ public static function getLatest($limit = 8) { $cacheKey = "coreshop_latest"; if (!($objects = \Pimcore\Model\Cache::load($cacheKey))) { $list = new Object\CoreShopProduct\Listing(); $list->setCondition("enabled=1"); $list->setOrderKey("o_creationDate"); $list->setOrder("DESC"); $objects = $list->getObjects(); } return $objects; }