André Luiz
André Luiz

Reputation: 7292

Prestashop: how to add fields to the order summary page

I'm working with Prestashop 1.6 and I need to add a checkbox and text field in the order summary page, as shown below.

enter image description here

I'm lost on which hooks to use to do so. These fields should be also shown in the invoice. For the hook of the invoice I believe it is the DisplayPDFInvoice hook, but for the order summary (display and get information) I don't know which hooks to use.

Can you give me some tips? Thanks for any help

Upvotes: 0

Views: 1125

Answers (1)

Nimish
Nimish

Reputation: 1016

You can use hook hookDisplayBeforeShoppingCartBlock to render any content on cart summary page. Don't forget to register this hook to your module.

I have tried using the same and got the results as below:

enter image description here

Code:

public function hookDisplayBeforeShoppingCartBlock()
{      
    return '<div>Text Area : </div><textarea rows="3" cols="30">This is a text area rendered from hookDisplayBeforeShoppingCartBlock</textarea><br><br><input type="checkbox" name="vehicle" value="Bike">checkbox 1<br><input type="checkbox" name="vehicle" value="Car">checkbox 2';
}

The above code is used just to show an example, you can render any template file from there. As you can see that this hook renders content above cart block so you can use javascript to move it below cart block.

Upvotes: 1

Related Questions