本文整理汇总了PHP中coupon::getSessionCoupon方法的典型用法代码示例。如果您正苦于以下问题:PHP coupon::getSessionCoupon方法的具体用法?PHP coupon::getSessionCoupon怎么用?PHP coupon::getSessionCoupon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coupon
的用法示例。
在下文中一共展示了coupon::getSessionCoupon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateTempInvoice
function updateTempInvoice()
{
global $DB, $objComm, $lang;
include_once MODELS . '/member_model.php';
include_once MODELS_ADMIN . '/coupon_model.php';
$objMember = new member();
$InvRow = $this->getInvoice();
$memberid = $_SESSION['register']['member_id'];
$objCoupon = new coupon();
$rowCoupon = $objCoupon->getSessionCoupon();
if ($InvRow->id > 0 && $rowCoupon->id > 0) {
$row = $objMember->getMembers($memberid);
if ($rowCoupon->discount_price > 0) {
$discount = $rowCoupon->discount_price;
} else {
$discount = $row->amount_paid * $rowCoupon->discount_perc / 100;
}
$finalAmount = $row->amount_paid - $discount;
$arrData['coupon_code'] = $rowCoupon->coupon_code;
$arrData['coupon_id'] = $rowCoupon->id;
$arrData['discount_amt'] = $discount;
$arrData['final_total_amt'] = $finalAmount;
$arrData['payment_status'] = 'Pending';
$where = "`id` = '" . $InvRow->id . "'";
$DB->updateRecord('invoice', $arrData, $where, '');
return json_encode(array('discount' => '$' . number_format($discount, 2), 'final' => '$' . number_format($finalAmount, 2)));
} else {
$_SESSION['member_error'] = "coupon_code_error";
$objComm->redirect1("index.php?model=member&action=payment");
}
}