Hi all,
I have webshop, where user can place order without login into system. But when he is a registered user, I want him to login into system before proceeding with placing order (preferably by showing small login screen as a popup window..)
So far...
I have created partial view for login..
When finding out that it is an existing user, I redirect him to login.. which is shown as a pop up.. on the same page. (Note that I am using same page- place order page, only login partial form is rendered as a pop up using some css)
When user clicks on login post action is called up, which validates user credentials and if validation fails,renders same form again.
Now I want when crendentials are correct, I want to submit that form. But the problem is, I dont get the old model of Place order which is overridden by model of login. When I try submitting the form after user successfully logs in, empty form is being submitted, causing validation errors to be thrown up.
Is mine approach correct? Is there any alternate approach to solve this issue?
If you are having problems with different forms on the same page, maybe it would be better to use a separate login page, that just redirects your users back to the order page, after they log in.
You could also try to do the user login asynchronously, via web services and javascript.
I managed to get through issue. I had thought about using 2 different login pages, but still I had some problems with managing the information which user has entered in the place order form as it would have lost when user is switched to login view. Tempdata can store the data between controller to controller calls, so in this case I would have to go with Sessions.
So to manage all this things, I used the single form with 2 submit buttons (buy and login buttons). Login controls container were hidden in normal case, but when needed they were shown using css. As now all the data is enclosed in single form, it would post all the data including place order and login data. So it was easier to manage.
In the controller side, I had to manage code as per which button caused the action to be called up. But finally approach working fine. I am not sure if it is a best approach, but hope it would help someone.
How to ask user to login before placing order.
Hi all, I have webshop, where user can place order without login into system. But when he is a registered user, I want him to login into system before proceeding with placing order (preferably by showing small login screen as a popup window..)
So far...
Is mine approach correct? Is there any alternate approach to solve this issue?
Hi Girish,
If you are having problems with different forms on the same page, maybe it would be better to use a separate login page, that just redirects your users back to the order page, after they log in.
You could also try to do the user login asynchronously, via web services and javascript.
Hope that helps,
Lars
Hi Lars,
Thanks for the reply.
I managed to get through issue. I had thought about using 2 different login pages, but still I had some problems with managing the information which user has entered in the place order form as it would have lost when user is switched to login view. Tempdata can store the data between controller to controller calls, so in this case I would have to go with Sessions.
So to manage all this things, I used the single form with 2 submit buttons (buy and login buttons). Login controls container were hidden in normal case, but when needed they were shown using css. As now all the data is enclosed in single form, it would post all the data including place order and login data.
So it was easier to manage.
In the controller side, I had to manage code as per which button caused the action to be called up. But finally approach working fine.
I am not sure if it is a best approach, but hope it would help someone.
Regards
Girish.
is working on a reply...