docs/design/layouts.md
Layouts in OpenCart 4 give you complete control over the structure of your store's pages. Each layout defines which modules appear in specific positions (like sidebars, headers, or content areas) and which store routes (URL patterns) use that layout. This powerful feature allows you to create unique page designs for different types of content.
OpenCart 4 includes several pre-defined layouts for common page types:
| Layout Type | Typical Routes | Description |
|---|---|---|
| Default | common/home | Home page and general fallback layout |
| Product | product/product | Individual product pages |
| Category | product/category | Category listing pages |
| Manufacturer | product/manufacturer | Brand/brand listing pages |
| Information | information/information | Static content pages (About Us, Contact, etc.) |
| Article | cms/article | Blog/article pages (if CMS enabled) |
| Topic | cms/topic | Blog topic pages (if CMS enabled) |
{% hint style="info" %} Tip: You can modify the default layouts or create entirely new layouts to match your design needs. The Default layout cannot be deleted but can be modified. {% endhint %}
{% stepper %} {% step %} Log in to Admin Panel
Open your browser and navigate to your OpenCart admin URL (typically yourstore.com/admin).
Enter your administrator credentials to log in. {% endstep %}
{% step %} Navigate to Design β Layouts
From the admin dashboard, go to the main menu and click Design, then select Layouts from the dropdown menu.
You can also use the quick search: type "Layouts" in the admin search bar. {% endstep %}
{% step %} View Layouts List
You'll see the layout management interface showing all existing layouts.
The list displays layout names, associated routes, and action buttons for editing or deleting. {% endstep %} {% endstepper %}
{% stepper %} {% step %} Step 1: Click Add New
Click the Add New button (+) in the top-right corner of the layout list. {% endstep %}
{% step %} Configure Layout Settings
Fill in the layout configuration form:
Layout Name
{% hint style="info" %} Layout Name Requirements π
Layout Routes
{% hint style="warning" %} Route Configuration β οΈ
product/product for all product pages)Module Positions
{% hint style="success" %} Positioning Modules π’
{% step %} Save the Layout
Click Save to create the new layout. You'll see a success message confirming the layout has been created. {% endstep %} {% endstepper %}
{% stepper %} {% step %} Locate the Layout
From the layout list, find the layout you want to edit. You can use the search filter or browse through the list.
Click the Edit button (pencil icon) next to the layout name. {% endstep %}
{% step %} Modify Layout Settings
Make your changes in the layout form:
Use the same configuration guidelines as when creating a new layout. {% endstep %}
{% step %} Save Changes
Click Save to update the layout settings.
You'll see a success message confirming the layout has been updated. {% endstep %} {% endstepper %}
{% hint style="warning" %} Note: You cannot delete the Default layout if it's assigned as the default store layout. Other layouts can be deleted if they're not in use by products, categories, manufacturers, information pages, articles, or topics. {% endhint %}
{% stepper %} {% step %} Define Layout Name
The layout name is the internal identifier used in the admin panel. It should be descriptive and unique.
Click the Layout Name section below for detailed requirements. {% endstep %}
{% step %} Configure Layout Routes
Routes determine which store pages will use this layout. You can assign multiple route-store combinations.
Click the Layout Routes section below for route patterns and examples. {% endstep %}
{% step %} Arrange Module Positions
Modules are placed in specific positions on the page. Each position can contain multiple modules with sort order control.
Click the Module Positions section below for position descriptions and adding modules. {% endstep %} {% endstepper %}
<details> <summary><strong>Layout Name</strong></summary>Routes determine which pages use this layout. Each route consists of:
| Setting | Description | Examples |
|---|---|---|
| Store | Which store this applies to (multi-store) | Default Store, Store 2 |
| Route | URL pattern that triggers this layout | product/product, information/contact, common/home |
Common Route Patterns:
product/product - All product pagesproduct/category - All category pagesproduct/manufacturer - All manufacturer pagesinformation/information - All information pagescms/article - All article pages (CMS)cms/topic - All topic pages (CMS)common/home - Home pageaccount/* - Customer account pagescheckout/* - Checkout pages{% hint style="info" %} Route Matching: OpenCart uses the most specific route match. If no specific route matches, it falls back to the Default layout. {% endhint %}
</details> <details> <summary><strong>Module Positions</strong></summary>Modules can be placed in four main positions:
| Position | Location | Typical Use |
|---|---|---|
| Content Top | Above main content | Banners, featured products, promotions |
| Content Bottom | Below main content | Related products, additional information |
| Column Left | Left sidebar | Categories, filters, navigation |
| Column Right | Right sidebar | Cart, search, special offers |
Sort Order: Within each position, modules are displayed in ascending sort order (0 appears before 1).
Adding Modules:
Create a unique homepage with different module arrangements:
common/homeCustomize product pages with additional modules:
product/productImprove category browsing experience:
product/categoryStreamline the checkout process:
checkout/*Let's walk through creating a custom homepage layout from start to finish.
{% stepper %} {% step %} Plan Your Layout
Before creating the layout, decide what modules you want on your homepage:
Sketch the layout to visualize module placement. {% endstep %}
{% step %} Create the Layout
common/home{% step %} Add Modules to Positions
Click Add Module for each, then Save the layout. {% endstep %}
{% step %} Test the Layout
Adjust sort orders or module settings if needed. {% endstep %} {% endstepper %}
{% hint style="success" %} Success: You've created a custom homepage layout that highlights featured products, shows latest arrivals, and provides navigationβall optimized for conversion. {% endhint %}
Layouts support multi-store configurations:
Layouts work with all OpenCart modules:
Layouts complement the template system:
{% hint style="warning" %} Route Management β οΈ {% endhint %}
{% hint style="info" %} Module Placement π οΈ {% endhint %}
Possible Causes:
Solution: Check the route configuration and ensure it matches the page's route exactly.
</details> <details> <summary><strong>Cannot delete layout ποΈ</strong></summary>Possible Causes:
Solution:
Possible Causes:
Solution:
Possible Causes:
Solution: Review all route assignments and ensure each store-route combination is unique.
</details>{% hint style="info" %} Performance Considerations β‘
{% hint style="success" %} Documentation Summary π
You've now learned how to:
Next Steps: