Skip to main content

Overview

The product management system allows you to maintain your clothing inventory with detailed attributes including name, price, stock levels, category, size, and color. All product operations are accessible from the main inventory page.
Products are referred to as “prendas” (garments) in the system and are the core entities of your inventory.

Viewing the Inventory

Accessing the Product List

Navigate to the main inventory page (index.php) to view all products in a sortable, searchable table. Available columns:
  • ID - Unique product identifier
  • Nombre - Product name
  • Precio - Current price in dollars
  • Stock - Current stock quantity
  • Categoría - Product category
  • Talla - Size (displayed in uppercase)
  • Color - Color name
  • Acciones - Edit and delete buttons

Sorting Products

1

Click any column header

Click on any column header (ID, Nombre, Precio, Stock, Categoría, Talla, or Color) to sort by that column.
2

Toggle sort direction

Click the same header again to toggle between ascending (▲) and descending (▼) order.
3

Sort indicator

The active sort column displays an arrow indicator showing the current sort direction.
The sort state is preserved in the URL using ?sort=column&order=asc parameters, so you can bookmark specific views.

Searching Products

The search functionality allows you to quickly find products across multiple fields.
1

Enter search term

Type your search term in the search box located at the top of the inventory page. You can search by:
  • Product name
  • Color
  • Size
  • Price
  • Product ID (exact match)
2

Click 'Buscar'

Click the Buscar button to execute the search.
3

View filtered results

The table updates to show only matching products. If no results are found, you’ll see: “No se encontraron prendas que coincidan con la búsqueda.”
4

Clear search (optional)

Click the Limpiar button to return to the full inventory view.
Search maintains your current sort order. The search uses LIKE queries, so partial matches work (e.g., “cam” will find “Camisa Oxford”).

Creating a New Product

1

Click 'Nueva Prenda'

From the inventory page, click the Nueva Prenda button in the top-right corner to open the product creation form (crear.php).
2

Fill in product details

Complete all required fields:Nombre del Producto (required)
  • Enter the product name (e.g., “Camisa Oxford”)
  • This is a text field with no character limit
Precio ($) (required)
  • Enter the price as a decimal number (e.g., 500.00)
  • Accepts up to 2 decimal places
  • Field type: number with step="0.01"
Stock Inicial (required)
  • Enter the initial stock quantity (default: 0)
  • Must be a whole number
  • You can update this later through stock operations
3

Select product attributes

Choose from the dropdown menus:Categoría (required)
  • Select from existing categories (e.g., Camisas, Pantalones, Accesorios)
  • Categories are managed in the Categories section
Talla (required)
  • Select from available sizes (displayed in uppercase)
  • Common values: S, M, L, XL
  • Sizes are managed in the catalog settings
Color (required)
  • Select from available colors
  • Colors are managed in the catalog settings
4

Save the product

Click Guardar Producto to create the product, or Cancelar to return to the inventory without saving.
5

Verify creation

After successful creation, you’ll be redirected to the inventory page where the new product appears in the table.
All fields are required. The form will not submit if any field is empty.

Database Operation

INSERT INTO prenda (nombre, precio, stock_actual, id_categoria, id_talla, id_color) 
VALUES (:nombre, :precio, :stock, :cat, :talla, :color)

Editing an Existing Product

1

Locate the product

Find the product you want to edit in the inventory table. Use search or sorting to locate it quickly.
2

Click 'Editar'

Click the Editar button in the Acciones column for that product. This opens the edit form (editar.php?id=X).
3

Review current values

The form loads with all current values pre-filled:
  • Product name
  • Current price
  • Current stock level
  • Selected category, size, and color
4

Modify fields

Update any fields you want to change:Nombre del Producto
  • Edit the product name
Precio Actual ($)
  • Update the price
  • If you change the price, the system automatically creates a price history record
Stock
  • Adjust stock quantity directly
  • Note: For audited stock changes, use Stock Operations instead
Categoría, Talla, Color
  • Change any attribute using the dropdown menus
5

Select the employee making changes

