Skip to content

PHP POS

A friend commissioned us to develop a “Point of Sales” (POS) system for their grocery store in Valenzuela City.  We accepted the challenge, knowing that creating a custom POS system would streamline their operations and simplify sales tracking. Though they initially wanted the system built using older RDBMS software that utilized “.dbf” database formats, we opted for a modern approach instead. Building it with PHP/MySQL made more sense because it offered better flexibility and support.

To start the project, we decided to install XAMPP, a popular server solution.

XAMPP simplified the setup by providing a complete package with Apache (server) and MySQL (database). This eliminated the need for separate installations, allowing us to jump straight into development. Once we set up the server on their computer, we could efficiently manage the database and create a custom interface for the grocery store’s operations.

The actual coding took about two weeks. Our main challenge wasn’t building the core of the POS system but dealing with hardware integration.

Connecting the cash register and receipt printer to work seamlessly with the software was quite a task. The bar code scanner, however, was straightforward—plug and play without any additional configuration.

The real problem came when we tried to get the cash drawer to open automatically and print receipts upon completing a transaction. Most PHP-based applications struggle with this type of hardware communication, especially on a local machine. After some research, we found a PHP function designed to work with local hardware connections. It allowed us to send DOS ESC code sequences to the receipt printer, which was something I had tinkered with back in the day. In the past, these ESC sequences were used to adjust font sizes, compress text, and handle other custom printer settings.

With the right configuration, the system could successfully communicate with the printer and cash drawer.

Each time the store completed a transaction, the system would 1) print out the receipt, and 2) trigger the cash drawer to open. This automation minimized human error and enhanced efficiency during checkout.

We didn’t stop there. We had to create a detailed product inventory system. Most commercial products already had their own barcodes, which made it easier to build the database. We scanned every item available in the store and entered the data into the database. For products without barcodes, we used an open-source barcode generator. This tool allowed us to create unique barcodes for these items and ensure they were easy to scan at checkout.

Once the POS system was complete, we turned it over to the client along with the hardware setup.

We made sure the receipt printer, cash drawer, and barcode scanner were all synchronized with the system. The result was a smooth, reliable checkout process that their staff could easily manage.

This project, completed around 2005, is still in use today. The system has proven to be robust and adaptable despite being built nearly two decades ago. Over the years, they have made minor upgrades to the software, but the core functionality has remained the same. The project demonstrates the value of building with flexibility in mind and choosing a robust development platform like PHP/MySQL.

In the end, the POS system significantly enhanced their daily operations, improved transaction accuracy, and saved time.

Seeing our solution still in use today speaks volumes about the reliability and effectiveness of a well-designed POS system. The experience also reinforced the importance of blending software with hardware, especially in projects that require specific physical actions like opening cash drawers or printing receipts.

Originally published in ETN Multimedia.

Back To Top