Understanding Prestashop 

Introduction

To understand how Prestashop fully works, you need a understanding of PHP and Smarty. If you are a designer with limited PHP skills, dont panic. You will still find this section important if you wish to modify your store beyond simply changing your theme template files (.tpl) and the global css files. But of course, for many people, the theme may be all you wish to change.

Prestashop uses Smary templating, and you will be surpised how quickly you can learn Smarty without having to be a PHP/MySQL programmer. This will extend your HTMl/CSS skills and provide you with a greater level of flexibility.

lets get started...

Core (Root) PHP files

Within Prestashop, within your root are the folders and the core PHP files.

404.php
address.php
addresses.php
authentication.php
best-sales.php
cart.php
category.php
CHANGELOG
cms.php
contact-form.php
discount.php
footer.php
get-file.php
header.php
history.php
htaccess.txt
indentity.php
images.inc.php
index.php
init.php
manufacturer.php
my-account.php
new-products.php
order/php
order-confirmation.php
order-detail.php
order-follow.php
order-return.php
order-slip.php
pagination.php
password.php
pdf-invoice.php
pdf-order-return.php
pdf-order-slip.php
prices-drop.php
product.php
product-sort.php
README
robots.txt
search.php
sitemap.php
statistics.php
supplier.php
zoom.php 

if we now look at the index.php file, it contains the following code

<?php
include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/header.php');

$smarty->assign('HOOK_HOME', Module::hookExec('home'));
$smarty->display(_PS_THEME_DIR_.'index.tpl');

include(dirname(__FILE__).'/footer.php');
?>

Bascially this is the main index page when your prestashop is loaded and it tells Prestashop to included the configuration file "config.inc.php", the header.php file, the Home Hook, where the theme index template is that styles this homepage and includes the footer.php file

if we now look at the footer.php file being called into the index file, it contains the following code

<?php

if (isset($smarty))
{
    $smarty->assign(array(
        'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn'),
        'HOOK_FOOTER' => Module::hookExec('footer'),
        'content_only' => intval(Tools::getValue('content_only'))));
    $smarty->display(_PS_THEME_DIR_.'footer.tpl');
}

?>

This file assigns the hooks for the right_column and footer (Hooks are used to allow you to easily move modules form one block such a the left_column to the right_column and covered here) and calls the template file footer.tpl from your default theme

If you looked at the header.php file also being called from the index.php file you will see this includes the header info, the hooks for the header, Top and left-Columns and uses the header.tpl file from your theme to style the HTML for the header, top and left_column.

So the tpl files in your themes contain the smarty code (more in this in a moment). Within your themes is a CSS/global.css file and it is this file that control most of your FrontOffice (what your web visitor sees) store layout and design. This gobal.css file is called from the index.php file in your site root (not the tpl files) with the following code;

/* CSS */
$css_files[_THEME_CSS_DIR_.'global.css'] = 'all';

Please be aware that many sections are incomplete as this site is currently in middle of major update

PRESTASHOP GUIDES

prestashop admin guide prestashop designers guide

CATEGORIES

Prestashop Designers Guide