Developer forum

Forum » Development » Acquiring information about how a product was added to cart.

Acquiring information about how a product was added to cart.

Ronni Hansen
Ronni Hansen
Reply

Hi guys!

I was wondering if it is possible to get information on, how / where a product was added to the cart, since i need that information when the customer has completed an order.

Eg. So, what i mean is, the customer has the possibility to add the same product from either a regular products page, or a discounted products page, how do i get information about where the product was added from? 

Hope it makes sense, and thanks in advance :)

 

 


Replies

 
Nicolai Pedersen
Reply

Hi Ronni

In the database you have the table "EcomOrderLines" which holds all lines of orders and carts ("EcomOrders" table).

The Orderlines table has a field [OrderLineReference] that holds the URL to the page the user was on when adding the product to the cart. You might be able to use that information. See dump for an example.

BR Nicolai

Capture.PNG
 
Nicolai Pedersen
Reply
This post has been marked as an answer

The field can be empty - i.e. if you add products to cart using ajax, that field will be empty.

You can however with your cartcmd=add command, add the parameter ProductURL - &ProductURL=[yourreference] and then that will be saved to the OrderLineReference field.

So when adding the product to cart using ajax, you can pass on the information on the current page using that parameter.

BR Nicolai

Votes for this answer: 1
 
Ronni Hansen
Ronni Hansen
Reply

Hi Nicolai

Thanks for the quick response, awesome! :-)

We are indeed adding to the cart using AJAX, but i believe we have a custom MVC Controller handling this. However, i am pretty sure we can solve the problem by adding the URL to the OrderLine in there, as you suggest, which I believe will work!

Thanks, and have a great weekend! :-)

Best Regards

Ronni

 

You must be logged in to post in the forum