Overview
The catalog management system provides centralized control over product attributes including categories, colors, and sizes. Each module features a sidebar form for creating new entries and an inline table with modal-based editing.Categories, colors, and sizes are referenced by products through foreign keys, ensuring data consistency across the system.
Categories Module
Manage product categories with descriptions (categorias.php).
Category Structure
Creating Categories
The sidebar form allows quick category creation:- Form Fields
- Example Categories
- Nombre: Category name (e.g., “Caballero”, “Dama”, “Infantil”)
- Descripción: Optional detailed description of the category
Editing Categories
Categories are edited through a Bootstrap modal:The JavaScript function uses
addslashes() in PHP to escape quotes in descriptions, preventing XSS and JavaScript injection.Colors Module
Manage color options for products (colores.php).
Color Structure
Creating Colors
Auto-Increment IDs
Color IDs are automatically assigned by the database
Descriptive Names
Use descriptive names like “Negro Nocturno” or “Azul Marino”
Example Color Data
| ID | Nombre |
|---|---|
| 1 | Negro Nocturno |
| 2 | Blanco Pureza |
| 3 | Azul Marino |
| 4 | Rojo Pasión |
| 5 | Gris Oxford |
Updating Colors
Sizes Module
Manage size options for clothing items (tallas.php).
Size Structure
Creating Sizes
Size Examples
- Standard Sizes
- Display Format
| ID | Talla |
|---|---|
| 1 | ch (chica) |
| 2 | m (mediana) |
| 3 | g (grande) |
| 7 | ech (extra chica) |
| 8 | eg (extra grande) |
Updating Sizes
Deleting Sizes
The sizes module includes delete functionality with constraint handling:Common UI Pattern
All three catalog modules share a consistent layout:Database Relationships
Catalog tables are referenced by the mainprenda table:
These foreign key constraints ensure referential integrity - you cannot assign a non-existent category, color, or size to a product.
Success Messages
All modules use URL parameters for success feedback:| Parameter | Message Type | Example URL |
|---|---|---|
?msg=creada | Category created | categorias.php?msg=creada |
?msg=actualizada | Category updated | categorias.php?msg=actualizada |
?msg=creado | Color/size created | colores.php?msg=creado |
?msg=actualizado | Color/size updated | tallas.php?msg=actualizado |
?msg=eliminado | Size deleted | tallas.php?msg=eliminado |
Best Practices
Descriptive Names
Use clear, descriptive names for categories and colors to improve user experience
Plan Ahead
Create all needed categories, colors, and sizes before adding products
Check References
Before deleting, verify no products reference the catalog item
Standard Sizes
Use consistent size notation (ch, m, g, ech, eg) across your inventory
Related Features
Inventory Management
Create products using the categories, colors, and sizes defined here
Product CRUD
Edit products and change their category, color, or size assignments