Table of contents
- Howto documentation
- Theme structure
- Folders structure
- Template cutting into layouts and content blocks
- Template packaging
- Theme metadata and layout rules
- Common view variables
- Layout pages
- Content blocks
- Common view parts
- Variable modifiers and custom template functions
Overview
Notando eCommerce is a newest webshop platform using state of the art code technologies, proven approach used for data storage and treatment. That is why our clients get reliable, high-speed and easy-to-use webshop that once you try never want to use another. And our designer partners get the webshop platform design templates for which will always be in demand from customers.
This documentation has been prepared for you to learn the Notando eCommerce webshop solution themes structure. It explains the ways you can create any theme you want to. As you will see, making new theme using Notando eCommerce is very easy. You are not have to learn how the platform work inside, API and core concernig stuff. Our system use MVC patter for application as a whole and for the client side. That is why making design you will deal with the 'designers' things only. More over, business logic and presentation logic at client side are separated what allows you to concentrate more on the development of each individual part and get the more perfect results.
Notando eCommerce solution, has powerfull and flexibile themming engine. You are not have to create a theme from scratch each time, Notando platform provides default themes and you may create custom templates for parts you want to change only. Or you maybe want to change some resources such as Cascading Style Sheets files or images and left other parts as they are, this is possible too. So whether you are only beginner in themes design and want to spend only few hours to build your custom theme, or you are experienced professional and want to crate unique high-quality design — Notando eCommers is for you. So, lets start working together.
Structure of theme templates
Visual representation of template
Usually when create new design you see it as a parts: some adverticing at the top, product list at the central part, search form near products etc. After you thought over all parts placement you are ready to create design layout and you are sure that none of the important parts be missed. This idea applied in Notando webshop layout making — business logic parts of page devided for content blocks which are separated and independed. You can see at the right image 'category/menu-tree', 'filter/form' and others. And from another side, page layout devided onto structural blocks according to their positiion which we can call 'left', 'footer', 'content-top' (see image on the left). This structuring helps easier discussing and developing theme templates.
Theme structure
-
Layout — usually means a part of graphic design that deals in the arrangement and style treatment of elements (structural blocks, content blocks, page content blocks, static content) on a page. Your webshop theme layout templates are stored as .phml files, for example main.phtml layout template. Layouts are placed in templates/layouts folder (read more about folders structure)
Notando template engine supports particular design for every page you want, like two-column-layout for main page, three-column-layout for products list and some custom layout for shopping cart. To set up your site design this way, you should write proper xml-rules in blocks.xml file.
-
Structural block
is a part of page layout (for example 'left, 'top'). Structural blocks are containers for content blocks. Please notice, structural blocks can be defined only in layout templates and not in content block templates (for example, you can use 'footer' block to add info to page footer, but if one wants to add info to 'product_list' content block bottom usual html should be used). To add structural block into your layout write the following code in layout template file:{$layout->block_name}Here block_name is the name of a structural block, you want to be displayed in this part of page. This block_name also used in blocks.xml file to define which content blocks will be inside of the structural block. You can use any name you like for structural blocks, but each layout template must have {$layout->content} structure block. Page content will be always outputted in it.
-
Content block
is a self-contained block, containing meaningfull data. It represents some page functionality such as: category list, top menu, product cart, etc. Content block templates stored as .phtml files. They used to generate (X)HTML to be inserted into parent structural block of the content block. Content block template file should be places as follows:templates/blocks/[block_controller]/[block_action].phtml
You can read more about folders structure here. The part 'block_controller'/'block_action' will be called content block name. You can see such a names usage for example in blocks.xml file rules.
Example of content block template ('quick search' content block):
Content block can be added to page layout (or inside to another content block) using Zend View helper:
{$this->action($blockAction, $blockController, 'blocks')}Here $blockAction and $blockController are names of content block controller and action, 'blocks' is required helper function parameter value. E.g. helper call for content block named 'product/details' has got parameters: 'product', 'details', 'blocks'. See complete list of Avaialbe content blocks and Avaiable page content blocks. -
Page content block
is a type of content block, representing main content/functionality of specific page. For example your webshop product page main content is information about product. Page content block are rendered in content structural block in default layout. If you customize layout, you should do that youself this way:{$layout->content}content structural block are required in all layout templates. Page content block templates stored in folders structure the same way as other content blocks: templates/controllers/[page_controller]/[page_action].phtml. -
Common view part
is content block which already comes with Notando eCommerce solution. They are auxiliary tool, which you can use or not along with your templates. Please notice, common view part templates are not avaiable to edit. To include it into your layout or another content block, write the following:{include file="common/view_parts/product_in_list.phtml"}'product_in_list' here is the name of common view part. There is complete list of avaiable common view parts:
- product_attributes_form — product attributes form view (filter form for product search)
- menu_tree — product categories tree view
- product_in_grid — product in product grid view
- product_in_grid_wide — product in grid view for wide version of product grid
- product_in_grid_minimal — product in grid view for minimal version of product grid
- product_in_list — product in product list view
- grid_builder — grid view builder
- cart_products — product cart view
- product_header — main product information (name, image) view
- product_price_detailed — product detailed price information drawer
- fields_form — form field with label view (auxiliary, used for forms drawing)
- user_fields — user profile form view (fields_form view part used)
- draw_user_address — user address view (can be used in order page)
- content_list — list of CMS content, e.g. news list view
- content_show — CMS content page view, e.g. 'About us' page view
There are two auxiliary view parts, placed separately:
- common/modules/errors.phtml
- common/modules/status_messages.phtml
You can read more about how to use common view parts in layout here.
Folders structure
To set up new theme you should create the following folders structure:
- templates/controllers/[controller_name]/[action_name].phtml - template for page content block
- templates/blocks/[block_controller_name]/[block_action_name].phtml - template for content block
- templates/layouts/[layout_name].phtml - layouts are stored here
- templates/modules/[static_view_module].phtml - common content blocks, like header, footer or any static content
- languages/[language].mo - theme translation files
- resources/ - Template resources (skin files) like CSS, JavaScripts, images
Or you can just download one of common themes from download section at our site, unzip it and edit to make you personal theme. In this case, you should just be careful not to damage the listed above folders structure of downloaded theme.
Cutting template into layouts and content blocks
As you probably already noticed, blocks pattern is used in Notando webshop solution for making webshop pages. If one set up pages in such a way, one's webshop theme will be more organized and easy to work with. So, after creating pages (X)HTML markup your should cut it into content blocks and layouts. There are no restrictions for templates naming and cutting rules, but separate parts should be meaningfull and properly assosiated by means of blocks.xml file rules. You can see content block template file and layout template file examples above. Templates must be stored as .html files according to your theme folder structure.
Templates reuse
You only have to create templates you need to customize, templates from common/default theme will be used for the rest, you can change fallback theme from common/default to any other with metadata.xml. For example if you want to change product details page only, you should create corresponding template with your custom design and save it as 'templates/controllers/product/details.phtml' template file. Complete list of avaiable default content block templates and default layout templates is here. To create your custom pages you can also edit existing default templates, avaiable to download in download secrion at our site. And it is possible to use common view parts into your theme templates as well.
Theme metadata and layout rules
Layouts and content blocks behaviour described as XML rules in blocks.xml file. This file is the tool which allows you to assign content blocks to structural blocks, move blocks around in a page, set their position or disable them. Also in blocks.xml you are able to redefine page layout template and tune some page settings, like number of products per page or default list style. You can read more detailed information about blocks.xml here.
Metadata about your theme such as author or version are placed in metadata.xml file. This information will appear in theme selection interface in webshop backoffice. To get more information visit metadata files description page.
Theme resources
Theme resources are stored under resources/* folders. Common resource folders naming is the following:
- resources/images — folder for images storage
- resources/css — foler for Cascading Style Sheets
- resources/js — folder for JavaScript files and libraries
This is recommended folder structure. It is necessary only if selectable_resource smarty modifier is used in your theme. For example it is used in default theme templates. Due to this modifer it is possible to redefine resources only without changes in themplates. E. g. if you want only redefine images in default theme — create proper files and put them to resources/images. Then your images will have higher priority and will be used by default theme. You can read more about using smarty modifiers in your templates here.
Theme translations
All translations for Notando default theme are avaiable at our site's download section. These files are in Gettext format. If you want to change some tranlsations there, your should edit proper strings in downloaded .po file and then complie it to get .mo file as it is described at GNU 'gettext' documentation. Or you may create translation files yourself with translations you want to customize only. In this case you theme's translation priority higher then default translation.
Translation files should be placed accourding to folders structure in such a way:
languages/[your_language1].mo
languages/[your_language2].mo
As you can see in this example Notando webshop engine provides multilingual interface: en, ru, is language translations are avaiable for default theme now.
Theme packaging
To create theme package — just add all theme metadata files, resources and templates into zip file. It should have the following structure:
/ |-templates |-resources |-languages |-metadata.xml |-blocks.xml
You theme package should contain at least one of the following: resources, templates, blocks.xml to be fully flegged theme. Theme folder in filesystem will be named after zip file, so use unique names for all your themes.
