I am trying to add 'Add to Cart' buttons to each product listed on the the product/category page which seems to be a fairly straight forward job but it doesn't work. I am using something like this:
Code: Select all
<form action="<?php echo $products[$j]['href2']; ?>" method="post" enctype="multipart/form-data" id="category_product">
<input type="hidden" name="quantity" size="3" value="1" />
<a onclick="$('#category_product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
<input type="hidden" name="product_id" value="<?php echo $products[$j]['product_id']; ?>" />
</form>
Code: Select all
<form action="<?php echo $products[$j]['href2']; ?>" method="post" enctype="multipart/form-data" id="category_product">
<input type="hidden" name="quantity" size="3" value="1" />
<input type="button" onclick="form.submit();" id="add_to_cart" value="<?php echo $button_add_to_cart; ?>" />
<input type="hidden" name="product_id" value="<?php echo $products[$j]['product_id']; ?>" />
</form>
Any ideas how I can it to work with jquery?