Main Content

## Choose 4 from these 8 idea

Oct 31 2017 00:22:38

#1

Join date : 2013-02-11 Posts : 15

I asked this a year or so back but we are back to this and wondering if Mal's-E can be coded for this.

Here's the idea: What we are wanting to do is offer say a dozen or 6 or 4 of something (cookies in this case) from a choice list (array) of maybe 8-10 options/products. Here is an example from a website that is similar to ours: https://www.wickedgoodcupcakes.com/shop-online/show-product/Custom-4-Pack/3

In this case, as you choose, you are allowed 4 jars in this case. If you choose 4 of the Pumpkin Spice Cupcake (for example) you can't add any others without reducing the number of Pumpkin Spices jars and so on. The maximum number you can choose is 4 period. Either 4 of just one item, or 2 of one, one of another and one of another, etc. You get the idea.

Is this feasible with Mal's-E? I understand it probably won't look like the example given, but just wondering how to code this for concept on my daughter's website. Example: She wants to have a mixed dozen cookies for example with 8-10 choices but with a maximum total of 12 cookies allowed in the order. This is just one idea we are wanting to accomplish.

Here is her current website store page using Mals-E ( http://www.mylksbakery.com/order-mylks-cookies-online/ )

Thanks,

Sandy

Here's the idea: What we are wanting to do is offer say a dozen or 6 or 4 of something (cookies in this case) from a choice list (array) of maybe 8-10 options/products. Here is an example from a website that is similar to ours: https://www.wickedgoodcupcakes.com/shop-online/show-product/Custom-4-Pack/3

In this case, as you choose, you are allowed 4 jars in this case. If you choose 4 of the Pumpkin Spice Cupcake (for example) you can't add any others without reducing the number of Pumpkin Spices jars and so on. The maximum number you can choose is 4 period. Either 4 of just one item, or 2 of one, one of another and one of another, etc. You get the idea.

Is this feasible with Mal's-E? I understand it probably won't look like the example given, but just wondering how to code this for concept on my daughter's website. Example: She wants to have a mixed dozen cookies for example with 8-10 choices but with a maximum total of 12 cookies allowed in the order. This is just one idea we are wanting to accomplish.

Here is her current website store page using Mals-E ( http://www.mylksbakery.com/order-mylks-cookies-online/ )

Thanks,

Sandy

Oct 31 2017 09:37:47

#2

Join date : 2008-09-18 Posts : 2973

You should be able to achieve your objective with some javascript assistance (not from me - I'm already out of my depth- it's not great js!)

An elements number is associated with each element in the form. You'll also need some onSubmit code to check mixedqty is a multiple of 12

<form action="http://wwx.aitsafe.com/cf/add.cfm"; method="post" name="that" id="that">

..

<table>

<tr><th colspan="2">Mixed dozen<input type="hidden" name="product[]" value="Mixed dozen:," /></th></tr>

<tr><td>Tuxedo<input type="hidden" name="product[]" value="Tuxedo," /></td>

<td><input name="product[]" type="text" size="5" value="0" onKeyUp="total(this)" /></td></tr>

<tr><td>Butter<input type="hidden" name="product[]" value="Butter," /></td>

<td><input name="product[]" type="text" size="5" value="0" onKeyUp="total(this)" /></td></tr>

<tr><td>Nutty<input type="hidden" name="product[]" value="Nutty," /></td>

<td><input name="product[]" type="text" size="5" value="0" onKeyUp="total(this)" /></td></tr>

<input type="hidden" name="price" value="29.99" />

</table>

<br />

Total <input type="text" name="mixedqty" size="2" />

<input type="submit" value="Buy mixed dozen" />

</form>

the above would give a cart line such as

Mixed dozen: Tuxedo 3, Butter 4, Nutty 5

P.S. - it would also show all of the other options with qty 0.

An elements number is associated with each element in the form. You'll also need some onSubmit code to check mixedqty is a multiple of 12

<form action="http://wwx.aitsafe.com/cf/add.cfm"; method="post" name="that" id="that">

..

<table>

<tr><th colspan="2">Mixed dozen<input type="hidden" name="product[]" value="Mixed dozen:," /></th></tr>

<tr><td>Tuxedo<input type="hidden" name="product[]" value="Tuxedo," /></td>

<td><input name="product[]" type="text" size="5" value="0" onKeyUp="total(this)" /></td></tr>

<tr><td>Butter<input type="hidden" name="product[]" value="Butter," /></td>

<td><input name="product[]" type="text" size="5" value="0" onKeyUp="total(this)" /></td></tr>

<tr><td>Nutty<input type="hidden" name="product[]" value="Nutty," /></td>

<td><input name="product[]" type="text" size="5" value="0" onKeyUp="total(this)" /></td></tr>

<input type="hidden" name="price" value="29.99" />

</table>

<br />

Total <input type="text" name="mixedqty" size="2" />

<input type="submit" value="Buy mixed dozen" />

</form>

the above would give a cart line such as

Mixed dozen: Tuxedo 3, Butter 4, Nutty 5

P.S. - it would also show all of the other options with qty 0.

Alan

*Some shipping help documents are available at* www.stoner.org.uk/mals/

Oct 31 2017 18:25:58

#3

Join date : 2008-09-18 Posts : 3226

Yes, what you're asking for can be done using a javascript built into the page, the script can easily be adapted for any product or quantity on other pages...

See my web site...

http://www.malsforms.com

See my web site...

http://www.malsforms.com

Having trouble with a form or need one building?

Fast turnaround, but I do charge :)

Mal's Forms / Scripts and the syntax are here.