Jump to content

Add custom field in backoffice orders


nspinheiro

Recommended Posts

Hello

 

I would like to create a custom field in the orders page (inside each individual order)

 

It is just to include small comments from the sales team for further reference, basically text.

 

I can only find tutorials for products, not for orders.

 

Can i try to use the same concepts, changing off course the .tpl file edited and the db table? will it work without damaging the order process?

Link to comment
Share on other sites

you will have to:

- add new field to ps_order table to store this text for further reference

- modify orders admin theme template file to display this field on order details page

- modify order controller, where you have to define new field definition in object definition

 

something like: http://www.prestashop.com/forums/topic/285258-solvedhow-to-add-new-text-field-to-a-product-which-will-only-be-available-from-the-bo/

but instead of products controller / template files use files related to orders

  • Like 1
Link to comment
Share on other sites

  • 8 months later...
  • 8 months later...

what kind of field you want to add, what you're trying to achieve?

Hello  Vekia,

I am trying to add a "Company" field on my orders tab in back office. This way I can see what orders are company from which company. Also is there a way to simply have a company page where you can see what money each company has spent?

 

Thanks!

Link to comment
Share on other sites

  • 4 months later...

Hello Vekia sir,

need ur help..,

want to add a custom field "Asked Delivery date" in back office, while creating a new order for customer (in shipping section below Delivery Option). I want to add a datetime type input.

Admin selects a date and created the order. It should also be visible in Orders list in back office

 

would be great help if you could tell me in which file and where i have to change...

Edited by mayank02 (see edit history)
  • Like 1
Link to comment
Share on other sites

Hello Vekia sir,

need ur help..,

want to add a custom field "Asked Delivery date" in back office, while creating a new order for customer (in shipping section below Delivery Option). I want to add a datetime type input.

Admin selects a date and created the order. It should also be visible in Orders list in back office

 

would be great help if you could tell me in which file and where i have to change...

 

Seems we are on the same issue mayank, even I am looking for adding a date in shipping in back office admin manual order and bought a module from smadha but for some reason many vendors are unable to give a proper solution to add a date of delivery in shipping section in back office /Manual Order by admin.

 

Vekia , Any guidance shall be appreciated...  

Link to comment
Share on other sites

Seems we are on the same issue mayank, even I am looking for adding a date in shipping in back office admin manual order and bought a module from smadha but for some reason many vendors are unable to give a proper solution to add a date of delivery in shipping section in back office /Manual Order by admin.

 

Vekia , Any guidance shall be appreciated...  

 

post-1149803-0-13692400-1449565242_thumb.png

 

looking for something like the screenshot.

Link to comment
Share on other sites

  • 1 year later...

you will have to:

- add new field to ps_order table to store this text for further reference

- modify orders admin theme template file to display this field on order details page

- modify order controller, where you have to define new field definition in object definition

 

something like: http://www.prestashop.com/forums/topic/285258-solvedhow-to-add-new-text-field-to-a-product-which-will-only-be-available-from-the-bo/

but instead of products controller / template files use files related to orders

 

 

Hello,

I tried with:

 

1) DATABASE

ALTER TABLE `ps_orders` ADD `custom` VARCHAR(200) NOT NULL AFTER `date_upd` `;

 

 

2) override/classes/order/Order.php

 

 

     /** @var text note*/

    public $custom; 

[...]

 

            'date_upd' =>                    array('type' => self::TYPE_DATE, 'validate' => 'isDate'),                                  

              'custom' =>                array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),   

[...]

 

 

3) /BackofficeXYZ/themes/default/template/controllers/orders/helpers/view/view.tpl

 

[...]

        <form class="form-horizontal hidden-print" method="post" action="{$currentIndex|escape:'html':'UTF-8'}&vieworder&token={$smarty.get.token}">

            <div class="form-group">

                                       

                            <div class="col-lg-5">

                                <label class="control-label col-lg-3">Note</label>                                

                               <input type="text" id="note" name="note" value="{$order->custom|default:''}"/>                   

                            </div>

                                   

                                        

                        <div class="col-lg-3">

                            <button class="btn btn-default" type="submit" name="submitCustom"><i class="icon-refresh"></i> {l s='Change'}</button>

                        </div>

                    </div>

            </form>  

[...]

 

BUT it doens't works...

how is the problem?

 

Thank you so much!

Link to comment
Share on other sites

  • 11 months later...
On 3/31/2017 at 8:46 AM, artigianidelweb said:

 

 

Hello,

I tried with:

 

1) DATABASE

ALTER TABLE `ps_orders` ADD `custom` VARCHAR(200) NOT NULL AFTER `date_upd` `;

 

 

2) override/classes/order/Order.php

 

 

     /** @var text note*/

    public $custom; 

[...]

 

            'date_upd' =>                    array('type' => self::TYPE_DATE, 'validate' => 'isDate'),                                  

              'custom' =>                array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),   

[...]

 

 

3) /BackofficeXYZ/themes/default/template/controllers/orders/helpers/view/view.tpl

 

[...]

        <form class="form-horizontal hidden-print" method="post" action="{$currentIndex|escape:'html':'UTF-8'}&vieworder&token={$smarty.get.token}">

            <div class="form-group">

                                       

                            <div class="col-lg-5">

                                <label class="control-label col-lg-3">Note</label>                                

                               <input type="text" id="note" name="note" value="{$order->custom|default:''}"/>                   

                            </div>

                                   

                                        

                        <div class="col-lg-3">

                            <button class="btn btn-default" type="submit" name="submitCustom"><i class="icon-refresh"></i> {l s='Change'}</button>

                        </div>

                    </div>

            </form>  

[...]

 

BUT it doens't works...

how is the problem?

 

Thank you so much!

 

Also you need add some lines in controllers/admin/AdminOrdersController.php something likes this. [function postProcess()]

elseif (Tools::isSubmit('submitCustom') && isset($order)) {
  $order->custom = Tools::getValue('note');
  $order->update();
  Tools::redirectAdmin(self::$currentIndex.'&id_order='.$order->id.'&vieworder&token='.$this->token);
}

 

  • Thanks 1
Link to comment
Share on other sites

  • 11 months later...
  • 2 weeks later...
  • 1 month later...

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...