...
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:
Joomla: /components/com_configbox/observers/Orders.php
Wordpress: /wp-content/plugins/configbox/app[application dir]/observers/Orders.php
How to manage connectors
...
Custom connectors are stored in this path:
Joomla: /components/com_configbox/data/customization[customization_folder]/custom_observers
Joomla: /wp-content/plugins/configbox/app/data/customization/custom_observers
Connector to place a configured product in a third party ecommerce cart
...
Example:
Connector to react on an order’s status change
Add the method onConfigBoxSetStatus
Code Block | ||
---|---|---|
| ||
function onConfigBoxAddToCart(&$cartDetails) { //** Add* your@param codeint for$orderId processing* the@param cartint Details // Set a value for redirectURL to redirect the user to a specific page $cartDetails->redirectURL = 'URL TO THIRD PARTY CART'; // Return true to indicate that all went well return true; } |
About $cartDetails
The parameter $cartDetails is a PHP object containing the information of the current cart and all positions in it. Use var_dump(), print_r() or dump() (install JDump from the JED) to see the structure and data of the object.
About $cartDetails->redirectURL
...
$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