Last Updated 4 hours ago
Custom look of the blog's left and right column.
Custom look of the blog's left and right column (leftColumn.tpl and rightColumn.tpl)
The blog block shown in the shop's left and right column (blog categories, popular, latest and similar posts) uses the module's standard template by default. Since version 1.99.9 you can replace it with your own file:leftColumn.tpl is used for the left column and rightColumn.tpl for the right one. The files are uploaded over FTP to the folder of a layout or to the folder of an older-type blog theme. Both cases are described below. Case 1. The blog uses a layout
A file placed in a layout folder works only on the pages that use this layout. In the following example, the look of the columns on the blog post page will be changed.Step 1. In the module panel, click Layouts in the side menu. Find the active layout and note its ID and Type:
- single - layout of the blog post page,
- list - layout of the pages with a list of posts: the blog home page, blog category, tag, search results and author page.
12. Step 2. Connect to the server over FTP and go to the
modules/pshowblog/views/themes/ folder. The layout folder is named after the layout and ends with its ID, e.g. my-post-12. Among others, it contains the layout.tpl and style.css files. The folder name does not change when the layout is renamed. Step 3. Copy the standard template
modules/pshowblog/views/templates/hook/leftColumn.tpl to the layout folder and adjust it to your needs. The file will be used in the left column on the pages that use this layout. Step 4. (Optional) If the right column should look different from the left one, put a
rightColumn.tpl file in the same folder. Without it, the right column uses the leftColumn.tpl file. Step 5. Clear the shop cache in Advanced Parameters > Performance > Clear cache and open any blog post to check the result.
Note. The blog categories page and the shop pages (e.g. a product category) do not use a layout. On these pages the module uses the file from the blog theme (case 2) or the standard template.
Case 2. The blog uses an older-type theme
A file placed in the blog theme folder works on all pages where a column with the blog block is visible, including the shop pages. The exception are pages that use a layout with its own column file. In the following example, theseo-blog-2023 theme is selected. Step 1. In the module panel, go to Settings and open the Themes tab. Check which blog theme is selected. In this example it is
seo-blog-2023. Step 2. Connect to the server over FTP and go to the folder of the selected theme:
- PrestaShop 1.7, 8 and 9:
modules/pshowblog/views/themes_17/seo-blog-2023/, - PrestaShop 1.6:
modules/pshowblog/views/themes//.
Step 3. Copy the standard template
modules/pshowblog/views/templates/hook/leftColumn.tpl to this folder and adjust it to your needs. Step 4. (Optional) If the right column should look different from the left one, put a
rightColumn.tpl file in the same folder. Step 5. Clear the shop cache in Advanced Parameters > Performance > Clear cache and check a blog or shop page with a visible column.
Which file is used
The module uses the first file it finds:- Left column:
leftColumn.tplfrom the layout folder, thenleftColumn.tplfrom the blog theme folder, and finally the standard template. - Right column:
rightColumn.tplfrom the layout folder, thenrightColumn.tplfrom the blog theme folder, thenleftColumn.tplfrom the same folders, and finally the standard template.
Tip. The file has access to the same variables as the standard template (
$categories_blog, $popular_entries, $last_entries, $similar_entries) plus $blog_column with the value left or right. Thanks to it, a single leftColumn.tpl file can look different in each column, e.g. {if $blog_column == 'right'} ... {else} ... {/if}. Note. The column must be visible on the page: in PrestaShop 1.7, 8 and 9 set a layout with a column for the blog pages in Design > Theme & Logo > Choose layouts, and in PrestaShop 1.6 enable the column for the blog pages in the shop theme settings (Preferences menu). For the right column, also enable the Display right column option in the module settings.
Note. The layout and blog theme folders are located inside the module folder, and a module update may overwrite the bundled blog themes. Keep a copy of your files and check after an update that they are still in place.