Generating Unique ID's

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

Hi, just want to say how pleased I am with the S-mart package. Even a novice like me has been able to get it to work, well almost.

Just one query, in regard to the generation of a unique ID => IP address. If i were to use a different sub routine to generate a random ID for a customer, rather than using their IP as the Unique ID. What changes elsewhere in the script does this constitute. Can I just keep the get_host routine and change the commands in it? or would I have to make changes elsewhere.

Regards, Jackson

-- Jackson (jkha@acacia.itd.uts.edu.au), April 15, 1998

Answers

No problem, that's what I did after I realized that my customers IP-addresses changed during a session (.. various reasons ...).

BUT .... you have to save the id on the client's (customers) pc. I use a cookie to do it (I guess that's the only way?) and it's just a "get cookie" within the "get_host routine" (or whatever name you choose...) in order to create the value for "reffile" and that's it.

Hans-Juergen

-- Hans-Juergen Thiess (hjthiess@christshop.com), April 16, 1998.


Thanx for the speedy response. Due to various reasons, I'd prefer to have a unique ID stored on the server which would be used to track the customer, rather than use a cookie. I liked Tom's solution, however i replace the get_host routine with his solution, and instead of tracking the user, i get the time + random number displayed. What do my URL's to my static pages have to look like, in order to pass the UID of the user.

THanks

-- Jackson (jkha@acacia.itd.uts.edu.au), April 19, 1998.


Mmmhhh, I can't understand how "your" solution works... Imagine a customer starts shopping. Then he leaves your site, calls another Site A, Site B and comes back in order to continue shopping. HOW do you identify that there is a shopping cart for this customer? "My solution" tries to get the cookie. If there's one, ok, look for an existing cart. If not, ok, create a new one (cookie and cart). The original solution was to get the customers ip address which has to be unique during the whole session (but, as I wrote, it is my experience that it's not unique and therefore did not work for me and my customers...).

Hans-Juergen

-- Hans-Juergen Thiess (hjthiess@christshop.com), April 20, 1998.


Hi, Well if i was to implement it my way, i'd have to pass the unique ID with every URL in order to maintain state. Well i think you've got the better solution with the cookie. Just a couple of questions.

1. If they do not accept cookies (ie the customer) what happens from then on?

2. What are the full changes to Smart in order to get cookies to work?

Once again, many thanx for your help Jackson

-- Jackson (jkha@acacia.itd.uts.edu.au), April 21, 1998.


Just a thought to both of you .. you both are using remote_host that in iteslf will change various reasons mainly AOL!!! if you use remote_ADDR the ip will not change. :) just a helpful hint

-- Chris Ward (webmaster@cuztomcomputerz.hypermart.net), June 21, 1999.


I have implemented cookies with my cart. If you are interested to know more, email me at patrickccf@hotmail.com.

--
God bless!

-- Patrick Chan (patrickccf@hotmail.com), March 20, 2000.


Moderation questions? read the FAQ