From e3a2b841a321a70cdcb17427f78cfebb80474852 Mon Sep 17 00:00:00 2001 From: Maxime Flasquin Date: Tue, 11 Apr 2023 21:09:27 +0200 Subject: [PATCH 1/8] Fix category retrive for bestsellers --- dashproducts.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dashproducts.php b/dashproducts.php index 8b4be2c..78a13b7 100755 --- a/dashproducts.php +++ b/dashproducts.php @@ -221,7 +221,12 @@ public function getTableBestSellers($date_from, $date_to) if (!Validate::isLoadedObject($product_obj)) { continue; } - $category = new Category($product_obj->getDefaultCategory()['id_category_default'], $this->context->language->id); + + $productCategoryId = $product_obj->getDefaultCategory(); + if (is_array($product_obj->getDefaultCategory()) && isset($product_obj->getDefaultCategory()['id_category_default'])) { + $productCategoryId = $product_obj->getDefaultCategory()['id_category_default']; + } + $category = new Category($productCategoryId, $this->context->language->id); $img = ''; if (($row_image = Product::getCover($product_obj->id)) && $row_image['id_image']) { From d1722adb2dfd7878f9afd9e7a24a8e5ea7da89bf Mon Sep 17 00:00:00 2001 From: Maxime Flasquin Date: Wed, 19 Apr 2023 11:44:45 +0200 Subject: [PATCH 2/8] Update dashproducts.php Co-authored-by: Daniel Hlavacek --- dashproducts.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dashproducts.php b/dashproducts.php index 78a13b7..8f43848 100755 --- a/dashproducts.php +++ b/dashproducts.php @@ -223,8 +223,8 @@ public function getTableBestSellers($date_from, $date_to) } $productCategoryId = $product_obj->getDefaultCategory(); - if (is_array($product_obj->getDefaultCategory()) && isset($product_obj->getDefaultCategory()['id_category_default'])) { - $productCategoryId = $product_obj->getDefaultCategory()['id_category_default']; + if (is_array($productCategoryId) && isset($productCategoryId['id_category_default'])) { + $productCategoryId = $productCategoryId['id_category_default']; } $category = new Category($productCategoryId, $this->context->language->id); From 4ef783336806a8617b69dd5f05d2958d91414f1c Mon Sep 17 00:00:00 2001 From: justeen35 Date: Mon, 29 May 2023 10:09:25 +0200 Subject: [PATCH 3/8] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ecb5119..a14d69c 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,6 @@ Just make sure to follow our [contribution guidelines][contribution-guidelines]. This module is released under the [Academic Free License 3.0][AFL-3.0] [report-issue]: https://github.com/PrestaShop/PrestaShop/issues/new/choose -[prestashop]: https://www.prestashop.com/ +[prestashop]: https://www.prestashop-project.org/ [contribution-guidelines]: https://devdocs.prestashop.com/1.7/contribute/contribution-guidelines/project-modules/ [AFL-3.0]: https://opensource.org/licenses/AFL-3.0 From 175b61c10eaa4599d291c49c91ed09887ae50a00 Mon Sep 17 00:00:00 2001 From: florine2623 <16019289+florine2623@users.noreply.github.com> Date: Thu, 6 Jul 2023 11:25:21 +0200 Subject: [PATCH 4/8] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a14d69c..9101bc6 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ Enrich your stats, display a table of your latest orders and a ranking of your products. +## Compatibility + +PrestaShop: `1.7.6.0` or later + ## Reporting issues You can report issues with this module in the main PrestaShop repository. [Click here to report an issue][report-issue]. From 2c1eb5d316a48ffb7f1bc43e64ac9b1e524b0603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hlav=C3=A1=C4=8Dek?= Date: Thu, 23 Nov 2023 14:14:59 +0100 Subject: [PATCH 5/8] Update dashproducts.php --- dashproducts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashproducts.php b/dashproducts.php index 8f43848..f99dd59 100755 --- a/dashproducts.php +++ b/dashproducts.php @@ -148,7 +148,7 @@ public function getTableRecentOrders() 'id' => 'details', 'value' => '', 'class' => 'text-right', - 'wrapper_start' => '', + 'wrapper_start' => '', 'wrapper_end' => '', ]; From 5a029a8393e4ecdfb25647f21a4e355855a1516a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hlav=C3=A1=C4=8Dek?= Date: Thu, 23 Nov 2023 14:22:32 +0100 Subject: [PATCH 6/8] Update dashproducts.php --- dashproducts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashproducts.php b/dashproducts.php index 8f43848..3eb17b4 100755 --- a/dashproducts.php +++ b/dashproducts.php @@ -33,7 +33,7 @@ public function __construct() { $this->name = 'dashproducts'; $this->tab = 'administration'; - $this->version = '2.1.3'; + $this->version = '2.1.4'; $this->author = 'PrestaShop'; parent::__construct(); From d043d8ad1a0d0a1ba7c4f468f6cbb77a0ce2710c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hlav=C3=A1=C4=8Dek?= Date: Thu, 23 Nov 2023 14:23:10 +0100 Subject: [PATCH 7/8] Update config.xml --- config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.xml b/config.xml index c03cd01..1b73f53 100644 --- a/config.xml +++ b/config.xml @@ -2,7 +2,7 @@ dashproducts - + From 05234b659cdb7fee698b74e28217e129c7259781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hlav=C3=A1=C4=8Dek?= Date: Thu, 23 Nov 2023 16:12:01 +0100 Subject: [PATCH 8/8] Fallback on a previous version of constant --- dashproducts.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dashproducts.php b/dashproducts.php index 8f43848..0d11b29 100755 --- a/dashproducts.php +++ b/dashproducts.php @@ -231,7 +231,7 @@ public function getTableBestSellers($date_from, $date_to) $img = ''; if (($row_image = Product::getCover($product_obj->id)) && $row_image['id_image']) { $image = new Image((int) $row_image['id_image']); - $path_to_image = _PS_PROD_IMG_DIR_ . $image->getExistingImgPath() . '.' . $this->context->controller->imageType; + $path_to_image = (defined('_PS_PRODUCT_IMG_DIR_') ? _PS_PRODUCT_IMG_DIR_ : _PS_PROD_IMG_DIR_) . $image->getExistingImgPath() . '.' . $this->context->controller->imageType; $img = ImageManager::thumbnail($path_to_image, 'product_mini_' . $row_image['id_image'] . '.' . $this->context->controller->imageType, 45, $this->context->controller->imageType); } @@ -326,7 +326,7 @@ public function getTableMostViewed($date_from, $date_to) $img = ''; if (($row_image = Product::getCover($product_obj->id)) && $row_image['id_image']) { $image = new Image((int) $row_image['id_image']); - $path_to_image = _PS_PROD_IMG_DIR_ . $image->getExistingImgPath() . '.' . $this->context->controller->imageType; + $path_to_image = (defined('_PS_PRODUCT_IMG_DIR_') ? _PS_PRODUCT_IMG_DIR_ : _PS_PROD_IMG_DIR_) . $image->getExistingImgPath() . '.' . $this->context->controller->imageType; $img = ImageManager::thumbnail( $path_to_image, 'product_mini_' . $product_obj->id . '.' . $this->context->controller->imageType,