Jump to content

Recommended Posts

Hi folks,

 

I am currently developing a web application that is to feature a custom shopping cart (i.e. it will have certain features not included with an 'off the shelf' or GPL app). What the features are is not of any real importance to this plea for help, the only reason I mention it is to prevent any, 'why not use *** cart?' replies.

 

I have been tuning up my coding skills with the assistance of the Prentice Hall book 'Practical PHP and MySQL' by Jono Bacon. In the book is a simple but full shopping cart solution, and to date this is the only cart I have been able to follow the coding process with.

 

The problem I have is that the method used within this cart uses two tables (orders and orderitems) to track items within the basket, giving each order a status number. In this case status 0 is 'still shopping'.

 

For the project I am working on this could cause problems as if visitors are browsing and adding items to a basket that is never confirmed as an order, it will fill up a table with entries that are invalid, and prevent visibility of stock to subsequent visitors.

 

Is there a recognised way of producing a shopping basket, or a method I could use with this cart to prevent this from happening? I have thought about puting a time limit on orders and deleting any that are over 24 hours old and still at status 0, but my live server does not allow cron jobs - and stock items will still appear unavailable for 24 hours when they are actually available.

 

This is a long and rather confusing post, but if anyone can throw me a bone it would prevent me losing what is left of my hair!! ;-)

 

Regards,

 

BigNaz

Link to comment
https://forums.phpfreaks.com/topic/50550-custom-shopping-cart/
Share on other sites

You do not "have" to use cronjobs. Essentially when a user vists a page you can have the job run on that page. It may slow the page viewing down a tad, but not much if that is all you are doing.

 

That way anytime a person refreshes or browses the page they should have the most up-to-date view of what is in the cart.

 

That is how I would handle it without access to cron jobs.

 

 

Link to comment
https://forums.phpfreaks.com/topic/50550-custom-shopping-cart/#findComment-248391
Share on other sites

I never thought of that!

 

However I would still have to work out what the best time allowance should be, to show as many products as available as possible without punishing slow shoppers???  (oh yeah, and work out how to add/subtract times and dates!?!?)

 

Has anybody got an example of how they have written a cart, or are they all very similar?

 

BigNaz

Link to comment
https://forums.phpfreaks.com/topic/50550-custom-shopping-cart/#findComment-248401
Share on other sites

I spent several months creating a shopping basket. This is not an east solution. I am assuming that you have an orders table and a separate table of ALL order-items. There would be a field in the order-items table that links to a unique record in the orders. You can have an order and order-items that never get completed but this should not prevent subsequent customers from adding an order and order-items. But if they can’t be viewed why? I could help with more info. Got the t-shirt on this one.

 

Desmond.

 

 

Link to comment
https://forums.phpfreaks.com/topic/50550-custom-shopping-cart/#findComment-248410
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.