Search documentation of phoenix_kit

# PhoenixKit.Migrations.Postgres.V46 (phoenix_kit v1.7.87)

Copy Markdown View Source

V46: Product Options with Dynamic Pricing + Import Logs + Translations

This migration adds:

- phoenix_kit_shop_config table for global Shop configuration
- option_schema JSONB column to categories for category-specific options
- image_id BIGINT column to categories for Storage media integration
- featured_image_id and image_ids columns to products for Storage integration
- selected_specs JSONB column to cart_items for specification storage
- phoenix_kit_shop_import_logs table for CSV import history tracking
- translations JSONB column to products and categories for multi-language support

## Option Schema Format

Options support dynamic pricing with two modifier types:

    %{
      "key" => "material",
      "label" => "Material",
      "type" => "select",
      "options" => ["PLA", "ABS", "PETG"],
      "affects_price" => true,
      "modifier_type" => "fixed",  # "fixed" or "percent"
      "price_modifiers" => %{
        "PLA" => "0",
        "ABS" => "5.00",
        "PETG" => "10.00"
      }
    }

## Price Calculation Order

1. Sum all fixed modifiers
2. Add to base price (intermediate price)
3. Sum all percent modifiers
4. Apply percent to intermediate price

Example: Base $20 + PETG ($10 fixed) + Premium (20% percent) Result: ($20 + $10) * 1.20 = $36

## Summary

### Functions

down(opts)
up(opts)

## Functions

# down(opts)

# up(opts)