Skip to main content

Overview

The complaints system (Denuncias) allows customers to report issues with products, promotions, or vendor service. Vendors and administrators can respond to complaints, track resolution status, and maintain communication history.

Denuncia Structure

Complaint Fields

FieldTypeDescription
id_denunciaintUnique complaint identifier
motivotextComplaint reason/description
fechavarchar(25)Submission date
register_idregistrointCustomer ID (complainant)
galeria_id_galeriaintProduct ID (if product complaint)
promocion_id_promointPromotion ID (if promo complaint)
locale_id_localintStore/vendor ID
statusintResolution status (0=pending, 1=resolved)
respintResponse indicator (0=no response, user_id=responded)
nombrevarcharResponder name

Model Relationships

Denuncia belongsTo:
  - Locale (store)
  - Register (customer)
  - Gallery (product)
  - Promo (promotion)

Filing Complaints

Customer Complaint Flow

1

Identify Issue

Customer encounters problem with product or promotion
2

Access Complaint Form

Navigate via product/promotion detail page:
  • Product: /ventas/denunciar/{product}/{customer}/{store}
  • Promotion: /ventas/denunciar_promo/{product}/{customer}/{store}
Form displays with pre-filled context
3

Describe Issue

Customer enters complaint details in the motivo field:
  • Product quality issues
  • Delivery problems
  • Service complaints
  • Incorrect items
  • Other concerns
4

Submit Complaint

Form submits to:
  • Product: /denuncias/denunciar
  • Promotion: /denuncias/denunciar_promo
System automatically adds:
  • Current date (fecha)
  • Customer ID (register_idregistro)
  • Store ID (locale_id_local)
  • Initial status (0 = pending)
  • Response status (0 = no response)
5

Confirmation

Customer redirected to /denuncias/fin_denunciar with success message

Vendor Complaint Management

Viewing Complaints

Endpoint: /denuncias/index
Vendors see only complaints for their store:
$user = $this->Session->read('Auth.User.locale_id_local');
$conditions = array(
    'Denuncia.locale_id_local' => $user,
    'Denuncia.resp =' => '0'  // Unresponded only
);
Features:
  • 10 complaints per page
  • Ordered by date (newest first)
  • Shows pending complaints only

Responding to Complaints

1

Select Complaint

From the complaints list, click to view detailsRoute: /denuncias/responder_denuncia/{id}
2

Review Details

System displays:
  • Customer information
  • Product/promotion details
  • Complaint text (motivo)
  • Store information
  • Submission date
3

Compose Response

Fill in the response form with:
  • Resolution explanation
  • Actions taken
  • Refund/exchange information
  • Apology or clarification
4

Submit Response

Form submits to /denuncias/registro_denunciaSystem Actions:
  • Creates new denuncia record as response
  • Sets resp field to responder’s user ID
  • Marks original complaint as resolved (status = 1)
  • Links response to original complaint
  • Notifies customer (if email enabled)

Response Record Creation

$this->data['Denuncia']['nombre'] = $vendor_name;
$this->data['Denuncia']['galeria_id_galeria'] = $product_id;
$this->data['Denuncia']['promocion_id_promo'] = $promo_id;
$this->data['Denuncia']['resp'] = $user_id;  // Responder
$this->data['Denuncia']['locale_id_local'] = $store_id;
$this->data['Denuncia']['status'] = 0;  // Response is new
$this->data['Denuncia']['register_idregistro'] = $customer_id;

Customer Complaint Tracking

Viewing My Complaints

Endpoint: /ventas/misreclamos Customers can track all their complaints and responses: Features:
  • Shows complaints with responses (resp != 0)
  • Pagination (8 items per page)
  • Ordered by date
  • Displays:
    • Product/promotion images and details
    • Store information
    • Complaint status
    • Response indicator
    • Vendor contact information
Query Structure:
$fields = array(
    'Gallery.id_galeria',
    'Gallery.thumbnails',
    'Gallery.url',
    'Gallery.texto_galeria',
    'Denuncia.id_denuncia',
    'Denuncia.promocion_id_promo',
    'Denuncia.fecha',
    'Denuncia.status',
    'Locale.nombre_empresa',
    'Locale.encargado_nombre',
    'Locale.encargado_apellido',
    'Promo.id_promo',
    'Promo.url'
);

Responding to Vendor Reply

1

View Response

Customer clicks on complaint with response indicatorRoute: /denuncias/responder_reclamo/{id}
2

Read Vendor Response

System displays:
  • Original complaint
  • Vendor’s response
  • Resolution details
  • Store contact information
3

Follow-up (Optional)

If issue not resolved, customer can submit follow-up complaintSubmits to: /denuncias/registro_reclamo

Complaint Status Workflow

Status Values

Status = 0

PendingComplaint has not been marked as resolved. May be waiting for response or customer review.

