dokan
dokan copied to clipboard
Module/form manager
All Submissions:
- [ ] My code follow the WordPress' coding standards
- [ ] My code satisfies feature requirements
- [ ] My code is tested
- [ ] My code passes the PHPCS tests
- [ ] My code has proper inline documentation
- [ ] I've included related pull request(s) (optional)
- [ ] I've included developer documentation (optional)
- [ ] I've added proper labels to this pull request
Changes proposed in this Pull Request:
Related Pull Request(s)
https://github.com/getdokan/dokan-pro/pull/2883
Closes
- Closes https://github.com/getdokan/dokan-pro/issues/2926
How to test the changes in this Pull Request:
- Steps or issue link
Changelog entry
Title
Detailed Description of the pull request. What was previous behaviour and what will be changed in this PR.
Before Changes
Describe the issue before changes with screenshots(s).
After Changes
Describe the issue after changes with screenshot(s).
Feature Video (optional)
Link of detailed video if this PR is for a feature.
PR Self Review Checklist:
- Code is not following code style guidelines
- Bad naming: make sure you would understand your code if you read it a few months from now.
- KISS: Keep it simple, Sweetie (not stupid!).
- DRY: Don't Repeat Yourself.
- Code that is not readable: too many nested 'if's are a bad sign.
- Performance issues
- Complicated constructions that need refactoring or comments: code should almost always be self-explanatory.
- Grammar errors.
FOR PR REVIEWER ONLY:
As a reviewer, your feedback should be focused on the idea, not the person. Seek to understand, be respectful, and focus on constructive dialog.
As a contributor, your responsibility is to learn from suggestions and iterate your pull request should it be needed based on feedback. Seek to collaborate and produce the best possible contribution to the greater whole.
- [ ] Correct — Does the change do what it’s supposed to? ie: code 100% fulfilling the requirements?
- [ ] Secure — Would a nefarious party find some way to exploit this change? ie: everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities?
- [ ] Readable — Will your future self be able to understand this change months down the road?
- [ ] Elegant — Does the change fit aesthetically within the overall style and architecture?
Summary by CodeRabbit
-
New Features
- Introduced form validation and custom section rendering in the product editor based on category selection.
- Enhanced product creation process with improved attribute handling and UI interactions.
- Added a centralized management system for product form components to enhance customization capabilities.
- Introduced a new class for managing product form sections, allowing for structured handling of fields.
- Added a method to retrieve ancestors of chosen categories for improved category management.
- Enhanced dashboard management capabilities and template organization within the application.
-
Bug Fixes
- Adjusted styles for validation errors and hidden elements to improve UI consistency.
-
Refactor
- Removed outdated product creation functions and streamlined product form handling.
- Updated catalog mode data handling for improved data integrity and security.
- Improved logic for handling product variations and metadata updates.
- Refactored category selection logic to enhance clarity and reduce redundancy.
-
Chores
- Added new properties and methods to enhance product form components and attributes management.
- Modified data structures to accommodate greater flexibility in handling category representations.
@devAsadNur @nurul-umbhiya What is the status of this PR?
@Mohaiminulislam1989 bhai minimum of 15 days of works left. Pro code rewrite is going on.
@nurul-umbhiya vai can we target releasing this by February 10?
@Mohaiminulislam1989 No bhai. I'm guessing 25th February. after developing this feature, we need through testing. Also, we need to integrate this feature with new Vendor Dashboard.
Hope we will not miss the release. Thank you for prompt reply.
For the Product Form Customize
feature, the task has been done from my end. Now, @nurul-umbhiya Bhai is working on rewrite.
CC: @Mohaiminulislam1989 Bhai, @shams-sadek1981 Bhai
Product Form Manager-related rewrite is completed from my end. @Mohaiminulislam1989 @shams-sadek1981
Walkthrough
The update to this codebase involves multiple functionalities and structure improvements, including new validation methods in the product editor, UI and CSS adjustments, AJAX control flow alterations, deprecations, metadata handling improvements, added dependencies, and better category handling. Notably, key classes and methods have been refined to streamline product creation, attribute handling, catalog mode updates, and metadata management, while some deprecated methods have been replaced for better performance and maintainability.
Changes
Files/Directories | Change Summary |
---|---|
.gitignore | Added dokan-tailwind.js to ignore list. |
assets/src/js/product-editor.js |
Added form validation, custom section rendering, and modified product creation process. |
assets/src/less/dashboard.less |
Styled validation error messages. |
assets/src/less/products.less |
Changes to hide elements, update selectors, and modify padding. |
dokan.php |
Added new property and constant, initialized new class. |
includes/Admin/Notices/Manager.php |
Removed specific notice functions. |
includes/Admin/Settings.php |
Removed one_step_product_create and disable_product_popup settings. |
includes/Ajax.php |
Removed create_product() function from constructor. |
includes/Assets.php |
Added new import, method, and updated script dependencies. |
includes/Blocks/ProductBlock.php |
Added conditional check for a pro version in get_configurations method. |
includes/.../CatalogMode/Products.php , ProductBulkEdit.php |
Enhanced handling of catalog mode data with better safety checks and methods. |
includes/.../CatalogMode/Helper.php |
Improved catalog mode data retrieval for product variations. |
includes/.../Dashboard/Manager.php |
Added new property templates with type TemplateManager . |
includes/.../Dashboard/Templates/... |
Updated properties and imports related to products and categories. |
includes/Emails/... |
Changed meta data update methods from update_meta_data to add_meta_data . |
includes/Product/... |
Added, modified, and deprecated methods in product management-related classes and functions for better handling and readability. |
includes/ProductCategory/... |
Fixed typos and updated methods to utilize the caching and category retrieval more efficiently. |
includes/ProductForm/... |
Introduced new classes and methods for handling product form elements and attributes effectively. |
Sequence Diagram(s)
Product Creation Process (After Changes)
sequenceDiagram
participant Vendor as Vendor
participant Dokan_Editor as Dokan_Editor
participant Server as Server
participant Database as Database
Vendor->>Dokan_Editor: Open Product Editor
Dokan_Editor->>Vendor: Display Form
Vendor->>Dokan_Editor: Enter Product Details
Dokan_Editor->>Dokan_Editor: Validate Form
alt Form Valid
Dokan_Editor->>Server: Submit Product Details
Server->>Database: Save Product
Database->>Server: Acknowledge
Server->>Dokan_Editor: Success Response
Dokan_Editor->>Vendor: Confirmation Message
else Form Invalid
Dokan_Editor->>Vendor: Show Validation Errors
end
Assessment against linked issues
Objective | Addressed | Explanation |
---|---|---|
Vendor can set the discount prize schedule in back date (#2926) | ❌ | The provided changes don't mention any checks or validation for backdate scheduling. |
Poem
In code's vast realm, with lines so bright,
A rabbit hops, through day and night.
Forms now validated, CSS aligned,
With each commit, new paths defined.
Products emerge with seamless grace,
Bugs hop away, finding no trace.
In the burrow of code, we celebrate,
For every merge, we animate!
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>.
-
Generate unit testing code for this file.
-
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitai
in a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file.
-
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitai
in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai generate interesting stats about this repository and render them as a table.
-
@coderabbitai show all the console.log statements in this repository.
-
@coderabbitai read src/utils.ts and generate unit testing code.
-
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
-
@coderabbitai help me debug CodeRabbit configuration file.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (invoked as PR comments)
-
@coderabbitai pause
to pause the reviews on a PR. -
@coderabbitai resume
to resume the paused reviews. -
@coderabbitai review
to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full review
to do a full review from scratch and review all the files again. -
@coderabbitai summary
to regenerate the summary of the PR. -
@coderabbitai resolve
resolve all the CodeRabbit review comments. -
@coderabbitai configuration
to show the current CodeRabbit configuration for the repository. -
@coderabbitai help
to get help.
Additionally, you can add @coderabbitai ignore
anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configration File (.coderabbit.yaml
)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yaml
file to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.