Overview
The promotions system (Promos) allows vendors to create special offers, featured deals, and promotional campaigns. Promotions function similarly to products but with additional visual prominence and marketing features.Promotion Structure
Promo Fields
| Field | Type | Description |
|---|---|---|
id_promo | int | Unique promotion identifier |
texto_promo | varchar(255) | Promotion name/title |
descripcion | text | Detailed promotion description |
thumbnails | text | Main promotion image |
url | varchar(255) | SEO-friendly URL slug |
claves | varchar(255) | Keywords/tags for search |
publicar | int | Publication status (0=hidden, 1=published) |
precio | double | Promotional price |
cantidad | int | Total quantity available |
cantidad_existente | int | Current stock level |
prod_vendidos | int | Total units sold |
locale_id_local | int | Store/vendor association |
usuario_id_usuario | int | User who created the promo |
fechacre_promo | timestamp | Creation date |
Model Relationships
Creating Promotions
Enter Promotion Details
Fill in the promotional information:Required Fields:
- Promotion name (
texto_promo) - Description (detailed offer details)
- Keywords (
claves) for search optimization - Associated store (auto-filled for vendors)
- Price (special promotional price)
- Warranty terms
Upload Promotional Image
Select an eye-catching promotion imageSupported Formats: JPG, JPEG, PNG, GIF, MP3, SWF, FLVImage Processing:
- Original stored in
/files/promos/otras/ - Thumbnail (450x280) in
/files/promos/thumbnails/ - Slider version (779x280) in
/files/promos/slider/
Set Stock Quantities
Define promotional inventory:
- Initial quantity (
cantidad) - System sets
cantidad_existente=cantidad - System initializes
prod_vendidos= 0
Image Sizes & Processing
- Thumbnail (450x280)
- Slider (779x280)
- Original
Location:
/files/promos/thumbnails/Purpose: Grid views, listings, category pagesProcessing:URL Generation
Promotions automatically generate SEO-friendly URLs: Formula:texto_promo + claves (slugified)
Example:
- Promo Name: “Descuento Especial Verano”
- Keywords: “muebles oferta”
- Generated URL:
descuento-especial-verano-muebles-oferta
URLs are unique and automatically incremented if duplicates exist (e.g.,
url_1, url_2).Promotion Listings
Vendor View
Endpoint:/promos/index
Vendors see only their own promotions:
- 10 promotions per page
- Ordered by creation date (newest first)
- Quick actions: Edit, Delete, Activate/Deactivate
Administrator View
Administrators see all promotions across all stores with no filtering.Editing Promotions
Edit Workflow:- Navigate to Promos > Index
- Select promotion to edit
- Modify fields as needed:
- Promotion details
- Description and keywords
- Price and terms
- Stock quantities
- Upload new image (optional)
- Save changes
- New images are processed in all three sizes
- Old images remain on disk but are not referenced
- Consider manual cleanup of unused images
Stock Management
Inventory Tracking
Promotions use the same stock tracking as products:Available Stock
cantidad_existente - Current units available for saleUnits Sold
prod_vendidos - Total units sold through this promotionStock Updates on Sale
When a customer purchases a promotion:Publication Control
Visibility Management
Activate Promotion
Route:
/promos/activa/{id}Sets publicar = 1 to display promotion to customersDeactivate Promotion
Route:
/promos/desactiva/{id}Sets publicar = 0 to hide promotion from public view- Schedule promotions (activate when campaign starts)
- Pause promotions during stock outages
- Test promotions before public launch
- End campaigns without deleting history
Deleting Promotions
Delete Process:- Navigate to promotion listing
- Click delete button for target promotion
- System removes promotion record
- Redirects to listing with confirmation message
/promos/delete/{id}
Sales Integration
Purchasing Promotions
Promotions are sold through the sales system: Purchase Flow:- Customer views promotion details
- Clicks to purchase
- System validates:
- Promotion exists and is published
- Stock available (
cantidad_existente > 0) - No duplicate pending orders
- Creates sale record with
promocion_id_promo - Updates promotion stock
- Processes payment
/ventas/consulta_promocion- Check availability/ventas/add_promo- Add to cart/ventas/finalizar_compra- Complete purchase
Response Codes
| Code | Meaning |
|---|---|
| 0 | Database error |
| 1 | Success |
| 2 | Out of stock |
| 4 | Duplicate order |
Store Assignment
Auto-complete Store Search
Endpoint:/promos/verlocal
Provides AJAX autocomplete for store selection:
Categories & Classification
Promotions can be organized using categories:Category Association
Join Table:categories_galleries
Relationship: Many-to-Many (HABTM)
Benefits:
- Browse promotions by category
- Filter promotional campaigns
- Organize seasonal offers
- Group related promotions
Image Management
Multiple Images
Promotions support multiple images through file attachments: Join Table:archivos_galleries
Supported Types:
- Images: JPG, JPEG, PNG, GIF
- Audio: MP3
- Flash: SWF, FLV
Deleting Images
Endpoint:/promos/deleteimg/{promo_id}/{file_id}
Removes specific image from promotion’s gallery.
Validation Rules
texto_promo (Name)
texto_promo (Name)
- Rule: Not empty
- Message: “No debes dejar vacio el campo”
- Used in URL generation
descripcion (Description)
descripcion (Description)
- Rule: Not empty
- Message: “No debes dejar vacio el campo”
- Should explain promotional terms
claves (Keywords)
claves (Keywords)
- Rule: Not empty
- Message: “No debes dejar vacio el campo”
- Used for SEO and search
locale_id_local (Store)
locale_id_local (Store)
- Rule: Not empty
- Message: ”* Requerido”
- Must reference active store
MeioUpload Configuration
Promotion images use the MeioUpload behavior:Best Practices
Compelling Visuals
Compelling Visuals
- Use high-quality, attention-grabbing images
- Optimize for slider dimensions (779x280)
- Include promotional text in image
- Maintain consistent branding
Clear Descriptions
Clear Descriptions
- State promotional terms clearly
- Include start and end dates
- Specify any restrictions or conditions
- Highlight savings or benefits
Stock Management
Stock Management
- Set realistic stock levels
- Monitor inventory during campaigns
- Deactivate when out of stock
- Restock or end promotion promptly
SEO Optimization
SEO Optimization
- Use descriptive promotion names
- Include relevant keywords
- Create unique URLs for each campaign
- Add to appropriate categories
Promotional Campaigns
Campaign Types
Seasonal Sales
Holiday specials, seasonal clearance, back-to-school offers
Flash Sales
Limited-time offers with urgent messaging and countdown timers
Bundle Deals
Multiple items packaged together at discounted price
New Product Launch
Introductory pricing for new inventory items
Clearance
Deep discounts on discontinued or excess inventory
Loyalty Rewards
Special offers for repeat customers or members
Related Features
Inventory Management
Regular product listings
Sales Tracking
Promotional sales reporting
Galleries
Image management system
Technical Notes
URL Slug Generation
Implemented inbeforeSave() model method: