Skip to main content
The Sistema Magdaleno uses a gallery system (Galleries) to manage product listings. This guide covers how to add products, edit inventory, and maintain your product catalog.

Product Overview

Products in the system include:
  • Product name and description
  • Images (automatically resized to thumbnails and display sizes)
  • Pricing information
  • Inventory tracking (quantity available, quantity sold)
  • Store location association
  • Publication status
  • Warranty information
  • Keywords for search

Adding a New Product

Access the product creation form at galleries/add.
1

Navigate to Add Product

From the admin menu, select Multimedia > Productos > Agregar (or Galeria > Agregar for vendors).
2

Enter Product Name

In the “Producto” field, enter a descriptive name for your product.
3

Add Keywords

In the “Palabras Claves” (Keywords) field, enter search terms that customers might use to find this product.
Use comma-separated keywords for better search results. Example: “camisa, ropa, moda, algodón”
4

Set Quantity

Enter the initial quantity available in the “Cantidad” field (size 20 input).The system automatically sets:
  • cantidad_existente: Current available quantity
  • prod_vendidos: Products sold (starts at 0)
5

Set Alert Threshold

In “Cant. Alerta” (Alert Quantity), specify the minimum quantity before low-stock alerts.
6

Enter Price

Set the “Precio por Producto” (Price per Product).
7

Select Store Location

For Administrators: Use the autocomplete field to search and select a store location by name.For Vendors: The store location is pre-filled and locked to your assigned location.The autocomplete searches stores via galleries/verlocal and filters by:
  • Store name matching your search term
  • Active stores only (status = 1)
8

Specify Warranty

Select warranty status from the “Garantia” dropdown:
  • Si (Yes)
  • No
9

Upload Product Image

Click “Imagen del Producto” to upload an image file.
The system automatically creates two versions:
  • Thumbnail: Resized to max 124x124px (saved in /files/galeria/thumbnails/)
  • Display: Resized to max 600x480px (saved in /files/galeria/normal/)
  • Original: Stored in /files/galeria/otras/
10

Set Publication Status

Check the “Publicar” checkbox to make the product visible to customers immediately.Leave unchecked to save as draft.
11

Add Description

In the “Descripción” field, provide detailed product information. This field supports rich text editing with TinyMCE.
12

Submit Product

Click “Crear Galeria” (Create Gallery) to save the product.Success message: “La galeria se ha guardado” (Gallery has been saved)Error message: “La galeria no pudo guardarse porfavor intenta nuevamente” (Gallery could not be saved, please try again)

Image Processing Details

When you upload a product image, the system processes it through the SimpleImage library:

Thumbnail Generation

$image = new SimpleImage();
$image->load($original_file_path);
if($image->getWidth() > 124){
    $image->resizeToWidth(124);
}
if($image->getHeight() > 124){
    $image->resizeToHeight(124);
}
$image->save($thumbnail_path);

Display Image Generation

$image = new SimpleImage();
$image->load($original_file_path);
if($image->getWidth() > 600){
    $image->resizeToWidth(600);
}
if($image->getHeight() > 480){
    $image->resizeToHeight(480);
}
$image->save($normal_path);
Ensure uploaded images are in supported formats (JPG, PNG, GIF). Large images may take time to process.

Viewing Products

Access the product list at galleries/index. The product list displays:
  • ID: Unique product identifier (id_galeria)
  • Nombre de la Galeria: Product name (texto_galeria)
  • Fecha de Creación: Creation date (fechacre_galeria)
  • Publicar: Publication status (Active/Not Active)
  • Nombre de Usuario: User who created the product
  • Actions: Edit, Delete, Activate/Deactivate buttons

List Features

Sorting: Click column headers to sort:
  • Sort by ID: Paginator->sort('ID', 'id_galeria')
  • Sort by Name: Paginator->sort('Nombre de la Galeria', 'texto_galeria')
  • Sort by Date: Paginator->sort('Fecha de Creación', 'fechacre_galeria')
Pagination: Navigate through products 10 per page (configurable) Filtering for Vendors: Vendors only see products for their store location:
$this->paginate = array(
    'conditions' => array('Gallery.locale_id_local' => $user),
    'limit' => 10,
    'order' => 'fechacre_galeria DESC'
);

Editing Products

Modify existing products through galleries/edit/{id}.
1

Access Product List

Navigate to Multimedia > Productos > Lista.
2

Select Product to Edit

Click the edit icon (edit.PNG) next to the product you want to modify.
3

Update Product Information

Modify any fields as needed:
  • Product name
  • Keywords
  • Quantity (resets cantidad_existente and prod_vendidos)
  • Alert threshold
  • Price
  • Store location
  • Warranty status
  • Image (upload new image to replace)
  • Publication status
  • Description
4

Save Changes

Click the submit button to save updates.Success: “La galeria se ha guardado” (Gallery has been saved) Error: “La galeria no pudo guardarse porfavor intenta nuevamente”
Editing quantity resets inventory counters. The system sets cantidad_existente to the new quantity and prod_vendidos to 0.

