Created
August 24, 2015 08:59
-
-
Save vgrish/58ff5f398355d43cb360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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