gsOnBeforeExportValues
Triggered before retrieving values for export.
Available variables:
| Name | Description |
|---|---|
| where | Current conditions as an array; if none exist, it is an empty array. |
| object | Export object |
| properties | Export properties |
modUser
Export only superusers.
php
if ($modx->event->name === 'gsOnBeforeExportValues') {
if ($object->model_class === 'modUser') {
$where['sudo'] = 1;
}
$modx->event->params['where'] = $where;
}modResource
Select resources with a specific template.
php
if ($modx->event->name === 'gsOnBeforeExportValues') {
if ($object->model_class === 'modResource') {
$where['template'] = 3; // id шаблона
}
$modx->event->params['where'] = $where;
}FormIt
Select forms with a specific IP.
php
if ($modx->event->name === 'gsOnBeforeExportValues') {
if ($object->model_class === 'FormIt') {
$where['ip'] = '555.190.128.26';
}
$modx->event->params['where'] = $where;
}msCategory
Select categories with a specific parent.
php
if ($modx->event->name === 'gsOnBeforeExportValues') {
if ($object->model_class === 'msCategory') {
$where['parent'] = 34; // id категории
}
$modx->event->params['where'] = $where;
}msProduct
Select products with the manufacturer Panasonic.
php
if ($modx->event->name === 'gsOnBeforeExportValues') {
if ($object->model_class === 'msProduct') {
$name = 'Panasonic';
if ($vendor = $modx->getObject(msVendor::class, compact('name'))) {
$where['vendor'] = $vendor->id;
}
}
$modx->event->params['where'] = $where;
}or products priced above 2000.
php
if ($modx->event->name === 'gsOnBeforeExportValues') {
if ($object->model_class === 'msProduct') {
$where['price:>'] = 2000;
}
$modx->event->params['where'] = $where;
}msVendor
Select manufacturers that have a logo.
php
if ($modx->event->name === 'gsOnBeforeExportValues') {
if ($object->model_class === 'msVendor') {
$where['logo:!='] = '';
}
$modx->event->params['where'] = $where;
}msOrder
Get all orders with status 2 (Paid).
php
if ($modx->event->name === 'gsOnBeforeExportValues') {
if ($object->model_class === 'msOrder') {
$where['status'] = 2;
}
$modx->event->params['where'] = $where;
}msOptionsPrice2
Select all modifications of a specific product.
php
if ($modx->event->name === 'gsOnBeforeExportValues') {
if ($object->model_class === 'msOptionsPrice2') {
$where['rid'] = 3; // id товара
}
$modx->event->params['where'] = $where;
}