WP Manifestindependent plugin directory
manifest / ai / ai

AI Product Creator - Bulgarian Edition

Създавайте WooCommerce продукти с AI-генерирани описания на български език и изображения от интернет базирани на името на продукта.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/ha-hub-i/ai/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

AI Product Creator for WordPress/WooCommerce

A comprehensive WordPress plugin that automatically creates WooCommerce products with AI-generated descriptions and web-sourced images based on product names.

Features

  • AI-Powered Descriptions: Generate compelling product descriptions using OpenAI GPT
  • Intelligent Image Search: Find and download relevant product images from multiple sources
  • Multiple Image Sources: Support for Unsplash, Pixabay, and Pexels
  • Bulk Product Creation: Create multiple products at once
  • Smart Product Features: Auto-generate product attributes and features
  • Preview Functionality: Preview generated content before creating products
  • Quality Filtering: Advanced image quality and relevance scoring
  • SEO Optimization: Generated content optimized for search engines
  • Activity Logging: Track creation activities and API usage
  • Responsive Admin Interface: Mobile-friendly administration panel

Installation

Method 1: Manual Installation

  1. Download the plugin files
  2. Create the following directory structure in your WordPress installation:
wp-content/plugins/ai-product-creator/
├── ai-product-creator.php (main plugin file)
├── includes/
│   ├── class-apc-admin.php
│   ├── class-apc-ai-service.php
│   ├── class-apc-image-search.php
│   ├── class-apc-product-creator.php
│   └── class-apc-settings.php
├── assets/
│   ├── css/
│   │   └── admin.css
│   └── js/
│       └── admin.js
├── languages/
└── readme.txt
  1. Upload all files to the plugin directory
  2. Activate the plugin from WordPress Admin → Plugins

Method 2: ZIP Installation

  1. Compress all plugin files into a ZIP archive named ai-product-creator.zip
  2. Go to WordPress Admin → Plugins → Add New → Upload Plugin
  3. Upload the ZIP file and activate

Configuration

1. OpenAI API Setup

  1. Go to AI Products → Settings
  2. Get your API key from OpenAI Platform
  3. Enter the API key in the OpenAI API Key field
  4. Click "Test Connection" to verify

2. Image Search Setup

Unsplash (Recommended)

  • Free tier available with demo key
  • Get API key from Unsplash Developers
  • High-quality stock photos

Pixabay

  • Requires free API key
  • Get API key from Pixabay API
  • Large collection of free images

Pexels

  • Requires free API key
  • Get API key from Pexels API
  • Professional quality photos

3. Basic Settings

// Required settings
OpenAI API Key: your-openai-api-key
Description Template: "Generate a detailed product description for: {product_name}. Include features, benefits, and target audience."

// Optional settings
Max Description Length: 500 (characters)
Max Images per Product: 5
Image Quality Filter: medium
Auto Publish: false (save as drafts)

Usage

Creating Single Products

  1. Navigate to AI Products → Create Product
  2. Enter the product name
  3. Select options:
    • ✅ Generate AI Description
    • ✅ Search for Product Image
    • ⬜ Auto Publish Product
  4. Choose product category and price (optional)
  5. Click "Preview" to see generated content
  6. Click "Create Product" to finalize

Bulk Product Creation

// Example: Create multiple products programmatically
$product_creator = new APC_Product_Creator();
$product_names = array(
    'Wireless Bluetooth Headphones',
    'Stainless Steel Water Bottle',
    'Organic Cotton T-Shirt'
);

$results = $product_creator->bulk_create_products($product_names, array(
    'generate_description' => true,
    'search_image' => true,
    'auto_publish' => false,
    'category' => 'electronics'
));

Updating Existing Products

  1. Edit any WooCommerce product
  2. In the "AI Product Actions" meta box:
    • Click "Regenerate Description" to create new AI content
    • Click "Search New Image" to find fresh product images

API Integration

Custom AI Service Integration

// Hook into the AI generation process
add_filter('apc_ai_prompt_template', function($template, $product_name) {
    return "Create an engaging description for {$product_name} that highlights its unique selling points.";
}, 10, 2);

// Modify generated descriptions
add_filter('apc_generated_description', function($description, $product_name) {
    // Add custom footer or modify content
    return $description . "\n\nFree shipping on orders over $50!";
}, 10, 2);

Custom Image Sources

// Add custom image search source
add_filter('apc_image_search_sources', function($sources) {
    $sources['custom'] = 'Custom Image API';
    return $sources;
});

