custom input field during checkout in prestashop

I'm writing a module, what I want is to create a new variable in the checkout process; a text field for a code that a customer can insert. Then I want to retrieve the same variable in the hookDisplayOrderConfirmation. I show on the screenshot where i want to display the input field.
Can you help me? Best regards.



PrestaShop expert answer about custom input field during checkout

Hello, for me everything is clear. Case requires minor coding skills. It can be easily implemented.
  1. input field 
    In your case you need to use hook "displayShoppingCart" - to create an input field in cart (at the top of it as you show on screenshot)
    To form where the input field will appear create <input type="hidden"> with value equal to the ID of cart: $this->context->cart->id
    When someone will fill the code there, save it in dedicated database table (you need to create it):
    - cart_id
    - code_value
  2. hookDisplayOrderConfirmation
    then use hookDisplayOrderConfirmation to show it after checkout.
    you can use sql query to get the code_value that was saved in your database table (hookDisplayOrderConfirmation returns an ID of order, you can use it to get the cart id)

If I were you - this is the know-how that i will use to build such feature
Share on Google Plus

About VEKIA

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments:

Post a Comment