Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apex_micro_site
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Ali Arshad
apex_micro_site
Commits
0ab6c275
Commit
0ab6c275
authored
Feb 15, 2018
by
Muhammad Usman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
promo working
parent
c5c9ae5c
Pipeline
#315
passed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletions
+35
-1
functions.php
WWW_DATA/wp-content/plugins/apex_global_lms/functions.php
+33
-0
lms.js
...ATA/wp-content/plugins/apex_global_lms/template/js/lms.js
+2
-1
No files found.
WWW_DATA/wp-content/plugins/apex_global_lms/functions.php
View file @
0ab6c275
...
@@ -100,6 +100,11 @@ function vq_lms_process_order()
...
@@ -100,6 +100,11 @@ function vq_lms_process_order()
}
}
$data
=
json_decode
(
stripslashes
(
$_POST
[
'data'
]),
true
);
$data
=
json_decode
(
stripslashes
(
$_POST
[
'data'
]),
true
);
$code
=
""
;
if
(
isset
(
$data
[
'pcode'
]))
{
$code
=
$data
[
'pcode'
];
}
print_r
(
json_decode
(
$_POST
));
if
(
count
(
$data
[
'data'
])
===
0
)
{
if
(
count
(
$data
[
'data'
])
===
0
)
{
echo
"Unable to process your request"
;
echo
"Unable to process your request"
;
...
@@ -144,6 +149,34 @@ function vq_lms_process_order()
...
@@ -144,6 +149,34 @@ function vq_lms_process_order()
}
}
}
}
if
(
$code
!=
""
){
$val
=
-
1
;
$terms
=
get_terms
(
array
(
'taxonomy'
=>
'vq_course_promo'
,
'hide_empty'
=>
false
,
));
foreach
(
$terms
as
$term
)
{
if
(
$code
===
$term
->
name
)
{
$val
=
get_term_meta
(
$term
->
term_id
,
'vq_course_promo_value'
,
true
);
}
}
if
(
$val
!=
-
1
)
{
$discount
=
((
$val
/
100
)
*
$totalCost
)
*
-
1
;
$itemsXML
.=
"<Items><itemname> Discount (
{
$val
}
%) </itemname><quantity>1</quantity><amount>"
.
number_format
(
$discount
,
2
)
.
"</amount></Items>"
;
$postContent
.=
"<b>Discount (
{
$val
}
%)</b>: "
.
number_format
((
float
)
$discount
,
2
,
'.'
,
''
)
.
"<br />"
;
$totalCost
+=
$discount
;
}
}
if
(
$oid
>
0
)
{
if
(
$oid
>
0
)
{
$post
=
array
(
$post
=
array
(
'ID'
=>
$oid
,
'ID'
=>
$oid
,
...
...
WWW_DATA/wp-content/plugins/apex_global_lms/template/js/lms.js
View file @
0ab6c275
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
});
});
if
(
promoValue
>
0
)
{
if
(
promoValue
>
0
)
{
totalCost
=
((
100
-
promoValue
)
/
100
)
*
totalCost
;
totalCost
=
Math
.
ceil
(((
100
-
promoValue
)
/
100
)
*
totalCost
)
;
}
}
});
});
...
@@ -231,6 +231,7 @@
...
@@ -231,6 +231,7 @@
var
data
=
{};
var
data
=
{};
data
.
data
=
learners
;
data
.
data
=
learners
;
data
.
pcode
=
$
(
"#pcode-value"
).
val
();
data
.
id
=
parseInt
(
pid
);
data
.
id
=
parseInt
(
pid
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment