graham23s Posted February 4, 2008 Share Posted February 4, 2008 Hi Guys, i am about to start my first e-commerce type site the structure is up just testing a few things out, im a bit unsure about the procedute to add to cart etc i'm thinking each product has an id so if you want to add to basket it would be something like: <a href="product.php?id=1"><img src="images/addtobasket.jpg"></a> THEN insert the product id into the database along with the users id would that be a step in the right direction? cheers guys Graham Quote Link to comment https://forums.phpfreaks.com/topic/89431-e-commerce-site-advice/ Share on other sites More sharing options...
mikefrederick Posted February 4, 2008 Share Posted February 4, 2008 give each product an id and store it in the database before the user goes to check out. when a user adds something to the cart, set $_SESSION['productid']. gets a little more complicated with multiple items, but not too hard, look for a tutorial on sessions. Quote Link to comment https://forums.phpfreaks.com/topic/89431-e-commerce-site-advice/#findComment-457961 Share on other sites More sharing options...
revraz Posted February 4, 2008 Share Posted February 4, 2008 This also depends if you want the items to remain in the cart if they close the browswer and return later. Quote Link to comment https://forums.phpfreaks.com/topic/89431-e-commerce-site-advice/#findComment-457963 Share on other sites More sharing options...
graham23s Posted February 4, 2008 Author Share Posted February 4, 2008 Cheers guys, what would be the best way? store the items so when the user returns to the site the are still in the cart do you think? cheers Graham Quote Link to comment https://forums.phpfreaks.com/topic/89431-e-commerce-site-advice/#findComment-457966 Share on other sites More sharing options...
revraz Posted February 4, 2008 Share Posted February 4, 2008 I think that really depends on you. I think Amazon stores them, which I don't like, because for some of their stuff you have to add to cart to see the price. And then later when I come back to actually buy something, that other item is still in my basket. If you don't pay attention, you can buy more than what you really want. Quote Link to comment https://forums.phpfreaks.com/topic/89431-e-commerce-site-advice/#findComment-457969 Share on other sites More sharing options...
budimir Posted February 4, 2008 Share Posted February 4, 2008 Cheers guys, what would be the best way? store the items so when the user returns to the site the are still in the cart do you think? cheers Graham Maybe that would be the best way. But it depends on what are your needs. I have developed an e-commerce where I'm leaving everything in the basket until checkout, so user has some time to think through if that is the complete order and when he want's to send it. Quote Link to comment https://forums.phpfreaks.com/topic/89431-e-commerce-site-advice/#findComment-457970 Share on other sites More sharing options...
mikefrederick Posted February 4, 2008 Share Posted February 4, 2008 that wouldn't be typical, but you could do that with cookies. sessions save for 24 minutes i think, and usually people don't leave a site and come back 25 minutes later expecting the stuff that they added to a cart to still be there. or else you could use your database to store stuff from the cart but i personally don't think that is the way to go. Quote Link to comment https://forums.phpfreaks.com/topic/89431-e-commerce-site-advice/#findComment-457971 Share on other sites More sharing options...
mikefrederick Posted February 4, 2008 Share Posted February 4, 2008 It's not a bad idea to store everything until the user leaves and then delete it, but for all the users who never come back to the site you end up having large databases with irrelevant information. Quote Link to comment https://forums.phpfreaks.com/topic/89431-e-commerce-site-advice/#findComment-457973 Share on other sites More sharing options...
budimir Posted February 4, 2008 Share Posted February 4, 2008 Yup, that's right! But I'm deleting all the records from database where I had no activites for Last 7 days. That's how I'm keeping the database clean. Also a lot of my users are putting things in the basket through the week, so this proved to be the perfect way. At least in my case. Again, it depeneds on the purpose! Quote Link to comment https://forums.phpfreaks.com/topic/89431-e-commerce-site-advice/#findComment-457981 Share on other sites More sharing options...
graham23s Posted February 4, 2008 Author Share Posted February 4, 2008 thanks guys im getting there lol Graham Quote Link to comment https://forums.phpfreaks.com/topic/89431-e-commerce-site-advice/#findComment-458019 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.