public function actionView($categoryslug, $productslug) { $categoryData = ProductCategories::find()->where(["slug" => $categoryslug])->asArray()->one(); $productData = Products::find()->where(["slug" => $productslug])->with(["productToppings", "productImages"])->asArray()->one(); $tagData = ProductTagProducts::find()->where(["product_id" => $productData["id"]])->with(["tag"])->asArray()->all(); $orderProducts = new OrderProducts(); return $this->render("view", ["categoryData" => $categoryData, "productData" => $productData, "tagData" => $tagData, "topSelling" => $orderProducts->getTopSellingProducts(9)]); }
public function actionIndex() { $orderProducts = new OrderProducts(); $productCategories = new ProductCategories(); return $this->render('index', ["slider" => Slider::find()->orderBy('ordering ASC')->asArray()->all(), "topSelling" => $orderProducts->getTopSellingProducts(9), "categoryProducts" => $productCategories->getCatLowCostProducts()]); }