I have created a stock control system to allow admin staff to keep track of incoming and outgoing stock.
However I have now been told that they want to be able to process several items to one department at a time.
I would like to know what the best way of doing this is, I was thinking about something along the lines of a Shopping Basket but have never dealt wth anything like this before.
A demonstration version of the system can be found at http://www.sm2.atchosting.co.uk/demo/
Feel free to have a look at that to see how it works at the moment.
I will update the thread later with a link to the Source Code.
Do you mean on the “Process Order” screen - to be able to keep picking from a list and then send 2 or more items into the order?
Sorry for the delay with providing the source code, unfortunately I was away over the weekend and did not have access to the internet.
If anyone has any problems accessing the Source Code please let me know.
There’s a few ways of doing the same thing.
I did similar by having a text area on a page, and each time they want to pick an item I popped up a new window and used JS parent.opener to send back the code number and a text description into the text area.
I liked using that idea because, a) if ppl know the id number of the item they can just tap it in themselves, b) they can easily delete an item.
Its just a matter of analysing the numbers in the text area when the form is submitted, and maybe giving them visual confirmation of what they just did, or asking them to confirm before really committing.
right ok thank you for that I shall explore those routes, is there any possibility of seeing what you did as an example?
The whole thing is handled inside a framework (CodeIgniter) so is splintered around the place. The model is really basic, probably much like yours.
Which part do need a hand with? Is it just the JS shifting around of variables from popup windows?
Sorry if I am making things difficult for you but I am quite new to using PHP and am still learning.
Ok, if you dont use/understand JS, this would be a bridge too far for you.
Try this instead:
How about you make an “optional page” ( “Ordering more than one product? Go here” ) that has all your products and an input box for how many can be ordered of each type.
From your screen:
<option value="270198">Bic Pen BLUE</option>
<option value="270185">Bic Pens BLACK</option>
<option value="335614">Bic Pens RED</option>
<option value="284966">Bin Blue </option>
On the user page you could echo a list like this:
<form .... method = post>
<input type=text name="product" value="">Bic Pen BLUE<br />
<input type=text name="product" value="">Bn BLUE<br />
Lets say they enter 150 on that input box… so then on your postback form you’d do something like:
echo $_POST['product'] // and you'd see "150"
Then you could see how to deal with anything where each $_POST[‘product’] array contains a value, and save it.
(hint L use print_r( $_POST[‘product’] ); to see what is being sent )
What you’d likely want to do though is then set a min and max order number for each item. I mean do you want to process an order for 1 pen or 100 waste paper baskets, y’know what I mean … just in case of user error.
Even if you don’t use the idea as is, hacking it up should get you going …
thank you for that, I shall have a go and see what I come up with, someone else has recommended I use sessions and create something a bit like a shopping basket, what is your view on this?
I dion’t really see how a shopping basket would do.
However, the use of sessions is a good idea - it’s up to you how to implement them though.
If your app is on an intranet only, then yes go for sessions.
If your understanding of security is shaky, and you app is available to anyone over the web, then OK, use sessions but read a lot on security and sessions.
I’d say test/mock up both methods, especially when you are thinking of your worst user y’know the technophobe who forgot their glasses today and wants to order just 3 pens and 100 waste paper baskets.
How do you confirm what is being done, how do you abandon the basket, how do you take things out …
That kind of real world requirement.
(can someone really order 100 waste paper baskets when you probably only carry a stock of what, 3?)
If youv’e never passed around multi-dimensional arrays from form to page, then you may find that tricky enough for now, and I’d advise you try that method first - while you’re at it, if you aren’t familiar with the ~80 php array based functions, well this’ll sure get you started.