Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Custom price when buying a certain number of a product

238 views
Skip to first unread message

nor...@1kdims.com

unread,
Nov 12, 2013, 9:19:08 AM11/12/13
to django...@googlegroups.com
Hi folks,

first I have to say that django-oscar is an excellent piece of OSS (code wise and especially documentation wise). So thank your for that! So far I've managed to achieve everything I wanted. 

But right now I have a requirement where I don't see how it would be build with oscar.
A little background: Our client is a reseller of special cosmetics. You cold say they're B2B reseller because they only sell to cosmetic studios.
So for almost every product there are three variants (resale, cabinet and big pack). 
When a customer buys at least 6 pieces of the resale variants, they offer a special price, let's name it the Six Pack Price :)

How would you approach this requirement. Is that already covered somehow in oscar? I read through the offers app but it didn't click for my situation.

One alternative would be to add a new price field to the stock record class and add a strategy for the custom pricing based on the amount of items in the basket.

Thanks in advance for your ideas.

Cheers from Berlin,
norman

David Winterbottom

unread,
Nov 12, 2013, 10:38:40 AM11/12/13
to django-oscar
Norman,

On 12 November 2013 14:19, <nor...@1kdims.com> wrote:
Hi folks,

first I have to say that django-oscar is an excellent piece of OSS (code wise and especially documentation wise). So thank your for that! So far I've managed to achieve everything I wanted. 

But right now I have a requirement where I don't see how it would be build with oscar.
A little background: Our client is a reseller of special cosmetics. You cold say they're B2B reseller because they only sell to cosmetic studios.
So for almost every product there are three variants (resale, cabinet and big pack). 
When a customer buys at least 6 pieces of the resale variants, they offer a special price, let's name it the Six Pack Price :)

​To clarify: if your resale products cost ​€10 each, then does buying at least 6 lead to a cheaper base price (eg €8).  So 5 units would cost €50 but 6 would cost €48?

It sounds like it could be handled using the existing offers functionality.  You would need to 
  • create a range that includes all the resale products, then 
  • create a condition that requires the customer to buy at least 6 of them (a "count" condition with value 6 using the resale product range)
  • create a percentage discount incentive that applies to the same range and gives the appropriate % off.
Let me know if that works.


How would you approach this requirement. Is that already covered somehow in oscar? I read through the offers app but it didn't click for my situation.

One alternative would be to add a new price field to the stock record class and add a strategy for the custom pricing based on the amount of items in the basket.

Thanks in advance for your ideas.

Cheers from Berlin,
norman

--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-oscar.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-oscar/4a6e61c3-fa07-44c4-8815-6648658a2dc8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
David Winterbottom
Technical Director

Tangent Labs
84-86 Great Portland Street
London W1W 7NR
England, UK

Norman Rosner

unread,
Nov 12, 2013, 11:33:53 AM11/12/13
to django...@googlegroups.com
Hey David,

But right now I have a requirement where I don't see how it would be build with oscar.
A little background: Our client is a reseller of special cosmetics. You cold say they're B2B reseller because they only sell to cosmetic studios.
So for almost every product there are three variants (resale, cabinet and big pack). 
When a customer buys at least 6 pieces of the resale variants, they offer a special price, let's name it the Six Pack Price :)

To clarify: if your resale products cost €10 each, then does buying at least 6 lead to a cheaper base price (eg €8).  So 5 units would cost €50 but 6 would cost €48?
yes that would be the case. But each resale product does have its own special price. Would your solution work with the different prices?
 

It sounds like it could be handled using the existing offers functionality.  You would need to 
  • create a range that includes all the resale products, then 
  • create a condition that requires the customer to buy at least 6 of them (a "count" condition with value 6 using the resale product range)
  • create a percentage discount incentive that applies to the same range and gives the appropriate % off.
Let me know if that works.

I tried that but i got an error after submitting step one in the creation of an offer:
<ConditionalOffer: special> is not JSON serializable 
It's happening here: 

File "venv/lib/python2.7/site-packages/oscar/apps/dashboard/offers/views.py", line 190, in form_valid
    self._store_object(form)
  File "venv/lib/python2.7/site-packages/oscar/apps/dashboard/offers/views.py", line 128, in _store_object
    self.request.session.save()

Any clues - haven't looked it for now.

Thanks!
norman

David Winterbottom

unread,
Nov 12, 2013, 11:38:57 AM11/12/13
to django-oscar
On 12 November 2013 16:33, Norman Rosner <nor...@1kdims.com> wrote:
Hey David,

But right now I have a requirement where I don't see how it would be build with oscar.
A little background: Our client is a reseller of special cosmetics. You cold say they're B2B reseller because they only sell to cosmetic studios.
So for almost every product there are three variants (resale, cabinet and big pack). 
When a customer buys at least 6 pieces of the resale variants, they offer a special price, let's name it the Six Pack Price :)

To clarify: if your resale products cost €10 each, then does buying at least 6 lead to a cheaper base price (eg €8).  So 5 units would cost €50 but 6 would cost €48?
yes that would be the case. But each resale product does have its own special price. Would your solution work with the different prices?

​Yes, a % discount would work with any price.​

 
 

It sounds like it could be handled using the existing offers functionality.  You would need to 
  • create a range that includes all the resale products, then 
  • create a condition that requires the customer to buy at least 6 of them (a "count" condition with value 6 using the resale product range)
  • create a percentage discount incentive that applies to the same range and gives the appropriate % off.
