本文整理汇总了PHP中RSMembershipHelper::getTransactionMembershipFields方法的典型用法代码示例。如果您正苦于以下问题:PHP RSMembershipHelper::getTransactionMembershipFields方法的具体用法?PHP RSMembershipHelper::getTransactionMembershipFields怎么用?PHP RSMembershipHelper::getTransactionMembershipFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RSMembershipHelper
的用法示例。
在下文中一共展示了RSMembershipHelper::getTransactionMembershipFields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _execute
function _execute()
{
$app = JFactory::getApplication();
$task = $app->input->get('task', '', 'string');
if ($task == 'addextra') {
$this->_bindId();
} else {
$this->_setId();
if ($task == 'addextrapayment') {
// empty session
$this->_emptySession();
$membership = $this->getMembership();
$extra = $this->getExtra();
$paymentplugin = $app->input->get('payment', 'none', 'cmd');
// calculate the total price
$total = $extra->price;
$user = JFactory::getUser();
$user_id = $user->get('id');
$row = JTable::getInstance('Transaction', 'RSMembershipTable');
$row->user_id = $user_id;
$row->user_email = $user->get('email');
$this->_data = new stdClass();
$this->_data->username = $user->get('username');
$this->_data->name = $user->get('name');
$this->_data->email = $user->get('email');
$this->_data->fields = RSMembershipHelper::getUserFields($user->get('id'));
$membership_fields = RSMembershipHelper::getTransactionMembershipFields($user->get('id'), $membership->last_transaction_id);
if (count($membership_fields)) {
$this->_data->membership_fields = $membership_fields;
}
$row->user_data = serialize($this->_data);
$row->type = 'addextra';
$params = array();
$params[] = 'id=' . $this->_id;
$params[] = 'membership_id=' . $membership->id;
$params[] = 'extras=' . $extra->id;
$row->params = implode(';', $params);
// params, membership, extras etc
$row->date = JFactory::getDate()->toSql();
$row->ip = $_SERVER['REMOTE_ADDR'];
$row->price = $total;
$row->currency = RSMembershipHelper::getConfig('currency');
$row->hash = '';
$row->gateway = $paymentplugin == 'none' ? 'No Gateway' : RSMembership::getPlugin($paymentplugin);
$row->status = 'pending';
$this->_html = '';
// trigger the payment plugin
$delay = false;
$args = array('plugin' => $paymentplugin, 'data' => &$this->_data, 'extras' => array(), 'membership' => $membership, 'transaction' => &$row, 'html' => &$this->_html);
$returns = $app->triggerEvent('onMembershipPayment', $args);
// PHP 5.4 fix...
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
foreach ($returns as $value) {
if ($value) {
$this->_html = $value;
}
}
}
$properties = $row->getProperties();
$returns = $app->triggerEvent('delayTransactionStoring', array(array('plugin' => $paymentplugin, 'properties' => &$properties, 'delay' => &$delay)));
// PHP 5.4 fix...
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
foreach ($returns as $value) {
if ($value) {
$delay = true;
}
}
}
// plugin can delay the transaction storing
if (!$delay) {
// store the transaction
$row->store();
// store the transaction id
$this->transaction_id = $row->id;
// finalize the transaction (send emails)
RSMembership::finalize($this->transaction_id);
// approve the transaction
if ($row->status == 'completed' || $row->price == 0 && $membership->activation != 0) {
RSMembership::approve($this->transaction_id, true);
}
if ($row->price == 0) {
$app->redirect(JRoute::_(RSMembershipRoute::ThankYou(), false));
}
}
}
}
}