Developer forum

Forum » Ecommerce - Standard features » is it possible to get current amount of products in cart - asyncronous, without having an extra page etc. for the async call?

is it possible to get current amount of products in cart - asyncronous, without having an extra page etc. for the async call?

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

Is it possible to get the current amount of products in cart (update it asyncronous) withour having a seperate page for async call etc.?

/Hans


Replies

 
Nicolai Pedersen
Reply

If you are in a layout template with a pageviewmodel you can go with 

@Model.Cart.ProductsCount
@Model.Cart.OrderlinesCount
@Model.Cart.TotalProductsCount

In other templates you can use @Dynamicweb.Ecommerce.Common.Context.Cart.OrderLines.Count

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

thanks Nicolai

But can i get the value without reloading the page, or loading another page asyncronously?

/Hans

 
Nicolai Pedersen
Reply

You can use the webapi:

~/dwapi/ecommerce/carts/{cartSecret}

where the cartSecret is Dynamicweb.Ecommerce.Common.Context.Cart.Secret

That will give you the cart as json.

BR Nicolai

 

You must be logged in to post in the forum