Skip to content

Instantly share code, notes, and snippets.

@ilyautkin
Forked from core01/.php
Last active September 10, 2015 10:49
Show Gist options
  • Save ilyautkin/95d932a509ffdf21bff8 to your computer and use it in GitHub Desktop.
Save ilyautkin/95d932a509ffdf21bff8 to your computer and use it in GitHub Desktop.
modxplugin
<?php
if ($modx->event->name == 'OnDocFormSave') {
if ($mode == 'new') {
$sellUSD = $modx->stripTags($_POST['sellUSD']);
$buyUSD = $modx->stripTags($_POST['buyUSD']);
$exchange = array(
'sellUSD' => $sellUSD,
'buyUSD' => $buyUSD
);
// $prop["exchange"] = $exchange;
$resource->setProperties($exchange, 'exchange');
# ВОТ ЭТОТ КОД -> РАБОТАЕТ, значения записываются в TV
/* if(!$resource->setTVValue('$sellUSD', $sellUSD) and !$resource->setTVValue('buyUSD', $buyUSD)) {
$message = "Fail!";
}
else{
$message = "Success";
}
*/
$resource->save();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment