Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ecommerce
Commits
43d9981e
Commit
43d9981e
authored
May 11, 2018
by
Saleem Latif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
track enrollment code purchases on ecommerce basket page.
parent
4ed4b74d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
ecommerce/extensions/checkout/signals.py
+17
-12
No files found.
ecommerce/extensions/checkout/signals.py
View file @
43d9981e
...
...
@@ -27,22 +27,10 @@ def track_completed_order(sender, order=None, **kwargs): # pylint: disable=unus
if
order
.
total_excl_tax
<=
0
:
return
for
line
in
order
.
lines
.
all
():
if
line
.
product
.
is_coupon_product
or
line
.
product
.
is_enrollment_code_product
:
return
voucher
=
order
.
basket_discounts
.
filter
(
voucher_id__isnull
=
False
)
.
first
()
coupon
=
voucher
.
voucher_code
if
voucher
else
None
try
:
bundle_id
=
BasketAttribute
.
objects
.
get
(
basket
=
order
.
basket
,
attribute_type__name
=
BUNDLE
)
.
value_text
except
BasketAttribute
.
DoesNotExist
:
bundle_id
=
None
properties
=
{
'orderId'
:
order
.
number
,
'total'
:
str
(
order
.
total_excl_tax
),
'currency'
:
order
.
currency
,
'coupon'
:
coupon
,
'discount'
:
str
(
order
.
total_discount_incl_tax
),
'products'
:
[
{
...
...
@@ -60,6 +48,23 @@ def track_completed_order(sender, order=None, **kwargs): # pylint: disable=unus
],
}
for
line
in
order
.
lines
.
all
():
if
line
.
product
.
is_enrollment_code_product
:
track_segment_event
(
order
.
site
,
order
.
user
,
'Bulk Enrollment Codes Purchase Completed'
,
properties
)
if
line
.
product
.
is_coupon_product
or
line
.
product
.
is_enrollment_code_product
:
return
voucher
=
order
.
basket_discounts
.
filter
(
voucher_id__isnull
=
False
)
.
first
()
coupon
=
voucher
.
voucher_code
if
voucher
else
None
try
:
bundle_id
=
BasketAttribute
.
objects
.
get
(
basket
=
order
.
basket
,
attribute_type__name
=
BUNDLE
)
.
value_text
except
BasketAttribute
.
DoesNotExist
:
bundle_id
=
None
properties
[
'coupon'
]
=
coupon
try
:
bundle_id
=
BasketAttribute
.
objects
.
get
(
basket
=
order
.
basket
,
attribute_type__name
=
BUNDLE
)
.
value_text
program
=
get_program
(
bundle_id
,
order
.
basket
.
site
.
siteconfiguration
)
...
...
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