You must specify a name to add a product to your shopping cart.

chas5427chas5427 Member
in Help edited June 2008
am getting this error when adding an item to the cart. worked for links, but not for the forms that i am using.

and can you tell me the proper syntax for the view cart button to add class="foxycart" ? (see below)

here is the form code:

<form action="https://inspirestore.foxycart.com/cart"; class="foxycart" method="post">
<input type="hidden" name="[*longtitle:rawurlencode*]" value="[*longtitle*]" />
<input type="hidden" name="price" value="[*price*]>
<div id="contentstore">[*#content*]</div>
<div id="pricestore">Price: <b>$[*price*]</b></div>

<div id="colorsizeprice">
<div id="colorstore"><select name="color" size="1">
<option value="color" selected>Select Color</option>
<option value="[*color1*]">[*color1*]</option>
<option value="[*color2*]">[*color2*]</option>
<option value="[*color3*]">[*color3*]</option>
<option value="[*color4*]">[*color4*]</option>
<option value="[*color5*]">[*color5*]</option>
<option value="[*color6*]">[*color6*]</option>
</select></div>
<div id="sizestore"><!-- <select name="size" size="1">
<option value="size" selected>Select Size</option>
<option value="[*size1*]">[*size1*]</option>
<option value="[*size2*]">[*size2*]</option>
<option value="[*size3*]">[*size3*]</option>
<option value="[*size4*]">[*size4*]</option>
<option value="[*size5*]">[*size5*]</option>
</select> -->  </div>
<div id="quantitystore">Quantity: <input name="quantity" type="text" value="1" size="4" maxlength="4"></div>
</div>
<div id="orderstore">
<div id="viewcart"><input name="View Cart" value="View Cart" type="button" onClick="window.location='https://inspirestore.foxycart.com/cart?cart=view';class="foxycart"></div><div id="addtocart"><input type="submit" value="Add to Cart" /></div>
</div><!--orderstore-->
<div id="storefooter">   </div></form>


thanks! - chas
Comments
  • brettbrett FoxyCart Team
    Hi Chas.

    <input type="hidden" name="[*longtitle:rawurlencode*]" value="[*longtitle*]" />

    That should be:
    <input type="hidden" name="name" value="[*longtitle*]" />

    ;)

    PS: You don't need to url encode form values, just links. Though if you're allowing your users to enter values themselves you'll want to make sure they don't put in any double- or single-quotes into the longtitle or it might break your form.

    Let me know if that helps.
  • lukeluke FoxyCart Team
    As for your view cart question, just setup a link to ?cart=view or set that as the action of a form with a "cart" hidden input with the value "view". Both will need the "foxycart" class.
  • thanks guys. the foxybox is now appearing.

    looks like my attempt at a second button within the main form will not work? will create another form for the view cart button . . .

    and i must say, i am very impressed with foxycart and how it works. nicely done!

    chas
  • brettbrett FoxyCart Team
    If you want the view cart button within the form, just make it a link and you'll be good to go ;)
Sign In or Register to comment.