Developer's Guide
Security
1. All user datas (datas entered by users) have to be casted.
2.
3. $data = Tools::getValue('name');
4.
5. $myObject->street_number = (int)Tools::getValue('street_number');
6. All method/function's parameters must be typed (when Array or
Object) when received.
7.
8. public myMethod(Array $var1, $var2, Object $var3)
9. For all other parameters they have to be casted each time they are
use, but not when
sent to other methods/functions
10.
11. protected myProtectedMethod($id, $text, $price)
12. {
13. $this->id = (int)$id;
14. $this->price = (float)$price;
15. $this->callMethod($id, $price);
16. }
Limitations
1. Source code lines are limited to 120 characters
2. Functions and methods lines are limited to 80 with good
justifications
Other
1. It's forbidden to use a ternary into another ternary
2. We recommend to use && and || into your conditions
3. Please don't use reference parameters
SQL
Table names
1. Table names must begin with the PrestaShop "DB_PREFIX" prefix
2.
3. [...] FROM `'. _DB_PREFIX_.'customer` [...]
4. Table names must have the same name as the object they reflect
e.g. "ps_cart"
5. Table names have to stay singular
e.g. "ps_order"
6. Language data have to be stored in a table named exactly like the
object's one and with the suffix "_lang" e.g. "ps_product_lang"
SQL query
1. Keywords must be written in uppercase.