Shruthi Posted October 1, 2016 Share Posted October 1, 2016 First I will create a voucher which gives 10% discount on the final amount of the product We are giving 5000 credit cash for each registered customer in our website...The customer can use the voucher until 5000 rupees got over. when the order got placed using the above mentioned voucher I want to display the discount amount deducted from the 5000 example for first order discount is 500(5000-500=4500 I should get ) for the first time of the voucher used For the second order using the same voucher if the customer get 10% discount suppose the discount amount is 400 amount should be (4500-400(discont amount of the second order)= 4100) likewise 4100-.... To achieve this I tried in classes/PaymentModule.php $order->total_paid_tax_excl = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(false, Cart::BOTH, $order->product_list, $id_carrier), _PS_PRICE_COMPUTE_PRECISION_); $order->total_paid_tax_incl = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::BOTH, $order->product_list, $id_carrier), _PS_PRICE_COMPUTE_PRECISION_); $order->total_paid = $order->total_paid_tax_incl; $order->round_mode = Configuration::get('PS_PRICE_ROUND_MODE'); $order->round_type = Configuration::get('PS_ROUND_TYPE'); $order->gcash_dis=5000-$order->total_discounts; $order->invoice_date = '0000-00-00 00:00:00'; But I am not getting any data in ps_orders table and I tried to get the discount amount by joining two tables cart_rule table with the order_cart_rule table $query = ' SELECT ocr.value AS discount,cr.code FROM `'._DB_PREFIX_.'order_cart_rule` ocr LEFT JOIN `'._DB_PREFIX_.'cart_rule ` cr ON (ocr.id_cart_rule = cr.id_cart_rule)'; return Db::getInstance()->executeS($query); not geting the way So how to do this Link to comment Share on other sites More sharing options...
rocky Posted October 4, 2016 Share Posted October 4, 2016 Did you override classes/order/OrderCartRule.php too add 'gcash_dis' to the 'fields' array and create a variable to store the value? You'll need to do that as well as add the field to the table using phpMyAdmin before it will work. Link to comment Share on other sites More sharing options...
opnh Posted October 4, 2016 Share Posted October 4, 2016 (edited) Hello rocky I am using another account for forum for the same application I did it with creating new module called Gcash Still I am working on that for further queries I will post the question again Thank you Edited October 4, 2016 by opnh (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