Gereric Warehouse Interface

Description

Generic Warehouse Interface (GWI) is a tool that helps connecting your Woocommerce shop with the warehouse. This is an attempt to create a framework that specializes on data transmission between E-shop (For starters Woocommerce in specific ) and warehouses.

The goal is to allow developers to focus on the stability and quality of the interface rather than the details like the making of XML etc.

GWI gives you the freedom to change any values or structure of the final format that will be delivered to the warehouse. I have tried to make it as customizable as possible, for sure in the future this will be further improved.

Table of content

Installation

You can install it like any other WordPress plugin 🙂

Configuration

Once installed and activated, on the administrator area you will find a new menu item called “Warehouse Interface”

There are 3 tabs in the GWI options page, the General Options, Delivery Methods and Parameters.

General Options :

Currently there are 5 options on this tab.

Enabled: If checked data will be transmitted, if unchecked nothing will happen.

Ready Status / After Status: These fields are being populated on your sites order statuses. Even the custom statuses will be included here. The “ready status” is the status that will activate the export to the warehouse and the “after status” is the status where the order will be put once the transition is successful.

Once an order is put to the “ready status” the order will be transmitted and if that is successful , order is put to “after status”

Deploy Method: currently 2 methods are being supported, HTTP and FTP. An order can be exported using either of these two protocols, but they can also be overwritten depending to what each interface needs.

Deploy Format: GWI supports 2 formats JSON and XML. Again due to the customizable nature of GWI developers receive the data to be transmitted first in PHP array and later to XML / JSON, thus you can deploy whatever format is required.

Delivery Methods :

On this tab you can configure the warehouse deployment credentials. There are two options, FTP and HTTP.

Ftp: Username, password, host and port are the required credentials, remote path refers to the folder structure of the remote server that files will be deployed to. Px. folder1/folder2/deploy_final_folder. The filename input defines the name of the file created to the FTP server. Currently for order id you can use {order_id} and any other character viable as filename. You can further edit the name via filter described below. If you put the value “test_shop_{order_id}_order.xml”, order 111 will create the file “test_shop_111_order.xml”.

Http: url is the target url that the request is delivered. Username/password fields are used in case the url is htaccess password protected. Key is used as api-key if needed.

Http is using cURL and before data are being transmitted, a filter is applied including the cURL object, making it completely configurable.

Parameters:

the nodes displayed on this tab are being dynamically produced by the “gwi_parameters” array which is called via filter, so you can edit it as much as you need

In this tab you can configure the file format that will be transmitted. Each node has four options to configure.

Enable: if node is disabled, node and children will not be included in the export file/content

Element name: this is the name you want the current node to have in your file. Px. if you edit the Element name of order_id node to OrderID then in XML for example you will see this node as <OrderID> … </OrderID> instead of <order_id>.

Singles: this is referring to the multiple children name. If you change the Singles value of the node order_positions the children of this node each will be an element of that value. For example as you see in the image above the singles value of order_positions is “pitem” here is the generated XML

<order_positions>
    <pitem>…</pitem>
    <pitem>…</pitem>
</order_positions>

Currently its used for order items only, but it was a necessity to include it.

Priority: it is not used for the first versions as the format is defined by the seeding array alone, but it can be used by developer due to the filters if you are so inclined to change the positions of the elements.

Actions and Filters

For each element that will be included in the final form, each element, standard and custom, is editable via filters

Actions:

gwi_order_deploy_response // http server response in HTTP protocol

Filters:

gwi_parameters // modify file format, very important filter as this edits the final file structure. See examples for more details.
gwi_export_hook // Modify status order ready for export
gwi_transfer_http // the cURL object ready for modifications
gwi_transfer_ftp // the FTP connection object
gwi_transfer_ftp_filename // filename of the FTP file that is created.
gwi_transfer_ftp_mode // ASCII or BINARY
gwi_add_order_note // Allow order note after delivery to warehouse (default = true)
gwi_add_order_note // Order not content
gwi_allow_status_complete // Status order gets after delivered to warehouse

gwi_order_xml // The final xml *affecting this will affect json as all orders first translated into XML and if applicable to json
gwi_order_json // the final json
gwi_allow_item_in_order // allow this item delivered to warehouse. Px. an item is handled by another provider or is virtual, you can simply deny it being included.

//Value filters are being separated into order values and item value // Order valuess

gwi_element_value_order_id
gwi_element_value_order_value
gwi_element_value_order_date
gwi_element_value_shipping_first_name
gwi_element_value_shipping_last_name
gwi_element_value_shipping_company
gwi_element_value_shipping_street
gwi_element_value_shipping_postal_code
gwi_element_value_shipping_city
gwi_element_value_shipping_country
gwi_element_value_shipping_additional
gwi_element_value_order_($custom_element) //
Any custom field added in gwi_parameters. If you have added in gwi_parameters array, a custom element px. “order_origin”, you can edit the value of the element via the filter “gwi_element_value_order_order_origin”.

// item values

gwi_element_item_value_sku
gwi_element_item_value_price
gwi_element_item_value_quantity
gwi_element_item_value_item_id
gwi_element_item_value_item_name
gwi_element_item_value_($custom_element)
// Any custom item field added in gwi_parameters

Examples

Change format of file
Add new item field
Add new order field


Download

Scroll to Top