screentekdesignsltd Posted March 6, 2012 Share Posted March 6, 2012 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 More sharing options...
CartExpert.net Posted March 10, 2012 Share Posted March 10, 2012 Hello, Have you made the modifications to Order.php class? Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted March 10, 2012 Author Share Posted March 10, 2012 I have made the box and update button but the code to update/edit the field isn't working Link to comment Share on other sites More sharing options...
CartExpert.net Posted March 11, 2012 Share Posted March 11, 2012 You need to add the new property to the Order.php class. Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted March 11, 2012 Author Share Posted March 11, 2012 how do i do that I have added the $txn_id as a public variable to the orders.php class Is this it or more needs doing? Link to comment Share on other sites More sharing options...
CartExpert.net Posted March 12, 2012 Share Posted March 12, 2012 You need to add it to the 'getFields' method and if needed to add validation and required arrays. Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted March 12, 2012 Author Share Posted March 12, 2012 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 More sharing options...
CartExpert.net Posted March 13, 2012 Share Posted March 13, 2012 The syntax is correct. Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted March 13, 2012 Author Share Posted March 13, 2012 What about the code needed in orders.php in the classes folder Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted March 13, 2012 Author Share Posted March 13, 2012 also got the following code in the AdminOrders file connected to the submitTxnid /* Update Transaction Id */ elseif (Tools::isSubmit('submitTxnid')) { // Update the transaction id on order $txn_id = pSQL(Tools::getValue('txn_id')); $order->txn_id = $txn_id; $order->update(); } Is this correct? Link to comment Share on other sites More sharing options...
CartExpert.net Posted March 13, 2012 Share Posted March 13, 2012 yes, it is correct. As said in a previous post: You need to add the new property the 'getFields' method and if needed add it to validation and required arrays. Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted March 13, 2012 Author Share Posted March 13, 2012 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 More sharing options...
screentekdesignsltd Posted March 13, 2012 Author Share Posted March 13, 2012 . Link to comment Share on other sites More sharing options...
CartExpert.net Posted March 14, 2012 Share Posted March 14, 2012 You need to add it to the getFields() method too. $fields['txn_id'] = pSQL($this->txn_id); Link to comment Share on other sites More sharing options...
screentekdesignsltd Posted March 14, 2012 Author Share Posted March 14, 2012 Works a treat. Thanks for your help. Link to comment Share on other sites More sharing options...
lucop Posted January 21, 2013 Share Posted January 21, 2013 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 More sharing options...
CartExpert.net Posted January 21, 2013 Share Posted January 21, 2013 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 More sharing options...
lucop Posted January 21, 2013 Share Posted January 21, 2013 (edited) 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 January 21, 2013 by lucop (see edit history) Link to comment Share on other sites More sharing options...
CartExpert.net Posted January 21, 2013 Share Posted January 21, 2013 That's the Order.php class. Regards. Robin. The CartExpert Team Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now