Skip to content

Commit 056f3fa

Browse files
committed
Plugin: BuyCourses: Fix error in coupon processing - refs #5581
1 parent 3caf822 commit 056f3fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plugin/buycourses/src/process.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
$coupon = null;
4141

4242
if (isset($_REQUEST['c'])) {
43-
$couponCode = $_REQUEST['c'];
43+
$couponId = (int) $_REQUEST['c'];
4444
if ($buyingCourse) {
45-
$coupon = $plugin->getCouponByCode($couponCode, BuyCoursesPlugin::PRODUCT_TYPE_COURSE, $_REQUEST['i']);
45+
$coupon = $plugin->getCoupon($couponId, BuyCoursesPlugin::PRODUCT_TYPE_COURSE, $_REQUEST['i']);
4646
} else {
47-
$coupon = $plugin->getCouponByCode($couponCode, BuyCoursesPlugin::PRODUCT_TYPE_SESSION, $_REQUEST['i']);
47+
$coupon = $plugin->getCoupon($couponId, BuyCoursesPlugin::PRODUCT_TYPE_SESSION, $_REQUEST['i']);
4848
}
4949
}
5050

@@ -155,7 +155,7 @@
155155
Display::return_message($plugin->get_lang('CouponRedeemed'), 'success', false)
156156
);
157157

158-
header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/process.php?i='.$_REQUEST['i'].'&t='.$_REQUEST['t'].'&c='.$formCouponValues['coupon_code']);
158+
header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/process.php?i='.$_REQUEST['i'].'&t='.$_REQUEST['t'].'&c='.$coupon['id']);
159159

160160
exit;
161161
}

0 commit comments

Comments
 (0)