Updated January 1st, 2015
Special Order Plus facilitates taking special orders through the Ingram ipage and Baker & Taylor Title Source 360 web databases by providing a HTML form on these websites and a printing backend.
- Web server capable of running PHP.
- A userscript plugin like Tampermonkey or Greasemonkey (not tested in Firefox, though).
- The pdftk tool for filling the PDF forms and stamping barcodes.
- GNU barcode patched with PDF support.
It's not quite ready for prime-time, but eager testers will need to ensure that all of the requirements are met then:
- Install the userscripts on your client browsers (ipage-plus.js for Ingram and ts360-plus.js for Baker & Taylor).
- Put special-order.php on a web server.
- Edit ipage-plus.js and ts360-plus.js to point to the appropriate URL for special-order.php (there's no setting for this yet).
- Provide a PDF form template to be filled by special-order.php (a default template will be uploaded at some point).
- Hit it until it works.
It's at the bailing wire and good intentions stage of development right now, so there will probably be a lot of hitting.
The special order system is made up of two parts:
- A local userscript, which does the information scraping and inserts the special order form into the websites.
- A remote web server, which collects the form data from clients, compiles it into a PDF, prints the PDF, and keeps track of an index number.
The local userscript is a short JavaScript program which primarily:
- Scrapes the title information from the current web page in ipage and TS360.
- Adds a special order form to those pages.
- Submits the personal information and title information to the web server.
Information about the current title is both scraped from the page using jQuery selectors and, for Ingram, by submitting an HTTP POST request for the title data.
An HTML form is added to the page inside of a ColorBox which can be shown using either a button inserted on the page, or a keyboard shortcut.
The form data, which contains both the collected personal information from the HTML form and title information scraped from the page, is submitted to the web server using AJAX.
The remote web server is a short PHP program which primarily:
- Collects and parses the form data from clients.
- Generates a PDF from the form data and other data.
- Prints the PDF.
The form data from the client is collected and parsed to display appropriately in the PDF form (first name + laste name = name, etc.), and processed into an XFDF file.
An index number is generated for the special order, then a PDF form is filled from the XFDF file, stamped with a barcode of the EAN13 for the book, and the PDF is flattened.
The PDF is printed to a network printer using CUPS.
When a client with the appropriate userscripts installed visits a title listing on either Ingram ipage or Baker & Taylor TS360, a special order form button is displayed.
After the page is loaded, the userscript scrapes the data for the current title from the web page and sends a query for an additional data file about the title from their server. This information is then inserted into the special order form.
When the user clicks the special order button, a form with fields for customer and order information is displayed. After the information is filled in and the form is submitted, the data is sent to the web server for processing and printing.
The web server parses and formats the form data from the client and generates an XFDF file from this data. An index number for the special order is generated from a counter file on the web server. An EAN13 barcode is created. All of this data is inserted into a PDF form. Finally, the PDF is printed.