...
- Do not mix XHTML and PHP code.
- Do not mix XHTML and CSS code, put the CSS code in a separate
.css
file. - Always validate your XHTML and CSS code using the W3C validators: XHTML validator, CSS validator.
- Do not make SQL queries from a PHP controller ({{.php file at the root of PrestaShop); prefer the use of existing methods from the PrestaShop classes, or create new methods for these classes.
- Always check if a method you need does not already exist in the available classes.
- Always make sure to produce a clear and readable code, making it easy to maintain for anyone.
- Do comment your code, in English.
- When editing the theme on a production site, always first put the shop in maintenance mode via the back-office.
- Use modern browsers, such as Firefox, Google Chrome or Opera, and make sure your friends do too.
- Whenever possible, use CSS sprites (follow-up article.
- If you wish to thank PrestaShop team for its hard work, please consider donating, or spread the good word!
Customizing the default theme
Follow the following steps below to create your own theme out of the PrestaShop default theme.
1. Copy the default theme
- Locate the
/themes
directory in your PrestaShop install, and create a copy of the default../themes/prestashop/
directory. - Rename the duplicate.
2. Modify the CSS sheet
- In the customized theme folder (e.g.,
/themes/MyStoreTheme/
), locate the/css
folder. - Open the
global.css
file and change it according to your needs. This is where you are only limited by your creativity – and your knowledge of CSS.
Note: themaintenance.css
file, located in the same folder, controls the layout of the Maintenance Mode page. - New or modified images must be placed in the new theme's
/img
folder (e.g.,/themes/MyStoreTheme/img
).
Tip | ||
---|---|---|
| ||
|
3. Create a preview screen shot
Once your customized theme is ready, you must place a file representing the theme, called preview.jpg
, in the theme's root folder (e.g., /themes/MyStoreTheme
). This file must be a 100 × 100 pixels .jpg
file.
4. Test your theme
- Go to back-office's "Preferences" tab, then its "Appearance" and its "Themes" section.
- Select the new theme and click Save..
Share your themes!
Show off your hard work, get feedback, and build your reputation by sharing your theme in the Themes section of our Forum!
You can also sell your theme to PrestaShop users through our Addons website!
Creating your own theme
PrestaShop's default theme
...
File or folder | Description |
---|---|
preview.jpg | This image is used as a preview in the "Theme" selector in the "Preferences" > "Appearance" sub-tab. This image is mandatory, as without it the them cannot be selected. It should obviously reflect the theme's design, and not its logo or designer's name... |
404.tpl | Used when the requested page is not found (HTTP error 404). |
address.tpl | Used when adding or editing a client street address. |
addresses.tpl | Used when listing a client's street addresses. |
authentication.tpl | Used when identifying a user, or creating a new user account. |
best-sales.tpl | Used to list all best sale. |
breadcrumb.tpl | Used to find the navigation path, or breadcrumb trail. |
category.tpl | Used to list all products in a given category. |
category-tree-branch.tpl | Used only by the Category block. |
category-cms-tree-branch.tpl | ... |
cms.tpl | Used for informational pages ("Tools" > "CMS" sub-tab). |
contact-form.tpl | Used by the contact form. |
discount.tpl | Used when listing all discount tickets for a single client. |
errors.tpl | Used when displaying errors. Potentially called by all of the pages. |
footer.tpl | Page footer. |
guest-tracking.tpl | Used when a visitor has no know account on the site, but wants his order to be tracked – and therefore needs to create an account or log in. |
header.tpl | Page header |
history.tpl | Used when lsiting the order history of a client. |
identity.tpl | Used when a client edits his/her personal information. |
index.php | Blank file, prevents visitors to view the content of the folder. |
index.tpl | Welcome page. |
maintenance.tpl | Used when the site is in maintenance mode. |
manufacturer.tpl | Used when listing all products from a single manufacturer. |
manufacturer-list.tpl | Used when listing all manufacturers. |
my-account.tpl | Weclome page for a client's account. |
new-products.tpl | Used when listing the products that were last added to the cart. |
order-address.tpl | Used during the order process: Step 1, choosing the addesses addresses (delivery, billing). |
order-carrier.tpl | Used during the order process: Step 2, choosing the carrier mode. |
order-confirmation.tpl | Used during the order process: Last step, confirming the order (after payment). |
order-detail.tpl | Used to display the content of a client's order. |
order-follow.tpl | Used when a client needs to ask for a product return. |
order-opc.tpl | ... |
order-opc-new-account.tpl | ... |
order-payment.tpl | Used during the order process: Step 3, choosing the payment mode. |
order-return.tpl | Used to display a client product return details. |
order-slip.tpl | Used to display a client's credit slips. |
order-steps.tpl | Order process progress bar. |
pagination.tpl | Used by all pages that list products. Displays the pagination button, enable to skip to the next/previous page of products. |
password.tpl | Used when a client needs to change his password. |
prices-drop.tpl | Used to list all current promotions. |
product.tpl | Used to display details for a single product. |
product-list.tpl | Used by all pages that list products. Displays the actual products list. |
product-sort.tpl | Used by all pages that list products. Displays a menu enabling to sort and filter products. |
products-comparison.tpl | ... |
scenes.tpl | Used to display a scene's details within a product category. |
search.tpl | Used to list results from a search query. |
shopping-cart.tpl | Used to list products in a client's cart. |
shopping-cart-product-line.tpl | Used to display from a single cart row. |
sitemap.tpl | Used to display the site map. |
store_infos.tpl | ... |
stores.tpl | ... |
supplier.tpl | Used to list all the products from a single supplier. |
supplier-list.tpl | Used to list all suppliers. |
thickbox.tpl | Used to zoom a productsproduct's picture. |
/cache | ... |
/css | Contains all style sheet files for the theme. The |
/img | Contains all of the theme's images. You should replace these images with your own adequate creations. If you do not know what to make of it, you should leave the original files. |
/js | Contains all of the theme's JavaScript files. Scripts JavaScript utilisés dans le thème. Unless you know exactly what you are doing, you should leave these files alone. |
/lang | Contains all translation files. These are generated by the back-office translation tool, and should not be edit directly. If a translation needs editing, go to the back-office, "Tools" tab, "Translation" sub-tab, "Modify translation" section, and choose "Front office translations". |
Customizing the default theme
Follow the following steps below to create your own theme out of the PrestaShop default theme.
1. Copy the default theme
- Locate the
/themes
directory in your PrestaShop install, and create a copy of the default../themes/prestashop/
directory. - Rename the duplicate.
2. Modify the CSS sheet
- In the customized theme folder (e.g.,
/themes/MyStoreTheme/
), locate the/css
folder. - Open the
global.css
file and change it according to your needs. This is where you are only limited by your creativity – and your knowledge of CSS.
Note: themaintenance.css
file, located in the same folder, controls the layout of the Maintenance Mode page. - New or modified images must be placed in the new theme's
/img
folder (e.g.,/themes/MyStoreTheme/img
).
Tip | ||
---|---|---|
| ||
|
3. Create a preview screen shot
Once your customized theme is ready, you must place a file representing the theme, called preview.jpg
, in the theme's root folder (e.g., /themes/MyStoreTheme
). This file must be a 100 × 100 pixels .jpg
file.
4. Test your theme
- Go to back-office's "Preferences" tab, then its "Appearance" and its "Themes" section.
- Select the new theme and click Save..
Share your themes!
Show off your hard work, get feedback, and build your reputation by sharing your theme in the Themes section of our Forum!
You can also sell your theme to PrestaShop users through our Addons website!
Integration: where the hooks and modules are
...
Header section
Homepage blocks
Modules
Category central column
Modules
Product page
Account forms & order steps
...