Managing Publication Status

Control product visibility without deleting.

Activating a Product

Make a product visible through galleries/activa/{id}:
1

Locate Inactive Product

Find products marked as “No Activa” (Not Active) in red.
2

Click Activate Link

Click the “Activar” link with the inactive icon (desactivo.png).
3

Confirm Activation

The system updates the database:
Gallery->updateAll(
    array('Gallery.publicar' => '1'),
    array('Gallery.id_galeria' => $id)
)
Success message: “La Galeria se modificó correctamente” (Gallery modified successfully)

Deactivating a Product

Hide a product from customers through galleries/desactiva/{id}:
1

Locate Active Product

Find products marked as “Activa” (Active) in green.
2

Click Deactivate Link

Click the “Desactivar” link with the active icon (activo.png).
3

Confirm Deactivation

The system updates the database:
Gallery->updateAll(
    array('Gallery.publicar' => '0'),
    array('Gallery.id_galeria' => $id)
)
Success message: “La Galeria se modificó correctamente”
Use deactivation instead of deletion to temporarily hide products that are out of season or under maintenance.

Deleting Products

Permanently remove products through galleries/delete/{id}.
Deleting a product is permanent and removes all associated data. Consider deactivating instead if you might need the product later.
1

Access Product List

Navigate to the product list view.
2

Click Delete Icon

Click the delete icon (delete.PNG) next to the product.
3

Confirm Deletion

A JavaScript confirmation dialog asks: “Estas seguro?” (Are you sure?)
4

Complete Deletion

Confirm the action. The system executes:
Gallery->deleteAll("Gallery.id_galeria=".$id)
Success: “Gallery deleted” Error: “Gallery was not deleted”

Inventory Management

Track product quantities and sales automatically.

Inventory Fields

  • cantidad: Original quantity entered
  • cantidad_existente: Current available quantity (decrements with each sale)
  • prod_vendidos: Total products sold (increments with each sale)
  • cantidad_alerta: Low stock alert threshold

Automatic Inventory Updates

When a sale occurs through denuncias/add (the sales function):
// Check if product has stock
$galeria = $this->Gallery->find('all', array(
    'conditions' => array(
        'id_galeria' => $producto,
        'cantidad_existente >' => 0
    )
));

if(!empty($galeria)){
    // Get current values
    $c = $galeria[0]['Gallery']['cantidad_existente'];
    $cant = $c - 1; // Decrement available
    
    $vend = $galeria[0]['Gallery']['prod_vendidos'];
    $vendidos = $vend + 1; // Increment sold
    
    // Update inventory
    $this->Gallery->updateAll(
        array(
            'Gallery.cantidad_existente' => $cant,
            'Gallery.prod_vendidos' => $vendidos
        ),
        array('Gallery.id_galeria' => $producto)
    );
}

Checking Stock Status

View In-Stock Products Navigate to Inventario > Existencia to see products with available quantity. View Out-of-Stock Products Navigate to Inventario > Agotados to see products with cantidad_existente = 0 or below alert threshold.
Regularly check the “Agotados” (Out of Stock) page to identify products that need restocking.

Store Location Autocomplete

For administrators adding products, the store location field uses AJAX autocomplete:
1

Start Typing Store Name

Begin entering the store name in the “Nombre del Local” field.
2

View Suggestions

After typing at least 1 character, the system queries galleries/verlocal with your search term.The endpoint searches:
$locales = $this->Locale->find('all', array(
    'fields' => array('Locale.nombre_empresa', 'Locale.id_local'),
    'conditions' => array(
        'Locale.nombre_empresa LIKE' => '%'.$frase.'%',
        'Locale.status =' => 1
    )
));
3

Select Store

Click on a store from the dropdown list. The system stores the id_local value.

Troubleshooting

Product Not Saving

Problem: “La galeria no pudo guardarse porfavor intenta nuevamente” Solutions:
  • Verify all required fields are filled
  • Check that image file is a valid format
  • Ensure store location is properly selected
  • Verify you have permission to add products
  • Check file upload size limits

Image Not Displaying

Problem: Product image doesn’t show in listing Solutions:
  • Verify image file uploaded successfully
  • Check file permissions in /files/galeria/ directories
  • Ensure SimpleImage library is properly loaded
  • Verify image dimensions are valid

Stock Not Updating

Problem: Inventory doesn’t change after sales Solutions:
  • Check that sales are being recorded in the Venta table
  • Verify the Gallery update query in the sales controller
  • Ensure cantidad_existente field is not locked
  • Check for database transaction errors

Autocomplete Not Working

Problem: Store location autocomplete doesn’t show suggestions Solutions:
  • Check browser console for JavaScript errors
  • Verify jQuery UI is loaded
  • Ensure galleries/verlocal endpoint is accessible
  • Check that active stores exist in the database (status = 1)
Vendors have their store location automatically assigned and cannot change it when adding products. Only administrators can select different store locations.

Build docs developers (and LLMs) love