Skip to content

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:

  1. The system looks up the suggestion in ai_site_improvements
  2. Determines the target table and field
  3. Applies special handling based on field type
  4. Updates the target record with the approved value
  5. Marks the suggestion as implemented
  6. Logs the change to the system log

Rejection Flow

When an admin rejects a suggestion:

  1. The current value is kept unchanged
  2. 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 vendors table
  • 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_units table
  • 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_id and URL
  • Finds or creates a content_seo record 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_filters if they don't exist
  • Creates filter options in shop_filters_options if 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_tags if 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

  1. Review suggestions individually rather than bulk-approving for important fields
  2. SEO changes take effect after cache clearing (happens automatically)
  3. New vendors and units are created automatically if the AI suggests ones that don't exist
  4. Check the system log after approving changes to verify they applied correctly
  5. 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.


  • 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