Directory structure
The WEBSALE storefront is logically divided into different directories that structure the templates and associated resources such as CSS, JavaScript, and images.Template directory
Thetemplates/ directory contains all HTML templates of the storefront. These are organized into subdirectories named after the corresponding controllers. This structure separates the template files according to the specific frontend areas to which they relate.
templates/components/: Reusable template elements (includes), e.g., product boxes.templates/layouts/: Base templates (layout templates) that define the general framework of all shop pages (e.g., header, footer, navigation).templates/mails/: Templates for automatically sent emails, e.g., order confirmations or shipping notifications.templates/pdfs/: Templates for PDF outputs, e.g., invoices or delivery notes.templates/views/: Page templates (view templates) for the individual shop pages, e.g., home page, category pages.
Media directory
The directorymedia/themes/default/ contains the resources for designing the storefront, such as fonts, SCSS files, images, and icons. This directory is located at the same level as templates/.
templates/ directory access the resources in the media/themes/default/ directory to define the layout, colors, fonts, and images of the storefront. This enables a clean separation of structure (HTML) and design (CSS and media).
Example of including resources:
Base template (layout template)
The base template, also referred to as the layout template, sets the general framework for all pages of the storefront. It defines central content and areas that are reused on most shop pages, ensuring a consistent structure and user experience. The layout template is not a standalone shop page and cannot be called directly from outside via a link. Instead, it is extended or embedded by the specific page templates (views). The base template is located in the directory- Technical
<head>area:- Meta information for search engine optimization (e.g., title, description, keywords).
- References to the CSS and JavaScript files of the storefront.
- Integration of external resources such as fonts or tracking codes.
- Visible header area:
- Logo: Display of the shop logo.
- Search: Input field for the product search.
- Login area: Access to the customer account.
- Basket and watchlist: Overview of saved products.
- Navigation: Primary navigation of the shop (e.g., categories).
- Breadcrumb:
- Display of the current navigation path for better user orientation.
- Footer:
- Additional links such as imprint, privacy policy, terms and conditions.
- Contact information or other additional content.
extends command:
Template blocks
Template blocks form the basic structure of a base template and enable simple and flexible customization of the storefront. They group the storefront components into small, isolated blocks that can be edited or overwritten independently of each other. This block system ensures a clean structure and the reusability of content. Template blocks are clearly defined areas within a template that are marked by theblock element. They serve to separate individual components of the storefront (e.g., header, footer, navigation) from one another so that each component can be customized independently.
Example of a block:
Overriding template blocks
A template block can be overridden in a view template to make specific adjustments for individual pages. To do this, simply integrate theblock element with the desired source code into the view template. The base template remains unchanged.
Example: Overriding the header for the home page
Extending template blocks
It is also possible to extend existing blocks without removing their original content. For this, the keywordsprepend (prepend content) and append (append content) are available.
Example: Adding a free shipping banner in the header:
View templates (page templates)
View templates define the individual content for specific shop pages and are the only templates that can be addressed from outside via a link. They are generally based on a base template and use its blocks to maintain a consistent structure and design. View templates are located in the directoryimpressum.htm.
A view template should always use a base template. This ensures that all fundamental structures such as header, footer, or the technical <head> area are inherited from the base template. The assignment is always made with the extends command:
extends command, only blocks may be used in the view template. For each view template, you can then decide which blocks of the base template should be inherited, overridden, or extended. No code may be placed outside of blocks.
System templates
There are three predefined system templates that may not be renamed or moved:start.htm: Defines the home page of the shop.category.htm: Template for category pages.product.htm: Template for product pages.
Custom templates
For all other shop pages there are no system specifications. All other shop pages are freely definable view templates that can be created. These can be named freely, e.g.:account.htm: For the customer accountsearch.htm: For the searchimpressum.htm: For the imprint page- etc.
Components (includes)
Components, also known as includes, are reusable template elements that can be used flexibly in different areas of the shop. They serve to bundle HTML code or other instructions (e.g., CSS, JavaScript) and use them in multiple places in the shop. Unlike base templates or view templates, components do not contain complete HTML page structures withdoctype, <html>, or <body>, but only selected code snippets.
Components are located in the directory:
- In the category overview, to display products in a list.
- In the search results, to display the hits.
- On the watchlist, to display saved products.
- In the cross-selling area on the product detail page, to display related or recommended products.
