AI Improvements RAW Documentation¶
Menu Location: AI > AI Improvements RAW
Access Level: Administrator and above
Last Updated: 2026-03-02
Overview¶
The AI Improvements RAW page (process_improvements.php) is the backend processor for AI-generated product improvement suggestions. It handles the approval and rejection actions from the AI Suggestions page, applying approved changes directly to the database. This is not a standalone UI page - it works as the action handler for the AI Suggestions review workflow.
Primary Functions:
- Apply approved AI suggestions to product data
- Reject suggestions and keep current values
- Bulk approve multiple suggestions at once
- Handle special field types (SEO, tags, filters, vendors, units)
- Log all changes to the system log
- Clear caches after updates
How It Works¶
Approval Flow¶
When an admin approves a suggestion from the AI Suggestions page:
- The system looks up the suggestion in
ai_site_improvements - Determines the target table and field
- Applies special handling based on field type
- Updates the target record with the approved value
- Marks the suggestion as implemented
- Logs the change to the system log
Rejection Flow¶
When an admin rejects a suggestion:
- The current value is kept unchanged
- The suggestion is marked as rejected (implemented = -1)
Special Field Handling¶
Standard Fields (name, etc.)¶
Updates the field directly on the target table (e.g., menu table).
Description / Brand / Distributer¶
Redirects the update to the product_classification table using the product's classify_id.
Distributer (Vendor)¶
- Looks up the vendor by name in the
vendorstable - Creates a new vendor record if the name doesn't exist
- Stores the vendor ID in the field
Units¶
- Looks up the unit by name in
product_unitstable - Creates a new unit record if the name doesn't exist
- Stores the unit ID in the field
SEO Fields (seo_title, seo_description, seo_keyword)¶
- Resolves the product's
classify_idand URL - Finds or creates a
content_seorecord for the product - Updates the specific SEO field
- Clears the APC cache for the affected URL
Shop Filters¶
- Parses the JSON suggestion containing filter categories and options
- Creates filter categories in
shop_filtersif they don't exist - Creates filter options in
shop_filters_optionsif they don't exist - Links products to filter options via
shop_filters_options_values
Product Tags¶
- Parses the JSON suggestion containing tag names
- Creates tags in
product_tagsif they don't exist - Links tags to products via
product_tags_links - On rejection, removes existing tag links
Database Tables Involved¶
| Table | Purpose |
|---|---|
| ai_site_improvements | Source of suggestions and their status |
| menu | Product records |
| product_classification | Product category/description data |
| vendors | Vendor/distributor records |
| product_units | Unit of measure records |
| content_seo | SEO metadata for products |
| shop_filters | Filter categories |
| shop_filters_options | Filter option values |
| shop_filters_options_values | Product-to-filter-option links |
| product_tags | Tag definitions |
| product_tags_links | Product-to-tag links |
Bulk Approval¶
The system supports bulk approval via the approveAll POST parameter:
- Accepts an array of suggestion IDs
- Applies all suggestions in sequence
- Updates each target record
- Marks all as implemented
Note: Bulk approval uses the simplified update path and doesn't include the special handling for SEO, tags, or filters that individual approval does.
System Logging¶
All approved changes are logged with:
- Entry type: -19291
- Format:
Product updated: #[id] '[name]', [field] changed from '[old]' to '[new]'
This provides a complete audit trail of AI-driven product changes.
Tips & Best Practices¶
- Review suggestions individually rather than bulk-approving for important fields
- SEO changes take effect after cache clearing (happens automatically)
- New vendors and units are created automatically if the AI suggests ones that don't exist
- Check the system log after approving changes to verify they applied correctly
- This page is the backend - use AI Suggestions for the review interface
FAQ¶
Where do I review suggestions?¶
Use the AI Suggestions for Product page (ai-suggestions.php). This page (process_improvements.php) is the backend that handles the approve/reject actions.
What happens if I approve a suggestion for a deleted product?¶
The update query will run against the product's ID. If the product no longer exists, the update has no effect.
Can I undo an approved change?¶
There is no built-in undo. Check the system log to see the previous value and manually revert if needed.
Why are some fields handled differently?¶
Fields like SEO, tags, and filters involve multiple tables and relationships. The special handling ensures data integrity across related tables.
Related Pages¶
- AI Suggestions for Product (
ai-suggestions.php) - The review UI for suggestions - Products - Product catalog management
- Product Tags - Tag management
- Store Categories - Category management
- Shop Filter Report - Filter usage tracking