5

I need to create a module where it checks if the Customer has an order, and if he does check if its Paid(aka in Complete state), if yes let him order again, if not do not let him order.

I thought of using event-observer with this event: sales_convert_quote_to_order
And check there, and if he isn't allowed he is throwed back to the page where he can pay for it.

is that event good for what iam trying to do? or should i do it differently? How?

2 Answers 2

1

This event is triggered either from the backend of by a Payment extension so I don't think the actual customer will be there when it is triggered. You might want to display a notification in the frontend in the cart for that user telling him he needs to pay the first invoice and hide the 'checkout' button until all invoices have been paid. It will probably depend on how the customer should pay his invoice, sounds like you are using a bank transfer as payment method?

2
  • So basically i need to override the module that has the cart in it?
    – NaGeL182
    Commented Mar 4, 2013 at 15:13
  • Yes you should be fine by putting a check in the PHTML file containing that button. Write an extra function in the black class that checks for any outstanding invoices by the current customer Commented Mar 4, 2013 at 15:38
1

sales_convert_quote_to_order is triggered at the end of the checkout (Sander might have mistaken it for "convert order to invoice"), but I would not use it.

Not because of technical reasons but for user experience. I wouldn't let the customer go through the whole checkout and tell him at the end "oh sorry, you are not allowed to order". So use the first event in the checkout where you know who the customer is.

This is controller_action_predispatch_checkout_onepage_index, which is triggered when you go to the checkout as customer or after choosing "login" or "register" as guest. This is a normal non-ajax request you can redirect to the cart with an error message if checkout is not allowed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.