tijojoel Posted August 21, 2017 Share Posted August 21, 2017 Hi, I would like to ask you how to make that customer could pay from his order history page. For example, he orders products but not completes payment (no money in bank account or something), need that he could make payment through order history page. Prestashop version - 1.6 Link to comment Share on other sites More sharing options...
NemoPS Posted August 21, 2017 Share Posted August 21, 2017 How should the payment be completed? Credit card? Link to comment Share on other sites More sharing options...
tijojoel Posted August 21, 2017 Author Share Posted August 21, 2017 yes by credit card heartland payment module is there to complete the payment Link to comment Share on other sites More sharing options...
tijojoel Posted August 21, 2017 Author Share Posted August 21, 2017 Do you have any idea to do this? Link to comment Share on other sites More sharing options...
NemoPS Posted August 21, 2017 Share Posted August 21, 2017 If you have the module already, you will have to modify it, and create a button in the order history where the user can proceed to the gateway, with all of the information sent Link to comment Share on other sites More sharing options...
tijojoel Posted August 21, 2017 Author Share Posted August 21, 2017 yes i had done that the problem I am facing is instead of cart elements I need current order elements. I mean $address = new Address((int)$this->context->cart->id_address_invoice); $address_state = new State($address->id_state); $customer = new Customer($this->context->cart->id_customer); $amount = $this->context->cart->getOrderTotal(); so $amount is coming zero because I am not entering it into the cart. How I pass the current order id and total amount then update the order instead of create? Link to comment Share on other sites More sharing options...
tijojoel Posted August 21, 2017 Author Share Posted August 21, 2017 (edited) @nemo I have orderid in the ParentOrderController.php, I want that Id to be passed to securesubmit.php(payment module gateway page) then only I can pass total amount. Edited August 21, 2017 by tijopromantia (see edit history) Link to comment Share on other sites More sharing options...
tijojoel Posted August 22, 2017 Author Share Posted August 22, 2017 someone please help me Link to comment Share on other sites More sharing options...
tijojoel Posted August 24, 2017 Author Share Posted August 24, 2017 @nemo do you know any payment module that work from order history page Link to comment Share on other sites More sharing options...
NemoPS Posted August 26, 2017 Share Posted August 26, 2017 Unfortunately I don't know any, I think you just have to code what you need yourself.For the order id, it depends on what is available at that point of the code, it might even be $order->id Link to comment Share on other sites More sharing options...
Scully Posted August 27, 2017 Share Posted August 27, 2017 Again one of these double posts. Red flag for tijopro.... Link to comment Share on other sites More sharing options...
Scully Posted August 28, 2017 Share Posted August 28, 2017 This is one of your double post! https://www.prestashop.com/forums/topic/624300-passing-product-information-and-updating-of-an-order/?do=findComment&comment=2598095 Link to comment Share on other sites More sharing options...
tijojoel Posted August 29, 2017 Author Share Posted August 29, 2017 @nemo Do you know what all tables and values I have to update to payment completion from order history page? Link to comment Share on other sites More sharing options...
NemoPS Posted August 30, 2017 Share Posted August 30, 2017 You should not really be editing any table.If the order has been placed, and it has been, you just have to trigger a payment with the module you have, just using the way it processes it by default $order->addOrderPayment($amount, Tools::getValue('payment_method'), Tools::getValue('payment_transaction_id'), $currency, Tools::getValue('payment_date'), $order_invoice)This is how you usually add a payment for an already created order, but it obviously needs to take place after the cc payment has been processed by your module's apiAfter that you can trigger a new order state Link to comment Share on other sites More sharing options...
tijojoel Posted August 30, 2017 Author Share Posted August 30, 2017 @nemo yes you are right , I had called the payment gateway but my payment gateway is extending to PaymentModule.php, so there order is created. what should i do to eliminate this? Link to comment Share on other sites More sharing options...
NemoPS Posted August 31, 2017 Share Posted August 31, 2017 So it's creating another order?If so you need to extract the code from your module, put it in a different method (function) and run that, instanciating OrderPayment only Link to comment Share on other sites More sharing options...
tijojoel Posted August 31, 2017 Author Share Posted August 31, 2017 yes i had created another function and added only the code to update the order-payment table but there is a condition - if (!isset($order) || !Validate::isLoadedObject($order) || !$order->addOrderPayment($amount_paid, null, $transaction_id)) { I had changed only the condition to if ( !$Order->addOrderPayment($amount_paid, null, $transaction_id)) { PrestaShopLogger::addLog('PaymentModule::validateOrder - Cannot save Order Payment', 3, null, 'Cart', (int)$id_cart, true); throw new PrestaShopException('Can\'t save Order Payment'); } Now the problem is how I add $order here? so condition is failing yes i had created another function and added only the code to update the order-payment table but there is a condition - if (!isset($order) || !Validate::isLoadedObject($order) || !$order->addOrderPayment($amount_paid, null, $transaction_id)) { I had changed only the condition to if ( !$Order->addOrderPayment($amount_paid, null, $transaction_id)) { PrestaShopLogger::addLog('PaymentModule::validateOrder - Cannot save Order Payment', 3, null, 'Cart', (int)$id_cart, true); throw new PrestaShopException('Can\'t save Order Payment'); } Now the problem is how I add $order here? so condition is failing Link to comment Share on other sites More sharing options...
NemoPS Posted September 1, 2017 Share Posted September 1, 2017 WHat's that file exactly? Your module or historyController.php? Link to comment Share on other sites More sharing options...
tijojoel Posted September 3, 2017 Author Share Posted September 3, 2017 The file is paymentModule.php, that I had override with adding updateOrder instead of validateOrder Link to comment Share on other sites More sharing options...
tijojoel Posted September 5, 2017 Author Share Posted September 5, 2017 @nemo I had solved it by taking //Insert current order id in cookie Context::getContext()->cookie->__set('current_order_id', $this->existingOrderId); Not sure I am taking correct way to retrieve existing ID. Now Order Id is getting and I can update into the order_payment table, now the problem I am facing is duplicate transaction details are entering for single transaction i.e, for payment completion the order-payment table is inserting with two values, one with transaction id and one without. Link to comment Share on other sites More sharing options...
NemoPS Posted September 7, 2017 Share Posted September 7, 2017 How are you adding it to the cookie? I mean you get it from a link or save it after the order partial completion?Be aware of the fact that in the latter case, if someone places two orders consecutively, they will never be able to pay for the first one.When is it inserting the empty payment? Link to comment Share on other sites More sharing options...
tijojoel Posted September 8, 2017 Author Share Posted September 8, 2017 @nemo I got the existing orderid from the link when user clicks on the order they want to pay the orderid taken and added into the cookie. Link to comment Share on other sites More sharing options...
NemoPS Posted September 9, 2017 Share Posted September 9, 2017 Okay, that's correct then, is the payment duplicate created when you submit the new one, or a blank one is right away when creating the order? Link to comment Share on other sites More sharing options...
tijojoel Posted September 15, 2017 Author Share Posted September 15, 2017 Thank you all I have solved the issue Link to comment Share on other sites More sharing options...
hadahan Posted January 16, 2019 Share Posted January 16, 2019 On 9/15/2017 at 12:48 PM, tijopromantia said: Thank you all I have solved the issue Please write a detailed solution! 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