public function showMyCategoryAnalytics() { $categories = $this->categories_repo->getCategories(); $analytics = $this->analytics_repo->getCategoryAnalytics(); $admin_analytics = []; if (!empty($analytics['_users'][\AuthMgr::getLoggedUserId()])) { $admin_analytics = $analytics['_users'][\AuthMgr::getLoggedUserId()]; } return View::make('category-analytics', ['header_title' => 'My Category Analytics', 'categories' => $categories, 'analytics' => $admin_analytics]); }
/** * When a product has been added to cart */ public function onCartAdded($product_id, $product_user_id) { if (empty($product_id)) { throw new \InvalidArgumentException(); } if ($product_user_id == \AuthMgr::getLoggedUserId()) { return; } $this->recordInteraction($this->cart_add_add_type_id, $product_id); }
public function showMyRecommendations($page = 1) { $items_per_page = 15; $filters = [['filter' => 'TermFilter', 'params' => ['field' => 'user_id', 'value' => \AuthMgr::getLoggedUserId()]]]; $fetcher_response = $this->prod_suite_fetcher->filterProducts(($page - 1) * $items_per_page, $items_per_page, $filters); $pagination_html = ''; //if there are results, generate pagination if (!empty($fetcher_response['results'])) { $this->paginator->setUrl(\Request::url(), '/(:num)')->setItems($fetcher_response['meta']['total_hits'], $items_per_page)->setPage($page); //make pagination html $pagination_html = \HTML::paginatorHTML($this->paginator->toArray()); } return \View::make('my-recommendations')->with('products', $fetcher_response['results'])->with('pagination_html', $pagination_html); }