# creatuity/magento2-openai-content-generator

`composer require creatuity/magento2-openai-content-generator`

Canonical URL: https://packagento.com/creatuity/magento2-openai-content-generator

## At a glance

- **Vendor**: creatuity (https://packagento.com/creatuity.md)
- **Latest version**: 0.0.3 — released 2024-05-20
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/creatuity/magento2-openai-content-generator and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require creatuity/magento2-openai-content-generator:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## README

### Table of Contents
1. [Overview](#overview)
2. [Installation](#installation)
3. [User Guide](#user-guide)
    - [Configuration](#configuration)
    - [Short Description](#short-description)
    - [Description](#description)
    - [Meta Tags](#meta-tags)
    - [Mass Actions](#mass-actions)
4. [Links](#links)

### Overview
The Creatuity AI Content Generator module for Magento allows for the automated generation of descriptions and metadata for products based on their attributes. By interfacing with OpenAI, product attributes can be utilized to produce compelling content with ease.

This module consists of:
- [Core Module](https://github.com/creatuity/magento2-ai-content-generator-core)
- [Mass Actions Module](https://github.com/creatuity/magento2-ai-content-generator-mass-actions)
- [OpenAI's Integration Module](https://github.com/creatuity/magento2-openai-content-generator)

The core is designed with potential future integrations in mind, allowing for easy integration with other AI services.

### Installation
```bash
composer require creatuity/magento2-openai-content-generator
bin/magento s:up
```
If you have problem with instalation, add the following repositoreis to your composer.json file

```json
{
    "type": "vcs",
    "url": "git@github.com:creatuity/magento2-openai-content-generator.git"
},
{
    "type": "vcs",
    "url": "git@github.com:creatuity/magento2-ai-content-generator-core.git"
},
{
    "type": "vcs",
    "url": "git@github.com:creatuity/magento2-ai-content-generator-mass-actions.git"
}
```

### User Guide

#### Configuration
1. Navigate to `Stores → Configuration → Creatuity → AI Content`.
2. Configure the fields as per your requirement:
    ![image](https://github.com/creatuity/magento2-openai-content-generator/assets/1653168/5720949f-169b-4f14-af8f-878608835752)


    | Configuration Field    | Description | Default Value |
    |------------------------|-------------|---------------|
    | Enabled                | Enable/Disable the module | No |
    | AI Provider            | Choose AI Provider (Only OpenAI currently) | OpenAI |
    | Description Attributes | Default attributes for description generation | Product Name, Size, Color |
    | Meta-tags Attributes   | Default attributes for meta-tag generation | Product Name, Description |
    | OpenAI API Key         | Your OpenAI API Token | - |
    | Model Name             | OpenAI model for requests. Model determines cost | gpt-3.5-turbo |


Once the module is configured and enabled, you can go to product configuration.

**NOTE:** You can’t generate any data using the module until product is created
![image](https://github.com/creatuity/magento2-openai-content-generator/assets/1653168/9a7d3474-eb98-45a8-a344-3eb5329db1ea)

When you create and configure product **(it is strongly recommended to fully configure product attributes first before generating description and meta-tags)** you can go to a proper section where you are able now to click **Generate With AI** button 

The button opens a modal window where you can optionally configure some prompt settings which will be sent to AI model

Example:

![image](https://github.com/creatuity/magento2-openai-content-generator/assets/1653168/ff906f51-3f9c-4f0b-8205-1fae72097447)

Product Attributes values are by default the same as the once selected in configuration. You can change here these selected by default attributes by selecting other attributes that you want to use to generate short description and description for this particular product

#### Short Description
- In the product configuration, navigate to the Content section.
- Click on "Generate With AI" to open a modal.
- Here, you can customize the product attributes used for generating content.
- Generated content appears in the Short Description's textarea.
- To regenerate content, adjust settings and click "Generate" again.
- Once satisfied, click "Apply" to move the generated content to the product's Short Description field.

#### Description
This section works similarly to the Short Description section. If you have Page Builder enabled, you'll need to manually copy the generated description and paste it in the desired field as auto-fill is unsupported.

#### Meta Tags
1. Once the product descriptions are finalized, navigate to the `Search Engine Optimization` section.
2. Click "Generate With AI" to open a modal.
3. You can modify the default attributes used for meta-tag generation.
4. Click "Generate" to get three meta-tag suggestions.
5. Choose your preferred meta-tag and click "Apply".
6. Remember to save the product.

#### Mass Actions
For bulk content generation:
1. On the product grid, select the products you want.
2. Choose either:
    - Generate With AI → Description
    - Generate With AI → Meta-Tags
3. On the redirected page, generate and save content for products individually using "Generate One By One".
4. Use "Skip" to bypass a product or "Confirm and Continue" to proceed to the next product.
5. You can halt the process anytime. Pending products will always be displayed in the admin notifications bar.

### Links
- [Core Module Repository](https://github.com/creatuity/magento2-ai-content-generator-core)
- [Mass Actions Module](https://github.com/creatuity/magento2-ai-content-generator-mass-actions)
- [OpenAI Integration Module Repository](https://github.com/creatuity/magento2-openai-content-generator)

---

For any issues or feedback, please raise a ticket in the respective repository.

## Recent Versions

| Version | Released |
|---|---|
| 0.0.3 | 2024-05-20 |
| 0.0.2 | 2023-09-21 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| creatuity/magento2-ai-content-generator-core | ^0.0.3 |
| creatuity/magento2-ai-content-generator-mass-actions | ^0.0.2 |
| orhanerday/open-ai | ^4.8 |
| php | ^8.1 |

### Require (dev)

| Package | Constraint |
|---|---|
| phpunit/phpunit | ^9 |

## Quality

Latest release (0.0.3) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 1 | 1 | – | – |
| 2.4.8 | – | 1 | 1 | – |
| 2.4.9 | – | – | 1 | 1 |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 71 | 71 warnings (ruleset: Magento2) — 30 auto-fixable with phpcbf |
| PHPMD | Warning | 4 | 4 rule violations (UnusedPrivateMethod:2, UnusedFormalParameter:1, UnusedPrivateField:1) |
| Cpd | Warning | 1 | 1 duplicated chunk spanning 11 total lines (min-lines=5, min-tokens=70) |
| Composer validate | Info | 2 | valid; 2 advisory notes (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Error | Error | – | – |
| 2.4.8 | – | Error | Error | – |
| 2.4.9 | – | – | Error | Error |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["creatuity/magento2-openai-content-generator"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

creatuity is a Magento 2 vendor on Packagento. See https://packagento.com/creatuity.md for their full catalogue.

