PHP / MySQL POS Solution Incorporating Barcode Scanner into Website Form Input (Australian Solution)

Looking for advice from php/MySQL devs who have experience in integrating barcode scanners into php product ordering systems.

The scanners are intended to be used by website staff for point of sale on location. The user navigates to the new order page, scans the item and the order form populates all fields with the item's details.

This psudo POS system is for an Australian business. So any hardware, has to be available in AU. The entire system must be php/mysql based, so solutions such as myob will be ignored.

Thanks in advance for taking any time composing replies.
LVL 19
Who is Participating?
RobConnect With a Mentor Owner (Aidellio)Commented:
PHP-Barcode 0.3pl1

PHP-Barcode generates
  - Barcode-Images using libgd (png, jpg,gif),
  - HTML-Images (using 1x1 pixel and html-table)
  - silly Text-Barcodes

PHP-Barcode encodes using
  - a built-in EAN-13/ISBN Encoder
  - genbarcode (by Folke Ashberg), a command line
    barcode-encoder which uses GNU-Barcode
    genbarcode can encode EAN-13, EAN-8, UPC, ISBN, 39, 128(a,b,c),
    I25, 128RAW, CBR, MSI, PLS
    genbarcode is available at 

(C) 2001,2002,2003,2004 by Folke Ashberg <>

The newest version can be found at
psimationConnect With a Mentor Commented:
I havn't worked with barcode scanners for quite a while, but "back in the day", the barcode scanners we used to work with were merely "keyboard" interfaces - ie. the barcode scanner would "convert" the barcode into characters and then simply send it via the keyboard interface as if it were typed in in the first place.
I am guessing that most barcode scanners will come with software (or firmaware) that will already be capable of "understanding" most standards already , and the bundled software will allow you to further add/edit onto the standard values if you require.

Thus, if things still work the same, you won't need to do any coding in order to use a barcode scanner on your website, but you may need to do some coding if you want to add some extra descriptions to the standard barcode values ( usually they are only number sequence printed below barcodes as you see them on packages) - but this should be pretty straigh forward; you could simply create a lookup table holding your descriptions paired with the numerical values, and when you scan something, you replace the numbers with the description.
RobConnect With a Mentor Owner (Aidellio)Commented:
TO add to psimation, I see this as 3 parts, the webpage, the database, and the user input.  
The webpage (php form) is where the user puts a barcode into a textbox and submits the form.
The barcode is used in a database lookup to return the other information.  How the barcode is entered shouldn't matter (ie user input or barcode scanner).
Most barcode scanners these days have the scanner send escape keys such as newline after a barcode is scanned, so whether the user types the barcode manually and presses enter or a barcode is scanned, the form won't know the difference.
I know these guys sell a quality barcode scanner: but there are heaps of different options such as bluetooth wireless but I reckon you only need the basic scanner as long as it can send the escape codes (prevent the user having to press enter after every scan).
Where are you up to in the project and what part in particular do you require advice?
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

v2MediaAuthor Commented:
The project is completed; the client wants this as an additional feature. My ignorance of how scanners work is the problem, and finding some off-the-shelf code to integrate them into a website.

There's a massive hole in the advice given so far. I realise that scanners are basic input devices that translate barcodes into numeric sequences and a trailing \r\n. However in order for this input to work, there's several processes that have to be completed to get to that stage:

Modify product labels to feature barcodes
Inventory scan to associate a barcode with a product

These are the processes which obviously require additional forms for data entry, item selection and scripting for item barcode printing. From what the both of you have posted, the scanner is nothing more than emulated keyboard entry. So that leaves incorporating the barcode into the product label printing.

So, the forms/processing required would be something along these lines yes?

1. Barcode generation (prolly pdf)

2. Product selection to printer form for printing the required number of barcodes for each item selected (all items for initial print run).

3. Forms for scanning in the initial code to product associations (auto submits and iterates to next item).

There's probably a bunch of other things that these systems use to minimise labour, such as printing a catalog of item thumbnails over barcodes for manual scanning when label cannot be scanned....

I realise this whole concept of barcode scanning is simple, but from my experience, the devil is in the detail...

RobOwner (Aidellio)Commented:
1. PDF yes it will need to be so that when it is printed it will be clear. (I have php code for this as well) as we generate barcodes so that they can be put on our product.

2. I'm guessing this is selecting a product that you want to print barcodes for and php will print out a form full of labels (barcodes) to stick on the product?

3. Would this be a form that would bring up all your product items that do not currently have a barcode associated?  If so, then you find the product the page is asking for and then scan the barcode that's on the item and associate the barcode in your system with that product code?
RobOwner (Aidellio)Commented:
To add have a look at PHP-Barcode which can create html images from php

eg. this is all the code you would need with their include file:

$code = (get_magic_quotes_gpc()) ? stripslashes(getvar('code')) : getvar('code');
// encoding - this will guess EAN or UPC
// scale
// mode (type)

Open in new window

v2MediaAuthor Commented:
Thx for ur help tagit. I get the impression there's nothing available in a nice, neat package that will do it all, which is what I was really hoping for. This will more than likely be a one-time project. I really didn't want to have to put together all the different pieces into a coherent whole that's usable via a website gui. It seems that's what's required tho.
RobOwner (Aidellio)Commented:
this is a command line barcode generator for creating eps files:
RobOwner (Aidellio)Commented:
here is the code i use to create the eps:
		echo "$code<br>";
		$res = barcode_encode_ean($code);
		if ($res["valid"]) {
			// Outputs all the result of the shellcommand, and returns
			// the last output line into $last_line. Stores the return value
			// of the shell command in $retval.
			// 931618812345
			//create the directory
			if (!is_dir("eps")) {
				mkdir("./eps/",0777, true);
			if (!is_dir("./eps/$sid")) {
				mkdir("./eps/$sid",0777, true);
			if (!strcmp($encoding,"any")==0) {
				$last_line = system("barcode -o .\\eps\\$sid\\$ean.eps -b $ean -u mm -E -e $encoding -g $w" . "x" . "$h+10+10 -p $w" . "x$h", $retval);
			else {
				$last_line = system("barcode -o .\\eps\\$sid\\$ean.eps -b $ean 0u mm -E -g $w" . "x$h", $retval);
			if (false) {
				echo "$retval -> $last_line<br>";
			echo "
			Created EPS barcode file: <a href=\"eps/$sid/$ean.eps\">$ean.eps</a>

Open in new window

All Courses

From novice to tech pro — start learning today.