Skip to content

Commit

Permalink
Merge pull request #56 from PrestaShop/dev
Browse files Browse the repository at this point in the history
Release version 2.1.4
  • Loading branch information
Hlavtox authored Nov 28, 2023
2 parents dacb40f + 17c26aa commit 1e126b6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand All @@ -19,6 +23,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
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>dashproducts</name>
<displayName><![CDATA[Dashboard Products]]></displayName>
<version><![CDATA[2.1.3]]></version>
<version><![CDATA[2.1.4]]></version>
<description><![CDATA[Adds a block with a table of your latest orders and a ranking of your products]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[dashboard]]></tab>
Expand Down
15 changes: 10 additions & 5 deletions dashproducts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -148,7 +148,7 @@ public function getTableRecentOrders()
'id' => 'details',
'value' => '',
'class' => 'text-right',
'wrapper_start' => '<a class="btn btn-default" href="index.php?tab=AdminOrders&id_order=' . (int) $order['id_order'] . '&vieworder&token=' . Tools::getAdminTokenLite('AdminOrders') . '" title="' . $this->trans('Details', [], 'Modules.Dashproducts.Admin') . '"><i class="icon-search"></i>',
'wrapper_start' => '<a class="btn btn-default" href="index.php?controller=AdminOrders&id_order=' . (int) $order['id_order'] . '&vieworder&token=' . Tools::getAdminTokenLite('AdminOrders') . '" title="' . $this->trans('Details', [], 'Modules.Dashproducts.Admin') . '"><i class="icon-search"></i>',
'wrapper_end' => '</a>',
];

Expand Down Expand Up @@ -221,12 +221,17 @@ 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($productCategoryId) && isset($productCategoryId['id_category_default'])) {
$productCategoryId = $productCategoryId['id_category_default'];
}
$category = new Category($productCategoryId, $this->context->language->id);

$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);
}

Expand Down Expand Up @@ -321,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,
Expand Down

0 comments on commit 1e126b6

Please sign in to comment.