Storefront Templates as Extensions

Storefront Templates

AbanteCart storefront templates are set per store and consist of number of files. Storefront default template is located in /storefront/view/default/ directory that includes all other components for the template.
Template is constructed based on the page layout and blocks. With template CSS and JavaScript pages, layouts and blocks can be set to display desired style. Most of layout settings are stored and managed in the database with great flexibility.
Most important components of AbanteCart templates aside of images, CSS and JavaScripts are .tpl files. These .tpl files respect PHP syntax, and rendered by AView class. When rendered AView class populate template with template variables’ values generated by controller as part of MVC approach.
These template files are located in /storefront/view/default/template directory

It is recommended that all new templates to AbanteCart developed and added as extensions. This will allow seamless upgrade to future versions of abantecart.

When develop template as extension you simply override any existing default template files in extension or add new once.


Blocks and layout

AbanteCart offers a lot of flexibility to develop different layouts for pages with set collection of blocks assigned per layout per page. Important to note that layout system is only used in pages for storefront. Responses and Control Panel pages do not utilize layout system. Each layout is linked to one template and one or multiple pages. Default layout is loaded if no other layout is found linked to given page.
Below diagrams demonstrate how page, layout and blocks are related to each other:


Why do you need layout for your extension?
Most of extensions of features add to AbanteCart will require display of information. This information might need to be shown in particular part of the page. This can be controlled with using a block to show information. This block can be set to needed part of the page with setting it in layout manager. The steps are the following: Add new block to layout manger, Add new block to layout. If layout is not known, user needs to be informed of the block and directed to layout manager in control panel to enable this block there it is desired.

Layout and blocks can be loaded with one XML files that will create all the database entries for the layout and block. There is a function loadXML() that is available in ALayoutManager class. This function can be called or if you

$layout = new ALayoutManager();
// Input possible with XML string, File or both.
// We process both one at a time. XML string processed first
$layout->loadXml(array('file' => $file));
$layout->loadXml(array('xml' => ‘xml string here’));

$layout->loadXml(array(
'file' => $file,
'xml' => ‘xml string here’
));