Skip to content

Instantly share code, notes, and snippets.

@ig0r74
Created December 13, 2018 15:31
Show Gist options
  • Save ig0r74/6feb62e10047d1303df15af5d765e36e to your computer and use it in GitHub Desktop.
Save ig0r74/6feb62e10047d1303df15af5d765e36e to your computer and use it in GitHub Desktop.
MODX MiniShop2 пересохранить все товары процессором
<?php
ini_set('max_execution_time', 0);
ignore_user_abort(true);
$c = 'modResource';
$q = $modx->newQuery($c);
$q->where(array('class_key' => 'msProduct'));
$q->sortby('id');
$q->select(array(
"{$c}.*",
));
$s = $q->prepare();
$s->execute();
while($row = $s->fetch(2)) {
$response = $modx->runProcessor('resource/update', $row);
if($response->isError()){
print_r($response->getResponse());
return;
}
$modx->error->reset();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment