quantity input fields - howto implement max=max_allowed_purchase

231 views
Skip to first unread message

Michael Lind Hjulskov

unread,
Jul 1, 2014, 11:06:28 AM7/1/14
to django...@googlegroups.com
Hi

Is it hard to implement max=product.max_allowed_purchase on the quantity input fields
I would like that...

I guess I need first to create the max_allowed_purchase
and it needs to check with the strategy and the basket, and the net_stock etc.

after that I need to implement <input name="quantity" max="max_allowed_purchase" ....>
how should I implement it? 
in the form, the form template or in the numberfield widget or?



I'm also Considering to preset my qty fields with zero as initial value. 
and if product is in basket, set that qty number. 
that way my buy buttons actually will be update buttons. but I'm not sure if customers will feel this is natural.
Havent seen any split test done for that, have You?


Michael

David Winterbottom

unread,
Jul 1, 2014, 4:44:53 PM7/1/14
to django-oscar
On 1 July 2014 16:06, Michael Lind Hjulskov <mhju...@gmail.com> wrote:
Hi

Is it hard to implement max=product.max_allowed_purchase on the quantity input fields
I would like that...

I guess I need first to create the max_allowed_purchase
and it needs to check with the strategy and the basket, and the net_stock etc.

after that I need to implement <input name="quantity" max="max_allowed_purchase" ....>
how should I implement it? 
in the form, the form template or in the numberfield widget or?

​In the form class. You can set attributes on the widgets when __init__ gets called. Sounds like a good enhancement.

Might be worth creating a Github issue for it first so that someone else can pick it up in case you run out of time.​

 



I'm also Considering to preset my qty fields with zero as initial value. 
and if product is in basket, set that qty number. 
that way my buy buttons actually will be update buttons. but I'm not sure if customers will feel this is natural.
Havent seen any split test done for that, have You?

​No.​

 


Michael

--
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/cbfd3e38-9fa1-488e-b723-e85d6ca9a1e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
David Winterbottom
Technical Director

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

Chris Hawkes

unread,
Jul 4, 2014, 1:11:22 AM7/4/14
to django...@googlegroups.com, david.win...@tangentlabs.co.uk
i was actually wondering how to simply disable the quantity, so far I have not found the ability to do that yet, but I'm just getting started.  

Michael Lind Hjulskov

unread,
Jul 10, 2014, 7:58:06 AM7/10/14
to django...@googlegroups.com
Hi David 
Okay, I created the github issue here



Med venlig hilsen
Michael Hjulskov

Mobil +45 22116322


Michael Lind Hjulskov

unread,
Jul 10, 2014, 8:03:43 AM7/10/14
to django...@googlegroups.com
Hi Chris
Thats fairly simple. And there are several ways to do it.
Which one is the best practice? I'm not sure.
howto's: Either edit the put in basket form template, or edit the put in basket form and change quantity field to hidden. Or maybe just use the simple basket form in the relevant View.

Or maybe You managed to fix it somehow?

Michael Hjulskov


Michael Lind Hjulskov

unread,
Jul 23, 2014, 10:35:18 AM7/23/14
to django...@googlegroups.com, david.win...@tangentlabs.co.uk
Hi David

I've implemented an alternative way to set max on the qty field and also a  new way to put products in basket
it works via ajax and initially with zero in the qty
if You want to experience it go here: http://www.dyrefoder.dk/produkt/orijen-6-fresh-fish_6/
Im not finished but Im getting there...
NOTE! at this moment its only implemented on this exact site! not in any of the other sites, lists etc.

Michael
Reply all
Reply to author
Forward
0 new messages