You have ordered one item and placed it into your cart. Let's say you
ordered one small black t-shirt. Your cart will have the product_id,
color_id and size_id for the small black t-shirt. The quantity of this item
is, let's say 30. You have one in your cart, so how many are available:
1) 29
2) 30
Now let's say that while I ordered one small black t-shirt, Sven ordered 1
small black t-shirt, Anders ordered one black t-shirt, and Olov ordered one
black t-shirt. If all four of us, at one time, are all ordering the same
item and putting it into our carts, how many should there be available to
us:
1) 26
2) 25
3) 29
4) 30
This is where the contention comes in. The client wants it done "FIFO"
(First In First Out) meaning that whoever gets it first will subtract the
quantity - but I dispute that (coming from somewhat of a Java background)
that since PHP doesn't so single-threading, that means that all four of us
could order t-shirts, but the quantity has to reflect that all four of us
are ordering (multi-threading).
I dunno, help!
Phil 7 1865
"Phil Powell" <so*****@erols.com> wrote in message
news:eF8eb.25672$sp2.7183@lakeread04... You have ordered one item and placed it into your cart. Let's say you ordered one small black t-shirt. Your cart will have the product_id, color_id and size_id for the small black t-shirt. The quantity of this
item is, let's say 30. You have one in your cart, so how many are available:
1) 29 2) 30
Now let's say that while I ordered one small black t-shirt, Sven ordered 1 small black t-shirt, Anders ordered one black t-shirt, and Olov ordered
one black t-shirt. If all four of us, at one time, are all ordering the same item and putting it into our carts, how many should there be available to us:
1) 26 2) 25 3) 29 4) 30
This is where the contention comes in. The client wants it done "FIFO" (First In First Out) meaning that whoever gets it first will subtract the quantity - but I dispute that (coming from somewhat of a Java background) that since PHP doesn't so single-threading, that means that all four of us could order t-shirts, but the quantity has to reflect that all four of us are ordering (multi-threading).
I dunno, help!
Phil
You gonna go round in circles here mate.
What are the chances of multiple people buying the same item in a short
period?
WHat you should do is subtract from the qty when the trtansaction is
complete.
This is why you do not want to follow your current path:
Scenario: I go to your shop and put your entire stock into my basket.
This would stop any legit shopper from being able to put anythin in there
basket.
Just reduce qty when transaction is successful
Hope this helps
RG
On Tue, 30 Sep 2003 01:37:25 -0400, Phil Powell wrote: This is where the contention comes in. The client wants it done "FIFO" (First In First Out) meaning that whoever gets it first will subtract the quantity - but I dispute that (coming from somewhat of a Java background) that since PHP doesn't so single-threading, that means that all four of us could order t-shirts, but the quantity has to reflect that all four of us are ordering (multi-threading).
I dunno, help!
How about the quantity available is the stock quantity (in the product or
stock table) minus the "in basket" quantity (from the basket table). That
way the stock is available and allocated to people. When your baskets
expire (as per your other post) the record that allocates them will be
deleted and hence your stock will then be available for other people.
This means that RG would have to keep doing this every time his basket
expired. If you shorten your expiry time (I would say 24 hours is too
long) it makes it very unfeasible to do what RG suggests (and if someone
writes a script to hit your server every few hours you can block them).
As some advice I would set baskets to expire after 1-2 hours of inactivity
and have every page on your site update the basket time when hit. That
way if the person is still actively looking around your site the basket
expiry will be refreshed and if they leave it won't hang around for long.
You could also give people the option to "Save my basket for later" which
would then put the expiry date 10 years in the future. However, this
opens you back up to RG's attack *.
Most web customers are very quick to jump ship. If they find something
they like they'll buy it. If they actually go to the effort to put it in
their basket they will buy it there and then, unless something makes them
leave the site - when they return virtually no customer would expect their
basket to still be there (would you in a traditional shop?).
And finally, in answer to your earlier post - yes I have "some" (<g>)
experience of writing shopping basket systems.
Cheers,
Andy
* Meaning the attack that RG suggested, not that RG will actually be
attacking your server. :-)
"Andy Jeffries" <ne**@andyjeffries.remove.co.uk> wrote in message
news:pa****************************@andyjeffries.r emove.co.uk... On Tue, 30 Sep 2003 01:37:25 -0400, Phil Powell wrote: This is where the contention comes in. The client wants it done "FIFO" (First In First Out) meaning that whoever gets it first will subtract
the quantity - but I dispute that (coming from somewhat of a Java
background) that since PHP doesn't so single-threading, that means that all four of
us could order t-shirts, but the quantity has to reflect that all four of
us are ordering (multi-threading).
I dunno, help!
How about the quantity available is the stock quantity (in the product or stock table) minus the "in basket" quantity (from the basket table). That way the stock is available and allocated to people. When your baskets expire (as per your other post) the record that allocates them will be deleted and hence your stock will then be available for other people.
This means that RG would have to keep doing this every time his basket expired. If you shorten your expiry time (I would say 24 hours is too long) it makes it very unfeasible to do what RG suggests (and if someone writes a script to hit your server every few hours you can block them).
As some advice I would set baskets to expire after 1-2 hours of inactivity and have every page on your site update the basket time when hit. That way if the person is still actively looking around your site the basket expiry will be refreshed and if they leave it won't hang around for long.
You could also give people the option to "Save my basket for later" which would then put the expiry date 10 years in the future. However, this opens you back up to RG's attack *.
Most web customers are very quick to jump ship. If they find something they like they'll buy it. If they actually go to the effort to put it in their basket they will buy it there and then, unless something makes them leave the site - when they return virtually no customer would expect their basket to still be there (would you in a traditional shop?).
And finally, in answer to your earlier post - yes I have "some" (<g>) experience of writing shopping basket systems.
Cheers,
Andy
* Meaning the attack that RG suggested, not that RG will actually be attacking your server. :-)
You make me sound like a menace, I'm not, honestly ;P
RG
On Tue, 30 Sep 2003 10:25:17 +0100, RG wrote: * Meaning the attack that RG suggested, not that RG will actually be attacking your server. :-)
You make me sound like a menace, I'm not, honestly ;P
That's not what I heard over on alt.l33t.haxor2! :-)
Cheers,
Andy
I go to the shop and put the entire stock into my basket, however, I might
be doing this legitimately, meanwhile, I am going around in the shop buying
other stuff. Another legit shopper goes in and purchases just ONE item.
When I later on go to checkout with all 30 items, I of course will have a
problem; I am purchasing 30 items but 29 are only in stock because someone
else just bought one.
That CAN actually happen, so then I would have to follow my current path. :(
Phil
"RG" <Me@NotTellingYa.com> wrote in message
news:3f***********************@mercury.nildram.net ... "Phil Powell" <so*****@erols.com> wrote in message news:eF8eb.25672$sp2.7183@lakeread04... You have ordered one item and placed it into your cart. Let's say you ordered one small black t-shirt. Your cart will have the product_id, color_id and size_id for the small black t-shirt. The quantity of this item is, let's say 30. You have one in your cart, so how many are available:
1) 29 2) 30
Now let's say that while I ordered one small black t-shirt, Sven ordered
1 small black t-shirt, Anders ordered one black t-shirt, and Olov ordered one black t-shirt. If all four of us, at one time, are all ordering the
same item and putting it into our carts, how many should there be available
to us:
1) 26 2) 25 3) 29 4) 30
This is where the contention comes in. The client wants it done "FIFO" (First In First Out) meaning that whoever gets it first will subtract
the quantity - but I dispute that (coming from somewhat of a Java
background) that since PHP doesn't so single-threading, that means that all four of
us could order t-shirts, but the quantity has to reflect that all four of
us are ordering (multi-threading).
I dunno, help!
Phil
You gonna go round in circles here mate. What are the chances of multiple people buying the same item in a short period? WHat you should do is subtract from the qty when the trtansaction is complete.
This is why you do not want to follow your current path: Scenario: I go to your shop and put your entire stock into my basket. This would stop any legit shopper from being able to put anythin in there basket.
Just reduce qty when transaction is successful Hope this helps RG
"Phil Powell" <so*****@erols.com> wrote in message
news:WHdeb.27289$sp2.2015@lakeread04... I go to the shop and put the entire stock into my basket, however, I might be doing this legitimately, meanwhile, I am going around in the shop
buying other stuff. Another legit shopper goes in and purchases just ONE item. When I later on go to checkout with all 30 items, I of course will have a problem; I am purchasing 30 items but 29 are only in stock because someone else just bought one.
That CAN actually happen, so then I would have to follow my current path.
:( Phil
What you need to do then is check that the qty ordered tallies up with the
users basket at CHECKOUT.
Tell the user that they can only have 29
RG
"RG" <Me@NotTellingYa.com> wrote in message
news:3f***********************@mercury.nildram.net ... "Phil Powell" <so*****@erols.com> wrote in message news:WHdeb.27289$sp2.2015@lakeread04... I go to the shop and put the entire stock into my basket, however, I
might be doing this legitimately, meanwhile, I am going around in the shop buying other stuff. Another legit shopper goes in and purchases just ONE item. When I later on go to checkout with all 30 items, I of course will have
a problem; I am purchasing 30 items but 29 are only in stock because
someone else just bought one.
That CAN actually happen, so then I would have to follow my current
path. :( Phil
Ignore previous post.
At checkout, check that there is enough stock to cover the order. If there
isn't tell the user.
RG This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: WindAndWaves |
last post by:
Hi Folks
I am working with a session and a 'cart' (note that I do not really know what I am doing though).
I was wondering if there is some easy way (function) to work out how many items I have...
|
by: Shell |
last post by:
What is the best way to store the items and quantities that customers have chosen across a session without using cookies
The customer does not need to login to do online shopping and users will be...
|
by: Don Grover |
last post by:
USing ASP, MSSql on W2k3
I am worried of accumulated old cart product selections from expired browser
windows or other unforseen events.
I am holding selected productID's & quantities & userID...
|
by: help |
last post by:
please i need help. I am doing a wed site online shopping system for my
school project, which requires some asp coding using vb script. I am new
to asp and have no knowledge whatsoever on how to...
|
by: MattB |
last post by:
Hi. I have an ecommerce application that has a shopping cart as many do.
I've created a way to automatically add other items to the cart if
certain items are added, like "Get a fee t-shirt if you...
|
by: Rob Meade |
last post by:
Hi all,
Ok - so I've got the array thing going on, and the session thing going on,
and up until now its all been ok.
I've got my view basket page which is displaying 3 rows (as an example) - I...
|
by: gregerly |
last post by:
Hello,
I once again turn to this community of genius' for some help with a problem. I've got a shopping cart (which is working well so far) that I will be implementing all kinds of AJAX...
|
by: vozzek |
last post by:
Hi everyone,
For the past four months I've been working on a retail website. Built it from scratch, including the shopping cart, which uses a mySQL database indexed by session id. All the pages...
|
by: chrism |
last post by:
Hello,
I'm hoping someone can help me out here.
I'm building a shopping cart using sessions, populating with $_POST
values from a form. Code abbreviated below:
check if form is submitted. if...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |