Skip to content

Commit

Permalink
MySQL 5.7 fixes and tweaks to other widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
bymayo committed Jan 4, 2019
1 parent e7dcbc3 commit 5e030eb
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 87 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Commerce Widgets Changelog

## 2.0.10 - 2019-01-04
### Fixed
- `groupBy` issue with MySQL 5.7 on some widgets
- Week was showing incorrectly in the Goal widget
- Installing the plugin now populates the cache setting by default

### Changed
- When no elements exist on a widget they now show a message

## 2.0.9 - 2018-10-30
### Added
- *New Widget* Top Products Widget - See your top products ordered by Revenue or # Ordered
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bymayo/commerce-widgets",
"description": "Insightful dashboard widgets for your Craft Commerce 2 store.",
"type": "craft-plugin",
"version": "2.0.9",
"version": "2.0.10",
"keywords": [
"craft",
"cms",
Expand Down
136 changes: 60 additions & 76 deletions releases.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,62 @@
[
{
"version": "1.0.8",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/craft-2.zip",
"date": "2018-10-30T13:25:28.418Z",
"notes": [
"[Fixed] Completed carts figure incorrect - https://github.com/bymayo/craft-commerce-widgets/issues/11"
]
}
{
"version": "1.0.7",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/craft-2.zip",
"date": "2018-05-25T13:25:28.418Z",
"notes": [
"[Improved] Updated Icons & Branding"
]
},
{
"version": "1.0.6",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/craft-2.zip",
"date": "2018-03-08T17:03:00+00:00",
"notes": [
"[Added] Added 'All' to TotalRevenueOrdersWidget",
"[Improved] Moved Craft 2 version to seperate branch (Craft 3 version coming soon...)"
]
},
{
"version": "1.0.5",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2017-02-09T17:03:00+00:00",
"notes": [
"[Fixed] Incorrect limit on Cart Abadonment widget (Thanks terryupton! [Again!])",
"[Improved] Removed left over debugging in JS",
"[Improved] Changed colour of Cart Abanadoment widget chart"
]
},
{
"version": "1.0.4",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2017-02-09T17:03:00+00:00",
"notes": [
"[Fixed] Incorrect year on Total Revenue widget (Thanks terryupton!)"
]
},
{
"version": "1.0.3",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2016-09-19T17:03:00+00:00",
"notes": [
"[Added] Top Customers widget"
]
},
{
"version": "1.0.2",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2016-09-19T11:57:00+00:00",
"notes": [
"[Improved] Cart Abanadonment widget graph now has a 'No Results' state"
]
},
{
"version": "1.0.1",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2016-09-19T11:42:00+00:00",
"notes": [
"[Fixed] Fixed Cart Abandonment widget numbers",
"[Improved] Cart Abandonment widget colours. Now easier to see which value is completed"
]
},
{
"version": "1.0.0",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2016-09-02T19:42:00+00:00",
"notes": [
"[Added] Initial release"
]
}
{
"version": "1.0.6",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/craft-2.zip",
"date": "2018-03-08T17:03:00+00:00",
"notes": [
"[Added] Added 'All' to TotalRevenueOrdersWidget",
"[Improved] Moved Craft 2 version to seperate branch (Craft 3 version coming soon...)"
]
},
{
"version": "1.0.5",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2017-02-09T17:03:00+00:00",
"notes": [
"[Fixed] Incorrect limit on Cart Abadonment widget (Thanks terryupton! [Again!])",
"[Improved] Removed left over debugging in JS",
"[Improved] Changed colour of Cart Abanadoment widget chart"
]
},
{
"version": "1.0.4",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2017-02-09T17:03:00+00:00",
"notes": [
"[Fixed] Incorrect year on Total Revenue widget (Thanks terryupton!)"
]
},
{
"version": "1.0.3",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2016-09-19T17:03:00+00:00",
"notes": [
"[Added] Top Customers widget"
]
},
{
"version": "1.0.2",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2016-09-19T11:57:00+00:00",
"notes": [
"[Improved] Cart Abanadonment widget graph now has a 'No Results' state"
]
},
{
"version": "1.0.1",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2016-09-19T11:42:00+00:00",
"notes": [
"[Fixed] Fixed Cart Abandonment widget numbers",
"[Improved] Cart Abandonment widget colours. Now easier to see which value is completed"
]
},
{
"version": "1.0.0",
"downloadUrl": "https://github.com/bymayo/commerce-widgets/archive/master.zip",
"date": "2016-09-02T19:42:00+00:00",
"notes": [
"[Added] Initial release"
]
}
]
5 changes: 2 additions & 3 deletions src/models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Settings extends Model
/**
* @var string
*/
public $cacheDuration;
public $cacheDuration = 3600;

// Public Methods
// =========================================================================
Expand All @@ -39,8 +39,7 @@ class Settings extends Model
public function rules()
{
return [
['cacheDuration', 'integer'],
['cacheDuration', 'default', 'value' => 3600]
['cacheDuration', 'integer']
];
}
}
6 changes: 6 additions & 0 deletions src/templates/widgets/ProductsRecent/body.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
</td>
<td>{{ product.defaultPrice|currency(commerce.currency) }}</td>
</tr>
{% else %}
<tr>
<td colspan="3">
No products found.
</td>
</tr>
{% endfor %}
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/widgets/ProductsTop/body.twig
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</tr>
{% else %}
<tr>
<td colspan="4">
<td colspan="5">
No products found.
</td>
</tr>
Expand Down
6 changes: 6 additions & 0 deletions src/templates/widgets/SubscriptionPlans/body.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
</td>
<td>{{ plan.activeSubscriptions|number_format() }}</td>
</tr>
{% else %}
<tr>
<td colspan="2">
No subscriptions found.
</td>
</tr>
{% endfor %}
</tbody>
</table>
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/CartAbandonment.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public function getTotalCarts($isCompleted)
'orders.isCompleted' => $isCompleted
]
)
->groupBy('month')
->orderBy('month');
->groupBy(['orders.dateCreated'])
->orderBy('orders.dateCreated');

$command = $query->createCommand();
$result = $command->cache(CommerceWidgets::$plugin->getSettings()->cacheDuration)->queryAll();
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/Goal.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function getTotals()
$query
->where(
[
'WEEK(orders.datePaid)' => date('W'),
'WEEK(orders.datePaid, 1)' => date('W'),
'YEAR(orders.datePaid)' => date('Y')
]
);
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/ProductsTop.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getProducts()
->join(
'LEFT JOIN', '{{%commerce_variants}} variants', 'variants.id = purchasables.id'
)
->groupBy('items.purchasableId')
->groupBy(['items.purchasableId'])
->orderBy($this->orderBy . ' desc')
->limit($this->limit);

Expand Down
2 changes: 1 addition & 1 deletion src/widgets/SubscriptionPlans.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function getSubscriptionPlans()
'plans.isArchived' => 0
]
)
->groupBy('plans.id')
->groupBy(['plans.id'])
->orderBy($this->orderBy)
->limit($this->limit);

Expand Down
2 changes: 1 addition & 1 deletion src/widgets/TopCustomers.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getCustomers()
->from(['orders' => '{{%commerce_orders}}'])
->where(['orders.isCompleted' => 1])
->orderBy($this->orderBy . ' desc')
->groupBy(['orders.email'])
->groupBy(['orders.email', 'orders.customerId'])
->limit(5);

if($this->includeGuests == 'no')
Expand Down

0 comments on commit 5e030eb

Please sign in to comment.