From 7801e0469aa18cad8b73d44572de3d236947e990 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 27 Feb 2023 16:20:02 +0530 Subject: [PATCH] Fix Stats > Stats issues --- modules/statscheckup/statscheckup.php | 11 ----------- modules/statsforecast/statsforecast.php | 2 +- modules/statsproduct/statsproduct.php | 16 ++-------------- 3 files changed, 3 insertions(+), 26 deletions(-) diff --git a/modules/statscheckup/statscheckup.php b/modules/statscheckup/statscheckup.php index 132a933bf..5192a3d48 100644 --- a/modules/statscheckup/statscheckup.php +++ b/modules/statscheckup/statscheckup.php @@ -280,17 +280,6 @@ class StatsCheckUp extends Module ); foreach ($result as $row) { - $row['stock'] = 0; - if ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($row['id_product'])) { - $bookingParams['hotel_id'] = $roomTypeInfo['id_hotel']; - $bookingParams['id_room_type'] = $row['id_product']; - if ($booking_data = $objBookingDtl->getBookingData($bookingParams)) { - if (isset($booking_data['stats']['num_avail'])) { - $row['stock'] = $booking_data['stats']['num_avail']; - } - } - } - $totals['products']++; $scores = array( 'active' => ($row['active'] ? 2 : 0), diff --git a/modules/statsforecast/statsforecast.php b/modules/statsforecast/statsforecast.php index 426ff4cf9..b4744b6c2 100644 --- a/modules/statsforecast/statsforecast.php +++ b/modules/statsforecast/statsforecast.php @@ -240,7 +240,7 @@ class StatsForecast extends Module $this->html .= ' - '.($this->context->cookie->stats_granularity == 42 ? (Tools::displayDate($row['fix_date']).' - '.Tools::displayDate($row['end_date'])) : Tools::displayDate($row['fix_date'])).' + '.($this->context->cookie->stats_granularity == 42 ? (Tools::displayDate($row['fix_date']).' - '.Tools::displayDate($row['end_date'])) : $row['fix_date']).' '.$visits_today.' '.(int)$row['registrations'].' '.(int)$row['countOrders'].' diff --git a/modules/statsproduct/statsproduct.php b/modules/statsproduct/statsproduct.php index 53aff5c72..3c03159e0 100644 --- a/modules/statsproduct/statsproduct.php +++ b/modules/statsproduct/statsproduct.php @@ -302,20 +302,8 @@ class StatsProduct extends ModuleGraph '; - $bookingParams = array(); - $bookingParams['date_from'] = $dateFrom; - $bookingParams['date_to'] = $dateTo; - foreach ($this->getProducts($this->context->language->id) as $product) { - $availRooms = 0; - if ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($product['id_product'])) { - $bookingParams['hotel_id'] = $roomTypeInfo['id_hotel']; - $bookingParams['id_room_type'] = $product['id_product']; - if ($booking_data = $objBookingDtl->getBookingData($bookingParams)) { - if (isset($booking_data['stats']['num_avail'])) { - $availRooms = $booking_data['stats']['num_avail']; - } - } - } + // get room types info + foreach ($this->getProducts() as $product) { $this->html .= '