Skip to content

Commit

Permalink
Merge pull request #32 from mageplaza/2.3-develop
Browse files Browse the repository at this point in the history
2.3 develop
  • Loading branch information
Shinichi69 authored Sep 13, 2021
2 parents 74a9393 + a981563 commit 5f1664f
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Block/Dashboard/Bestsellers.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ public function getTitle()
*/
public function canShowDetail()
{
return true;
return $this->_helperData->moduleIsEnable('Mageplaza_ReportsPro');
}
}
2 changes: 1 addition & 1 deletion Block/Dashboard/Customers.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ public function getTitle()
*/
public function canShowDetail()
{
return true;
return $this->_helperData->moduleIsEnable('Mageplaza_ReportsPro');
}
}
3 changes: 1 addition & 2 deletions Block/Dashboard/SalesByLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ protected function getDataByDateRange($startDate, $endDate, $size = null)
/** @var Collection $collection */
$collection = $this->_orderCollectionFactory->create();
$collection = $this->_helperData->addStoreFilter($collection);
$collection = $this->_helperData->addStatusFilter($collection);
$collection = $this->_helperData->addTimeFilter($collection, $startDate, $endDate);
$collection->getSelect()->join(
['soa' => $collection->getTable('sales_order_address')],
Expand Down Expand Up @@ -160,6 +159,6 @@ public function getTitle()
*/
public function canShowDetail()
{
return true;
return $this->_helperData->moduleIsEnable('Mageplaza_ReportsPro');
}
}
40 changes: 26 additions & 14 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ public function getDateRange($format = null)
$compareEndDate = null;
}
} else {
[$startDate, $endDate] = $this->getDateTimeRangeFormat('-1 month', 'now', null, $format);
list($startDate, $endDate) = $this->getDateTimeRangeFormat('-1 month', 'now', null, $format);
$days = date('z', strtotime($endDate) - strtotime($startDate));
[$compareStartDate, $compareEndDate] = $this->getDateTimeRangeFormat(
list($compareStartDate, $compareEndDate) = $this->getDateTimeRangeFormat(
'-1 month -' . ($days + 1) . ' day',
'-1 month -1 day',
null,
Expand All @@ -180,8 +180,8 @@ public function getDateRange($format = null)
}

/**
* @param $format
* @param $date
* @param null $format
* @param mixed $date
*
* @return string
* @throws Exception
Expand Down Expand Up @@ -227,8 +227,8 @@ public function getTimezone()
}

/**
* @param $startDate
* @param $endDate
* @param string $startDate
* @param string $endDate
*
* @return false|int|string
*/
Expand All @@ -243,15 +243,15 @@ public function getDaysByDateRange($startDate, $endDate)

/**
* @param AbstractCollection $collection
* @param $startDate
* @param string $startDate
* @param null $endDate
*
* @return mixed
* @throws Exception
*/
public function addTimeFilter($collection, $startDate, $endDate = null)
{
[$startDate, $endDate] = $this->getDateTimeRangeFormat($startDate, $endDate, 1);
list($startDate, $endDate) = $this->getDateTimeRangeFormat($startDate, $endDate, 1);

if ($this->_request->getParam('card_id') === 'tax') {
return $collection
Expand All @@ -265,7 +265,7 @@ public function addTimeFilter($collection, $startDate, $endDate = null)
}

/**
* @param $startDate
* @param string $startDate
* @param null $endDate
* @param int $days
* @param int $isObject
Expand All @@ -287,9 +287,9 @@ public function getPeriodsDate($startDate, $endDate = null, $days = 0, $isObject
$startDate = new \DateTime($startDate);

$interval = new DateInterval('P1D');
$daterange = new DatePeriod($startDate, $interval, $endDate);
$dateRange = new DatePeriod($startDate, $interval, $endDate);
/** @var \DateTime $date */
foreach ($daterange as $date) {
foreach ($dateRange as $date) {
if ($isObject) {
$data[$date->format('Y-m-d')] = new DataObject();
} else {
Expand Down Expand Up @@ -373,7 +373,7 @@ public function getLifetimeSales()
}

/**
* @param $startDate
* @param string $startDate
* @param null $endDate
*
* @return mixed
Expand All @@ -395,8 +395,8 @@ public function getSalesByDateRange($startDate, $endDate = null)
}

/**
* @param $startDate
* @param $endDate
* @param string $startDate
* @param string $endDate
*
* @return DataObject
* @throws LocalizedException
Expand Down Expand Up @@ -450,4 +450,16 @@ public function getConfigMobileAccessKey()
{
return $this->getConfigValue(static::CONFIG_MODULE_PATH . '/mobile/access_key');
}

/**
* Check the following modules is installed
*
* @param string $moduleName
*
* @return bool
*/
public function moduleIsEnable($moduleName)
{
return $this->_moduleManager->isEnabled($moduleName);
}
}
33 changes: 25 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# The Most Popular Magento 2 Advanced Reports extension FREE!
# Magento 2 Advanced Reports extension FREE!

**Mageplaza Magento 3 Advanced Reports** is a free extension which helps stores quickly access to advanced reports on Dashboard. As your shop grows, so is the amount of numbers you have to deal with everyday. Eventually, it would reach a point where you find yourself in dire need of a tool that can take care of the figures for you.

To facilitate the management of statistics, we proudly introduce **Magento 2 Advanced Reports extension** by Mageplaza. This module would help store admins keep their number neat and clean while enable them to see the level of progress made in comparison to the same period last month, last year and so on.
To facilitate the management of statistics, we proudly introduce **[Magento 2 Advanced Reports extension](https://www.mageplaza.com/magento-2-reports-extension/)** by Mageplaza. This module would help store admins keep their number neat and clean while enable them to see the level of progress made in comparison to the same period last month, last year and so on.


[![Latest Stable Version](https://poser.pugx.org/mageplaza/module-reports/v/stable)](https://packagist.org/packages/mageplaza/module-reports)
Expand Down Expand Up @@ -35,13 +35,21 @@ A: Yes, it can.
### ✓ Install via composer (recommend)
Run the following command in Magento 2 root folder:

With Marketing Automation (recommend):
```
composer require mageplaza/module-reports mageplaza/module-smtp
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
```

Without Marketing Automation:
```
composer require mageplaza/module-reports
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
```

## 4. Mageplaza Advanced Reports features
## 4. Magento 2 Advanced Reports features

### New advanced reports

Expand Down Expand Up @@ -93,7 +101,7 @@ On the **Magento 2 dashboard**, store admins can drag and drop to move report ar
![Magento 2 dashboard extension](https://i.imgur.com/cLbXk6G.gif)


## 5. More Advanced Reports features
## 5. More Magento 2 Reports features

### Friendly presentation

Expand Down Expand Up @@ -125,7 +133,7 @@ Advanced Reports extension is compatible with many [other Mageplaza products](ht
- Drag and drop to arrange report layouts
- Adjust report boards’ sizes by pulling double arrows

## 7. How to configure Advanced Reports extension
## 7. How to configure Magento 2 Reports extension

First, you need to enable the module. Login to Magento backend, then on the admin panel choose **Store > Settings > Configuration > Mageplaza Extensions > Reports**.

Expand Down Expand Up @@ -182,22 +190,31 @@ In the Dashboard, you can:
- [Magento 2 Layered Navigation](https://github.com/mageplaza/magento-2-ajax-layered-navigation)
- [Magento 2 security extension](https://github.com/mageplaza/magento-2-security)

**Other extensions on Our store:**
- [Magento 2 Google Tag Manager](https://www.mageplaza.com/magento-2-google-tag-manager/)
- [Magneto 2 Store Locator](https://www.mageplaza.com/magento-2-store-locator-extension/)
- [Magento 2 customer attributes](https://www.mageplaza.com/magento-2-customer-attributes/)
- [Magento 2 Ajax Cart module](https://www.mageplaza.com/magento-2-quick-view/)
- [Magento 2 Store Pickup Module](https://www.mageplaza.com/magento-2-store-pickup-extension/)
- [Magento 2 Google Map](https://www.mageplaza.com/magento-2-google-maps/)
- [Magento 2 Sorting extension](https://www.mageplaza.com/magento-2-better-sorting/)
- [Magento 2 Google Analytics](https://www.mageplaza.com/magento-2-google-analytics-pro/)

**The Most Popular Magento 2 Advanced Reports extension FREE**
- [Advanced Reports Documentation](#1-advanced-reports-documentation)
- [Advanced Reports FAQs](#2-advanced-reports-faqs)
- [How to install Magento 2 Advanced Reports extension](#3-how-to-install-magento-2-advanced-reports-extension)
- [Mageplaza Advanced Reports features](#4-mageplaza-advanced-reports-features)
- [Magento 2 Advanced Reports features](#4-magento-2-advanced-reports-features)
- [New advanced reports](#new-advanced-reports)
- [Customizable report period & report comparison](#customizable-report-period--report-comparison)
- [Line-chart reports](#line-chart-reports)
- [Flexible reports dashboard layouts](#flexible-reports-dashboard-layouts)
- [More Advanced Reports features](#5-more-advanced-reports-features)
- [More Magento 2 Reports features](#5-more-magento-2-reports-features)
- [Friendly presentation](#friendly-presentation)
- [Rates & Changes](#rates--changes)
- [Enhance default reports](#enhance-default-reports)
- [Full Magento 2 Advanced Reports features](#6-full-magento-2-advanced-reports-features)
- [How to configure Advanced Reports extension](#7-how-to-configure-advanced-reports-extension)
- [How to configure Magento 2 Reports extension](#7-how-to-configure-magento-2-reports-extension)
- [Advanced Reports General Configuration](#advanced-reports-general-configuration)
- [Quick report outside the Dashboard](#quick-report-outside-the-dashboard)

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"mageplaza/module-core": "^1.4.5"
},
"type": "magento2-module",
"version": "1.4.0",
"version": "1.4.1",
"license": "proprietary",
"authors": [
{
Expand Down
3 changes: 3 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Module Enable</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<comment><![CDATA[Select <b>Yes</b> to enable this module.<br />
1. It helps to reduce abandonment cart with <a href="https://www.mageplaza.com/magento-2-one-step-checkout-extension/" target="_blank">One Step Checkout</a>. <br />
2. Magento stores see upwards of 30% revenue 💰 with AVADA. <a href="https://go.avada.io/mageplaza">Learn more</a>]]></comment>
</field>
<field id="dashboard_enabled" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Dashboard</label>
Expand Down

0 comments on commit 5f1664f

Please sign in to comment.