[ 'type' => 'number', 'bulkEdit' => true, 'label' => 'Price', 'step' => 0.01, 'max' => 99999, 'description' => 'Product price' ], 'product_type' => [ 'type' => 'select', 'label' => 'Product Type', 'options' => [ 'REGULAR' => 'Regular Product', 'SERVICE' => 'Service', 'DIGITAL' => 'Digital Product', 'FOOD_AND_BEV' => 'Food & Beverage', 'EVENT' => 'Event/Ticket', 'SUBSCRIPTION' => 'Subscription', 'DONATION' => 'Donation' ], 'default' => $config['integrations']['helcim']['content_type'] ?? 'REGULAR' ], 'cart_quantity' => [ 'type' => 'number', 'label' => 'Quantity', 'hidden' => true, ], // Tax & Shipping 'tax_exempt' => [ 'type' => 'true_false', 'label' => 'Tax Exempt', 'section' => 'helcim-tax' ], 'shipping_required' => [ 'type' => 'true_false', 'label' => 'Shipping Required', 'section' => 'helcim-shipping' ], 'shipping_weight' => [ 'type' => 'number', 'label' => 'Shipping Weight (kg)', 'step' => 0.01, 'section' => 'helcim-shipping', 'condition' => [ 'field' => 'shipping_required', 'operator' => '==', 'value' => true ] ], // Availability 'available_online' => [ 'type' => 'true_false', 'label' => 'Available Online', 'section' => 'helcim-availability', 'default' => true ], 'available_for_pickup' => [ 'type' => 'true_false', 'label' => 'Available for Pickup', 'section' => 'helcim-availability', 'default' => true ], 'available_for_delivery' => [ 'type' => 'true_false', 'label' => 'Available for Delivery', 'section' => 'helcim-availability', 'default' => false ], '_helcim_sku' => [ 'type' => 'text', 'label' => 'SKU', 'description' => 'Stock keeping unit', 'section' => 'helcim-config' ], // Product Variations 'product_variations' => [ 'type' => 'repeater', 'label' => 'Product Variations', 'description' => 'Different versions of this product', 'add_label' => 'Add Variation', 'section' => 'variations', 'fields' => $this->getVariationFields($config) ], // Product Options 'options' => [ 'type' => 'group', 'label' => 'Product Options', 'section'=> 'helcim-options', 'fields' => [ 'max_order' => [ 'type' => 'number', 'label' => 'Maximum per order', 'default' => 50 ], 'min_order' => [ 'type' => 'number', 'label' => 'Minimum per order', 'default' => 0, ], 'step' => [ 'type' => 'number', 'label' => 'Order increment', 'default' => 1, ], 'preparation_time' => [ 'type' => 'number', 'label' => 'Preparation time (minutes)', 'description' => 'Time needed to prepare this item', 'condition' => [ 'field' => 'product_type', 'operator' => 'in', 'value' => ['FOOD_AND_BEV', 'SERVICE'] ] ] ] ], // Subscription Fields 'subscription_settings' => [ 'type' => 'group', 'label' => 'Subscription Settings', 'section' => 'helcim-subscription', 'condition' => [ 'field' => 'product_type', 'operator' => '==', 'value' => 'SUBSCRIPTION' ], 'fields' => [ 'billing_cycle' => [ 'type' => 'select', 'label' => 'Billing Cycle', 'options' => [ 'daily' => 'Daily', 'weekly' => 'Weekly', 'monthly' => 'Monthly', 'quarterly' => 'Quarterly', 'yearly' => 'Yearly' ], 'default' => 'monthly' ], 'trial_period' => [ 'type' => 'number', 'label' => 'Trial Period (days)', 'description' => 'Free trial period before billing starts', 'default' => 0 ], 'setup_fee' => [ 'type' => 'number', 'label' => 'Setup Fee', 'step' => 0.01, 'description' => 'One-time setup fee' ] ] ], // Food & Beverage Specific 'food_settings' => [ 'type' => 'group', 'label' => 'Food & Beverage Settings', 'section' => 'helcim-food', 'condition' => [ 'field' => 'product_type', 'operator' => '==', 'value' => 'FOOD_AND_BEV' ], 'fields' => [ 'ingredients' => [ 'type' => 'textarea', 'label' => 'Ingredients', 'description' => 'List ingredients (comma separated)' ], 'allergens' => [ 'type' => 'checkbox_list', 'label' => 'Allergens', 'options' => [ 'gluten' => 'Contains Gluten', 'dairy' => 'Contains Dairy', 'nuts' => 'Contains Nuts', 'soy' => 'Contains Soy', 'eggs' => 'Contains Eggs', 'seafood' => 'Contains Seafood' ] ], 'dietary_options' => [ 'type' => 'checkbox_list', 'label' => 'Dietary Options', 'options' => [ 'vegetarian' => 'Vegetarian', 'vegan' => 'Vegan', 'gluten_free' => 'Gluten Free', 'dairy_free' => 'Dairy Free', 'keto' => 'Keto Friendly', 'halal' => 'Halal', 'kosher' => 'Kosher' ] ], 'spice_level' => [ 'type' => 'range', 'label' => 'Spice Level', 'min' => 0, 'max' => 5, 'default' => 0 ], 'serving_size' => [ 'type' => 'text', 'label' => 'Serving Size', 'description' => 'e.g., "Serves 2-3"' ] ] ], // Service Specific 'service_settings' => [ 'type' => 'group', 'label' => 'Service Settings', 'section' => 'helcim-service', 'condition' => [ 'field' => 'product_type', 'operator' => '==', 'value' => 'SERVICE' ], 'fields' => [ 'service_duration' => [ 'type' => 'number', 'label' => 'Duration (minutes)', 'description' => 'Service duration in minutes' ], 'booking_required' => [ 'type' => 'true_false', 'label' => 'Booking Required' ], 'capacity' => [ 'type' => 'number', 'label' => 'Service Capacity', 'description' => 'Maximum number of customers per service' ], 'staff_required' => [ 'type' => 'number', 'label' => 'Staff Required', 'description' => 'Number of staff needed', 'default' => 1 ] ] ], // Event Specific 'event_settings' => [ 'type' => 'group', 'label' => 'Event Settings', 'section' => 'helcim-event', 'condition' => [ 'field' => 'product_type', 'operator' => '==', 'value' => 'EVENT' ], 'fields' => [ 'event_date' => [ 'type' => 'datetime', 'label' => 'Event Date & Time' ], 'event_location' => [ 'type' => 'text', 'label' => 'Event Location' ], 'max_attendees' => [ 'type' => 'number', 'label' => 'Maximum Attendees' ], 'early_bird_price' => [ 'type' => 'number', 'label' => 'Early Bird Price', 'step' => 0.01, 'description' => 'Discounted price for early registrations' ], 'early_bird_deadline' => [ 'type' => 'date', 'label' => 'Early Bird Deadline' ] ] ] ]; // Add inventory fields if configured if ($config['hasInventory'] ?? false) { $fields['_helcim_inventory'] = [ 'type' => 'number', 'label' => 'Inventory', 'bulkEdit' => true, 'section' => 'inventory' ]; $fields['track_inventory'] = [ 'type' => 'true_false', 'label' => 'Track Inventory', 'section' => 'inventory', 'default' => true ]; $fields['low_stock_threshold'] = [ 'type' => 'number', 'label' => 'Low Stock Alert', 'description' => 'Alert when stock falls below this level', 'section' => 'inventory', 'default' => 5 ]; $fields['product_variations']['fields']['inventory'] = [ 'type' => 'number', 'label' => 'Stock Quantity', 'description' => 'Current stock for this variation' ]; } return $fields; } /** * Get variation fields */ private function getVariationFields(array $config): array { $fields = [ 'name' => [ 'type' => 'text', 'label' => 'Variation Name', 'description' => 'e.g., "Small", "Large", "Red"' ], 'price' => [ 'type' => 'number', 'label' => 'Price', 'step' => 0.01, 'max' => 99999, 'description' => 'Price for this variation' ], 'sku' => [ 'type' => 'text', 'label' => 'SKU', 'description' => 'Stock keeping unit for this variation' ], 'track_inventory' => [ 'type' => 'true_false', 'label' => 'Track Inventory', ], '_helcim_variation_id' => [ 'type' => 'text', 'label' => 'Helcim Variation ID', 'description' => 'Helcim ID for this variation', 'hidden' => true ], '_helcim_last_sync' => [ 'type' => 'datetime', 'label' => 'Last Sync', 'hidden' => true ], 'options' => [ 'type' => 'group', 'label' => 'Variation Options', 'collapsible' => true, 'fields' => [ 'color' => [ 'type' => 'color', 'label' => 'Color', 'description' => 'Visual color for this variation' ], 'size' => [ 'type' => 'select', 'label' => 'Size', 'options' => [ '' => 'N/A', 'xs' => 'Extra Small', 's' => 'Small', 'm' => 'Medium', 'l' => 'Large', 'xl' => 'Extra Large', 'xxl' => '2X Large', 'custom'=> 'Custom' ] ], 'custom_size' => [ 'type' => 'text', 'label' => 'Custom Size', 'condition' => [ 'field' => 'size', 'operator' => '==', 'value' => 'custom' ] ], 'weight' => [ 'type' => 'number', 'label' => 'Weight (kg)', 'step' => 0.01, 'description' => 'Weight of this variation' ], 'dimensions' => [ 'type' => 'group', 'label' => 'Dimensions', 'fields' => [ 'length' => [ 'type' => 'number', 'label' => 'Length (cm)', 'step' => 0.1 ], 'width' => [ 'type' => 'number', 'label' => 'Width (cm)', 'step' => 0.1 ], 'height' => [ 'type' => 'number', 'label' => 'Height (cm)', 'step' => 0.1 ] ] ] ] ] ]; // Add service-specific variation fields $product_type = $_POST['product_type'] ?? $config['integrations']['helcim']['content_type'] ?? 'REGULAR'; if ($product_type === 'SERVICE') { $fields['service_duration'] = [ 'type' => 'number', 'label' => 'Duration (minutes)', 'description' => 'Duration for this service variation' ]; $fields['available_for_booking'] = [ 'type' => 'true_false', 'label' => 'Available for Booking' ]; } if ($product_type === 'FOOD_AND_BEV') { $fields['portion_size'] = [ 'type' => 'select', 'label' => 'Portion Size', 'options' => [ 'small' => 'Small', 'regular' => 'Regular', 'large' => 'Large', 'family' => 'Family Size' ] ]; $fields['calories'] = [ 'type' => 'number', 'label' => 'Calories', 'description' => 'Calorie count for this variation' ]; } if ($product_type === 'DIGITAL') { $fields['download_limit'] = [ 'type' => 'number', 'label' => 'Download Limit', 'description' => 'Maximum number of downloads', 'default' => -1 ]; $fields['expiry_days'] = [ 'type' => 'number', 'label' => 'Access Duration (days)', 'description' => 'Days until download expires', 'default' => 0 ]; } return $fields; } }