IMPORTANT: Select your name from the “Empleado que realiza la modificación” dropdown.
This field is required (red border). Employee tracking is essential for audit trails, especially for price changes.
6

Save changes

Click Actualizar y Guardar Historial to save all changes and create audit records, or Volver to cancel.

Price Change Tracking

When you update a product’s price:
  1. The system compares the new price with the previous price
  2. If different, it automatically inserts a record into the actualizacion table
  3. The record includes:
    • Previous price
    • New price
    • Product ID
    • Employee ID (who made the change)
    • Timestamp
View all price change history in the Historial de Actualización de Precios page (actualizaciones.php).

Transaction Safety

The edit operation uses database transactions for data integrity:
$conn->beginTransaction();

// If price changed, log it
if ($nuevo_precio != $precio_anterior) {
    INSERT INTO actualizacion ...
}

// Update product
UPDATE prenda SET nombre=?, precio=?, stock_actual=?, 
                  id_categoria=?, id_talla=?, id_color=? 
WHERE id_prenda=?

$conn->commit(); // Save all changes
If any error occurs, the entire operation is rolled back to prevent partial updates.

Deleting a Product

Product deletion is permanent and cannot be undone. Use with caution.
1

Locate the product

Find the product you want to delete in the inventory table.
2

Click 'Borrar'

Click the Borrar button (red outline) in the Acciones column.
3

Confirm deletion

A browser confirmation dialog appears asking “¿Eliminar?”
  • Click OK to proceed with deletion
  • Click Cancel to abort
4

Handle deletion result

Success: The product is removed from the database and you’re redirected to the inventory page.Failure: If the product has associated records (in registro or actualizacion tables), deletion will fail with an alert:
“No se puede eliminar: Esta prenda tiene registros asociados en otras tablas.”

Why Deletion Might Fail

Products cannot be deleted if they have:
  • Price change history (actualizacion table)
  • Merchandise reception records (registro table)
  • Stock movement records (movimiento_stock table)
This is enforced by database foreign key constraints to maintain data integrity.
Alternative: Instead of deleting products with history, consider setting their stock to 0 and marking them as discontinued in the product name (e.g., “[DISCONTINUED] Product Name”).

Troubleshooting

  • Verify your search term spelling
  • Try searching with fewer characters (partial matches work)
  • Click Limpiar to reset and view all products
  • Check that products exist in the database
  • Ensure all required fields are filled
  • Check that price is a valid decimal number (e.g., 500.00, not “500-”)
  • Verify stock is a whole number (no decimals)
  • Make sure you’ve selected options from all dropdown menus
The employee dropdown is required for audit purposes:
  • Scroll down to find the “Empleado que realiza la modificación” field (red border)
  • Select your name from the dropdown
  • If your name isn’t listed, contact an administrator to add you in Employee Management
This is a database integrity protection:
  • Products with price history cannot be deleted
  • Products with stock movement records cannot be deleted
  • Products with reception records cannot be deleted
Solution: Instead of deleting, set stock to 0 and update the name to indicate it’s discontinued.
Price history is only created when:
  • The new price is different from the current price
  • You selected an employee in the dropdown
  • The transaction completed successfully
Check the Historial de Actualización de Precios page to verify the record was created.

Managing Categories

Learn how to create and organize product categories

Stock Operations

Track inventory movements with entries, exits, and adjustments

Managing Employees

Set up employee accounts for audit trail tracking

Database Schema

Understand the underlying product data structure

Best Practices

1

Use descriptive product names

Include key details in the product name for easy searching (e.g., “Camisa Oxford Manga Larga” instead of just “Camisa”).
2

Set up catalogs first

Before adding products, create all your categories, colors, and sizes to streamline product entry.
3

Use stock operations for inventory changes

While you can edit stock directly, using the Stock Operations module provides better audit trails.
4

Always select the correct employee

When editing products, always select the correct employee name for accurate audit trails, especially for price changes.
5

Regular price reviews

Periodically review the Price History page to ensure all price changes are legitimate and properly documented.

Build docs developers (and LLMs) love