Project folders
The root of an installed shop has about two dozen folders. You do not need to remember all of them: you write your code in two, and a few more are worth knowing to find logs, the cache and class sources.
The shop root
shop/
├── admin437xyz/ the back office
├── app/ Symfony settings, parameters.php
├── bin/ the console: bin/console
├── classes/ legacy core classes: Product, Cart, Order
├── config/ constants and settings, defines.inc.php
├── controllers/ legacy core controllers
├── img/ product and category images
├── mails/ email templates
├── modules/ modules — your code goes here
├── override/ overrides of core classes
├── src/ the new Symfony core
├── themes/ themes
├── translations/ translations
├── upload/ files uploaded by customers
├── var/ cache and logs
├── vendor/ Composer libraries
└── webservice/ the web service entry pointWhere your code goes
| Folder | What you do there |
|---|---|
modules/acmehello | Write the module |
themes/acme | Make a child theme |
Everything else belongs to the engine. Files in classes, controllers, src and in the classic theme may and should be read, but not edited.
Where to find the sources
When a module calls Product::getPriceStatic() or Configuration::get(), it helps to open the class itself and look at the arguments.
| What you look for | Where it is |
|---|---|
The Product, Cart, Customer classes | classes/Product.php and neighbouring files |
The Module class | classes/module/Module.php |
| The storefront product page | controllers/front/ProductController.php |
| The product page template | themes/classic/templates/catalog/product.tpl |
| Symfony back office pages | src/PrestaShopBundle/Controller/Admin |
Logs and cache
| Path | What is there |
|---|---|
var/logs | Error logs |
var/cache/dev | The cache in debug mode |
var/cache/prod | The cache in normal mode |
If a page returns a 500 error and the screen is empty, the first thing to check is the last lines of the file in var/logs.
The cache is cleared with a command run from the shop root:
php bin/console cache:clearThe command removes the Symfony cache of the current environment and prints a success message. The "Clear cache" button on the "Advanced Parameters → Performance" page also resets compiled Smarty templates.
The console
The bin/console file is the same Symfony console as in ordinary projects on that framework. The shop's own commands are listed like this:
php bin/console list prestashopThe list includes commands for installing modules; they are used in the next lessons.
Common mistake
The php bin/console command is run from the module folder and prints "Could not open input file". The bin/console path is relative to the shop root. Change to the root or give the full path: php /var/www/shop/bin/console.