In the previous chapter the basics for using the myShop extensions were explained. However, before we can start creating a custom layout, the block concept should be explained. The basics will be explained using the productlist as an example, but there are many more ‘blocks’ which you can use.
Basically, a block is a programmatic marker which defines what data is going to be shown, or makes it possible to iterate over a set (usually of products).
Blocks are used to specify what information goes where, it acts as boundaries for data sets. For instance the myshop-block:productlist defines where all products should be shown, and within this context product-independent information like field names can be shown. Within the productlist block you will typically find a product block, this block will be shown again and again until all products within the scope of the productlist block have been shown.
How this looks in a custom layout template can be seen in the example below:
<table style="myshop-block:productlist" border="1"> <thead> <tr> <td style="myshop-label:1; font-weight:bold"></td> <td style="myshop-label:2; font-weight:bold"></td> </tr> </thead> <tbody> <tr style="myshop-block:product"> <td style="myshop-value:1; color:red;"></td> <td style="myshop-value:2"></td> </tr> </tbody> </table>
As you can see, the productlist block starts at line 1. The fieldnames (myshop-label) of the first two columns in the excel are shown once in the thead.
On line 9 you can find the mentioned product block, which will be repeated until all products are shown (this is restricted to the products which should be shown on the current page).
It is possible to include more then one product block inside a productlist block, this is typically used to show multiple products on one line or in another specific sequence.
If you would use the example above in a custom layout template, you would get a table not much unlike this one:
|El Carretero||The Portables|
|Moliendo Café||P. Joke Manzo|
Besides the block for the productlist the are some other blocks which you can use, including a standard search-block, menu-block and others. See for more information the section block in the Referencelist.