public function getListProductFeature($setting) { $data['products'] = array(); if (!$setting['limit']) { $setting['limit'] = 4; } if (!empty($setting['product'])) { $products = array_slice($setting['product'], 0, (int) $setting['limit']); foreach ($products as $product_id) { $product = new Product(); $product_info = $product->getProduct($product_id); $data['products'][] = array('product_id' => $product_info['product_id'], 'thumb' => 'assets/image/' . $product_info['image'], 'name' => $product_info['name'], 'description' => substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, (int) \Yii::$app->params['config_product_description_length']) . '..', 'price' => $product_info['price'], 'special' => $product_info['special'], 'rating' => $product_info['rating'], 'href' => 'product/product/' . 'product_id=' . $product_info['product_id']); } } return $data; }
public function getBestSellerProducts() { $product_data = array(); $order = new OrderProduct(); $data = $order->getAllBestSellerProducts(12); $product = new Product(); $count = 0; foreach ($data as $result) { $info = $product->getProduct($result['product_id']); $product_data[$count]['product_id'] = $result['product_id']; $product_data[$count]['thumb'] = 'assets/image/' . $info['image']; $product_data[$count]['name'] = $info['image']; $product_data[$count]['description'] = $info['description']; $product_data[$count]['price'] = $info['price']; $product_data[$count]['special'] = $info['special']; $product_data[$count]['rating'] = $info['rating']; $product_data[$count]['href'] = 'product/product/' . 'product_id=' . $info['product_id']; $count++; } return $product_data; }