Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Wrong process for the hotel name for 'most viewed' room types for dashboard in the back-office. #1248

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions modules/dashproducts/dashproducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public function getTableBestSellers($date_from, $date_to, $id_hotel)
(!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();
Expand Down Expand Up @@ -366,6 +366,7 @@ public function getTableMostViewed($date_from, $date_to, $id_hotel)
$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)) {
Expand All @@ -379,8 +380,8 @@ public function getTableMostViewed($date_from, $date_to, $id_hotel)
$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(
Expand Down