Skip to content

Phase 1: Housekeeping + Configurable Attributes#52

Closed
DavidLambauer wants to merge 12 commits intomage-os-lab:mainfrom
DavidLambauer:feature/phase1-housekeeping-configurable-attributes
Closed

Phase 1: Housekeeping + Configurable Attributes#52
DavidLambauer wants to merge 12 commits intomage-os-lab:mainfrom
DavidLambauer:feature/phase1-housekeeping-configurable-attributes

Conversation

@DavidLambauer
Copy link
Copy Markdown
Contributor

Summary

  • Fixes Improve composer dependencies #22: Added explicit Magento module dependencies (magento/framework, magento/module-catalog, magento/module-ui, magento/module-backend, magento/module-config, magento/module-store), removed mirror repository from composer.json
  • Fixes Fix code style issues #23: Applied PSR-12 code style fixes across all PHP files via PHP-CS-Fixer
  • Fixes Incorrect 'temperature' setting label #25: Corrected temperature field label (was "System Prompt"), added range/description comments to all advanced config fields, fixed duplicate sortOrder on presence_penalty
  • Fixes Feature: Make attributes configurable #27: Replaced the hardcoded 5-attribute enrichment system with a dynamic row configuration — any text/textarea product attribute can now be enriched without code changes

Configurable Attributes (#27) Details

The static textarea fields for short_description, description, meta_title, meta_keyword, and meta_description have been replaced with a dynamic rows table in the admin config (Stores > Configuration > Catalog > AI Data Enrichment > Product Fields Auto-Generation).

Each row has:

  • Attribute — dropdown populated from product text/textarea attributes
  • Prompt — the prompt template with {{variable}} support
  • Enabled — toggle per attribute

Changes:

  • Block/Adminhtml/Form/Field/AttributeColumn — select renderer loading product text/textarea attributes via ProductAttributeRepositoryInterface
  • Block/Adminhtml/Form/Field/ProductAttributes — dynamic rows field array block extending AbstractFieldArray
  • Model/Config — new getEnrichableAttributes() method reads the serialized dynamic rows; getProductPrompt() delegates to it
  • Model/Product/EnrichergetAttributes() now reads from config instead of returning a hardcoded array
  • Setup/Patch/Data/MigrateProductPromptsToDynamicRows — data patch migrating existing per-attribute config values to the new serialized format, then cleans up old paths
  • Default prompts added for meta_title, meta_keyword, and meta_description (previously had no defaults)

Test plan

  • Run setup:upgrade — should complete without errors
  • Run setup:di:compile — should complete without errors
  • Verify dynamic rows table renders at Stores > Config > Catalog > AI Data Enrichment > Product Fields Auto-Generation
  • Verify attribute dropdown loads product text/textarea attributes
  • Add a custom attribute row, save config, reload — confirm persistence
  • Verify enrichment still works: create a new product with the module enabled
  • Verify mass actions still work from the product grid
  • For existing installs: confirm data patch migrates old prompt config values correctly

@DavidLambauer
Copy link
Copy Markdown
Contributor Author

Closing in favor of @rhoerr's standalone PRs that cover the same issues with less bundling: #39 (#22), #38 (#25), #45 (#27).

The only piece not covered by Ryan's stack is #23 (PSR-12 code style). I'll open a separate small PR for that on top of the merged baseline so it doesn't get held up by the bigger overlap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Make attributes configurable Incorrect 'temperature' setting label Fix code style issues Improve composer dependencies

1 participant