jtchandler Posted January 29, 2014 Share Posted January 29, 2014 (edited) I am writing a custom payment module. Everything seems to be working except I can't figure out how to convert an user's cart into an order. I collect the information, send it off to the payment processor, and then return the info to a custom module page. On this page I want it to covert the cart to an order and mark it paid, but I can't figure out the code to do it. Is there a hook I should be using for this? Is there a function for the order class? Edit: This is for Prestashop 1.5 Edited January 29, 2014 by jtchandler (see edit history) Link to comment Share on other sites More sharing options...
jtchandler Posted January 30, 2014 Author Share Posted January 30, 2014 Finally found it. It is the validateOrder function. The following is working well for me in a moduleFrontController: //Get cart id from $_POST $cart_id = Tools::getvalue('cart_id'); $cart = new Cart((int)$cart_id); $order_status = (int)Configuration::get('PS_OS_PAYMENT'); $order_total = $cart->getOrderTotal(true, Cart::BOTH); $this->module->validateOrder($cart->id, $order_status, $order_total, "Payment Name Here", null, array(), null, false, $cart->secure_key); Hope this helps someone else. 2 Link to comment Share on other sites More sharing options...
cataplina Posted April 11, 2021 Share Posted April 11, 2021 On 1/30/2014 at 1:36 PM, jtchandler said: Finally found it. It is the validateOrder function. The following is working well for me in a moduleFrontController: //Get cart id from $_POST $cart_id = Tools::getvalue('cart_id'); $cart = new Cart((int)$cart_id); $order_status = (int)Configuration::get('PS_OS_PAYMENT'); $order_total = $cart->getOrderTotal(true, Cart::BOTH); $this->module->validateOrder($cart->id, $order_status, $order_total, "Payment Name Here", null, array(), null, false, $cart->secure_key); Hope this helps someone else. hello, could you please specify which file is this? where should i loook to edit? thanks! 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