Jump to content

[Solved] Display Custom Field In Orders in BO and Editable/Updatable


Recommended Posts

Hi All

 

This is my problem

 

I have added a txn_id field to the orders table and am displaying this in the individual order in BO as part of the Payment Method field.

 

I wish to make this field be seperate in its own box within the order in BO and be able to update and edit as I please.

 

Any ideas anyone.

 

Thanks

 

Most appreciated in advance.

 

ScreenShot Attached, need code to update the txn_id field as in screenshot within customer order page

 

 

screenshotorderupdate.bmp

Link to comment
Share on other sites

This is the code on the AdminOrders.php file for Transaction Id, is this correct.

 

 /* Display transaction details */
 echo '
   <br />
   <fieldset style="width: 400px">
  <legend><img src="../img/admin/details.gif" /> '.$this->l('Transaction Details').'</legend>
  <label>'.$this->l('Payment Method:').' </label>
  <div style="margin: 2px 0 1em 190px;">'.$order->txn_id.''.'</div>';
 echo '
<form action="'.$currentIndex.'&vieworder&id_order='.$order->id.'&token='.$this->token.'" method="post" style="text-align:center;">
 <input type="text" name="txn_id" size="25" value="'.$order->txn_id.'" />
echo '.$order->id.';
   <input type="hidden" name="id_order" value="'.$order->id.'" />
   <input type="submit" name="submitTxnid" value="'.$this->l('Update').'" class="button" />';

 echo '</fieldset></form>';

Link to comment
Share on other sites

This is what i have in the order.php class file

 

/** @var string Object transaction id (Payment Method) */

public $txn_id;

 

protected $tables = array ('orders');

 

protected $fieldsRequired = array('conversion_rate', 'id_address_delivery', 'id_address_invoice', 'id_cart', 'id_currency', 'id_lang', 'id_customer', 'id_carrier', 'payment', 'total_paid', 'total_paid_real', 'total_products', 'total_products_wt');

protected $fieldsValidate = array(

'id_address_delivery' => 'isUnsignedId',

'id_address_invoice' => 'isUnsignedId',

'id_cart' => 'isUnsignedId',

'id_currency' => 'isUnsignedId',

'id_lang' => 'isUnsignedId',

'id_customer' => 'isUnsignedId',

'id_carrier' => 'isUnsignedId',

'secure_key' => 'isMd5',

'payment' => 'isGenericName',

'recyclable' => 'isBool',

'gift' => 'isBool',

'gift_message' => 'isMessage',

'total_discounts' => 'isPrice',

'total_paid' => 'isPrice',

'total_paid_real' => 'isPrice',

'total_products' => 'isPrice',

'total_products_wt' => 'isPrice',

'total_shipping' => 'isPrice',

'carrier_tax_rate' => 'isFloat',

'total_wrapping' => 'isPrice',

'shipping_number' => 'isUrl',

'conversion_rate' => 'isFloat',

'txn_id' => 'IsGenericName'

);

Link to comment
Share on other sites

  • 10 months later...

Hi I can't find wich file I have to edit to insert the box in the order page in the BO.

 

Can you please explain me better how should I do ?

 

Because I need to add a box to upload my own invoice so I can adapt your code!

 

Thank you

Link to comment
Share on other sites

Hi.

 

If your shop is bellow version 1.5 you need to edit the file 'YOUR_ADMIN/tabs/AdminOrders.php'

 

If it's 1.5 you need to override 'controllers/admin/AdminOrdersController.php' and one of the template files in 'YOUR_ADMIN/themes/default/controllers/order/'

 

Regards.

 

Robin.

 

The CartExpert Team

Link to comment
Share on other sites

Thank you! I use prestashop but I'm not able to do

 

This:

You need to add it to the getFields() method too.

 

$fields['txn_id'] = pSQL($this->txn_id);

 

 

AND THIS

 

/** @var string Object transaction id (Payment Method) */

public $txn_id;

 

protected $tables = array ('orders');

 

protected $fieldsRequired = array('conversion_rate', 'id_address_delivery', 'id_address_invoice', 'id_cart', 'id_currency', 'id_lang', 'id_customer', 'id_carrier', 'payment', 'total_paid', 'total_paid_real', 'total_products', 'total_products_wt');

protected $fieldsValidate = array(

'id_address_delivery' => 'isUnsignedId',

'id_address_invoice' => 'isUnsignedId',

'id_cart' => 'isUnsignedId',

'id_currency' => 'isUnsignedId',

'id_lang' => 'isUnsignedId',

'id_customer' => 'isUnsignedId',

'id_carrier' => 'isUnsignedId',

'secure_key' => 'isMd5',

'payment' => 'isGenericName',

'recyclable' => 'isBool',

'gift' => 'isBool',

'gift_message' => 'isMessage',

'total_discounts' => 'isPrice',

'total_paid' => 'isPrice',

'total_paid_real' => 'isPrice',

'total_products' => 'isPrice',

'total_products_wt' => 'isPrice',

'total_shipping' => 'isPrice',

'carrier_tax_rate' => 'isFloat',

'total_wrapping' => 'isPrice',

'shipping_number' => 'isUrl',

'conversion_rate' => 'isFloat',

'txn_id' => 'IsGenericName'

);

 

 

which files do I have to edit?

Edited by lucop (see edit history)
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...