gruszdaname Posted December 28, 2017 Share Posted December 28, 2017 (edited) Hello, I want to save order (ps_order_detail) product quantity (product_quantity) to other field in same table (product_quantity_order) for client to see original order qty he orderer. I have module to edit quantity of existing order and to complete order for but client need to see what he ordered in first place. I write function but it's not working. public function postProcess() { if (Tools::isSubmit('id_order')) { $orderId = (int)Tools::getValue('id_order'); $op_qty = (int)Tools::getValue('product_quantity', array()); $query = "UPDATE " . _DB_PREFIX_ . "order_detail SET product_quantity_order = '" . $op_qty . "' WHERE id_order=" . $orderId; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($query); } parent::postProcess(); } Any help please, Prestashop 1.6.1.17 I've try even smth like this: class AdminOrdersController extends AdminOrdersControllerCore { // Complete module functions [...] public function postProcess() { if (Tools::getValue('product_quantity')) { $id_ord = (int)Tools::getValue('id_order'); $id_prod = (int)Tools::getValue('product_id'); //$op_qty = (int)Tools::getValue('product_quantity', array()); $quantity = (int)Tools::getValue('product_quantity'); $query = "UPDATE `"._DB_PREFIX_."order_detail` od SET product_quantity_order=". $quantity . " WHERE od.id_order=" . $id_ord . " AND od.product_id=" . $id_prod . " AND od.id_shop=" . $id_shop . ";"; Db::getInstance()->Execute($query); } parent::postProcess(); } } But no luck Edited December 28, 2017 by gruszdaname (see edit history) 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