// Handle custom image search
add_action('apc_search_custom_images', function($query, $options) {
    // Implement your custom image search logic
    $images = your_custom_image_search($query);
    return $images;
}, 10, 2);

Security Considerations

API Key Security

  1. Environment Variables: Store API keys in environment variables

    // In wp-config.php
    define('APC_OPENAI_API_KEY', getenv('OPENAI_API_KEY'));
    define('APC_UNSPLASH_ACCESS_KEY', getenv('UNSPLASH_ACCESS_KEY'));
  2. File Permissions: Ensure proper file permissions

    chmod 644 *.php
    chmod 755 includes/
    chmod 644 includes/*.php
  3. Database Security: All inputs are sanitized and validated

    // Example of plugin's security measures
    $product_name = sanitize_text_field($_POST['product_name']);
    $category = intval($_POST['category']);
    check_admin_referer('apc_create_product', 'apc_nonce');

Content Filtering

// Add content filtering hooks
add_filter('apc_description_content', 'wp_kses_post');
add_filter('apc_image_alt_text', 'sanitize_text_field');

Testing

Unit Testing Setup

# Install PHPUnit
composer require --dev phpunit/phpunit

# Run tests
./vendor/bin/phpunit tests/

Test Cases

// Example test case
class APC_AI_Service_Test extends WP_UnitTestCase {

    public function test_description_generation() {
        $ai_service = new APC_AI_Service();
        $description = $ai_service->generate_description('Test Product');

        $this->assertNotEmpty($description);
        $this->assertLessThan(500, strlen($description));
    }

    public function test_image_search() {
        $image_search = new APC_Image_Search();
        $images = $image_search->search_images('laptop');

        $this->assertIsArray($images);
        $this->assertGreaterThan(0, count($images));
    }
}

Performance Optimization

Caching Implementation

// Cache AI responses
add_action('apc_description_generated', function($description, $product_name) {
    $cache_key = 'apc_desc_' . md5($product_name);
    wp_cache_set($cache_key, $description, 'apc_descriptions', 3600);
}, 10, 2);

// Cache image search results
add_action('apc_images_found', function($images, $query) {
    $cache_key = 'apc_images_' . md5($query);
    wp_cache_set($cache_key, $images, 'apc_images', 1800);
}, 10, 2);

Database Optimization

-- Add indexes for better performance
ALTER TABLE wp_apc_product_generation_log 
ADD INDEX idx_product_name (product_name);

ALTER TABLE wp_apc_product_generation_log 
ADD INDEX idx_generation_date (generation_date);

Troubleshooting

Common Issues

  1. API Connection Fails

    • Verify API keys are correct
    • Check internet connectivity
    • Ensure proper SSL/TLS configuration
  2. Images Not Downloading

    • Check file permissions on uploads directory
    • Verify API quotas not exceeded
    • Ensure sufficient disk space
  3. Descriptions Not Generated

    • Verify OpenAI API key and quota
    • Check error logs: wp-content/debug.log
    • Test API connection in settings

Debug Mode

// Enable debug logging
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('APC_DEBUG', true);

// View logs
tail -f wp-content/debug.log | grep "APC"

Error Codes

Code Description Solution
APC001 API Key Missing Add OpenAI API key in settings
APC002 Quota Exceeded Check API usage limits
APC003 Image Download Failed Verify image URL and permissions
APC004 Invalid Product Data Check required fields

Hooks and Filters

Action Hooks

// Product creation hooks
do_action('apc_before_product_creation', $args);
do_action('apc_product_created', $product_id, $args);
do_action('apc_product_updated', $product_id, $options);

// AI generation hooks
do_action('apc_description_generated', $description, $product_name);
do_action('apc_images_found', $images, $query);

Filter Hooks

// Content modification filters
apply_filters('apc_ai_prompt_template', $template, $product_name);
apply_filters('apc_generated_description', $description, $product_name);
apply_filters('apc_image_search_query', $query, $product_name);
apply_filters('apc_found_images', $images, $query);

Requirements

  • WordPress: 5.0 or higher
  • WooCommerce: 5.0 or higher
  • PHP: 7.4 or higher
  • cURL: Enabled for API requests
  • OpenSSL: For secure API communication
  • Memory: 128MB recommended
  • Storage: 10MB+ for plugin files

Changelog

Version 1.0.0

  • Initial release
  • AI description generation
  • Multi-source image search
  • Admin interface
  • Settings management
  • Activity logging

Support

For support and documentation:

License

This plugin is licensed under the GPL v2 or later.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

Please follow WordPress coding standards and include proper documentation.