What Are Modules?
Modules are display components that can be positioned in various layouts throughout your store. They typically:- Display dynamic content (products, categories, banners)
- Can be added to multiple layouts
- Support multiple instances with different settings
- Are managed through Extensions → Extensions → Modules
Modules can be assigned to specific layouts and positions using Design → Layouts in the admin panel.
Built-in Modules
OpenCart includes these default modules inupload/extension/opencart/:
Account
Displays customer account links in a sidebar
Banner
Image carousel/slider for promotional banners
Bestseller
Shows your best-selling products
Category
Displays category navigation tree
Featured
Showcase hand-picked featured products
Filter
Product filtering by attributes
HTML Content
Display custom HTML/text content
Information
Links to information pages
Latest
Recently added products
Special
Products currently on special offer
Store
Display store locations (multi-store)
Blog/Topic
Blog post listings and topics
Module Architecture
Admin Controller
Location:admin/controller/extension/[vendor]/module/[name].php
Catalog Controller
Location:catalog/controller/extension/[vendor]/module/[name].php
Catalog module controllers must accept a
$setting array parameter and return a string (rendered HTML).Multiple Module Instances
Unlike other extension types, modules can have multiple instances with different configurations:Creating Instances
- Go to Extensions → Extensions → Modules
- Find your module and click Edit
- Some modules have an Add button to create new instances
- Configure each instance with unique settings
Example: Multiple Banner Modules
Module Instance Storage
Module instances are stored in themodule table:
Common Module Features
Banner Module
Location:admin/controller/extension/opencart/module/banner.php:1
Configuration Options:
- Banner: Select from pre-configured banners
- Effect: Slide, fade, or other transition effects
- Items: Number of items to display at once
- Controls: Show previous/next buttons
- Indicators: Show dot navigation
- Interval: Auto-advance timing (milliseconds)
- Width/Height: Image dimensions
- Homepage hero sliders
- Promotional banners
- Category page headers
- Sidebar advertisements
Product Display Modules
Three modules display products with similar functionality:Featured Products
Featured Products
Purpose: Display hand-selected featured productsConfiguration:
- Select specific products to feature
- Set number of products to display
- Control width and height
- Enable/disable status
admin/controller/extension/opencart/module/featured.php:1Latest Products
Latest Products
Purpose: Automatically show recently added productsConfiguration:
- Set limit (number of products)
- Set image dimensions
- Enable/disable status
admin/controller/extension/opencart/module/latest.php:1Bestseller Products
Bestseller Products
Purpose: Display best-selling products by sales volumeConfiguration:
- Set limit for number of products
- Configure image dimensions
- Enable/disable status
admin/controller/extension/opencart/module/bestseller.php:1HTML Content Module
Location:admin/controller/extension/opencart/module/html.php:1
Purpose: Display custom HTML/text content blocks
Features:
- Multi-language support
- Full HTML editor
- Can contain text, images, links, or custom code
- Multiple instances for different content blocks
- Custom promotional text
- Store policies
- Social media links
- Custom widgets
Category Module
Location:admin/controller/extension/opencart/module/category.php:1
Purpose: Display category navigation tree
Configuration:
- Status enable/disable
- Typically displayed in sidebar
- Shows category hierarchy
- Highlights current category
Assigning Modules to Layouts
After configuring a module, assign it to layouts:- Go to Design → Layouts
- Select a layout (e.g., “Homepage”, “Product”, “Category”)
- Click Edit
- Add module to desired position:
- Content Top
- Content Bottom
- Column Left
- Column Right
Developing Custom Modules
Basic Module Structure
Catalog Display Controller
Module Best Practices
Cache-Friendly
Design modules to work with OpenCart’s caching system for better performance
Responsive Design
Ensure module views work on all screen sizes
Language Support
Use language files for all user-facing text
Settings Validation
Always validate user input in the save method
Troubleshooting
Module Not Displaying
- Check installation: Is the module installed?
- Check status: Is the module enabled in settings?
- Check layout: Is the module assigned to the current layout?
- Check position: Is the module in a visible position?
- Check cache: Clear the cache (Dashboard → Developer Settings → Refresh)
Module Not Saving Settings
- Check permissions: Does the user have modify permission?
- Check validation: Are all required fields filled?
- Check browser console: Look for JavaScript errors
- Check error log: Review system/storage/logs/error.log
Next Steps
- Payment Extensions - Payment gateway integration
- Shipping Extensions - Shipping calculators
- Theme Extensions - Visual customization
- Extensions Overview - Extension system basics

