ESN Posted June 23, 2010 Share Posted June 23, 2010 I tried to edit paypal module of PrestaShop and create a customized payment module, but I think I tangled in a philosophical problem on the code. As I understand when customer redirected to the paypal website, there is no appropriate order inserted in the `orders` table yet. As soon as customer come back from paypal site, at the end of `modules/paypal/validation.php` file, `validateOrder()` function will be called and order will inserted into `orders` table.It's completely recognizable till now, but after this my brain slightly farts! There's a serious problem when I see customer will return to `order-confirmation.php` and it checks the `order_id` before it inserted into DB! Let me to explain; On the top of `order-confirmation.php` there's a check about order: $id_order = Order::getOrderByCartId(intval($id_cart)); ... if (!$id_order OR !$id_module OR !$secure_key OR empty($secure_key)) Tools::redirect('history.php'.(Tools::isSubmit('slowvalidation') ? '?slowvalidation' : '')); ... $smarty->assign(array( 'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)), 'HOOK_PAYMENT_RETURN' => Hook::paymentReturn(intval($id_order), intval($id_module)))); It tries to get `id_order` associated to the cart (`id_cart`), but as I explained there's no associated order yet, so `Order::getOrderByCartId` returns false. In the next line customer will be redirected to the `history.php` and `Hook::orderConfirmation` will not never called and no order placed!I can't believe if you say it's a bug, but I can't understand where I'm wrong.Any help will be appreciated Link to comment Share on other sites More sharing options...
texscalper Posted July 25, 2011 Share Posted July 25, 2011 It tries to get `id_order` associated to the cart (`id_cart`), but as I explained there's no associated order yet, so `Order::getOrderByCartId` returns false. In the next line customer will be redirected to the `history.php` and `Hook::orderConfirmation` will not never called and no order placed!<br/><br/>I can't believe if you say it's a bug, but I can't understand where I'm wrong.<br/>Any help will be appreciated Same here ! I'm updating a IWSile payment module, and I'm stuck at same problem. Retrieving id_order from id_cart returns false and customer is redirected to histoy.php page. Am I missing some piece of logic ? Thanks Claudio Link to comment Share on other sites More sharing options...
Thomas Lamy Posted August 26, 2011 Share Posted August 26, 2011 It tries to get `id_order` associated to the cart (`id_cart`), but as I explained there's no associated order yet, so `Order::getOrderByCartId` returns false. In the next line customer will be redirected to the `history.php` and `Hook::orderConfirmation` will not never called and no order placed!<br/><br/>I can't believe if you say it's a bug, but I can't understand where I'm wrong.<br/>Any help will be appreciated Same here ! I'm updating a IWSile payment module, and I'm stuck at same problem. Retrieving id_order from id_cart returns false and customer is redirected to histoy.php page. Am I missing some piece of logic ? Thanks Claudio Same here, with a modified moneybookers module. I checked thrice, haven't removed code other than filling my new templates. Any hint on where the ps_orders record is actually created? there is no cart->createOrder, nor Order->fromCart or similar... 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