Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
<?php
class ObserverEcomsystem {
	// Add various methods that act as listeners
}

  • Save the file and add upload it as connector (see 6.8.3)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 will not do.

Example:

Connector to react on an order’s status change

Add the method onConfigBoxSetStatus

Code Block
languagephp
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

...