您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

offer.rst 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. ======
  2. Offers
  3. ======
  4. Oscar ships with a powerful and flexible offers engine which is contained in the
  5. offers app. It is based around the concept of 'conditional offers' - that is,
  6. a basket must satisfy some condition in order to qualify for a benefit.
  7. Oscar's dashboard can be used to administer offers.
  8. Structure
  9. ---------
  10. A conditional offer is composed of several components:
  11. * Customer-facing information - this is the name, description and type of an
  12. offer.
  13. These will be visible on offer-browsing pages as well as within the basket and
  14. checkout pages.
  15. * Availability - this determines when an offer is available.
  16. * Condition - this determines when a customer qualifies for the offer (e.g. spend
  17. £20 on DVDs). There are various condition types available.
  18. * Benefit - this determines the discount a customer receives. The discount can
  19. be against the basket cost or the shipping for an order.
  20. Availability
  21. ------------
  22. An offer's availability can be controlled by several settings which can be used
  23. in isolation or combination:
  24. * Date range - a date can be set, outside of which the offer is unavailable.
  25. * Max global applications - the number of times an offer can be used can be capped.
  26. Note that an offer can be used multiple times within the same order so this
  27. isn't the same as limiting the number of orders that can use an offer.
  28. * Max user applications - the number of times a particular user can use an
  29. offer. This makes most sense to use in sites that don't allow anonymous
  30. checkout as it could be circumvented by submitting multiple anonymous orders.
  31. * Max basket applications - the number of times an offer can be used for a
  32. single basket/order.
  33. * Max discount - the maximum amount of discount an offer can give across all
  34. orders. For instance, you might have a marketing budget of £10000 and so you
  35. could set the max discount to this value to ensure that once £10000 worth of
  36. benefit had been awarded, the offer would no longer be available. Note that
  37. the total discount would exceed £10000 as it would have to cross this
  38. threshold to disable the offer.
  39. Conditions
  40. ----------
  41. There are 3 built-in condition types that can be created via the dashboard.
  42. Each needs to be linked with a range object, which is subset of the product
  43. catalogue. Ranges are created independently in the dashboard.
  44. * Count-based - i.e. a customer must buy X products from the condition range
  45. * Coverage-based - i.e. a customer must buy X DISTINCT products from the condition range. This can be used to
  46. create "bundle" offers.
  47. * Value-based - i.e. a customer must spend X on products from the condition range
  48. It is also possible to create custom conditions in Python and register these so they
  49. are available to be selected within the dashboard. For instance, you could
  50. create a condition that specifies that the user must have been registered for
  51. over a year to qualify for the offer.
  52. Under the hood, conditions are defined by 3 attributes: a range, a type
  53. and a value.
  54. Benefits
  55. --------
  56. There are several types of built-in benefit, which fall into one of two
  57. categories: benefits that give a basket discount, and those that give a shipping
  58. discount.
  59. Basket benefits:
  60. * Fixed discount - i.e. get £5 off DVDs
  61. * Percentage discount - i.e. get 25% off books
  62. * Fixed price - i.e. get any DVD for £8
  63. * Multi-buy - i.e. get the cheapest product that meets the condition for free
  64. Shipping benefits (these largely mirror the basket benefits):
  65. * Fixed discount - i.e. £5 off shipping
  66. * Percentage discount - i.e. get 25% off shipping
  67. * Fixed price - i.e. get shipping for £8
  68. Like conditions, it is possible to create a custom benefit. An example might be
  69. to allow customers to earn extra credits/points when they qualify for some
  70. offer. For example, spend £100 on perfume, get 500 credits (note credits don't
  71. exist in core Oscar but can be implemented using the 'accounts' plugin).
  72. Under the hood, benefits are modelled by 4 attributes: a range, a type, a value
  73. and a setting for the maximum number of basket items that can be affected by a
  74. benefit. This last settings is useful for limiting the scope of an offer. For
  75. instance, you can create a benefit that gives 40% off ONE products from a given
  76. range by setting the max affected items to 1. Without this setting, the benefit
  77. would give 40% off ALL products from the range.
  78. Benefits are slightly tricky in that some types don't require a range and ignore
  79. the value of the max items setting.
  80. Examples
  81. --------
  82. Here's some example offers:
  83. *3 for 2 on books*
  84. 1. Create a range for all books.
  85. 2. Use a **count-based** condition that links to this range with a value of 3.
  86. 3. Use a **multibuy** benefit with no value (the value is implicitly 1)
  87. *Spend £20 on DVDs, get 25% off*
  88. 1. Create a range for all DVDs.
  89. 2. Use a **value-based** condition that links to this range with a value of 20.
  90. 3. Use a **percentage discount** benefit that links to this range and has a
  91. value of 25.
  92. *Buy 2 Lonely Planet books, get £5 off a Lonely Planet DVD*
  93. 1. Create a range for Lonely Planet books and another for Lonely Planet DVDs
  94. 2. Use a **count-based** condition linking to the book range with a value of 2
  95. 3. Use a **fixed discount** benefit that links to the DVD range and has a value of 5.
  96. More to come...
  97. Abstract models
  98. ---------------
  99. .. automodule:: oscar.apps.offer.abstract_models
  100. :members:
  101. Models
  102. -------
  103. .. automodule:: oscar.apps.offer.models
  104. :members:
  105. Views
  106. -----
  107. .. automodule:: oscar.apps.offer.views
  108. :members: