Solved

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

Posted on 2007-12-04
9
4,805 Views
Last Modified: 2013-12-12
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.
0
Comment
Question by:v2Media
  • 6
  • 2
9 Comments
 
LVL 17

Assisted Solution

by:psimation
psimation earned 100 total points
ID: 20409369
Hi
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.
0
 
LVL 43

Assisted Solution

by:Rob
Rob earned 400 total points
ID: 20414818
Hi,
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: www.vendorconnect.com.au 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?
cheers,
Rob
0
 
LVL 19

Author Comment

by:v2Media
ID: 20415360
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...



0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 43

Expert Comment

by:Rob
ID: 20415429
Hi,
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?
0
 
LVL 43

Expert Comment

by:Rob
ID: 20415456
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:


require("php-barcode.php");
 
$code='123456789012';
 
$code = (get_magic_quotes_gpc()) ? stripslashes(getvar('code')) : getvar('code');
 
// encoding - this will guess EAN or UPC
$e="ANY";
 
// scale
$s=2;
// mode (type)
$m='png';
 
barcode_print($code,$e,$s,$m);

Open in new window

0
 
LVL 43

Accepted Solution

by:
Rob earned 400 total points
ID: 20415537
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 www.ashberg.de/bar 

(C) 2001,2002,2003,2004 by Folke Ashberg <folke@ashberg.de>

The newest version can be found at http://www.ashberg.de/bar
0
 
LVL 19

Author Comment

by:v2Media
ID: 20415732
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.
0
 
LVL 43

Expert Comment

by:Rob
ID: 20415736
this is a command line barcode generator for creating eps files:

http://gnuwin32.sourceforge.net/packages/barcode.htm
0
 
LVL 43

Expert Comment

by:Rob
ID: 20415756
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
			$ean=substr($code,0,12);
			$eansum=barcode_gen_ean_sum($ean);
			$ean.=$eansum;
			//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 "
			</pre>
			<br>
			Created EPS barcode file: <a href=\"eps/$sid/$ean.eps\">$ean.eps</a>
			<br>
			";
			*/
		}

Open in new window

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question