Jump to content

Vue question. Templates.

Joveice

Hello,

 

So I where wondering how you would do this thing:

 

You click a button to add a item to your cart, your cart is currently empty, how do I create the item in the cart, is there some templates I can create where I fill in the data and woosh it created my html block?

Back-end developer, electronics "hacker"

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, Joveice said:

Hello,

 

So I where wondering how you would do this thing:

 

You click a button to add a item to your cart, your cart is currently empty, how do I create the item in the cart, is there some templates I can create where I fill in the data and woosh it created my html block?

Im not sure how much code experience you have, but getting stuff in a cart can be done in a few different ways, however a simple google search will yeild plenty of code examplesand javascript libraries to do what you want

 

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, factorialandha said:

Im not sure how much code experience you have, but getting stuff in a cart can be done in a few different ways, however a simple google search will yeild plenty of code examplesand javascript libraries to do what you want

 

I'm a backend dev and I'm asking for specifically Vue.

Back-end developer, electronics "hacker"

Link to comment
Share on other sites

Link to post
Share on other sites

35 minutes ago, Joveice said:

I'm a backend dev and I'm asking for specifically Vue.

Thats fine buy my answer still stands. A google search will most likely yield faster and more in depth results. Someone obviously may have experience, but googling "vue shopping cart example" yields quite a few helpful results i would say. 

Link to comment
Share on other sites

Link to post
Share on other sites

I personally would do something as the following.

 

Requirements (for me)

  • Shopping carts should be saved to account (Database)
  • Shopping carts should be saved to sessions for guests

On loading the page vue calls a get link to get the Shopping cart contents, display this however you like. I like to count the Array and set that number to a variable and show it like "$var items in your cart".

 

When clicking "Add to cart" the submit calls a vue function that connects to a laravel POST link. That method will see if the user if auth or not and then add the item to the account cart or session cart.

 

After that has been done, simply call the other function to get the contents again for the updated cart

Quote or mention me if not feel ignored 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×