Overview
The supplier management system maintains contact information for vendors who provide merchandise to your store. Supplier records are linked to merchandise reception records, creating a complete audit trail of where inventory originates.Why Supplier Records Matter
Supplier tracking provides:- Supply chain visibility: Know which vendors supply which products
- Reception auditing: Track merchandise receptions by supplier
- Contact management: Quick access to phone numbers and addresses for reordering
- Quality tracking: Identify patterns if certain suppliers have recurring issues
- Business relationships: Maintain historical records of all vendor partnerships
Accessing Supplier Management
Navigate to the Proveedores page (proveedores.php) from the main navigation menu.
Interface Layout
The page uses a split-screen layout:- Left Panel (4 columns): Quick-add form for creating new suppliers
- Right Panel (8 columns): Table displaying all supplier records with edit and delete actions
Creating a New Supplier
Locate the creation form
Enter supplier name
- Textiles del Norte S.A.
- Distribuidora García
- Importaciones Rodríguez Hnos.
- ABC Fashion Suppliers
- María Elena - Mayorista
Enter phone number (optional)
- ✅ Correct:
5551234567 - ❌ Incorrect:
555-123-4567or555 123 4567
- Maximum length: 10 characters (enforced by
maxlength="10") - Optional field (can be left empty)
Enter address (optional)
- Av. Reforma 123, Col. Centro, CDMX
- Calle Principal 45, Guadalajara, Jalisco
- Km 15 Carretera a León, Aguascalientes
- Street address
- City and state
- Additional contact information
- Email addresses
- Alternative phone numbers
Save the supplier record
Database Operation
id_proveedor is auto-generated as the primary key.
Error Handling
If creation fails, an error message displays:Viewing Suppliers
The supplier table displays:| Column | Description |
|---|---|
| ID | Auto-generated unique identifier |
| Proveedor | Company name (bold) with address below (small, muted text) |
| Contacto | Phone number |
| Acciones | Edit (yellow) and Delete (red) buttons in a button group |
Editing a Supplier
Supplier editing uses a modal dialog for a streamlined update experience.Click Edit button
Modal opens with current data
- Hidden field:
id_proveedor - Nombre / Empresa: Current supplier name
- Teléfono: Current phone number (10 character max)
- Dirección: Current address (3-row textarea)
Update supplier information
- Correct spelling or naming errors
- Update to reflect company rebranding
- Add or remove legal entity suffixes
- Update primary contact number
- Can be left blank if unknown
- Only numbers, no formatting characters
- Update physical address
- Add email addresses or additional contacts
- Correct location information
Modal JavaScript Implementation
The modal is populated using JavaScript with proper escaping:Deleting a Supplier
Confirm deletion
“¿Estás seguro de eliminar este proveedor?”
- Click OK to proceed with deletion
- Click Cancel to abort
Handle result
- Page reloads with
?msg=eliminado - Supplier removed from the table
- Supplier no longer appears in reception dropdowns
- Error alert displayed:
“No se puede eliminar este proveedor porque tiene registros de mercancía asociados.”
- Supplier remains in the system
- Database referential integrity preserved
Why Deletion Fails
Suppliers cannot be deleted if they have associated records in theregistro table (merchandise receptions).
This is enforced by a foreign key constraint:
Common Use Cases
Setting up initial supplier database
Setting up initial supplier database
- Gather supplier information: Collect names, phone numbers, and addresses from existing records
- Prioritize active suppliers: Enter currently active vendors first
- Use consistent naming: Decide on a naming convention (e.g., always include legal entity suffix)
- Verify contact info: Confirm phone numbers and addresses are current before entering
- Test in receptions: Create a test merchandise reception to ensure suppliers appear correctly
Updating supplier contact information
Updating supplier contact information
- Click Editar on the supplier’s row
- Update the Teléfono and/or Dirección fields
- Click Actualizar Cambios
- Verify the changes appear in the table
Handling supplier name changes (rebrand or acquisition)
Handling supplier name changes (rebrand or acquisition)
- Edit the supplier
- Change Nombre / Empresa to the new name
- Add a note in Dirección about the name change:
Formerly known as [Old Name] - Changed March 2026
- Create a new supplier with the new name
- Edit the old supplier to add
[INACTIVE - REBRANDED]prefix - Add a reference in the address field:
Now operating as [New Name]
Managing suppliers without full contact info
Managing suppliers without full contact info
- Create the supplier with the information you do have
- Use placeholder text in missing fields:
- Teléfono: Leave blank or enter
0000000000 - Dirección: Enter
Información pendienteorTBD
- Teléfono: Leave blank or enter
- Update the record later when you obtain complete information
Consolidating duplicate supplier entries
Consolidating duplicate supplier entries
- Identify the duplicates: Look for similar names in the table
- Choose the primary record: Select which record to keep (usually the one with more complete info)
- Update reception records: This requires database access
- Delete the duplicate: Once no receptions reference it, you can delete it
Troubleshooting
Cannot delete supplier - has associated records
Cannot delete supplier - has associated records
“No se puede eliminar este proveedor porque tiene registros de mercancía asociados.”Why it happens: The supplier has merchandise reception records in the
registro table.Solution options:- Mark as inactive: Edit the name to
[INACTIVE] Supplier Name - Keep the record: Retain for historical reference
- Database-level deletion (advanced):
Phone number field won't accept full number
Phone number field won't accept full number
maxlength="10" enforced:If your phone numbers need more digits:- For international numbers, use the address field
- For extensions, add to address:
Tel: 5551234567 Ext. 123 - Contact your developer to increase the field length if needed
- Pad with zeros:
555123→0000555123 - Or leave the field blank and put the number in the address field
Supplier doesn't appear in reception dropdowns
Supplier doesn't appear in reception dropdowns
- Verify creation: Check that the supplier appears in the Proveedores table
- Refresh the reception page: Dropdowns are populated on page load
- Check database: Query the
proveedortable to confirm the record exists - Clear browser cache: Try a hard refresh (Ctrl+F5 or Cmd+Shift+R)
- Check for JavaScript errors: Open browser console (F12) and look for errors
Edit modal shows wrong supplier data
Edit modal shows wrong supplier data
- Open browser console (F12)
- Look for JavaScript errors when clicking Editar
- Check if the supplier name or address contains special characters:
- Quotes (
"or') - Backslashes (
\) - Line breaks
- Quotes (
- Edit the supplier by recreating it with a simpler name
- Contact your developer to improve character escaping
addslashes() PHP function not handling certain characters correctly.Cannot save supplier - error message displayed
Cannot save supplier - error message displayed
- Database connection failure: Check that the database server is running
- Character encoding issues: Ensure special characters (á, é, í, ó, ú, ñ) are handled correctly
- Field validation: Verify nombre is not empty (it’s required)
- Constraint violations: Check for unique constraint violations if applicable
- Try creating a supplier with simple ASCII characters: “Test Supplier”
- If that works, the issue is with special characters
- Check PHP error logs for detailed error messages
- Contact your system administrator with the error message
Integration with Merchandise Reception
Suppliers are primarily used in the Recepciones de Mercancía module (registros.php).
Reception Form Integration
When registering a merchandise reception, you select the supplier from a dropdown:Reception History Query
To view all receptions from a specific supplier:Related Features
Database Schema
Best Practices
Establish naming conventions
- Always include legal entity suffix (S.A., S.R.L., etc.)
- Use consistent capitalization
- Decide whether to use full names or abbreviations
Keep contact information current
- Phone numbers (suppliers may change contact numbers)
- Addresses (suppliers may relocate)
- Add email addresses to the address field for easy reference
Never delete suppliers with history
Include complete information
- Helps with reordering
- Useful for warranty claims
- Essential for returns or exchanges
- Supports supply chain auditing
Document supplier relationships
- Note payment terms: “NET 30 payment terms”
- Add account numbers: “Acct #12345”
- Note special contacts: “Contact: Juan García for rush orders”
- Add email: “[email protected]”
Future Enhancements
While not currently implemented, future versions could include:- Supplier performance tracking: Rate suppliers based on quality, timeliness, pricing
- Contact person management: Multiple contacts per supplier with roles
- Document attachments: Store contracts, certificates, or correspondence
- Purchase order integration: Link suppliers to purchase orders
- Payment terms tracking: Record and monitor payment agreements
- Supplier categories: Group suppliers by type (domestic, international, etc.)
- Automatic reorder suggestions: Based on supplier lead times and stock levels