record addl info for subproducts

Questions and answers about ShopSite Custom Templates

record addl info for subproducts

Postby dafiwow » Sat Feb 12, 2011 10:42 pm

Our shopsite url is http://womenonwheels.org/store/page50.html

Last year I recorded addl info using the following template, which captured the requested information.
[-- DEFINE PRODUCT --]
[-- INCLUDE Product-GraphicAlign PROCESS --]
[-- INCLUDE Product-Graphic PROCESS --]
[-- INCLUDE Product-Name PROCESS --]
[-- INCLUDE Product-Price PROCESS --]
[-- INCLUDE Product-Sku PROCESS --]
[-- INCLUDE Product-Description PROCESS --]
<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">
<input type="hidden" name="itemnum" value="[-- PRODUCT.RecordNumber --]">
<input type=hidden name="[-- PRODUCT.RecordNumber --]:finoptnum" value=4>

<input name="[-- PRODUCT.RecordNumber --]:finopt:0" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:0" value="Name ">Name<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:0" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:0" value="" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:1" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:1" value="Member Number ">Member Number<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:1" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:1" value="" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:2" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:2" value="Chapter Affiliation ">Chapter Affiliation<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:2" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:2" value="" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:3" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:3" value="Number of previous Ride-Ins attended ">Number of previous Ride-Ins attended<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:3" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:3" value="" size="5"><br>

<select name="[-- PRODUCT.RECORDNUMBER --]:qnty"> <option value="1">1</option> </select>
<input value="Add To Cart" type="submit">
</form>
[-- INCLUDE Product-GraphicRight PROCESS --]
[-- END_DEFINE PRODUCT --]

This year we need to use radio button selection type, so are using subproducts. I have the following template in use, the requested addl information fields appear on the screen, but the input is not captured. What have I missed in the following template code? Note: I do have the same template in use for the product and the subproducts.

[-- DEFINE SUBPRODUCT --]
<input type="radio" checked="checked" name="itemnum" value="[-- PRODUCT.RecordNumber --]">[-- PRODUCT.Name --]
[-- IF PRODUCT.SaleAmount --][-- PRODUCT.SaleAmount --][-- ELSE --]
[-- PRODUCT.Price --][-- END_IF --]
[-- END_DEFINE SUBPRODUCT --]

[-- DEFINE PRODUCT --]
<CENTER>
[-- INCLUDE Product-Graphic PROCESS --]
[-- INCLUDE Product-Name PROCESS --]
[-- INCLUDE Product-Sku PROCESS --]
[-- INCLUDE Product-Description PROCESS --]
<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">
<input type="hidden" name="itemnum" value="[-- PRODUCT.RecordNumber --]">
<input type=hidden name="[-- PRODUCT.RecordNumber --]:finoptnum" value=4>

<input name="[-- PRODUCT.RecordNumber --]:finopt:0" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:0" value="Name ">Name<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:0" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:0" value="" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:1" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:1" value="Member Number ">Member Number<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:1" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:1" value="" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:2" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:2" value="Chapter Affiliation ">Chapter Affiliation<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:2" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:2" value="" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:3" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:3" value="Number of previous Ride-Ins attended ">Number of previous Ride-Ins attended<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:3" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:3" value="" size="5"><br>

<br>

########################
# SUBPRODUCTS #
########################
<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>
<TR><TD>
[-- IF PRODUCT.SubProduct --]
[-- LOOP SUBPRODUCTS --]
[-- SUBPRODUCTS --]<br>
[-- END_LOOP SUBPRODUCTS --]
[-- ELSE --]
<input type="hidden" name="itemnum" value="[-- PRODUCT.RecordNumber --]">
[-- END_IF --]
</TD><TD>

########################
# ADD TO CART #
########################
<input type=image src="[-- OUTPUT_DIRECTORY_URL --]/media/add_to_cart.gif" width=83 height=20 alt="add_to_cart.gif" hspace=3 vspace=3 border=0 align="bottom" name="Add to Cart" alt="Add to Cart">
</TD></TR></TABLE>
</form>
[-- INCLUDE Product-GraphicRight PROCESS --]
[-- END_DEFINE PRODUCT --]

The add to cart on the above products caused an error and would not process the selection. I have now changed it to the following:

[-- DEFINE SUBPRODUCT --]
<input type="radio" checked="checked" name="itemnum" value="[-- PRODUCT.RecordNumber --]">[-- PRODUCT.Name --]
[-- IF PRODUCT.SaleAmount --][-- PRODUCT.SaleAmount --][-- ELSE --]
[-- PRODUCT.Price --][-- END_IF --]
[-- END_DEFINE SUBPRODUCT --]

[-- DEFINE PRODUCT --]
<CENTER>
[-- INCLUDE Product-Graphic PROCESS --]
[-- INCLUDE Product-Name PROCESS --]
[-- INCLUDE Product-Sku PROCESS --]
[-- INCLUDE Product-Description PROCESS --]

<br>

########################
# SUBPRODUCTS #
########################
<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>
<input type="hidden" name="itemnum" value="[-- PRODUCT.RecordNumber --]">
<input type=hidden name="[-- PRODUCT.RecordNumber --]:finoptnum" value=4>

<input name="[-- PRODUCT.RecordNumber --]:finopt:0" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:0" value="Name ">Name<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:0" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:0" value="" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:1" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:1" value="Member Number ">Member Number<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:1" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:1" value="" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:2" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:2" value="Chapter Affiliation ">Chapter Affiliation<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:2" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:2" value="" size="15"><br>

<input name="[-- PRODUCT.RecordNumber --]:finopt:3" type=hidden id="[-- PRODUCT.RecordNumber --]:finopt:3" value="Number of previous Ride-Ins attended ">Number of previous Ride-Ins attended<br>
<input name="[-- PRODUCT.RecordNumber --]:finopt:3" type="text" id="[-- PRODUCT.RecordNumber --]:finopt:3" value="" size="5"><br>

<TABLE>
<TR><TD>
[-- IF PRODUCT.SubProduct --]
[-- LOOP SUBPRODUCTS --]
[-- SUBPRODUCTS --]<br>
[-- END_LOOP SUBPRODUCTS --]
[-- ELSE --]
<input type="hidden" name="itemnum" value="[-- PRODUCT.RecordNumber --]">
[-- END_IF --]
</TD><TD>

########################
# ADD TO CART #
########################
<input type=image src="[-- OUTPUT_DIRECTORY_URL --]/media/add_to_cart.gif" width=83 height=20 alt="add_to_cart.gif" hspace=3 vspace=3 border=0 align="bottom" name="Add to Cart" alt="Add to Cart">
</TD></TR></TABLE>
</form>
[-- INCLUDE Product-GraphicRight PROCESS --]
[-- END_DEFINE PRODUCT --]

Now the selection of the subproducts puts the subproduct and the product into the shopping cart (at least the error went away). What is causing both the product and selected subproduct to be put into the shopping cart with one click of the add to cart button?

Thank you in advance for your help.
dafiwow
dafiwow
 
Posts: 17
Joined: Mon Jan 24, 2011 8:58 pm
Location: Wisconsin

Re: record addl info for subproducts

Postby ShopSite Lauren » Tue Feb 15, 2011 3:03 pm

With the example that you gave, the product fields and the add to cart bottom form are all using the parent product information, so the parent product is added to the cart. Then, you have added in addition to that form, the subproduct information, which is why the subproduct is added to the cart in addition to the parent product. In order to setup what you would like, you would need to have the text entry fields setup for each subproduct, and you would need to remove the following line from your form so that the parent product is not added.
<input type="hidden" name="itemnum" value="[-- PRODUCT.RecordNumber --]">

However, what I would suggest instead, would be to add a pull down menu to your product, so that in addition to the text entry fields that you have, you have a pull down menu which adjusts the price of the product. This would mean that instead of having subproducts that are added to the cart, the same product is added to the cart, but one of the options would be the type of membership that they are getting, and the price will reflect that.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: record addl info for subproducts

Postby dafiwow » Tue Feb 15, 2011 3:29 pm

Thank you for your reply.
Is there a link that will provide the code needed to create the drop-down menu you recommended?
dafiwow
 
Posts: 17
Joined: Mon Jan 24, 2011 8:58 pm
Location: Wisconsin

Re: record addl info for subproducts

Postby ShopSite Lauren » Tue Feb 15, 2011 3:43 pm

1. you would need to go to Products > Edit Product Info, and create an ordering option pull down menu for your product.
http://www.shopsite.com/tutorial/products-orderingoptions.htm

2. You would need to go to Products > Edit Product Layout, and make sure that you have checked the checkbox to make sure you are displaying the pull down menu on your store pages.

3. You would need to make sure that your template has the following tags within your add to cart form.
[-- IF PRODUCT.DisplayOrderingOptions --]
[-- PRODUCT.OptionText --] [-- Order_Option_Menu Column --]
[-- END_IF --]

4. This may interfere with your text entry fields. If this is your only product which uses those text entry fields, they you would want to change the numbers on the finoptnum field, and the text entry fields, finopt, to increase each number by one.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 889
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 76 guests

cron