Skip to content

Commit 7745dd4

Browse files
Merge pull request #184 from matomo-org/string-order-id
Add optional word prefix to order ID since they don't have to be just numeric
2 parents 34ea20c + af36dcd commit 7745dd4

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,5 @@
6868
- 5.1.4 - 2025-11-10
6969
* Randomly mark visits as NovaAct agent also
7070
* Added new command to send fake AI Bot Requests
71+
- 5.1.5 - 2025-11-24
72+
* Generate string order IDs occasionally

Generator/VisitsFake.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,11 @@ public function generate($time = false, $idSite = 1, $limit = 1000)
186186
if ($this->faker->boolean(50)) {
187187
$tracker->doTrackEcommerceCartUpdate(50);
188188
} else {
189-
$orderId = $this->faker->randomNumber(5);
190-
// randomNumber() can produce 0, which is an invalid order number.
191-
if (0 === $orderId) {
192-
$orderId = 1;
193-
}
189+
do {
190+
$randomNumber = (string) $this->faker->randomNumber(5);
191+
$orderId = $this->faker->boolean(50) ? ($this->faker->word() . '-' . $randomNumber) : $randomNumber;
192+
} while ('0' === $orderId);
193+
194194
$subtotal = $price * $quantity;
195195
$tax = $subtotal * 0.19;
196196
$shipping = $subtotal * 0.05;

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "VisitorGenerator",
3-
"version": "5.1.4",
3+
"version": "5.1.5",
44
"description": "Developer tool that lets you generate fake visits. Useful if you are working with plugins or themes or if you use the Matomo API.",
55
"keywords": ["development", "tools"],
66
"license": "GPL v3+",

0 commit comments

Comments
 (0)