Table of content
HikaMarket Triggers
Product Blocks Display
public function onMarketProductBlocksDisplay(&$product, &$html) {
if(!defined('HIKAMARKET_COMPONENT'))
return;
// Check if the product edition is allowed
$marketConfig = hikamarket::config();
if(!$marketConfig->get('frontend_edition',0)) return;
// Check HikaMarket ACL
if(!hikamarket::acl('product_edit_plugin_myPluginName')) return;
$ret = '';
//
// Put the HTML code that you want to display in the product edition (on the front-end) into the variable $ret
// ( Test if new product with: $product->product_id )
//
//
if(!empty($ret)) {
$html[] = $ret;
}
}
ACL Integration
public function onMarketAclPluginListing(&$categories) {
// Your plugin can interact with product editing in the front-end.
$categories['product'][] = 'myPluginName';
}
Before vendor creation
/**
* @param $vendor - the vendor object
* @param $do - boolean value. Set it "false" to stop the vendor creation
*/
public function onBeforeVendorCreate(&$vendor, &$do) {
}
Before vendor update
/**
* @param $vendor - the vendor object
* @param $do - boolean value. Set it "false" to stop the vendor update
*/
public function onBeforeVendorUpdate(&$vendor, &$do) {
}
After vendor creation
/**
* @param $vendor - the vendor object
*/
public function onAfterVendorCreate(&$vendor) {
}
After vendor update
/**
* @param $vendor - the vendor object
*/
public function onAfterVendorUpdate(&$vendor) {
}
Before vendor delete
/**
* @param $elements - array of the vendor ids
* @param $do - boolean value. Set it "false" to stop the vendors deletion
*/
public function onBeforeVendorDelete(&$elements, &$do) {
}
After vendor delete
/**
* @param $elements - array of the vendor ids
*/
public function onAfterVendorDelete(&$elements) {
}
Before vendor pay
public function onBeforeVendorPay(&$order, &$vendor, &$orders, &$pay_orders, &$do) {
}
After vendor pay
public function onAfterVendorPay(&$order, &$vendor, &$orders, &$pay_orders) {
}
Before vendor category create
/**
* @param $vendor - the vendor object
* @param $category - the category object that we will use for the creation
* @param $do - boolean value. Set it "false" to stop the category creation
*/
public function onBeforeVendorCategoryCreate(&$vendor, &$category, &$do) {
}
Before vendor category update
/**
* @param $vendor - the vendor object
* @param $category - the category object that we will use for the update
* @param $do - boolean value. Set it "false" to stop the category update
*/
public function onBeforeVendorCategoryUpdate(&$vendor, &$category, &$do) {
}
Before products vendor attribution
/**
* @param $products - An array of product data
* array(
* '_id' => Cart product id
* 'id' => Product id
* 'vendor' => null, will receive the Vendor id
* 'fee' => (optional)
* 'qty' => (optional) Cart product quantity
* 'price' => (optional) Cart product price
* 'price_tax' => (optional) Cart product price, with tax
* );
* @param $productObjects - An array of the products, directly from the database
* @param $order - The HikaShop order object
*/
public function onBeforeProductsVendorAttribution(&$products, &$productObjects, &$order) {
}
After products vendor attribution
/**
* @param $vendors - The data which will be return by the Vendor attribution function.
* The variable contains array to link a vendor with a cart product id.
* @see onBeforeProductsVendorAttribution
*/
public function onAfterProductsVendorAttribution(&$vendors, &$products, &$productObjects, &$order) {
}
/**
* @param $vendor_id - The concerned vendor Id.
* @param $ret - The return price value (float).
* @param $order_products - The cart product objects.
* @param $products - An array of product information with the vendor attribution information.
* @param $coupon - The cart coupon.
* @param $vendor_order - The vendor subsale object for the concerned vendor.
* @param $do - Stop the processing of the vendor price and return directly the content of the variable $ret.
*/
public function onBeforeMarketCalculateVendorPrice($vendor_id, &$ret, &$order_products, &$products, $coupon, $vendor_order, &$do) {
}
After calculate vendor price
/**
* @see onBeforeMarketCalculateVendorPrice
*/
public function onAfterMarketCalculateVendorPrice($vendor_id, &$ret, &$order_products, &$products, $coupon, $vendor_order) {
}
Vendor panel display
/**
* @param $buttons - Array with the different buttons which will be display to the vendor
* @param $statistics - Array of array containing specific data used by the Statistic class ; can display raw data and dynamic one (list, charts, graphs)
*/
public function onVendorPanelDisplay(&$buttons, &$statistics) {
}
Statistics Plugin list
/**
* @param $vendor_id - The ID of the vendor
* @param $options - Array with useful values for the statictics.
*/
public function onHikamarketStatisticPluginList($vendor_id, $options) {
/*
$options = array(
'created' => true|false, // Indicates if created is in the list of stats_valid_order_statuses.
'valid' => array('confirmed','shipped'), // List of stats_valid_order_statuses
'offset' => '+3600' // String with the timezone offset useful for some queries
);
*/
return array(
'name' => 'Test',
'type' => 'plugin', // Can use other kind of type with an 'query' or 'value' entry for the SQL or raw data.
'plugin' => 'my_plugin', // Only with plugin type
'slot' => 1,
'order' => 3,
'published' => 0
);
}
Statistics Plugin list
/**
* @param $data - array given in the previous trigger of the documentation.
* @return $content
*/
public function onHikamarketStatisticPluginDisplay($data) {
if(!isset($data['type']) || $data['type'] != 'plugin')
return;
if(!isset($data['plugin']) || $data['plugin'] != 'my_plugin')
return;
return 'My content';
}
Before Vendor listing display
/**
* @param $view - the view object
* @param $sql_params - an array with the different parts for the vendor listing sql query
*/
public function onBeforeVendorListingDisplay(&$view, &$sql_params) {
/*
$sql_params = array(
'select' => array(),
'join' => array(),
'filter' => array( ... ),
'order' => '',
'search_map' => array( ... ),
'order_accept' => array( ... )
);
*/
}
Before order export query
public function onBeforeOrderExportQuery(&$select, &$from, &$filters, &$order, &$searchMap, &$orderingAccept) {
}
Product block display (front-end)
This trigger is called if the user have the ACL: product / edit / plugin
/**
* @param $product - the product which is currently in edition
* @param $html - an array of string which will be displayed in the page
*/
public function onMarketProductBlocksDisplay(&$product, &$html) {
}
Before product approval
This trigger is called before a product is approved for publication.
/**
* @param $oldProduct - the product which is currently targeted for approval
* @param $do - a boolean value to continue or not the approval
*/
public function onBeforeProductApproval(&$oldProduct, &$do) {
}
HikaShop Triggers
Product Blocks Display
public function onAfterOrderProductsListingDisplay(&$order, $type) {
switch($type) {
case 'order_frontvendor_show':
//
break;
case 'order_frontvendor_invoice':
//
break;
}
}