Pergunta

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?

Foi útil?

Solução

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?

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top