Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

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. ConfigBox calls these methods (if they exist) and provide standardized data as parameter to perform various processes. This is done using the observer pattern. Depending on the nature of the task the system calls only the first connector or all connectors.

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 a connector

  • 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 add it as connector (see 6.8.3).

Custom connectors are stored in this path:

[customization_folder]/custom_observers

Example:

Connector to react on an order’s status change

Add the method onConfigBoxSetStatus

//**
* @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

  • No labels