Previous un-completed orders being added to a new order in error.

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

S-Mart V1.9.2

The problem I have is when someone attempts to make an order but decides against it just before they get to the final send stage, in this case a filename is left in temp dir with their IP number that they were using at the time and not deleted (as they didnt complete the order).

However, the next time a user logs in, the contents of that "rogue" order file are added to the present users basket for some reason. I have only tried this as a test so far myself and always log in through the same ISP (but with the last 2 numbers of my IP different), Im wondering if the script is not picking up the last 2 numbers on the filename and hence thinks it is the same user.....what do you think??

I have not tested this yet by logging in through a different ISP.....that may fix the problem...still it is a problem if someone logs in through the same ISP as the user that first sent the "rogue" order.

Regards,

Graham Jupp

-- Graham Jupp (gjupp@bayweb.com.au), December 14, 1997

Answers

The name of a cart-file ($reffile in s-mart.cgi) is unique. It is created in --- sub get_host { $host = $ENV{'REMOTE_HOST'}; $reffile = "$tmpdir$delim$storename-$host"; } --- But in order to avoid any problem, I use a simple check in the "check_file" function. If a file is older than yx seconds ( I use 7200 secondes, 2 hours) I delete the old and create a new one. That's it. If you want, I can mail how it's done.

And you can run a similar script in order to delete old carts, created, but never used for an order every xy days or hours.

Keep your tmp clean.... ;-}

Hans-Juergen, CST, Berlin /Germany

-- Hans-Juergen Thiess (hjthiess@christshop.com), December 15, 1997.


Please tell me the code snippet I need to add in order to do this check_file thing.

-- Fred Smith (pancakepan@usa.net), October 27, 1998.

This will happen if your server doesn't support REMOTE_HOST for performance gains.

I replaced all four mentions of REMOTE_HOST with REMOTE_ADRR in the code to make it work on my server. It's like working with the IP address instead of the URL.

With this fixed, everything worked fine. Thanks Barry.

Good luck,

Yves.

-- Yves Poirier (yves@warholhockney.com), February 13, 1999.


Moderation questions? read the FAQ