Example #1
0
 /**
  * @param $threshold int Threshold where to assume product is low in stock.
  * @param $number int Number of products to find.
  * @return array List of products that are low in stock.
  */
 public function findLowStock($threshold, $number)
 {
     if (!isset($this->queries['low_stock_' . $threshold])) {
         $this->queries['low_stock_' . $threshold] = $this->service->findLowStock($threshold, $number);
     }
     return $this->queries['low_stock_' . $threshold];
 }
Example #2
0
 /**
  * Displays "Stock Report" meta box.
  */
 public function stockReport()
 {
     $lowStockThreshold = $this->options->get('advanced.low_stock_threshold', 2);
     $notifyOufOfStock = $this->options->get('advanced.notify_out_of_stock', true);
     $number = $this->options->get('advanced.dashboard_stock_number', 5);
     $outOfStock = array();
     if ($notifyOufOfStock) {
         $outOfStock = $this->productService->findOutOfStock($number);
     }
     $lowStock = $this->productService->findLowStock($lowStockThreshold, $number);
     Render::output('admin/dashboard/stockReport', array('notifyOutOfStock' => $notifyOufOfStock, 'outOfStock' => $outOfStock, 'lowStock' => $lowStock));
 }