Forum Moderators: open

Message Too Old, No Replies

Require total of 6 items on order form

I need to require that customer orders 6 items

         

TheKG

7:30 pm on Feb 8, 2021 (gmt 0)

10+ Year Member Top Contributors Of The Month



I need to design a form for customers to order items in different colors. I need to require that they order a total of 6 items which may be of any combination of the colors offered. So, they can order 2 red, 3 blue and 1 black. In any event the total quantity they order on this form must be 6. My pages are designed using CSS, MySql and PHP. I have some JS, but am not experienced enough in JS to begin to attempt writing it for this purpose.

Any assistance is appreciated.

NickMNS

1:23 pm on Feb 9, 2021 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It is difficult to really help here as we have no idea of the code or the specifics of what you need to do. This thread should not be about specifics, but rather about helping you solve a problem that others may face and/or could benefit from.

I will just say that you would likely want to watch the total quantity of items ordered and if that equals 6 then do what you need to do. I must assume that total quantity will be the sum of the quantity selected in multiple input boxes, so you''ll need to watch for a "change" event on the inputs. And for the result, well I assume you would disable the submit but until the total quantity reaches 6. This should give you a starting point.

not2easy

2:05 pm on Feb 9, 2021 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You might find some first steps at w3schools, they offer tutorials and let you try things out at your own pace. As NickMNS said, we're happy to help for problem solving but you should bring in whatever you need help with.

Take a look to see if you find something to start with: https://www.w3schools.com/js/js_input_examples.asp

lammert

4:44 pm on Feb 9, 2021 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is it for a commonly known eCommerce platform like Woocommerce or Magento? For the better-known platforms plugins exist which allow you to group items in categories and assign min/max amount values to these categories. No need to do any custom programming.

TheKG

5:44 pm on Feb 15, 2021 (gmt 0)

10+ Year Member Top Contributors Of The Month



First, I have been using NotePad++ to design my PHP pages for quite some time now and always look for answers online when a new issue arises. I have determined that because of the "where" clauses used on my page to call the information from the data base, I would not be able to use a "sum" field. I have since completed the redesign and am pleased with the results.