Let me know if that works.

I tried that but i got an error after submitting step one in the creation of an offer:
<ConditionalOffer: special> is not JSON serializable 
It's happening here: 

File "venv/lib/python2.7/site-packages/oscar/apps/dashboard/offers/views.py", line 190, in form_valid
    self._store_object(form)
  File "venv/lib/python2.7/site-packages/oscar/apps/dashboard/offers/views.py", line 128, in _store_object
    self.request.session.save()

Any clues - haven't looked it for now.

​That's a known Django 1.6 thing which I need to fix.  Should be done soon.

 

Thanks!
norman

--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-oscar.

For more options, visit https://groups.google.com/groups/opt_out.

Norman Rosner

unread,
Nov 12, 2013, 11:44:04 AM11/12/13
to django...@googlegroups.com
On Tue, Nov 12, 2013 at 5:38 PM, David Winterbottom <david.win...@tangentlabs.co.uk> wrote:



On 12 November 2013 16:33, Norman Rosner <nor...@1kdims.com> wrote:
Hey David,

But right now I have a requirement where I don't see how it would be build with oscar.
A little background: Our client is a reseller of special cosmetics. You cold say they're B2B reseller because they only sell to cosmetic studios.
So for almost every product there are three variants (resale, cabinet and big pack). 
When a customer buys at least 6 pieces of the resale variants, they offer a special price, let's name it the Six Pack Price :)

To clarify: if your resale products cost €10 each, then does buying at least 6 lead to a cheaper base price (eg €8).  So 5 units would cost €50 but 6 would cost €48?
yes that would be the case. But each resale product does have its own special price. Would your solution work with the different prices?

Yes, a % discount would work with any price.

Again need for clarification: The majority of prices would have a different discount %. Would that work as well?
 

 
 

It sounds like it could be handled using the existing offers functionality.  You would need to 
  • create a range that includes all the resale products, then 
  • create a condition that requires the customer to buy at least 6 of them (a "count" condition with value 6 using the resale product range)
  • create a percentage discount incentive that applies to the same range and gives the appropriate % off.
Let me know if that works.

I tried that but i got an error after submitting step one in the creation of an offer:
<ConditionalOffer: special> is not JSON serializable 
It's happening here: 

File "venv/lib/python2.7/site-packages/oscar/apps/dashboard/offers/views.py", line 190, in form_valid
    self._store_object(form)
  File "venv/lib/python2.7/site-packages/oscar/apps/dashboard/offers/views.py", line 128, in _store_object
    self.request.session.save()

Any clues - haven't looked it for now.

That's a known Django 1.6 thing which I need to fix.  Should be done soon.

I'm on 1.5.5 right now, if that helps.  

 

Thanks!
norman

--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-oscar.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-oscar/CAEBC%2Bt6P2GiUqssd2U5xc4L93jjvT1_ZUSfEJ940QvixM6u%2Bcg%40mail.gmail.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
David Winterbottom
Technical Director

Tangent Labs
84-86 Great Portland Street
London W1W 7NR
England, UK

You received this message because you are subscribed to a topic in the Google Groups "django-oscar" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-oscar/qHG7Joe3HrQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-oscar...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--

Norman Rosner | CEO | 1kdims UG (haftungsbeschränkt) | Warschauer Str. 24 | 10243 Berlin | +49 151 423 22 016 | Amtsgericht Berlin-Charlottenburg / HRB 140253 B

jona...@machtfit.de

unread,
Nov 12, 2013, 5:56:39 PM11/12/13
to django...@googlegroups.com

Again need for clarification: The majority of prices would have a different discount %. Would that work as well?
  

If you have significantly less than 99 distinct discounts to cover, you could use a CountCondition with a PercentageBenefit and create one Offer for each distinct discount, each with its own product Range.
Alternatively you can create your own Condition, which would be more involved than using batteries included but possible by design.
Have a look at https://github.com/tangentlabs/django-oscar/blob/master/oscar/apps/offer/models.py for Condition and Benefit, along with the currently available concrete implementations.

I'm on 1.5.5 right now, if that helps.  

SESSION_SERIALIZER defaults to JSONSerlializer for projects created with django-admin.py startproject since Django 1.5.3 (https://docs.djangoproject.com/en/1.5/ref/settings/#session-serializer).
If you are in a hurry ou can of course opt-out of that default until https://github.com/tangentlabs/django-oscar/pull/916 is completed and merged. 1.6 is already released so it wont be long.


Norman Rosner

unread,
Nov 14, 2013, 7:38:16 AM11/14/13
to django...@googlegroups.com
Hey there,

thanks Jonathan for the comments. Just wanted to let you folks know what I did.

Since I have a couple hundred products, nearly a third with special prices when at least 6 pieces are bought and the prices are not percentage based, using offers and ranges seems to be not the right thing. At least from my understandings of offers and ranges. Instead I customized the stock record and line model. In the line model#unit_price_excl_tax I check if the product in line is six pack price applicable. 
I had mainly two reasons to build it that way:
a) enable the user to enter price data at one specific point
b) show the original and the special price within each line in the basket

Cheers,
norman


--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to a topic in the Google Groups "django-oscar" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-oscar/qHG7Joe3HrQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-oscar...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-oscar.

For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages