Minimum Quantity Solution

General ShopSite user discussion

Minimum Quantity Solution

Postby Jacque » Sat Oct 02, 2010 5:35 am

In ShopSite 10 I needed the quantity input box to default to the minimum quantity for the respective product, not just the default of 1. I managed to work out a solution and wanted to post it in case others may need the same thing. I achieved this using an extra field and Javascript.

Pull up a product and go into "Edit Product Info". Go to the Extra Fields section at the bottom. If you do not have Product Fields in this section, you may need to turn that feature on by clicking "Extra Field Setup". Add the minimum quantity to Product Field 2 (or whichever you want), and save. To do this as a mass upload, in your spreadsheet (or whatever you use for mass uploads) copy your existing minimum quantity into Product Field 2.

In the product template, find the Qty section, which should look something like this:
[-- STORE.Qty --] <input type=text size=2 name="[-- PRODUCT.RecordNumber --]:qnty" value="1" >

Replace it with this:

[-- STORE.Qty --] <input id="prdQty" type=text size=2 name="[-- PRODUCT.RecordNumber --]:qnty" value="1" >
<script language="javascript">
document.getElementById("prdQty").value = "[-- PRODUCT.Field2 --]";
</script>

All this is doing is adding an ID to the quantity input box, and then JS uses that ID to set the value to whatever is in Extra Field #2. If you use a different Extra Field, just change [-- PRODUCT.Field2 --] to whatever Extra Field number you're using. For example: [-- PRODUCT.Field3 --].

HTH!
Jacque
 
Posts: 9
Joined: Wed Nov 05, 2008 8:11 am

Re: Minimum Quantity Solution

Postby mjbrunelle » Sat Oct 02, 2010 1:56 pm

This will work for a single product but what if you have multiple products on a page, and you only want to up date those that have a minimum specified.

Solution:

In Page Template:

[-- VAR.idCounter 0 --]

[-- LOOP PRODUCTS --]
[-- PRODUCT --]
[-- VAR.idCounter INC --]
[-- END_LOOP PRODUCTS --]

In Product Template:

<input id="prdQty[-- VAR.idCounter --]" class="productQnty" type=text size=2 name="[-- PRODUCT.SKU --]:qnty" value="1">
[-- IF PRODUCT.Field2 --]
<script language="javascript">document.getElementById("prdQty[-- VAR.idCounter --]").value = "[-- PRODUCT.Field2 --]";
</script>
[-- END_IF --]

Gives you a unique ID per product record for multiple product pages.
mjbrunelle
 
Posts: 147
Joined: Sun Jun 21, 2009 5:09 am

Re: Minimum Quantity Solution

Postby leila » Mon Oct 04, 2010 10:58 pm

I sure hope I could have read this thread first before, it looks easy enough to follow. I had the same issue and since I'm technologically challenged I have enlist the help of my neighbor's kid.
leila
 
Posts: 1
Joined: Mon Oct 04, 2010 10:46 pm

Re: Minimum Quantity Solution

Postby Jacque » Tue Oct 05, 2010 5:23 am

That's awesome. I love it. :)
Jacque
 
Posts: 9
Joined: Wed Nov 05, 2008 8:11 am


Return to User Forum

Who is online

Users browsing this forum: No registered users and 36 guests