Git Product home page Git Product logo

Comments (12)

mbrochh avatar mbrochh commented on July 22, 2024

grr yea I know... I once did a path that introduced a form with proper validation for the cart view but then I found out that the product detali view suffers from the same problem.

I had started on another patch to introduce a django form to the product detail view as well but then I faced yet another delicate problem:

SQL can only save so big values in the field that holds the sum of all items. While we might be able to check that the toal sum is not too big on the cart overview (in the form's clean method), we cannot check that so easily on the product detail view. Someone might enter a quantity of 999999999, which might still be ok, but then THAT has to be multiplied with some price and will most probably already result in a value that is too big for the database. additionaly, someone might add 99999999 items to his cart, then go back to the product detail page and add another 999999999...

I don't know what the best practice is for ecommerce solutions. I bet every shop has to deal with this? Do they just assume that no one will ever enter crazy amounts?

from django-shop.

chrisglass avatar chrisglass commented on July 22, 2024

I know it's a pretty ugly solution, but how about putting a setting or a constant for it? I think nobody will blame us if we put "cart can only handle 99999 objects of the same type" in a "known limitations" somewhere... What do you think?

from django-shop.

chrisglass avatar chrisglass commented on July 22, 2024

I mean put one higher limit on the price as well obviously... I think It's fair to assume people buying 5x5000k$ yatchs will probably not use an online shop?

from django-shop.

chrisglass avatar chrisglass commented on July 22, 2024

I'm kind of spammy, but I noticed this shop in particular uses another trick to limit the amount (drop down boxes).
http://shop.canonical.com/

from django-shop.

mbrochh avatar mbrochh commented on July 22, 2024

Hehe the DDLs there are kind of silly because on the cart they offer text inputs again :) But it's a nice idea.

from django-shop.

zeus avatar zeus commented on July 22, 2024

IMHO shop should handle big values. For example we build a panel for wholesale customers, and this panel should be able to handle very big values.

from django-shop.

mbrochh avatar mbrochh commented on July 22, 2024

zeus sure, everyone would want to have that feature. But how do you think this can be done? It's the database that restricts us. Should we save all prices and amounts and total sums as strings? o_O

from django-shop.

zeus avatar zeus commented on July 22, 2024

mbrochh AFAIK we have DecimalField for these fields. And DecimalField stored in db with Deciaml type which is in fact just string. I can't see db level limitations here :(.

from django-shop.

mbrochh avatar mbrochh commented on July 22, 2024

Hmm then I have to try to debug that issue again. As far as I can remember I got a MYSQL error when having a large amount of products which result in a very large total amount.

from django-shop.

zeus avatar zeus commented on July 22, 2024

We have limitation here - https://github.com/divio/django-shop/blob/master/shop/util/fields.py#L6 since someone think, that sum/prices can't contains more than 12 digits >_<.

My personal opinion - this should be configurable option with default = 20.

from django-shop.

chrisglass avatar chrisglass commented on July 22, 2024

This is changed and should be fixed in #138

Let me know if that addresses the problem

from django-shop.

jrief avatar jrief commented on July 22, 2024

Closed. Please check version 0.9.

from django-shop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.