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 1948
"Phil Powell" <so*****@erols. com> wrote in message
news:eF8eb.2567 2$sp2.7183@lake read04... 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**@andyjeffr ies.remove.co.u k> wrote in message
news:pa******** *************** *****@andyjeffr ies.remove.co.u k... 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@NotTellingY a.com> wrote in message
news:3f******** *************** @mercury.nildra m.net... "Phil Powell" <so*****@erols. com> wrote in message news:eF8eb.2567 2$sp2.7183@lake read04... 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.2728 9$sp2.2015@lake read04... 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@NotTellingY a.com> wrote in message
news:3f******** *************** @mercury.nildra m.net... "Phil Powell" <so*****@erols. com> wrote in message news:WHdeb.2728 9$sp2.2015@lake read04... 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 in my 'basket' / 'cart', because then I could
call this function from anywhere to show the user just how many items are on order
TIA
- Newbie Nicolaas
|
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 prompted to enter shipping information when they proceed to checkout
Any input will be very much appreciated! Thanks!
|
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 & sessionID in a
sql table from a shopping cart.
I allow user to clear their cart from a button and also automatically clear
their cart on user logon.
Also on checkout I clear their cart.
|
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 code what i need.
Please please please could someone please provide me with help, or
coding on how to add item details into a basket record, once the user
clicks the add to basket link.
*** Sent via Developersdex http://www.developersdex.com...
|
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 buy this" kind
of stuff.
The DataTable that holds the cart items has a column for "ID" (primary
key) and parentID that references another item's ID for items added with
another, so they can be lumped together. This lets me delete both the
main...
| |
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
have an input box on each row enabling the user to update the quantity.
If the enter a zero I need to remove the item from the array....
|
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 functionality on. However, first I want to make sure it works if javascript is not available. So when your on the shopping cart page, you can update the quantities then click Update Cart, which would update the totals, and refresh the shopping cart page,...
|
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 in the site are php. Everything was running smoothly, until I installed the credit card payment code.
I opened a merchant account with Linkpoint and they supplied the gateway. I didn't like the Firefox "your data is unencrypted" warning messages...
|
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 so, set up variables:
$name = $_POST;
$ribbon = $_POST;
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |