本文整理汇总了PHP中JObject::_calculateTrialPeriod方法的典型用法代码示例。如果您正苦于以下问题:PHP JObject::_calculateTrialPeriod方法的具体用法?PHP JObject::_calculateTrialPeriod怎么用?PHP JObject::_calculateTrialPeriod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JObject
的用法示例。
在下文中一共展示了JObject::_calculateTrialPeriod方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _secondPayment
/**
* Prepares the payment form
* and returns HTML Form to be displayed to the user
* for the second of two payments (when cart has both recurring and non-recurring items)
*
* Submit button target for onsite payments & return URL for offsite payments should be:
* index.php?option=com_tienda&view=checkout&task=confirmPayment&orderpayment_type=xxxxxx
* where xxxxxxx = $_element = the plugin's filename
*
* @return string HTML to display
*/
public function _secondPayment($order_id)
{
$order = JTable::getInstance('Orders', 'TiendaTable');
$order->load($order_id);
$items = $order->getItems();
$vars->is_recurring = $order->isRecurring();
// create a new orderpayment record
// we're creating a new orderpayment record,
// this one just for the recurring item
$orderpayment = JTable::getInstance('OrderPayments', 'TiendaTable');
$orderpayment->order_id = $order->order_id;
$orderpayment->orderpayment_type = $this->_element;
$orderpayment->transaction_status = JText::_('COM_TIENDA_INCOMPLETE');
$amount = $order->recurring_trial ? $order->recurring_trial_price : $order->recurring_amount;
$orderpayment->orderpayment_amount = $amount;
if (!$orderpayment->save()) {
// Output error message and halt
JError::raiseNotice('Error Saving Pending Payment Record', $orderpayment->getError());
return false;
}
// prepare the payment form
$vars = new JObject();
$vars->order_id = $order_id;
$vars->orderpayment_id = $orderpayment->orderpayment_id;
$vars->orderpayment_amount = $orderpayment->orderpayment_amount;
$vars->orderpayment_type = $this->_element;
$vars->cmd = '_xclick-subscriptions';
$vars->_calculateTrialPeriod($order);
$vars->order = $order;
$vars->orderitems = $items;
// set payment plugin variables
$vars->merchant_email = $this->_getParam('merchant_email');
$vars->post_url = $this->_getPostUrl();
// are there both recurring and non-recurring items in cart?
// if so, then user must perform two checkouts,
// so store a flag in the return_url
$vars->return_url = JURI::root() . "index.php?option=com_tienda&view=checkout&task=confirmPayment&orderpayment_type=" . $this->_element . "&paction=display_message";
$vars->cancel_url = JURI::root() . "index.php?option=com_tienda&view=checkout&task=confirmPayment&orderpayment_type=" . $this->_element . "&paction=cancel";
$vars->notify_url = JURI::root() . "index.php?option=com_tienda&view=checkout&task=confirmPayment&orderpayment_type=" . $this->_element . "&paction=process&tmpl=component";
$vars->currency_code = $this->_getParam('currency', 'USD');
// TODO Eventually use: Tienda::getInstance()->get('currency');
// set variables for user info
$row = JTable::getInstance('OrderInfo', 'TiendaTable');
$row->load(array('order_id' => $order_id));
$data = array('orderinfo' => $row);
$vars->first_name = $data['orderinfo']->shipping_first_name;
$vars->last_name = $data['orderinfo']->shipping_last_name;
$vars->email = $data['orderinfo']->user_email;
$vars->address_1 = $data['orderinfo']->shipping_address_1;
$vars->address_2 = $data['orderinfo']->shipping_address_2;
$vars->city = $data['orderinfo']->shipping_city;
//get 2-character IS0-3166-1 country code
$countryTable = JTable::getInstance('Countries', 'TiendaTable');
$countryTable->load($data['orderinfo']->shipping_country_id);
$vars->country = $countryTable->country_isocode_2;
//$vars->country = $data['orderinfo']->shipping_country_name;
$vars->region = $data['orderinfo']->shipping_zone_name;
$vars->postal_code = $data['orderinfo']->shipping_postal_code;
$html = $this->_getLayout('secondpayment', $vars);
$html .= $this->_getLayout('prepayment', $vars);
return $html;
}