News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Storing Cart data in a table

Started by DeepaVaith, February 10, 2012, 17:23:33 PM

Previous topic - Next topic

DeepaVaith

Can anyone tell me how to store the cart data in a table in VM 2?  I want the user to be able to see what they had put in the cart before they logged off.
I would also like the admin to be able to send out an email to the user if there are items in the cart that have not been checked out. 

Also, has anyone implemented  a multi vendor, multi cart type of solution?  any pointers to the same would be great!

Thanks,
Deepa

muasif80

Quote from: DeepaVaith on February 10, 2012, 17:23:33 PM
Can anyone tell me how to store the cart data in a table in VM 2?  I want the user to be able to see what they had put in the cart before they logged off.
I would also like the admin to be able to send out an email to the user if there are items in the cart that have not been checked out. 

Also, has anyone implemented  a multi vendor, multi cart type of solution?  any pointers to the same would be great!

Thanks,
Deepa

I believe this is not done by default and therefore the question has been raised.

There can be a few options

1. I think wherever a method call is made to store the cart data into the session, you need to either add a method call to save the current state of the cart along with the user id in a db table.
2. Or after updating the cart object in the session, take that cart object from the session and save it as it is along with the user id to a table
3. Upon the user's login again load check for any session data for this user in the database and load that back in the session as it is.
4. Remember to clear the session data from the db when the session data is cleared upon successful checkout.

I think when a user is logging out the logout event could be captured and at that time see if there is cart data in the session, if yes then show a popup with the state of the cart to the user.

For the admin to be able to see the carts for individual users and be able to send them emails, you will need to write a custom component standalone or you will need to modify the virtuemart code. The standalone component might be better option.

Regards
1. Expertise: PHP and JAVA Expert (SCJP)
2. DEV Tools: Eclipse PDT - WAMP - XDebug
3. www.mayotitech.com/products.php

DeepaVaith

wow - sounds complex.  Thanks a lot for the  idea.  I'm quite new to VM, could you tell me the complexity level of this effort?
I'm familiar with php and programming though.

bitstomper

Muasif80:

You seem to know what you are talking about.

I want something similar though do not need to store the data in a table.
I am trying to figure out how VM 2 stores the data from the addtocart form.
I need to change prices as I have a custom calculation where a client fills in width and height and price is calculated.
So I need to dump these values in the session (?) or change the pricing.

I have managed to do this with VM1 but it was very difficult.
Now, after upgrading I need to do this again in VM2.

It would be a great help if you could explain to me what the route is that VM takes.
So, from the default_addtocart how does this data end up in the session and can I make a change that will stick.
So VM does not constantly takes the product_price but sticks to the value I provided.

I have been messing with this for several days now and still can not get my head around it.
Any help to point me in the right direction would be very, very appreciated.



bitstomper

#4