Creating a Shopping cart application

1
I would like to create a shopping cart application, I have tried it but could not add things to my cart or create a order, I would like to know the steps of creating it if possible with the images or you could share me a sample app, the requirements are simple user should view the product and add to his cart and in the cart he can place the order
asked
5 answers
14

Hey Hariharan,

 

You need to work on the on change microflow and microflow through which you are moving to cart.

Please check out on change of + icon and Checkout logic of mine!!!

Here you go Domain model:

 

Customer – Account – You can directly skip ifyou directly using account instead customer entity.

ShoppingCart – Products added should be associated to this object. In other words its your order object also.

ProductMaster – A list of all the products of your application – Only admin can add/edit/delete.

Productimages – This will hold the image of the productMaster

Product – The selected products by the customer.

 

You will have a Data view – which will return the account holder. In my case the Customer object.

DS_GetCustomer – It will fetch the Customer entity – associated to the account entity using the current logged in user name.

{Name} – This is the design I made to represent the Customer name.

Add list view – Which will retrieve all the ProductMaster objects and displays on the screen.

OnChange microflow on + icon: Adding to Cart:

This + button checks if there is any ShoppingCart object exist

If Yes -- Create Product and associated the product to Product master and ShoppingCart object.

If No -- Create ShoppingCart object, associate to Customer. Create Product and associated the product to Product master and ShoppingCart object.

Note: While creating the Product object copy the ProductMaster details into the Product.

CheckOut: This button will take you to net page where you check out.

It will commit the object and opens the checkout page.

 

Above is the Checkout Logic:

If No Products added -- and trying to navigate – Showing message

If Products added -- and trying to navigate – Commit the shoppingCart and Products objects.

Later open the page Checkout page

I kept the same page – except for the products object retrieval instead on Product master objects.

 

Hope you find this helpful!!!

answered
1

https://academy.mendix.com/link/modules/19/lectures/280/1.5-Open-the-Application-Model in this learning path you can find also an example and kinda compare to yours. i have tried earlier and it works.

Win at working with data -

Introduction to Working with Data -

Open the Application Model

Resources available for this lecture

answered
1

My suggestion would be to have a look at the BaseApplication. This will get you the entities for Product, SalesOrder and Customer. In due time we will add a shoppingcart to this base-application as well. The cart will be a separate entity, which you will need to transform to a sales-order upon completion of the order by the customer.

 

Since the shopping cart is a separate functionality, the most SOLID approach is to create a separate module for it. In that module the domainmodel will look like this:

 

Also, with this non-persistant approach, and linking the shoppingcart to the user’s session, most of the shopping cart handling is done client-side, making it more light-weight for your server.

answered
0

Below you can see a simple example of the domain model for such a solution

The customer should be able to see products in a catalog (think about anonymous users vs. user with account).

If the customer wants to add the product to a cart, 1st check if there is an existing open shopping cart (use status enum to eg distinguish between new, open, ordered, delivered, canceled). If not create one. Check if there is an orderline related to the cart and to the selected product. If not, create one with the correct associations. If it exists, you need to decide if you want to update the amount (+1) or simply go to the line item. When updating the amount, recalculate the orderline price and the total price for the cart.

Hope this will help you a couple of steps further.

answered
0

HI,

 

I did a same application like this. I’m attaching the domain model picture and microflow picture for creating cart.

 

 

answered