Skip to content

Instantly share code, notes, and snippets.

@vgrish
Created August 24, 2015 08:59
Show Gist options
  • Save vgrish/58ff5f398355d43cb360 to your computer and use it in GitHub Desktop.
Save vgrish/58ff5f398355d43cb360 to your computer and use it in GitHub Desktop.
<?php
switch ($modx->event->name) {
case 'psOnBeforeOrderSubmit':
$payandsee = $modx->getService('payandsee');
$list = $payandsee->ListGet();
$user = $modx->user->id;
foreach($list as $key => $subscription) {
if ($subscription['pas_price'] != 0) {
continue;
}
if ($modx->getCount('PaySeeList', array(
'resource_id' => $subscription['id'],
'user_id' => $user,
'active' => 1,
))) {
$payandsee->ListRemove($key);
$modx->event->returnedValues = array('returned' => array('reload' => 1));
$modx->event->output('Такая подписка уже есть!');
break;
}
}
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment