public function editShop(Request $request, $shop_id) { $supplierId = Session::get('fs_supplier')['id']; if (is_numeric($shop_id)) { $objSupplierStore = Shop::getInstance(); $objSupplierStoreMetaData = ShopMetadata::getInstance(); $objLocationModel = Location::getInstance(); // $objReview = Reviews::getInstance();//Need to be modified later for shop reviews $whereforShop = ['rawQuery' => 'user_id =? and shop_id = ?', 'bindParams' => [$supplierId, $shop_id]]; $SupplierShopDetails = $objSupplierStore->getAllshopsWhere($whereforShop); // echo "<pre>";print_r($SupplierShopDetails);die; if ($SupplierShopDetails) { // $this->view->merchantStoreDetails = $merchantStoreDetails; $shopId = $SupplierShopDetails[0]->shop_id; $whereforShopMeta = ['rawQuery' => 'shop_id =?', 'bindParams' => [$shopId]]; $ShopMetaData = $objSupplierStoreMetaData->getAllshopsMetadataWhere($whereforShopMeta); $whereforcountry = ['rawQuery' => 'is_visible =? and location_type =? ', 'bindParams' => [0, 0]]; $allcountry = $objLocationModel->getAllLocationsWhere($whereforcountry); $whereforstate = ['rawQuery' => 'is_visible =? and location_type =? ', 'bindParams' => [0, 1]]; $allstates = $objLocationModel->getAllLocationsWhere($whereforstate); $whereforcity = ['rawQuery' => 'is_visible =? and location_type =? ', 'bindParams' => [0, 2]]; $allcities = $objLocationModel->getAllLocationsWhere($whereforcity); // $this->view->storeMetaData = $storeMetaData; $SupplierData['supplierId'] = $supplierId; $SupplierData['SupplierShopDetails'] = $SupplierShopDetails[0]; $SupplierData['ShopMetaData'] = $ShopMetaData; $SupplierData['country'] = $allcountry; $SupplierData['state'] = $allstates; $SupplierData['city'] = $allcities; // echo "<pre>";print_r($SupplierData);die; // $reviews = $objReview->getStoreReviews($shopId); $reviews = ""; // $this->view->reviews = $reviews; $r1 = $r2 = $r3 = $r4 = $r5 = 0; $rating = array($r5, $r4, $r3, $r2, $r1); $total = 0; $overAllRating = 0; if ($reviews != '') { foreach ($reviews as $key => $value) { if ($value['review_rating'] == 1) { $r1++; } elseif ($value['review_rating'] == 2) { $r2++; } elseif ($value['review_rating'] == 3) { $r3++; } elseif ($value['review_rating'] == 4) { $r4++; } elseif ($value['review_rating'] == 5) { $r5++; } } $rating = array($r5, $r4, $r3, $r2, $r1); $total = $r1 + $r2 + $r3 + $r4 + $r5; $overAllRating = (1 * $r1 + 2 * $r2 + 3 * $r3 + 4 * $r4 + 5 * $r5) / $total; $overAllRating = round($overAllRating, 1); } $reviewData['rating'] = $rating; $reviewData['total'] = $total; $reviewData['overAllRating'] = $overAllRating; } else { // $this->view->ErrorMsg = "Page you are looking for does not exist"; } return view("Supplier/Views/supplier/editShop", ['shopData' => $SupplierData], ['reviewData' => $reviewData]); } else { // $this->view->ErrorMsg = "Page you are looking for does not exist"; } return view("Supplier/Views/supplier/editShop"); }