Product Restock
Learn how to manage product restocking in your e-commerce system. This guide covers setting restock dates, configuring notifications, and implementing restock date displays in your templates.
Restock Date Management
The restock management system automatically appears in the product edit form when inventory levels fall below zero. This feature helps administrators track and manage product replenishment efficiently.
- Automatic restock date field appears when stock is below zero
- Daily automated email notifications for products due for restocking
- Consolidated notifications for multiple products with the same restock date
- Flexible date format support for template display
Configuration
Email Settings
Configure the notification email address through the following path:
Catalogues module → Configure → Manage Configuration → Restock Email
Email Fallback: If no specific restock email is configured, the system will default to using the centre email address for notifications.
Automation Schedule
The restock notification system operates on the following schedule:
- Runs once daily via cron job
- Checks all products with restock dates matching the current date
- Consolidates notifications for multiple products
Implementation Guide
Retrieving Restock Dates
Use the getRestockDate()
function to retrieve restock dates in your templates:
<{$product->getRestockDate($format = 'Y-m-d')}>
Date Formatting:
- Default format is 'Y-m-d'
- Accepts any valid PHP date format string
- Use 'U' format to get Unix timestamp
Validation Example
Here's how to check if a restock date is valid and not in the past:
<{if $product->getRestockDate('U') > $smarty.now}>
// Display restock information
<{else}>
// Handle expired restock date
<{/if}>
Best Practices
- Regularly monitor and update restock dates to maintain accuracy
- Implement date validation to prevent displaying outdated restock information
- Consider setting up additional notification triggers for approaching restock dates
- Keep email configuration updated to ensure proper notification delivery
- Document any custom date format implementations for team reference
Troubleshooting
Common issues and solutions:
- Missing Notifications: Verify email configuration in Manage Configuration
- Outdated Dates: Implement timestamp validation using getRestockDate('U')
- Display Issues: Confirm proper date format strings in templates
Important: Always validate restock dates against the current time to prevent displaying outdated information to customers. Use the Unix timestamp format (
getRestockDate('U')
) for accurate comparisons.