/** * @param $number int Number of products to find. * @return array List of products that are out of stock. */ public function findOutOfStock($number) { if (!isset($this->queries['out_of_stock'])) { $this->queries['out_of_stock'] = $this->service->findOutOfStock($number); } return $this->queries['out_of_stock']; }
/** * 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)); }