I am working for implementing a spring-boot based shopping application, where a feature exist called ‘add to cart’ for product which works when users is only logged in. Meaning spring-boot back-end creates session when user logged in to make mapping to cart object.
I am trying to implementing a features like real world shopping application like amazon, where product can be added into ‘cart’ even user is not logged in. Then after user log-in user session can be managed / merged with previous non-logged user.
Can some please give me any typical design pattern idea in details or book reference or tutorial link where I can get details idea about such kind of implementation.
If user is anonymous, I would save cart on server and save cart ID in browser using a persistent cookie. When user logs in, server can retrieve the anonymous cart from its ID. Alternatively, you could store full cart in cookie.
Related
I am new to Laravel and for a starter learning project, I was developing an E-commerce website using Laravel. I want to develop the cart functionalities but got stuck at a point.If a logged in user clicks "Add to Cart" button for an item, it gets stored in the database and that item in cart gets related to the particular user ID and that's how I know what user have what items in cart. But how can I handle users who don't have an account? Not all users always create accounts when they use an Ecommerce platform. What relation can I use for guest users ?
P.s. I know there are several cart functionalities available on Github for handling cart but I wanted to implement that myself
Please help me with this
I have to integrate facebook login in an e-commerce website made in X-cart 4.7.6. There are no add-ons available for this version and I am not able to bypass login validation, I wanted to log user in just by using fb id. Until now , i have been successful in fetching permissions and data from Facebook when user clicks on fb-login button and check that if the particular user is an existing user or a new user. Based on this the data is entered into existing database.
Now I have been trying to set ($allow_login) true and bypass all visible login validation from all files i guess.But yet it doesn't work. Suggest me some ideas or ways to make it work.
You say that there is no ready-made module, but actually it exists: it is included in X-Cart GoldPlus by default, but if you use a "younger" package called X-Cart Gold, you may purchase this addon separately for $99: https://market.x-cart.com/addons/social-login.html
Now I'm trying to develop Internet shop on Spring and now trying to create cart. What is the best way to store data like count, sum and list of products in the cart? I used HttpSession and Cookies, but Cookies can't store lists...
The cart is a pojo, those fields are properties of your object.
You can persist it in the database, or in session.
To do it in session, example:
Spring store object in session
https://www.youtube.com/watch?v=dcAYJSh_8ig
There is no best way, just the way you should do it given the context you have.
But persisting it in database allows you to have a cart history, you can remember the user cart after the session is gone, and you scale more easily because you can share your state between several server instances.
To do it with entities:
https://www.youtube.com/watch?v=DctbMWGZ42o
Just a proposition:
You can associate a anonymous account to the user session, and this anon account owns a cart. If the user create a real account, you transform the anon account to real account and keep the cart to order. If the user never go back, you should have a rule to clean the anon data every once in a while. If you can know the user email while it is an anon user (example: popup to register to newsletter), you can call him back to remember him that he has a waiting cart on the website.
I'm currently implementing this library ember-simple-auth to manage authentication in the emberjs application (shopping cart) that I am currently building.
The difficulty that I encounter is that the library manages authentication rules after logging in very well but not before logging in.
So here is the scenario:
The application must talk to the backend server to retrieve a session token for every user. This is necessary so that the user can save their items temporarily in the server side using session data. Something that you would expect for a shopping cart.
Then when the user is ready to move forward the application will then display the login screen and the user can authenticate themselves to checkout their items.
However, I can't seems to figure out yet how to do this using simple-auth. If I create a custom authenticator that just fetches token id from the server, it will mark the session as authenticated and will not ask for login on the authenticatedRoute.
In general what I'm trying to do are:
Customer visit the website
The application fetches session token from the server
Customer clicks around and saves item into the shopping cart. The data is synced with the server using the session token
Customer ready to checkout and navigates to checkout page
The application intercepts the route and redirect the customer to login route, where the customer can login and resume checkout.
I hope the above information is clear enough. Any hints and help will be much appreciated. Thanks.
I would probably only use Ember Simple Auth from the point on where the user actually logs in. Before that instead of using a session token to identify the basket, I'd probably explicitly create a basket on the server side (POST /basket) and then add to that via a REST interface (PUT /baskets/:id/items or so). That way you're not sharing state between the client and the server and have a clear interface. You also don't need to "abuse" Ember Simple Auth which probably only leads to other problems later on. When the user logs in then, you simply assign the previously created basket to that user and go on.
If a visitor adds items to their cart on a Magento site, could they follow a URL (maybe containing a session id?) from another machine an see the contents of their cart? Or is the cart stored in a cookie on the client side and therefore not available from another machine?
Thank You.
See the new persistent cart feature in 1.6 CE:
Magento stores a long-term cookie in each browser (per device) once the customer logs in or creates an account using that browser. The long term cookie allows us to re-create some of the session the user had when they were logged in previously. For example, a users shopping cart is re-created upon subsequent visits to the site. It does not allow the customer or another user to access sensitive information. The user will not be able to complete the checkout process or access account information unless they are officially logged in. Persistent shopping cart is completely configurable by merchants, provides an additional way for the merchant to strengthen customer satisfaction and loyalty and helps increase conversion rates.