Overview
Categories help organize your products into logical groups like “Camisas” (Shirts), “Pantalones” (Pants), “Accesorios” (Accessories), etc. The category management interface provides a streamlined workflow with a side-by-side form and table layout.Categories are required when creating products. Set up your category structure before adding inventory items.
Accessing Category Management
Navigate to the Categorías page (categorias.php) from the main navigation menu.
Interface Layout
The page is divided into two sections:- Left Panel (4 columns): Quick-add form for creating new categories
- Right Panel (8 columns): Table displaying all existing categories
Creating a New Category
Locate the creation form
On the left side of the page, you’ll see a card titled “Nueva Categoría” with a dark header.
Enter category name
In the “Nombre de la Categoría” field, enter a descriptive category name.Examples:
- Accesorios
- Camisas
- Pantalones
- Vestidos
- Calzado
- Ropa Deportiva
Add a description (optional)
In the “Descripción” field (textarea), add additional details about the category.Examples:
- “Prendas superiores formales e informales”
- “Incluye corbatas, cinturones, bufandas”
- “Pantalones casuales y de vestir”
The description field is optional but recommended for clarity, especially if multiple staff members manage inventory.
Save the category
Click the “Guardar Categoría” button (full-width blue button) to create the category.
Database Operation
Viewing Categories
The categories table on the right side displays:| Column | Description |
|---|---|
| ID | Auto-generated unique identifier |
| Nombre | Category name (bold text) |
| Descripción | Category description (smaller text) |
| Acción | Edit button (yellow) |
Editing a Category
Category editing uses a modal dialog for a streamlined experience without leaving the page.Click the Edit button
In the categories table, locate the category you want to modify and click its yellow “Editar” button.
Modal opens
A modal dialog titled “Modificar Categoría” appears, pre-populated with the current category data:
- Hidden field:
id_categoria(category ID) - Nombre field: Current category name
- Descripción field: Current description
Update the fields
Modify the name and/or description as needed:Nombre (required)
- Change the category name
- Cannot be left empty
- Update or add additional context
- Supports multi-line text (4 rows)
Save changes
Click “Actualizar Cambios” (blue button) to save, or “Cerrar” (gray button) to cancel without saving.
Modal Implementation Details
The edit modal uses JavaScript to populate form fields:Category Limitations and Constraints
Cannot Delete Categories
Categories cannot be deleted through the UI because:- Foreign Key Constraints: Products reference categories via
id_categoria - Data Integrity: Deleting a category would orphan all associated products
- Historical Records: Maintaining category history is important for reporting
Workaround for Unused Categories
If you need to “retire” a category:Edit the category name
Add a prefix like
[INACTIVE] or [DEPRECATED] to the category name.Example: [INACTIVE] Vintage CollectionUpdate the description
Add a note explaining why it’s inactive and when it was retired.Example: “Category retired on 2026-03-01. Products moved to ‘Camisas’ category.”
Database-Level Deletion
If you absolutely must delete a category:Contact your database administrator or developer to perform database-level deletions.
Category Naming Best Practices
Be Consistent
Use either singular (“Camisa”) or plural (“Camisas”) forms consistently across all categories.
Use Clear Names
Choose names that are immediately understandable to all staff members.
Avoid Overlaps
Don’t create categories with overlapping purposes (e.g., “Ropa Casual” and “Casual Wear”).
Think Hierarchically
Even though the system is flat, plan categories that could logically group into parent categories later.
Common Use Cases
Setting up initial category structure
Setting up initial category structure
When first configuring TiendaRopa:
- List all product types you sell
- Group similar items into logical categories
- Aim for 5-15 categories (not too few, not too many)
- Create categories before adding products
- Camisas (Shirts)
- Pantalones (Pants)
- Vestidos (Dresses)
- Ropa Interior (Underwear)
- Accesorios (Accessories)
- Calzado (Footwear)
Renaming a category used by many products
Renaming a category used by many products
If you need to rename a category that’s already assigned to products:
- Click Editar on the category
- Update the name in the modal
- Click Actualizar Cambios
- All products automatically reflect the new category name
Organizing by season or collection
Organizing by season or collection
You can create seasonal categories:
- “Primavera 2026”
- “Colección Verano”
- “Liquidación Invierno”
Handling subcategories
Handling subcategories
The system doesn’t support hierarchical categories natively, but you can simulate them with naming:
- “Ropa - Camisas”
- “Ropa - Pantalones”
- “Accesorios - Cinturones”
- “Accesorios - Corbatas”
Troubleshooting
Category name appears but description is blank
Category name appears but description is blank
This is normal behavior:
- The description field is optional
- Empty descriptions display as blank in the table
- Edit the category to add a description
Edit modal shows old data after updating
Edit modal shows old data after updating
This is a browser caching issue:
- The page reloads after each update
- If you see stale data, do a hard refresh (Ctrl+F5 or Cmd+Shift+R)
- Check that the URL contains
?msg=actualizada
Cannot save category - no error message
Cannot save category - no error message
Possible causes:
- Empty name field: The nombre field is required
- Database connection issue: Check database connectivity
- Character encoding problems: Ensure UTF-8 encoding for special characters
Special characters (accents, ñ) not displaying correctly
Special characters (accents, ñ) not displaying correctly
Ensure proper character encoding:
- Page uses
<meta charset="UTF-8"> - Database tables use
utf8mb4collation - PHP connection uses UTF-8 charset
Edit button opens modal but fields are empty
Edit button opens modal but fields are empty
Related Features
Managing Products
Learn how to create products and assign them to categories
Database Schema
Understand the categoria table structure and relationships
Integration with Product Management
Categories integrate with products through theid_categoria foreign key:
- Create a product: You select from existing categories
- Edit a product: You can change its category
- View inventory: Products display with their category name
- Search products: You can search by category name