The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Dynamically passing product data from database/product page to cart?

Here is the sameple code from the template I started with:
<!-- link example -->
<a href="https://gtsromanceboutique.foxycart.com/cart?name=Cool Example&price=10&color=red&code=sku123&quot;&gt;Add a red Cool Example</a>
<!-- form example -->
<form action="https://gtsromanceboutique.foxycart.com/cart"; method="post" accept-charset="utf-8">
<input type="hidden" name="name" value="Cool Example" />
<input type="hidden" name="price" value="10" />
<input type="hidden" name="code" value="sku123" />
<label class="label_left">Size</label>
<select name="size">
<option value="small">Small</option>
<option value="medium">Medium</option>
<option value="large">Large</option>
</select>
<input type="submit" name="Add a Cool Example" value="Add a Cool Example" class="submit" />
</form>


I want to get the data for the product from the record I am on dynamically using the data elements.
The elements are:
Item_Description (which is the name of the item) I want this to be the "Name"
RetailPrice (which is the selling price) I want this to be the "Price"
Item_No (which is unique item number from my vendor) I want this to be the "Code"

I would like to add Qty on the form as well. Here is what I got, but it does not seem to recognize the assignments:



<!-- link example -->2:28 PM 9/20/20132:28 PM 9/20/2013
<!--<a href="https://gtsromanceboutique.foxycart.com/cart?name=''+Item_Description+&price=''+RetailPrice=&color=red&code=''+Item_No">Add to cart</a> -->
<!-- form example -->
<form action="https://gtsromanceboutique.foxycart.com/cart"; method="post" accept-charset="utf-8">
<input type="hidden" name="name" value='"'+Item_Description+" />
<input type="hidden" name="price" value='"'+RetailPrice+" />
<input type="hidden" name="code" value='"'+Item_No+" />
<input type="submit" name="Add to cart" value="Add to cart" class="submit" /></form>

I have also tried:


<!-- link example -->
<a href="https://gtsromanceboutique.foxycart.com/cart?name= +Item_Description&price=+RetailPrice&color=red&code=+Item_No">Add a red Cool Example</a>
<!-- form example -->
<form action="https://gtsromanceboutique.foxycart.com/cart"; method="post" accept-charset="utf-8">
<input type="hidden" name="name" value=""+Item_Description />
<input type="hidden" name="price" value=""+RetailPrice />
<input type="hidden" name="code" value=""+Item_No />
<label class="label_left">Size</label>
<select name="size">
<option value="small">Small</option>
<option value="medium">Medium</option>
<option value="large">Large</option>
</select>
<input type="submit" name=""+Item_Description value=""+Item_Description class="submit" />
</form>

The sample form is working but I thought you could use all the products (17,000) from the database and not have to hard code each one into the its own button.

Please tell me that this can be done dynamically and not hard coded
Comments
Sign In or Register to comment.