Custom Connectors

What are connectors for?

Connectors are used to integrate third party software with ConfigBox to extend or replace functionality.

Example tasks:

  • Process an order and bring the customer to a custom cart page

  • Checkout a cart

  • Create a quotation file

  • Perform actions on order status changes

What are connectors technically?

A connector is basically a PHP file containing a PHP class with a set of methods. The methods act as observers to events triggered by the application (observer pattern).

Example connector:

[application dir]/observers/Orders.php

 

How to manage connectors

ConfigBox -> Settings -> Connectors:

 

Here you can enable or disable connectors and add or remove them.

Adding a connector

After clicking add you enter name of the connector, the settings and provide the file. Enter the form as per installation instructions of the connector provider.

How to develop the connector file

  • First you pick a name for your connector. In this example we use ecomsystem.

  • Create a PHP file with a PHP class called ObserverEcomsystem.

 

<?php class ObserverEcomsystem { // Add various methods that act as listeners }
  • Save the file and upload it as connector file.

Custom connectors are eventually stored in this path:

[customization_folder]/custom_observers

Mind that connectors need to be uploaded via the backend, simply copying the connector to this directory will not do. Editing after upload works.

Example:

Connector to react on an order’s status change

Add the method onConfigBoxSetStatus

class ObserverEcomsystem { //** * @param int $orderId * @param int $status **/ function onConfigBoxSetStatus($orderId, $status) { $orderModel = KenedoModel::getModel('ConfigboxModelOrderrecord'); // See PHP class ConfigboxOrderData for data structure $orderRecord = $orderModel->getOrderRecord($orderId); // ..Your code } }

Status IDs:

1 - In Checkout
2 - Ordered
3 - Paid
4 - Confirmed
5 - Shipped
6 - Cancelled
7 - Refunded
8 - Saved
11 - Quotation sent
14 - Quotation requested