Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

customizable shopping cart items - how to construct?

Status
Not open for further replies.

sysadmin42

Technical User
May 6, 2005
138
hello. I am about to make a shopping cart. What I want to do is have each item have the power to do different things if they're in the cart. i.e. There's a website subscription item. After confirmed payment, it should insert the new subscription into the database. Or, there's a renewal item, it should use a different script to update the account in the db.

So far, all I can think of is to make a field in the db contain a script filename for each item, have a main script that loops through and calls each script until the cart is empty. Is this a good way?

What are your thoughts on how to go about the architecture of this cart?
 
that's kinda what I'm thinking. What steps would be a good way to parse the cart?
 
Store in the cart a machine-meaningful token that describes the type of transaction the record represents. (This information would not be displayed to the user, but rather only used by the script.) Your action script would run through the items in the cart, reacting to the transaction-type token and using associated information in the record as the details of what to do.

The token could be numbers (1 means subscribe, 2 means renew, etc) or some kind of string. I'd probably go with numbers.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top