Hello all,
I've been looking through the google group mails and the documentation, and I'm having trouble figuring this one how. Here's what I want to do:
Give a 10% discount for purchases over $400
Replace that with a 15% discount for orders over $500
Replace that with a 20% discount for orders over $650
The documentation tells how to create a custom offer condition:
And here is one example of an implementation of a custom offer condition:
So I'm starting with the example they give. But I need more info:
1. Do I fork the offer app? I have done so and placed the new files in folder oscaroverrides/offer/
2. What do I name the files, and what code to I put in there? Here's what I have so far:
# oscaroverrides/offer/my_custom_discount.py
from oscar.apps.offer import models
class TenPercentForOver400(models.Condition):
name = "Save 10 percent orders over $400"
class Meta:
proxy = True
def is_satisfied(self, offer, basket):
if basket.total_excl_tax < 500:
return False
return True
from oscar.apps.offer.custom import create_condition
create_condition(TenPercentForOverTJS400)
Did I name the file correctly? How do I let django-oscar know that it exists and to execute it?
3. I need to do more, as per the instructions in the documentation. For example the documentation says to implement "a consume_items method that marks basket items as consumed once the condition has been met". Is this simply a matter of using the following code:
def consume_items(self, offer, basket, affected_lines):
return
Shouldn't the items be consumed only when they have been purchased?
4. How do I apply the discount?
Thanks,