From 033b3c5ddd8b9cdac09a4d259176808d900c2972 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 25 Sep 2024 17:17:38 +0530 Subject: [PATCH] Fixed: hotel names not available for some of the most view room types in dashboard --- modules/dashproducts/dashproducts.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/dashproducts/dashproducts.php b/modules/dashproducts/dashproducts.php index c51bf7301..d71187b31 100644 --- a/modules/dashproducts/dashproducts.php +++ b/modules/dashproducts/dashproducts.php @@ -262,7 +262,7 @@ class DashProducts extends Module (!is_null($id_hotel) ? HotelBranchInformation::addHotelRestriction($id_hotel, 'hbd') : '').' GROUP BY hbd.`id_product` ORDER BY `sales` DESC - LIMIT '.(int) Configuration::get('DASHPRODUCT_NBR_SHOW_BEST_SELLER', 10) + LIMIT '.(int) Configuration::get('DASHPRODUCT_NBR_SHOW_BEST_SELLER') ); $body = array(); @@ -366,6 +366,7 @@ class DashProducts extends Module $products = $this->getTotalViewed($date_from, $date_to, (int)Configuration::get('DASHPRODUCT_NBR_SHOW_MOST_VIEWED'), $id_hotel); $body = array(); if (is_array($products) && count($products)) { + $objHotelRoomType = new HotelRoomType(); foreach ($products as $product) { $product_obj = new Product((int)$product['id_object'], true, $this->context->language->id); if (!Validate::isLoadedObject($product_obj)) { @@ -379,8 +380,8 @@ class DashProducts extends Module $img = ImageManager::thumbnail($path_to_image, 'product_mini_'.$product_obj->id.'.'.$this->context->controller->imageType, 45, $this->context->controller->imageType); } - $objHotelRoomType = new HotelRoomType($product_obj->id); - $objHotelBranch = new HotelBranchInformation($objHotelRoomType->id_hotel, $this->context->language->id); + $roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($product_obj->id); + $objHotelBranch = new HotelBranchInformation($roomTypeInfo['id_hotel'], $this->context->language->id); $tr = array(); $tr[] = array(