Skip to content

jgevenson/Create-MTO-Order

Repository files navigation

Ecommerce Order Generator

A comprehensive Python application for generating ecommerce order JSON payloads with both GUI and CLI interfaces. Supports Made-to-Order (MTO) items with customizable sub-items and customer questions.

Features

Core Functionality

  • Dual Interface: Both GUI (tkinter) and CLI interfaces available
  • Tabbed GUI Interface: Organized into 5 tabs for easy navigation
    • Order Details
    • Customer Information
    • Order Items
    • Payment Information
    • JSON Preview

Order Management

  • Configure order IDs, store IDs, totals, and status
  • Set delivery timeslots with automatic date calculation
  • Add admin and user comments
  • Choose fulfillment type (delivery/pickup)
  • Real-time total calculations

Customer Information

  • Complete customer details (name, email, phone, loyalty card)
  • Full shipping address with delivery instructions
  • Customer source keys and identifiers
  • IP address and user agent tracking

Advanced Order Items

  • Item Templates: Pre-built templates for common MTO items
    • Generic Custom Item
    • Custom T-Shirt
    • Custom Jewelry
  • MTO (Made-to-Order) Support:
    • Manage MTO sub-items with categories
    • Configure sub-item options (left, right, whole)
    • Customer questions and responses system
    • Field keys with UUID generation
  • Item Properties: SKU, name, quantity, price, weight, etc.
  • Item Characteristics: Prepared, weighted, age-restricted, alcohol, etc.
  • Location Management: Department, aisle, section, shelf assignments

Payment Processing

  • Multiple payment method support
  • Card type and transaction details
  • Payment instrument configuration
  • Gift card support

JSON Generation & Export

  • Real-time JSON preview with syntax highlighting
  • Save to file functionality
  • Copy to clipboard option
  • Formatted JSON output
  • Validation and error handling

Installation

  1. Ensure you have Python 3.6+ installed
  2. Clone or download the project files
  3. No external dependencies required - all modules used are built into Python:
    • tkinter (GUI interface)
    • json (JSON processing)
    • datetime (date/time handling)
    • uuid (unique identifier generation)

Usage

GUI Interface

python order_generator.py

CLI Interface

python cli_order_generator.py

For interactive mode:

python cli_order_generator.py --interactive

Project Structure

Create MTO Order/
├── order_generator.py      # Main GUI application
├── cli_order_generator.py  # Command-line interface
├── item_manager.py         # Order item management
├── mto_manager.py          # MTO sub-items and questions
├── item_templates.py       # Pre-built item templates
├── requirements.txt        # Dependencies (none external)
└── README.md              # This file

Key Components

OrderGenerator (GUI)

  • Main application class with tabbed interface
  • Real-time data validation and JSON generation
  • Integration with item and MTO managers

ItemManager

  • Add, edit, and remove order items
  • Template-based item creation
  • Item validation and data management

MTOManager

  • Manage MTO sub-items with categories
  • Customer questions and responses system
  • UUID generation for field keys
  • Sub-item option configuration (left/right/whole)

ItemTemplates

  • Pre-built templates for common MTO items
  • Includes MTO metadata and customer questions
  • Easily extensible for new templates

CLI Interface

  • Command-line order generation
  • Interactive mode for step-by-step creation
  • Batch processing capabilities
  • Default order structure generation

MTO (Made-to-Order) Features

Sub-items Management

  • Add multiple sub-items to a single order item
  • Configure sub-item categories (e.g., "Veggies", "Buns", "Size", "Color")
  • Set sub-item options (left, right, whole selections)
  • Automatic sub-item numbering

Customer Questions System

  • Dynamic question creation with field keys
  • Sequence-based question ordering
  • Custom field prompts and responses
  • UUID-based field identification

Template System

  • Pre-configured MTO items with metadata
  • Reusable question and sub-item structures
  • Easy template selection during item creation

JSON Structure

The generated JSON follows a comprehensive ecommerce order structure including:

  • Order Metadata: ID, status, totals, timeslots, fulfillment type
  • Customer Information: Complete customer details and addresses
  • Order Items: Products with locations, MTO metadata, and characteristics
  • Payment Information: Payment methods, cards, and transactions
  • MTO Data: Sub-items and customer questions/responses
  • Comments: Admin and user comments
  • Custom Fields: Extensible field system

Default Values

The application comes pre-populated with sample data including:

  • Sample customer (Susana Dixon)
  • Sample order item with MTO metadata
  • Sample payment information
  • Sample shipping address
  • Pre-built item templates

Customization

The application is designed to be highly extensible:

  • New Templates: Add custom item templates in item_templates.py
  • MTO Categories: Extend sub-item categories and options
  • Question Types: Add new question types and field prompts
  • UI Layout: Modify tab structure and form fields
  • Validation: Add custom validation rules
  • Export Formats: Extend export capabilities

CLI Usage Examples

Generate Default Order

python cli_order_generator.py

Interactive Order Creation

python cli_order_generator.py --interactive

Update Specific Fields

python cli_order_generator.py --order-id "200000" --customer-name "John Doe"

Troubleshooting

  • Import Errors: Ensure Python 3.6+ is installed
  • GUI Issues: Verify tkinter is available in your Python installation
  • JSON Generation Errors: Check that all required fields are filled
  • MTO Management: Ensure items are selected before managing MTO data
  • Template Loading: Verify template names match available templates

Contributing

The application welcomes contributions for:

  • Additional item templates
  • New MTO categories and options
  • Enhanced validation rules
  • API integrations
  • Export format extensions
  • UI/UX improvements
  • Performance optimizations

License

This project is open source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages