Dropdown and Quantity inputs on MoreInfo page

General ShopSite user discussion

Dropdown and Quantity inputs on MoreInfo page

Postby mquinn614 » Wed Feb 10, 2010 8:17 pm

Hello all,

First post in this forum. Bought ShopSite Pro about 3 weeks ago, and I've been very pleased with it. Many of the posts in the forum have helped me a great deal.

Here's my issue: On certain MoreInfo pages, I want to have the following:


    - A dropdown box that lets the user select a Subproduct
    - A Quantity box
    - The add to cart button


The code I've used works properly if the user selects the first item in the dropdown list. However, if any other item in the list is selected, "1" of that item is added to the cart, regardless of what is entered in the Quantity input box.


Code: Select all
<form action="[-- SHOPPING_CART_URL BASE --]/order.cgi" method=post>
<input type=hidden name=storeid value=[--Store.id--]>
<input type=hidden name=dbname value=products>
<input type=hidden name=function value=add>
<TABLE style="margin-left: auto; margin-right: auto;">
<TR><TD>
[-- IF PRODUCT.SubProduct --]
<p>
Select Length:
</p>
<SELECT name="itemnum">
[-- LOOP SUBPRODUCTS  --]
  [-- SUBPRODUCTS --]
[-- END_LOOP SUBPRODUCTS --]
</SELECT>
Quantity <input type="text" size="2" name="[-- PRODUCT.RECORDNUMBER --]:qnty" value="1">

[-- ELSE_IF PRODUCT.QuantityPricing--]
[-- PRODUCT.QuantityPricing --]
<input type=hidden name=itemnum value=[-- PRODUCT.RecordNumber --]>
Quantity <input type="text" size="2" name="[-- PRODUCT.RECORDNUMBER --]:qnty" value="1"></center>

[-- ELSE --]
<input type="hidden" name="itemnum" value="[-- PRODUCT.RecordNumber --]">

[-- PRODUCT.Price --]
Quantity <input type="text" size="2" name="[-- PRODUCT.RECORDNUMBER --]:qnty" value="1"></center>

# end the IF PRODUCT.subproducts
[--END_IF--]


<br><br>
########################
#    ADD TO CART       #
########################
<div align="center">
<input type=image src="http://www.expcomm.com/media/buttons/deepred_addtocart.jpg" alt="add_to_cart.gif" name="Add to Cart" alt="Add to Cart">
</div>
</form>



The code works perfectly when the ELSE_IF (Quantity pricing) and ELSE (no quantity or subproduct options) sections are called, but fails when the IF Product.Subproduct section is called. I would bet my problem has something to do with

name="[-- PRODUCT.RECORDNUMBER --]:qnty"

referencing the current product page rather than the dropdown box.

Other than that I am at a total loss. Any suggestions are greatly appreciated!

Thanks,
Mike
mquinn614
 
Posts: 3
Joined: Wed Feb 10, 2010 7:57 pm
Location: US

Postby dortchjm » Thu Feb 11, 2010 7:45 am

Remove the extra <input type> under the Loop Subproducts and that should fix it.

Janice
dortchjm
 
Posts: 119
Joined: Tue Jan 29, 2008 9:24 pm

Postby mquinn614 » Thu Feb 11, 2010 8:34 am

Hi Janice,

Thanks for your advice and for the quick reply! Please allow me to clarify:

Removing the line with [<input type="text"] gets rid of the Quantity box entirely from the MoreInfo page when there is a subproducts dropdown. My goal is to have both the dropdown and a quantity box in this situation. The user would select one subproduct in the dropdown list, then enter a quantity in the textbox, and finally hit add to cart.

Thoughts?
Mike
mquinn614
 
Posts: 3
Joined: Wed Feb 10, 2010 7:57 pm
Location: US

Postby Jim » Thu Feb 11, 2010 2:11 pm

If the product that is being purchased is a subproduct then the [-- Product.recordnumber--] will be incorrect, since it would be for the main product not the subproduct. You would need to get the record number for the subproduct somehow and use that in the quantity field so that the appropriate subproduct is added and the quantity field matches that record number.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby mquinn614 » Fri Feb 12, 2010 7:27 am

Jim hit the nail on the head, that is exactly what I'm trying to accomplish. Can anyone suggest the ideal way to approach this?
mquinn614
 
Posts: 3
Joined: Wed Feb 10, 2010 7:57 pm
Location: US

Postby BFChris » Fri Feb 12, 2010 8:37 am

You'll probably need some Javascript to update the item's Product Record Number value based on the selection in the drop-down menu.
~~Barefoot Chris
--------------------------------
Barefoot Chris Web Design
www.barefootchris.net
--------------------------------
BFChris
 
Posts: 322
Joined: Mon Oct 09, 2006 3:28 pm
Location: PA


Return to User Forum

Who is online

Users browsing this forum: No registered users and 119 guests