Skip to content
  1. Extras
  2. mSync
  3. Events and plugins

Events and plugins ​

Plugins ​

Plugins required for the component and for extending it. May be extended in future versions.

removeUuid ​

Removes product property bindings when products are deleted in MODX. Fired on OnBeforeEmptyTrash.

Events ​

mSyncOnProductImport ​

Fired when processing each category and product in the products file after creating or updating a product or category.

ParameterValueDescription
$modeString category for categories, create for new products, update for updatesObject type being processed
$resourcemsCategory or msProduct objectminiShop object created or updated
$propertiesarrayProduct properties from XML; empty for categories
$datamSyncCategoryData or mSyncProductData object1C category/product to miniShop object mapping

mSyncBeforeProductOffers ​

Fired before processing one offer.

ParameterValueDescription
$uuidstringProduct UUID in 1C
$uuid_offerstringOffer UUID in 1C
$xmlSimpleXMLElementXML with the offer

mSyncOnProductOffers ​

Fired after processing one offer.

ParameterValueDescription
$resourcemsProduct objectminiShop product updated with offer data
$offermSyncOfferDataOffer object
$xmlSimpleXMLElementXML with the offer

mSyncAfterOffers ​

Fired after processing all offers.

ParameterValueDescription
$totalOffersintNumber of exported offers

mSyncOnCsvExport ​

Fired when adding each product to the CSV export. Lets you customize the export.

ParameterValueDescription
$fieldsarrayProduct fields: key = field (CSV column name), value = field value
$productmsProduct objectminiShop product being processed
$filenamestringExport file name
$startnumberFirst product index in current export iteration
$exportmSyncExportPrepareProcessorExport processor

mSyncOnBeforeImport ​

Fired before processing product and offer files.

ParameterValueDescription
$mode"catalog" or "offers"Whether catalog or offers are being processed
$filenamestringFile name

mSyncOnBeforeImportCategory ​

Fired before saving category temp data to the database.

ParameterValueDescription
$xmlSimpleXmlElementXML with Group (category) data
$dataarrayFields you can change in the plugin: 'name' — category name, 'uuid' — 1C ID, 'parent_uuid' — parent group ID in 1C
$levelnumberCategory nesting level

mSyncOnBeforeImportProduct ​

Fired before saving product temp data to the database.

ParameterValueDescription
$xmlSimpleXmlElementXML with Product data
$dataarrayProduct fields you can change in the plugin; see var_dump or source code

You can change $data the same way as in miniShop2 event plugins:

php
if ($modx->event->name == 'mSyncOnBeforeImportCategory') {
  $values = & $modx->event->returnedValues;
  $data['name'] .= "-test";
  $values['data'] = $data;
}

This plugin appends "-test" to the category name.

mSyncAfterImportCategories ​

Fired after categories are loaded from XML into the temp table.

ParameterValueDescription
$totalnumberNumber of imported categories

mSyncAfterImportProducts ​

Fired after all properties are loaded from XML into the temp table.

ParameterValueDescription
$lastnumberLast processed product index
$totalnumberNumber of imported products

mSyncOnPrepareCategory ​

Fired before creating or updating a miniShop category. Lets you change category mapping.

ParameterValueDescription
$datamSyncCategoryData1C category to miniShop category mapping. May be empty for new category.
$uuidstringCategory ID in 1C
$parentnumberParent category ID in miniShop
$parentUuidstringParent category ID in 1C

mSyncOnPrepareProduct ​

Fired before creating or updating a miniShop product. Lets you change product mapping.

ParameterValueDescription
$dataarrayProduct temp data
$pnumberParent category ID in miniShop
$parentnumberParent category ID in miniShop
$propertiesarrayProduct properties

mSyncAfterImportProperties ​

Fired after product properties are loaded from XML into the import session.

ParameterValueDescription
$xmlSimpleXmlElementXML with product properties
$lastnumberLast processed property index
$totalnumberNumber of properties found

mSyncAfterImport ​

Fired at the end of the catalog import.

ParameterValueDescription
$totalProductsnumberNumber of imported products
$totalCategoriesnumberNumber of imported categories
$importResourcesarrayResource IDs affected by this import: array( 'category' => array('created' => array(), 'updated' => array()), 'product' => array('created' => array(),'updated' => array())

mSyncOnCatalogFileImport ​

Fired before loading a catalog file. Lets you change the file name if it differs from the default.

ParameterValueDescription
$filenamestringFile name

mSyncOnBeforeSalesExport ​

Fired before exporting an order. Lets you add fields to the order.

ParameterValueDescription
$order_extarrayProduct fields to export
$ordermsOrderminiShop order

mSyncOnSalesExport ​

Fired before building the orders XML file.

ParameterValueDescription
$xmlSimpleXMLElementDocument with orders
$ordersarray of msOrderOrder collection

mSyncOnImportUnknownFile ​

Fired when an import file has an unknown name.

ParameterValueDescription
$filenamestringFile name