/** * Finds and returns number of available attributes. * * @return int Number of available product attributes */ public function countAttributes() { if (!empty($this->attributes)) { return count($this->attributes); } if ($this->attributesCount === null) { $this->attributesCount = $this->service->countAttributes(); } return $this->attributesCount; }
/** * Displays "Right Now" meta box. */ public function rightNow() { $counts = $this->wp->wpCountPosts(Types::PRODUCT); $productCount = $counts->publish; $categoryCount = $this->wp->wpCountTerms(Types::PRODUCT_CATEGORY); $tagCount = $this->wp->wpCountTerms(Types::PRODUCT_TAG); $attributesCount = $this->productService->countAttributes(); $counts = $this->wp->wpCountPosts(Types::ORDER); $pendingCount = $counts->{Order\Status::PENDING}; $onHoldCount = $counts->{Order\Status::ON_HOLD}; $processingCount = $counts->{Order\Status::PROCESSING}; $completedCount = $counts->{Order\Status::COMPLETED}; $cancelledCount = $counts->{Order\Status::CANCELLED}; $refundedCount = $counts->{Order\Status::REFUNDED}; Render::output('admin/dashboard/rightNow', array('productCount' => $productCount, 'categoryCount' => $categoryCount, 'tagCount' => $tagCount, 'attributesCount' => $attributesCount, 'pendingCount' => $pendingCount, 'onHoldCount' => $onHoldCount, 'processingCount' => $processingCount, 'completedCount' => $completedCount, 'cancelledCount' => $cancelledCount, 'refundedCount' => $refundedCount)); }