Jump to content

Add new fields in checkout order-carrier


Recommended Posts

Hi,

anyone know how to add more fields in checkout order process?

i want to add a text field in order step 3 (the carrier page)..
i check on the gift_message field and try to implement the same thing, but it's failed

i found that i need to add a new field column in table ps_orders and modify the controllers and class that link to this checkout, but no good...


can anyone help me please? Thanks

Link to comment
Share on other sites

i found that i need to add a new field column in table ps_orders and modify the controllers and class that link to this checkout, but no good…


that is exactly what you need to do. however the best practice is to take the core classes and extend them in the override folders.

For instance to add a new field to the order, you want to create a class as follows. Add the field to the database, and place that file in the override/classes folder.

<?php

class Order extends OrderCore
{

   public         $new_field;

   public function getFields()
   {
       $fields = parent::getFields();

       $fields['new_field'] = pSQL($this->new_field);
       return $fields;
   }

}
?>



I would then advise you to create a module and hook into the beforeCarrier and processCarrier to handle the business logic and presentation of the new fields.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...