This article was sponsored by Microsoft. Thank you for supporting the sponsors who make SitePoint possible.
Welcome back to our series of articles using Microsoft’s modern IDE: Visual Studio Community 2015 to quickly design and build an attractive, functional site for a client. If you missed the previous instalments, check them out below:
- Visual Studio Community 2015: Setting Up a Site
- Visual Studio Community 2015: Adding Email and Contact Pages
In this article, we’re going to add an ecommerce solution to our site. The solution will be simple, consisting of a single page to handle the shopping cart, payment information and success or fail messages for the user.
We’ll submit our payment information to a mock ASP.NET Web API app. The Web API app will act like a credit card processor. It will consume JSON via POST. It will then send back an HTTP status code indicating success or failure. Based on this feedback, we can determine what to do. But we’ll keep it simple by showing the user a message based on the received status code.
While the solution is simple, it will demonstrate core components of any ecommerce solution. These include:
- Listing of products to buy
- Ability to add or remove products
- Total price of products and purchase
- Form to capture payment information
- Connection to some third party credit card processor
- Ability to display result from credit card processor
- Upon success, deliver purchased product
The checkout page will be styled in Bootstrap and use some AngularJS to help with a little dynamic display of the product totals. The final result will look like the following:
Creating the Checkout Page
To create the checkout page, we’ll need to add a view and a few model classes.
Open the Views folder then Home. Right click the Home folder and select to add a new item. Select MVC View Page. Name the file Checkout.cshtml.
We’re going to once again style our page using Bootstrap, which we’ve already added a reference for. The following code will make up our checkout page:
[code language="html"]Continue reading %Visual Studio Community 2015: Adding Ecommerce Functionality%
by Brett Romero via SitePoint
No comments:
Post a Comment