Skip to content

Commit a23f173

Browse files
committed
initial commit
0 parents  commit a23f173

51 files changed

Lines changed: 15271 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ddev/.env.web

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
MAILPIT_SMTP_HOSTNAME="127.0.0.1"
2+
MAILPIT_SMTP_PORT="1025"
3+
CRAFT_DB_USER="db"
4+
CRAFT_DB_DRIVER="mysql"
5+
CRAFT_DB_PORT="3306"
6+
CRAFT_WEB_ROOT="/var/www/html"
7+
PRIMARY_SITE_URL="https://craft-commerce-reports.ddev.site"
8+
CRAFT_DB_SERVER="db"
9+
CRAFT_DB_DATABASE="db"
10+
CRAFT_DB_PASSWORD="db"

.ddev/config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: craft-commerce-reports
2+
type: craftcms
3+
docroot: .
4+
php_version: "8.2"
5+
webserver_type: nginx-fpm
6+
xdebug_enabled: false
7+
additional_hostnames: []
8+
additional_fqdns: []
9+
database:
10+
type: mysql
11+
version: "8.0"
12+
use_dns_when_possible: true
13+
composer_version: "2"
14+
composer_root: .
15+
web_environment: []
16+
corepack_enable: false
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Creates a new GitHub Release whenever the Craft Plugin Store
2+
# is notified of a new version tag.
3+
4+
name: Create Release
5+
run-name: Create release for ${{ github.event.client_payload.version }}
6+
7+
on:
8+
repository_dispatch:
9+
types:
10+
- craftcms/new-release
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- uses: ncipollo/release-action@v1
19+
with:
20+
body: ${{ github.event.client_payload.notes }}
21+
makeLatest: ${{ github.event.client_payload.latest }}
22+
name: ${{ github.event.client_payload.version }}
23+
prerelease: ${{ github.event.client_payload.prerelease }}
24+
tag: ${{ github.event.client_payload.tag }}

.github/workflows/tests.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
tests:
11+
name: Run tests
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Set up PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: 8.1
21+
22+
- name: Install dependencies
23+
run: composer install --no-interaction --no-suggest --ignore-platform-reqs
24+
25+
- name: Run tests
26+
run: composer test

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.DS_Store
2+
*.idea/*
3+
/.claude
4+
/.CHANGELOG.md
5+
/.codex
6+
/vendor
7+
composer

README.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Commerce Reports Plugin
2+
3+
Advanced reporting plugin for Craft Commerce that provides comprehensive sales analytics and data insights.
4+
5+
## Overview
6+
7+
This plugin extends Craft Commerce with powerful reporting capabilities, offering detailed analytics on sales performance, customer behavior, and commerce metrics through an intuitive dashboard interface.
8+
9+
## Features
10+
11+
### 📊 **Available Reports**
12+
- **Sales by Volume**
13+
- **Sales by Value**
14+
- **Sales by Category**
15+
- **Sales by Payment Method**
16+
- **Sales by Customer**
17+
- **Sales by User Type**
18+
- **Sales by Coupon**
19+
- **Abandoned Carts**
20+
21+
### ⚙️ **Key Features**
22+
- **Real-time Data Processing** - Automatic background data aggregation
23+
- **Historical Data** - Full historical sales analysis
24+
- **Multi-site Support** - Works with Craft's multi-site setup
25+
- **Configurable Categories** - Link product categories for enhanced reporting
26+
- **Data Management** - Built-in cleanup tools for maintenance
27+
28+
## Installation
29+
30+
1. Install via Composer:
31+
```bash
32+
composer require 99x/craft-commerce-reports
33+
```
34+
35+
2. Install the plugin in Craft CP:
36+
- Go to **Settings****Plugins**
37+
- Find "Commerce Reports" and click **Install**
38+
39+
## Configuration
40+
41+
### Category Field Setup
42+
1. Go to **Commerce Reports****Settings**
43+
2. Select the **Product Category Field** from the dropdown
44+
3. This enables the "Sales by Category" report functionality
45+
46+
### Data Management
47+
The plugin includes cleanup tools to manage storage:
48+
- **Last Week** - Clear last 7 days of data
49+
- **Last Month** - Clear last 30 days of data
50+
- **Last 3 Months** - Clear last 90 days of data
51+
- **Last 6 Months** - Clear last 180 days of data
52+
- **All Data** - Complete data cleanup
53+
54+
## Usage
55+
56+
### Accessing Reports
57+
Navigate to **Commerce Reports** in the Control Panel main menu to access all available reports.
58+
59+
### Data Processing
60+
- Initial data processing happens automatically after installation
61+
- Progress is shown via notification banners
62+
- Recent data syncs happen automatically in the background
63+
64+
### Console Commands
65+
For advanced users and automation:
66+
67+
```bash
68+
# Process recent data for last 7 days
69+
./craft commerce-reports/aggregate/last-days --days=7
70+
71+
# Clean up old data
72+
./craft commerce-reports/aggregate/cleanup --daysToDelete=30
73+
74+
## Technical Notes
75+
76+
### Performance
77+
- Uses aggregated data tables for fast report generation
78+
- Background processing prevents UI blocking
79+
- Efficient database queries optimized for large datasets
80+
81+
### Data Storage
82+
- Creates dedicated tables for aggregated metrics
83+
- Preserves original Commerce data integrity
84+
- Configurable data retention policies
85+
86+
### Compatibility
87+
- Requires Craft CMS 4.0+
88+
- Requires Craft Commerce 4.0+
89+
- Compatible with multi-site installations
90+
91+
## Support
92+
93+
For technical support and feature requests, please contact the development team.
94+
95+
---
96+
97+
**Version:** 1.0.0
98+
**License:** Proprietary
99+
**Developer:** 99x
100+

composer.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "99x/craft-commerce-reports",
3+
"description": "Craft Commerce Reports Plugin",
4+
"type": "craft-plugin",
5+
"license": "mit",
6+
"require": {
7+
"php": ">=8.2",
8+
"craftcms/cms": "^5.5.0",
9+
"craftcms/commerce": "^5.2.0"
10+
},
11+
"require-dev": {
12+
"craftcms/ecs": "dev-main",
13+
"craftcms/phpstan": "dev-main",
14+
"friendsofphp/php-cs-fixer": "^3.20",
15+
"symplify/easy-coding-standard": "^10.3"
16+
},
17+
"autoload": {
18+
"psr-4": {
19+
"NinetyNineX\\CraftCommerceReports\\": "src/"
20+
}
21+
},
22+
"extra": {
23+
"handle": "commerce-reports",
24+
"name": "Commerce Reports",
25+
"developer": "99x",
26+
"class": "NinetyNineX\\CraftCommerceReports\\Plugin",
27+
"iconPath": "src/icon.svg"
28+
},
29+
"scripts": {
30+
"check-cs": "ecs check --ansi",
31+
"fix-cs": "ecs check --ansi --fix",
32+
"phpstan": "phpstan --memory-limit=1G",
33+
"test": [
34+
"@check-cs",
35+
"@phpstan"
36+
]
37+
},
38+
"config": {
39+
"sort-packages": true,
40+
"platform": {
41+
"php": "8.2"
42+
},
43+
"allow-plugins": {
44+
"yiisoft/yii2-composer": true,
45+
"craftcms/plugin-installer": true
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)