Instructions to Complete Product Name Integration Current Status ✅ Database already has name column in products table ✅ ProductModel updated (create and update methods now handle name and product_type) ✅ Excel template already includes "Product Name" field Remaining Tasks 1. Update ProductController File: Z:/hnsims/v2/app/Controllers/ProductController.php In the add() method, update the data array to include name: // Find where product data is prepared (around line 50-80) $productData = [ 'part_number' => $_POST['part_number'], 'name' => $_POST['name'], // ADD THIS 'product_type' => $_POST['product_type'], // ADD THIS 'type_id' => $typeId, 'category_id' => $categoryId, 'description' => $_POST['description'] ?? '', 'low_stock_threshold' => $_POST['low_stock_threshold'] ?? 5, 'qr_code' => $qrCodePath ?? null, 'available_sizes' => $availableSizes ]; Copy Insert In the edit() method, do the same for update data. In validation, add name as required field. 2. Update Product Add/Edit Form File: Z:/hnsims/v2/app/views/products/add.php Add name input field after part_number (around line 50-60):
Copy Insert Update JavaScript to handle name field in product selection and form population (search for where part_number is set and add name handling). 3. Update Product Display Pages File: Z:/hnsims/v2/app/views/products/index.php Update table headers (around line 150): Part Number Product Name Type Category Copy Insert Update table rows (around line 180): Copy Insert File: Z:/hnsims/v2/app/views/products/detail.php Add name display in product details section (around line 50-80). 4. Update Stock Views Files to update: Z:/hnsims/v2/app/views/stock/add.php Z:/hnsims/v2/app/views/stock/out.php Z:/hnsims/v2/app/views/stock/in-stock.php In product dropdown/display, show name along with part_number: // In JavaScript where products are displayed displayName = `${product.part_number} - ${product.name}`; Copy Insert 5. Update Reports File: Z:/hnsims/v2/app/Models/TransactionModel.php Update SELECT queries to include p.name: SELECT p.part_number, p.name, p.product_type, ... Copy Insert File: Z:/hnsims/v2/app/views/reports/index.php Add name column to transaction reports table. 6. Update Bulk Upload Handler File: Z:/hnsims/v2/app/Controllers/ProductController.php In bulkAdd() method, update CSV/Excel parsing to handle name column: // Map Excel columns $productData = [ 'part_number' => $row[0], 'name' => $row[1], // Product Name column 'category_name' => $row[2], // Category 'product_type' => $row[3], // Product Type (from type dropdown) 'description' => $row[4], 'low_stock_threshold' => $row[5], 'available_sizes' => $row[6] ]; Copy Insert Note: You'll need to handle Excel file reading with PhpSpreadsheet. The template controller already generates proper Excel files. 7. Update Stock Out Form (v2) Task from original request: Adjust selector flow on stock out page: File: Z:/hnsims/v2/app/views/stock/out.php Desired flow: Product → Location → (if selected) Department → Employee → Size → Quantity Currently it's "zig-zagging". Update the form field order and JavaScript to follow this linear flow. Testing Checklist Add new product with name field Edit existing product and add name View product list shows name Product detail page shows name Stock add/out shows product name Reports include product name Bulk upload with Excel template works Stock out form follows correct flow Quick Reference: Database Structure products table: - part_number (SKU) - name (Product Name) ← NEW FIELD - product_type (Subcategory/Type name) - type_id → types table - category_id → categories table - description - low_stock_threshold - available_sizes