O'Reilly logo

PHP 5 e-commerce Development by Michael Peacock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Cleaning the basket

Shopping baskets need to be emptied, but this should be done only when:

  • The customer wants to empty their basket
  • The customer confirms an order
  • The basket contents are old and are not tied to a customer account

Expired contents

We could create a function to empty a user's basket, upon their request. However, this can't be used for the instance of expired contents, as it isn't tied to a specific user; we need to purge any data in the basket table that has expired. We need to do this, because after a certain period of time, the customer won't be able to see the products in their basket anyway, as they may have a new IP address from their Internet Service Provider, or they may have initiated a new session, and so their session ID ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required