Product Name Cleanup β€” Phase 3 Batch

Product Name Cleanup β€” Functional Description

Administrative exchange for unstructured Bucket B rows in pd_name_cleanup_staging (status = ai_ready AND bucket = bucket_b). Export writes those rows, with the live brand, model, and MPN, into JSON files a Grok session can read. Import reads the completed files, applies a 70-character title guard, and writes the proposal back onto the same product_id + language_id row. Export files are grok_batch_001.json and count upward, with at most 250 records each. Import reads only grok_batch_*_done.json. A file that is not valid JSON is logged and skipped. A file that commits is moved into cleanup_scratchpad/archive/. The import sets status to ai_completed. Titles of 70 characters or fewer stay unflagged. Longer titles are stored with is_flagged = 1 and flag_reason = AI_TITLE_EXCEEDS_70_CHARS. Only ai_ready and ai_completed rows can change. original_name and original_description are never assigned. This phase does not change oc_product or oc_product_description.

Operator Workflow

Work through these five steps in order. You do not need to edit code or open the database.

Step 1

Export Batches

  • Go to the Phase 3 Batch Dashboard (this page).
  • Click Generate Batch JSON Files (250 items/batch) in Module A.
  • Click Download All as ZIP to save grok_batch_*.json files locally.
Step 2

Process in Cursor

  • Open the batch in Cursor AI.
  • Copy the prompt from this Phase 3 Batch Dashboard with Copy Prompt to Clipboard, then paste it into the Cursor chat window.
  • Let Cursor save grok_batch_XXX_done.json.
Step 3

Upload & Import

  • Return to the Phase 3 Batch Dashboard (this page).
  • Drag your *_done.json files into Module B and click Upload *_done.json Files.
  • Click Import Uploaded *_done.json Files to Staging in Module C.
Step 4

Audit Staging

  • Review completed rows on the Phase 4 Review Dashboard.
  • Inline edit any titles exceeding 70 characters until the length badges turn green.
Step 5

Commit Live

  • On the Phase 4 Review Dashboard, approve reviewed rows and click Commit Approved Batches to Production.
  • That writes optimized titles and feature lists into the live OpenCart tables.
Cursor AI Batch Transformation Prompt

Technical reference

  • A browser visit shows the counts and the scratchpad file list. Generate, upload, and import start from the controls below. POST action=export_batches, action=upload_done, and action=import_done run the same engines. CLI still uses --action=export or --action=import.
  • CLI: php productNameCleanup_phase3_batch.php --action=export or --action=import from the fsadmin directory. With no --action, the CLI asks for one. JSON clients send format=json or the XMLHttpRequest header. Those callers skip navigation.
  • Scratchpad: /home/opencart/public_html/fsadmin/cleanup_scratchpad/. The directory is created at mode 0755 when it is missing. Files written by this page, and files received through the upload form, belong to the web server user and are stored at mode 0644. Apache is denied direct access. Download links stream the files through this script.
  • Export selects status = ai_ready and bucket = bucket_b, joins oc_product for model and MPN, and left-joins oc_manufacturer for the brand. A missing manufacturer does not drop the row.
  • A second export is refused while unfinished grok_batch_###.json files are still in the scratchpad. Move them aside, or finish them and save the replies as grok_batch_###_done.json, before exporting again.
  • Import matches product_id and language_id. Rows at passed_audit, committed, or any status other than ai_ready or ai_completed are not overwritten.
  • Writes commit per file, or in chunks of 2,500 rows when a done file is larger than that. A failed chunk rolls back that chunk only. The done file stays in place so it can be imported again.
  • A proposed name longer than 255 characters is clamped to the staging column. char_count_proposed keeps the real length, up to 65,535, and the row is flagged because it is also over 70 characters.
AI Ready

4,100

Waiting for export. bucket_b, status = ai_ready

Export Files

18

Generated JSON files available for download

Done Files

0

Uploaded *_done.json files waiting for import

AI Completed

499

bucket_b, status = ai_completed

Module A β€” Batch exporter

Writes ai_ready / bucket_b rows into 250-item JSON files. Each file tells Grok 4.7 High that proposed_name must be strictly 70 characters or fewer.

Module B β€” Upload completed JSON

Accepts one or more grok_batch_*_done.json files and stores them in the scratchpad with move_uploaded_file().

Module C β€” Import to staging

Reads every waiting grok_batch_*_done.json file, applies the 70-character shield, and updates pd_name_cleanup_staging inside a transaction. Committed files move to archive/.

Execution stats
Metric Value
Database opencart_fsreal_oc3
Batches created 0
Records written 0
Done files found 0
Files processed 0
Files skipped 0
Successful DB updates 0
Flagged over-length records 0
Flagged titles in bucket_b 0
Rows left unchanged 0
Invalid result rows 0
Files uploaded 0
Files rejected 0
Unfinished export files 18
Completed files waiting 0
Archived files 1
Execution time 0.014 seconds
Memory usage 2.00 MB
Scratchpad files Download All as ZIP

File Kind Bytes Modified Download
grok_batch_001.json Export 747,043 2026-10-01 18:24:35 Download
grok_batch_002.json Export 436,185 2026-10-01 18:24:35 Download
grok_batch_003.json Export 273,507 2026-10-01 18:24:35 Download
grok_batch_004.json Export 322,471 2026-10-01 18:24:35 Download
grok_batch_005.json Export 287,449 2026-10-01 18:24:35 Download
grok_batch_006.json Export 264,337 2026-10-01 18:24:35 Download
grok_batch_007.json Export 277,576 2026-10-01 18:24:35 Download
grok_batch_008.json Export 275,682 2026-10-01 18:24:35 Download
grok_batch_009.json Export 273,961 2026-10-01 18:24:35 Download
grok_batch_010.json Export 279,248 2026-10-01 18:24:35 Download
grok_batch_011.json Export 262,691 2026-10-01 18:24:35 Download
grok_batch_012.json Export 266,923 2026-10-01 18:24:35 Download
grok_batch_013.json Export 279,920 2026-10-01 18:24:35 Download
grok_batch_014.json Export 274,200 2026-10-01 18:24:35 Download
grok_batch_015.json Export 275,182 2026-10-01 18:24:35 Download
grok_batch_016.json Export 252,232 2026-10-01 18:24:35 Download
grok_batch_017.json Export 194,250 2026-10-01 18:24:35 Download
grok_batch_018.json Export 173,802 2026-10-01 18:24:35 Download