Child pages
  • Setting up your local development environment

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can download the latest version of PrestaShop at http://www.prestashop.com/en/downloads.

You can download the development version (unstable) development version on Github: https://github.com/PrestaShop/PrestaShop/archive/masterdevelopment.zip

Extract the PrestaShop files, and put them in the root folder of the AMP installer you chose:

...

In the "Databases" tab, put your wanted indicate the database name in the field you want and validate by clicking on the "Create a database" button.

...

Open the PrestaShop installer, which should be located at http://127.0.0.1/prestashop/install, and follow the its instructions.

You can read the Getting Started Guide guide for more details: http://doc.prestashop.com/display/PS15/Getting+Started.

Configuring PrestaShop

The By default installation of , PrestaShop is configured to provide a secure and stable environment to both the shop administrator and the clientscustomers.

As a developer, there are several changes that you could and should bring to the default installation in order to help you code better, spot bugs faster, and generally make a great PrestaShop product.

...

When your development has an impact on the front-office, whether you are building a theme or simply a module which displays information to the clientcustomer, you should force the template file compilation and disable the cache, so as to always see the direct result of your changes directly.

Go to the "Performances" page under the "Advanced parameters" menu to change these the following Smarty settings:

...

Warning

Forcing the compilation of Smarty will always slow down the page loading time of the page. Make sure that your production store is set to only recompile templates if there are updated files, and that its cache is enabled.

...

PrestaShop's default settings prevent the client customer to see any server error message or any debugging code.

You, on the other hand, need this information in order to correct any potential mistake in your code. To that end, open the /config/defines.inc.php file, and change the following lineedit it to set _PS_MODE_DEV_ to true:

Code Block
/* Debug only */
define('_PS_MODE_DEV_', true);

...

Using the debug methods

PrestaShop has custom debug methods available for developers: p($variable) and d($variable). They are used to display the content of a variable. It is really a wrapper around the well-known print_r() method (http://php.net/manual/en/function.print-r.php):

...

On top of that, PrestaShop defines the ppp() and ddd() method methods, which are respectively the aliases of p() and d(). They work exactly the same, but are often easier to search and find in a huge block of code.

These debug methods are not available activated by default. To activate them, you must enable the Debug mode, by setting _PS_MODE_DEV_ to true (see above).

Enabling the multistore mode

...

You can switch back and forth between single store and multistore mode – in single store mode, only the main store is used.

You can read more about the multistore mode in the PrestaShop 1.5 User Guide: http://doc.prestashop.com/display/PS15/Managing+Multiple+Shops.

About the configuration files

...

It is the main configuration file file for PrestaShop. You should not have to touch anything in there.

...

When in development/test mode, you must make sure to be able to view that all the error messages are displayed:

  • Set define('_PS_MODE_DEV_', false); to "true".

On the contrary, when in production mode, you must hide error messages as much as possible!

  • Make sure that

...

  • define('_PS_MODE_DEV_', false); is set to "false".

smarty.inc.php

This file contains all the Smarty-related settings.

...

$smarty->compile_check should be left to "false" in development mode.

$smarty->debugging gives access to Smarty debug information when displaying a page. That setting is more easily modified in the "Performance" page of the advanced parameters menu : the "Debug console" option enables you to choose between never displaying Smarty's debug information, always displaying it, or only displaying it when you add ?SMARTY_DEBUG to the URL of the page you want to test, which can be very useful.

Warning

When in production mode, $smarty->force_compile must be set to "false", as it will give a 30% boost to your page load time.

On the other hand, when editing a .tpl file, you must delete the /tools/smarty/compile folder (except the index.php file) in order to see your changes applied.

Note that this setting can be made directly from the back-office, in the "Performance" page under the "Advanced parameters" menu.