we have a marketplace site, where each seller/vendor have different accounts. we are displaying products infromation in their account in frontend. we want to provide a seller an option for editing the quantity we are using this code : http://pastebin.com/RTYvpS0W to display the list of product name, sku , quantity. we are using following code to edit the quantity
<td>
<?php echo (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($products)->getQty(); ?>
<input type="text" id="qty_<?php echo $product_id;?>" name="qty" value="<?php echo (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($products)->getQty(); ?>" style="display:none"/>
<span class="label wk_action">
<img onclick="updateField('<?php echo $product_id; ?>');return false;" src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>
</span>
</td>
<?php $url = Mage::getUrl('module_name/index/updateField/'); ?>
<script type = "text/javascript" >
var $wk_jq = jQuery.noConflict();
function updateField(product_id)
{
var qtyId = '#qty_'+product_id;
$wk_jq(qtyId).toggle()
$qty = $wk_jq(qtyId).val();
new Ajax.Request('<?php echo $url ?>', {
method: 'post',
parameters: {id: product_id, qty: $qty}
});
}
</script>
but its working only for first product, please help me what code have to replace to work it for all products