Skip to content

Instantly share code, notes, and snippets.

@Sentinel-7
Created September 23, 2021 11:02
Show Gist options
  • Save Sentinel-7/c29abb0ed90ed4ae84cad512610b2987 to your computer and use it in GitHub Desktop.
Save Sentinel-7/c29abb0ed90ed4ae84cad512610b2987 to your computer and use it in GitHub Desktop.
Замена tickets на msProducts (замена тикетов на товары)
<?php
// Id корня, глубина, контекст
$child = $modx->getChildIds(11, 10, array('context' => 'web'));
$q = $modx->newQuery('Ticket');
$q->where(array(
'id:IN' => $child,
'published' => true,
'deleted' => false,
'searchable' => true,
));
$products = $modx->getIterator('Ticket', $q);
foreach ($products as $k => $product) {
$product->set('class_key', 'msProduct');
$product->save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment