-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: Make analytics reports compatible with Dokan #2318
Open
mrabbani
wants to merge
78
commits into
develop
Choose a base branch
from
enhancement/analytics-reports
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 75 commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
b65555e
refactor: separate test directory for PHP and add factories
mrabbani 4ee1255
Add docs for factories
mrabbani f0b44e1
Update docs for test running instruction
mrabbani bab8fbf
Fix formating
mrabbani 0d9fb9d
refactor: folder structure for PSR4.
mrabbani 2e22dd9
Fix composer autoload for test cases
mrabbani 93a59aa
Fix test auto loading
mrabbani e271396
refactor: Simplify the shipping item attributes settings
mrabbani f9508ed
Add docblock to DBAssertionTrait
mrabbani 2094ee5
Implement league container to swap Dokan curent container
mrabbani 3cd5383
Implement queue handling
mrabbani 36e71ca
Seperate file for WeDevs_Dokan class
mrabbani 1856d99
Update Docblocks
mrabbani 5691487
Fix get & post request methods
mrabbani b41df65
Merge branch 'chore/tdd' into enhancement/analytics-reports
mrabbani 6a8ea9e
Apply conditions on Query
mrabbani 6f110e9
Add FilterQuery class
mrabbani b00222e
Add brain monkey for mocking
mrabbani d173d2a
Merge branch 'chore/tdd-integrate-brain-monkey' into enhancement/anal…
mrabbani 840d5dd
Add test cases for ScheduleListener and FilteQuery of dokan_order_stats
mrabbani e876902
Add PHPUnit data provider method for dokan_multi_vendor_order
mrabbani 1c23196
Merge branch 'chore/tdd' into enhancement/analytics-reports
mrabbani e554aa7
Add test cases for order stats
mrabbani ce2a6e2
Add create_multi_vendor_order method to DokanUnitTestCase
mrabbani 07a7362
Merge branch 'chore/tdd' into enhancement/analytics-reports
mrabbani 9feebd1
Update test cases
mrabbani 81af1ca
Check isset seller_id index
mrabbani cd6a0f6
Merge branch 'chore/tdd' into enhancement/analytics-reports
mrabbani 6698ac0
Remove dokan data retantion
mrabbani 9e80742
Merge branch 'chore/tdd' into enhancement/analytics-reports
mrabbani b8fa691
Use default data only when given data is empty for multi vendor order
mrabbani 563f378
Add docs for TDD
mrabbani 680faff
Update docs style
mrabbani 41f24ff
Fix the ref in Docs
mrabbani 1374d98
Add unit test only props
mrabbani 05695f0
Update docs
mrabbani e0f2557
Fix prop name
mrabbani 7a0428c
Merge with chore/tdd
mrabbani f3ee898
Fix base test class
mrabbani 67898c5
Rename col is_sub_order to order_type
mrabbani b42cfc9
Add method to get order type
mrabbani 6b91a8d
Apply Dokan stats conditions for Orders analytics
mrabbani 5a889db
Inroduce Single vendor order refund type
mrabbani 9c2a5d4
Add where clause for refund
mrabbani 7e18fd4
Add base query filter
mrabbani f53868a
Add query for condition for products analutics
mrabbani a9ccb38
Merge with devleop
mrabbani 29d6e12
Add test cases for Product analytics
mrabbani b08b12a
Implement categories, variations and product segmenters reports
mrabbani a70e159
Implement tax report
mrabbani bf5b2ef
Add docblocks
mrabbani 4c82265
Refactor and add docblocks
mrabbani d7b5c23
Add group for analytics test cases
mrabbani 2e2c716
Merge branch 'develop' into enhancement/analytics-reports
mrabbani 32ac352
Alter WC order stats data store
mrabbani 992fcf3
Remove error log for debug
mrabbani 16de598
Merge with develop
mrabbani 707259d
Implement coupons report only based on WC Order only
mrabbani 18cd21a
Fix plugin activation hooks
mrabbani 524c5f5
Add vendor hooks
mrabbani 97c3b32
Apply condition on SELECT clause to show coupon data against Dokan Su…
mrabbani f4e3118
Implement customer analynics report
mrabbani afaa5bd
Update docs
mrabbani 0176baf
Merge branch 'refactor/introduce-container' into enhancement/analytic…
mrabbani d3fa0f1
Add seller filter
mrabbani 7366a46
Update query param name for seller filter
mrabbani 9a2878c
Implement stock report product filter for seller
mrabbani 2c05bf0
Change accessibility to get seller id
mrabbani 30bc3c4
Implement stock stats report to filter by seller
mrabbani 6f13a6e
Fix typo
mrabbani c30f6aa
Prevent the removal of child order insertion in WC order stats table
mrabbani 0bb18ad
Pass valid filter param
mrabbani c7e04b0
Insert dokan stats data from the Order
mrabbani 768e909
Add col for shipping fee in dokan stats
mrabbani 0d84346
Create dokan order stats table if not exists
mrabbani 67443f3
Add Analytics Migrations
mrabbani 5a818a6
Update comment for ordery_type table column
mrabbani 4b2e85f
Remove auto table creation
mrabbani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
- [Introduction](#introduction) | ||
- [Custom Products Stats Datastore](#custom-products-stats-datastore) | ||
|
||
## Introduction | ||
To handle **Dokan Orders**, we followed the [WooCommerce Admin Reports Extension Guidelines](https://github.com/woocommerce/woocommerce/blob/trunk/docs/reporting/extending-woocommerce-admin-reports.md#handle-currency-parameters-on-the-server). | ||
|
||
## Custom Stats Datastore | ||
|
||
We need to customize the default *WooCommerce Analytics Datastore* for some reports. For example, we replaced the [WC Products Stats DataStore](https://github.com/woocommerce/woocommerce/blob/9297409c5a705d1cd0ae65ec9b058271bd90851e/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php#L170) with the [Dokan Product Stats Store](./../../includes/Analytics/Reports/Products/Stats/WcDataStore.php). This modification involves overriding the `$total_query` and `$interval_query` properties by substituting the `Automattic\WooCommerce\Admin\API\Reports\SqlQuery` class with `WeDevs\Dokan\Analytics\Reports\WcSqlQuery`. | ||
|
||
The primary change was to update the `get_sql_clause( $type, $handling = 'unfiltered' )` method to `get_sql_clause( $type, $handling = '' )`, allowing us to apply necessary filters for adding JOIN and WHERE clauses to the `dokan_order_stats` table. | ||
|
||
### Implementation Steps | ||
|
||
- **Step 1:** Create the [WcSqlQuery](./../../includes/Analytics/Reports/DataStoreModifier.php) class to override the `get_sql_clause( $type, $handling = 'unfiltered' )` method from the [WC SqlQuery](https://github.com/woocommerce/woocommerce/blob/9297409c5a705d1cd0ae65ec9b058271bd90851e/plugins/woocommerce/src/Admin/API/Reports/SqlQuery.php#L87) class. The new method should use `get_sql_clause( $type, $handling = '' )`. | ||
|
||
- **Step 2:** Implement the [WcDataStore](https://github.com/woocommerce/woocommerce/blob/9297409c5a705d1cd0ae65ec9b058271bd90851e/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php#L170) class to set the `$total_query` and `$interval_query` properties with instance of **WcSqlQuery**. | ||
|
||
- **Step 3:** Use the `woocommerce_data_stores` filter within the [DataStoreModifier](./../../includes/Analytics/Reports/DataStoreModifier.php) class to replace the default WooCommerce Products Stats datastore with the custom Dokan Product Stats Store. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the link fragment in the table of contents.
The link fragment for "Custom Products Stats Datastore" should match the section heading.
Committable suggestion
Tools
Markdownlint