Day 28 – Gitz’s Grocery Store

Go to project: Gitz’s Grocery Store

Welcome to my grocery store!

Here you can shop to your heart’s desire! Well… not really, I only have 8 products, and they are all virtual.

As I am hoping to work with webshops in the future, the BF thought it would be a good idea to make a shopping cart function myself. Some of the products have discounts. Some discounts are 50% discounts and others are 2 for 1. Happy shopping!

Screen Shot 2016-07-18 at 17.08.46Screen Shot 2016-07-18 at 17.09.03

I coded, I learned:

  • The most used function I made was the updateShoppingCart function. It’s being called every time something changes, for example that the user is adding a product to the cart.
  • I made an array with the products, that can be “purchased”. Then we made another array which started out empty and then as the user added products, they were pushed in to the second array. This way we could count how many times one product existed in the second array and use that number to make the count feature in the shopping cart.
  • In the first array, we also added some different discount types and hooked them up.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s