Control Purchases

greenspun.com : LUSENET : S-Mart Shopping Cart : One Thread

I need to control 1 of the products I am selling, because of distribution rights, that would control the users in the amounts of product they are buying. They can only buy 3 of these items per day, and per person. Does anyone have an idea on this. I thought of using cookies and maybe having them register before they can purchase items. Should this be done in Perl and added to S Mart or should it be done with something else? If anyone has any sugestions it will be much appreciated. Thanks JOE

-- Joe Bifano (Joe@woodease.com), April 22, 1998

Answers

To do this you need to decide on a unique identifier for users, most likely CC #. Then when a order is processed check to see if they have bought today. The easiest way to do this would be to make a 'lock' file of their CC#. So you'd - system('touch /lockfiles/$ccnum') - when a order is sent (make sure to distill CC#s first so they dont get clever w/ dashes/spaces etc - $ccnum =~ s/\N//; - ), and check for it's existance at the start of orders - unless (-e "/lockfiles/$ccnum") { ...} -

-- Barry Robison (brobison@stiusa.com), April 22, 1998.

What if the user has several credit cards? Would I still need to check names and address with the CC#? How woulld that be done.

-- Joe Bifano (Joe@woodease.com), April 22, 1998.

Moderation questions? read the FAQ