DEV Community

Discussion on: Introduction | Building a Shopping Cart with Symfony

Collapse
 
earlfaneuf profile image
Earl Faneuf

I had a hard time unsuccessfully attempting to figure out how to add a link on a product page to just ajax to the backend and add that product to the cart yet stay on the product page. Not the ajax part, that was easy. I mean how to pull apart the code to add to cart in the background (in that one case, bypassing the detail page.

Second, more important. I have added the code to send the total to paypal. Works like a charm. But now I am thinking how to I see what this userid has in the recorded shopping cart. There seems to be no indicator in the Order and OrderItem controllers to save the user, so as an admin, I can look at the products bought after the fact. I see that the code saves the order info into the database, but there is nothing in there to save who did the order LOL

Would be nice to have a tiny bit of assistance :-)

Collapse
 
earlfaneuf profile image
Earl Faneuf

The issue, with a bit of thinking, came to me and that now works like a charm too. The author is wonderful to supply this basic shopping cart.

Latest issue was trying to figure out how to reconnect the user back to the cart when they logout and back in. The data is still in the tables (thank God) but I am not sure how to reconnect it back to the logged in user. I am thinking you must be using a session variable set and I need to figure out how you are doing this so I can then reconnect the user on login.

That might be my last issue with the cart. I am extending it with my extra needs easily now that I figured out how to add the userid to the existing cart. I needed that so I can work on the payment side with paypal. Need to mark the items sold. So need to know who bought them. Of course the WHO is also for a real world shopping cart, rather critical since I need to know where to ship what they bought!! LOL