Status = 1

ResolvedComplaint has been addressed and marked complete by the system.

Response Values

Resp = 0

No ResponseOriginal complaint from customer awaiting vendor response.

Resp = User ID

Response SentContains the user ID of the person who responded (vendor or admin).

Complaint Categories

Product Complaints

Complaints linked to specific products (galeria_id_galeria): Common Issues:
  • Defective items
  • Wrong product received
  • Damaged during shipping
  • Not as described
  • Quality concerns
Product Information Displayed:
  • Product thumbnail
  • Product name
  • Product URL
  • Purchase details

Promotional Complaints

Complaints about promotions (promocion_id_promo): Common Issues:
  • Promotion not honored
  • Misleading advertising
  • Expired promotion accepted
  • Wrong pricing
  • Terms not clear

Deleting Complaints

Deleting complaints permanently removes the record. This action cannot be undone.
Delete Endpoint: /denuncias/delete/{id} Process:
  1. Administrator or vendor selects complaint
  2. Clicks delete action
  3. System removes record from database
  4. Redirects to complaint list with confirmation
Use Cases:
  • Spam complaints
  • Duplicate submissions
  • Test data cleanup
  • Resolved historical data

Message System Integration

Viewing Messages

Endpoint: /ventas/mismensajes Customers can view all communications with vendors: Includes:
  • Product inquiries (from pages table)
  • Complaint responses
  • Status updates
  • Vendor communications
Query Example:
$conditions = array(
    'Page.register_idregistro' => $customer_id,
    'Page.resp !=' => '0'  // Has response
);

Message Status Update

Endpoint: /denuncias/detallemensajepromo/{date}/{url}/{page_id} When customer views a message:
  1. System marks complaint as read (status = 1)
  2. Redirects to product/promo detail page
  3. Updates viewed timestamp

Access Control

Public Access

The following actions are accessible to customers without admin login:
$this->Auth->allowedActions = array(
    'add',
    'consulta',
    'denunciar',
    'fin_denunciar',
    'denunciar_promo',
    'registro_reclamo',
    'registro_denuncia',
    'detallemensajepromo'
);

Protected Access

Vendor/Admin Only:
  • index - View complaint list
  • responder_denuncia - Respond to complaints
  • registro_denuncia - Submit response
  • delete - Remove complaints

ACL Integration

Vendors can only see and respond to complaints for their assigned store. Access is filtered by locale_id_local matching the user’s session.

Reporting & Analytics

Complaint Metrics

Track key metrics for quality improvement: Common Queries:
  • Total complaints by store
  • Average response time
  • Resolution rate
  • Complaint categories
  • Repeat complainants
Sample Query:
SELECT 
  locale_id_local,
  COUNT(*) as total_complaints,
  SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) as resolved,
  SUM(CASE WHEN resp != 0 THEN 1 ELSE 0 END) as responded
FROM denuncias
GROUP BY locale_id_local

Best Practices

  • Respond to complaints within 24-48 hours
  • Acknowledge receipt immediately
  • Provide clear resolution timeline
  • Follow up after resolution
  • Use polite, professional language
  • Address customer concerns directly
  • Offer specific solutions
  • Include contact information for follow-up
  • Don’t delete complaints unless necessary
  • Use status and response fields properly
  • Document resolution actions
  • Track patterns for improvement
  • Train vendors on complaint handling
  • Provide response templates
  • Set response time expectations
  • Review complaint trends regularly

Email Notifications

The codebase includes commented email functionality ($this->_sendEmail($this->data)). This can be enabled to automatically notify customers when vendors respond.
Implementation Notes:
  • Configure email settings in CakePHP
  • Uncomment email sending in response handlers
  • Customize email templates
  • Include complaint details and response

Sales Tracking

View purchase history related to complaints

User Management

Manage vendor access to complaints

Inventory Management

Track products with frequent complaints

Technical Details

Date Format

Complaints use string dates with timestamps:
$fecha = date('d-m-Y');           // 26-10-2012
$fecha = date('d-m-Y H:i:s');     // 26-10-2012 15:30:45

Database Schema

CREATE TABLE denuncias (
  id_denuncia INT PRIMARY KEY AUTO_INCREMENT,
  motivo TEXT,
  fecha VARCHAR(25),
  register_idregistro INT,
  galeria_id_galeria INT,
  locale_id_local INT,
  promocion_id_promo INT,
  status INT DEFAULT 0,
  resp INT DEFAULT 0,
  nombre VARCHAR(255)
);

Session Variables

// Customer session
$this->Session->read('keyus');  // Customer ID

// Vendor session
$this->Session->read('Auth.User.locale_id_local');  // Store ID
$this->Session->read('Auth.User.id_usuario');       // User ID

Build docs developers (and LLMs) love