Example #1
0
 /**
  * @param int $userId
  * @param int $offset
  * @param int $limit
  * @return bool
  */
 public function getDiscountProduct($userId = 0, $offset = 0, $limit = KACANA_HOMEPAGE_ITEM_PER_TAG)
 {
     $productModel = new productModel();
     $userProductLike = new userProductLikeModel();
     $products = $productModel->getDiscountProduct($offset, $limit);
     foreach ($products as &$product) {
         if ($userId) {
             $product->isLiked = $userProductLike->getItem($userId, $product->id) ? true : false;
         }
         $this->formatProductProperties($product);
     }
     return $products;
 }