diff --git a/CHANGELOG.md b/CHANGELOG.md index c5a25a7..0199772 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,3 +68,5 @@ - 5.1.4 - 2025-11-10 * Randomly mark visits as NovaAct agent also * Added new command to send fake AI Bot Requests +- 5.1.5 - 2025-11-24 + * Generate string order IDs occasionally diff --git a/Generator/VisitsFake.php b/Generator/VisitsFake.php index f53963d..5c90b83 100644 --- a/Generator/VisitsFake.php +++ b/Generator/VisitsFake.php @@ -186,11 +186,11 @@ public function generate($time = false, $idSite = 1, $limit = 1000) if ($this->faker->boolean(50)) { $tracker->doTrackEcommerceCartUpdate(50); } else { - $orderId = $this->faker->randomNumber(5); - // randomNumber() can produce 0, which is an invalid order number. - if (0 === $orderId) { - $orderId = 1; - } + do { + $randomNumber = (string) $this->faker->randomNumber(5); + $orderId = $this->faker->boolean(50) ? ($this->faker->word() . '-' . $randomNumber) : $randomNumber; + } while ('0' === $orderId); + $subtotal = $price * $quantity; $tax = $subtotal * 0.19; $shipping = $subtotal * 0.05; diff --git a/plugin.json b/plugin.json index c3f6ce0..f650463 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "name": "VisitorGenerator", - "version": "5.1.4", + "version": "5.1.5", "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.", "keywords": ["development", "tools"], "license": "GPL v3+",