Child pages
  • Hooks in PrestaShop 1.7.x

Versions Compared

Key

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

PrestaShop 1.7.1.x

Naming scheme

  • action. These hooks are triggered by specific events that take place in PrestaShop.
  • display. These hooks result in something being displayed, either in the front-end or the back-end.

Updated Hooks

A couple of hooks were modified between 1.7.0.x and 1.7.1.x.

  • actionDeleteProductInCartAfter has been divided into two hooks:
    • actionObjectProductInCartDeleteBefore.
    • actionObjectProductInCartDeleteAfter.
  • displayProductButtons has been renamed into displayProductAdditionalInfo.
    • Don’t worry, we kept an alias :)

Full list of Hooks

...

array(
'object' => &(ObjectModel),
'fields' => &(array),
'fields_value' => &(array),
'form_vars' => &(array),
);

...

array(
'options' => &(array),
'option_vars' => &(array),
);

...

array(
'controller' => (AdminController),
'return' => (mixed)
);

...

array(
'rb_data' => (array) File data,
'write_fd' => &(resource) File handle
);

...

array(
'order' => (Order),
'customer' => (Customer),
'carrier' => (Carrier)
);

...

array(
'_ps_version' => (string) PrestaShop version,
'sql_select' => &(array),
'sql_table' => &(array),
'sql_where' => &(array),
'sql_order' => &(array),
'sql_limit' => &(string),
);

...

array(
'_ps_version' => (string) PrestaShop version,
'products' => &(PDOStatement),
'total' => (int),
);

...

This

...

array(
    '_POST' => (array) $_POST,
    'newCustomer' => (object) Customer object
);

...

array(
'order' => (object) Order

);

...

array(
    'orderReturn' => (object) OrderReturn
);

...

Called when the quantity of a product changes in an order.

WARNING: only invoked when a product is actually removed from an order.

...

array(
    'order' => Order,
    'productList' => array(
        (int) product ID 1,
(int) product ID 2,
...,
(int) product ID n ), 'qtyList' => array( (int) quantity 1,
(int) quantity 2,
...,
(int) quantity n 
    )
);

The order of IDs and quantities is important!

...

array(
    'newOrderStatus' => (object) OrderState,
'id_order' => (int) Order ID
);

...

array(
    'newOrderStatus' => (object) OrderState,
    'id_order' => (int) Order ID
);

...

page

...

array(
    'paymentCC' => (object) OrderPayment object
);

...

array(
    'id_order' => (int) Order ID
);

...

array(
    'expr' => (string) Search query,
    'total' => (int) Amount of search results
);

...

array(
    'old_id_shop' => (int) Old shop ID,
    'new_id_shop' => (int) New shop ID
);

...

array(
    'id_product' => (int) Product ID,
    'id_product_attribute' => (int) Product attribute ID,
    'quantity' => (int) New product quantity
);

...

array(
    'cart' => (object) Cart,
    'order' => (object) Order,
    'customer' => (object) Customer,
    'currency' => (object) Currency,
    'orderStatus' => (object) OrderState
);

...

array(
    'id_image' => (int) Image ID,
    'id_product' => (int) Product ID
);

...

array(
'id_customer' = (int) Customer ID
); 

...

array(
'id_order' = (int) Order ID
); 

...

Displayed between the <head></head> tags on every Back Office page (when logged in).

...

Code Block
languagephp
collapsetrue
array(
    'carriers' => array(
        array(
            'name' => (string) Name,
            'img' => (string) Image URL,
            'delay' => (string) Delay text,
            'price' =>  (float) Total price with tax,
            'price_tax_exc' => (float) Total price without tax,
            'id_carrier' => (int) intified option delivery identifier,
            'id_module' => (int) Module ID
    )),
    'checked' => (int) intified selected carriers,
    'delivery_option_list' => array(array(
        0 => array( // First address
            '12,' => array( // First delivery option available for this address
                 carrier_list => array(
                     12 => array( // First carrier for this option
                         'instance' => Carrier Object,
                         'logo' => <url to the carrier's logo>,
                         'price_with_tax' => 12.4, // Example
                         'price_without_tax' => 12.4, // Example
                         'package_list' => array(
                             1, // Example
                             3, // Example
                          ),
                     ),
                 ),
                 is_best_grade => true, // Does this option have the biggest grade (quick shipping) for this shipping address
                 is_best_price => true, // Does this option have the lower price for this shipping address
                 unique_carrier => true, // Does this option use a unique carrier
                 total_price_with_tax => 12.5,
                 total_price_without_tax => 12.5,
                 position => 5, // Average of the carrier position
             ),
         ),
     )),
     'delivery_option' => array(
         '<id_address>' => Delivery option,
         ...
     )
); 

NOTE: intified means an array of integers 'intified' by Cart::intifier

...

array(
    'address' => (object) Address object
);

...

Displays information on the customer account creation form

...

array(
    'total_to_pay' => (float) Total amount with tax,
    'currency' => (string) Currency sign,
    'objOrder' => (object) Order,
    'currencyObj' => (object) Currency
);

...

array(
    'order' => (object) Order object
);

...

array(
    'cart' => (object) Cart object
);

Note that the Cart object can also be retrieved from the current Context.

...

has moved to the DevDocs: List of hooks in PrestaShop 1.7