we are using following code to edit the price , quantity textfields for all products by clicking on one button. Price is working fine. Quantity is not working
Phtml code for Price
<input class="ama1" type = "text" id = "price_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" name= "price[]" value = "<?php echo $products->getPrice(); ?>" style = ""/>
<input type="hidden" name="curr_<?php echo $products->getId(); ?>" id="curr_<?php echo $products->getId(); ?>" value="<?php echo $products->getPrice(); ?>" />
<p id="updatedprice_<?php echo $products->getId(); ?>" style = "display:none;color:red; position:relative; top:16px;">Updated</p>
<br/>
<button id="price_reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideResetPrice('<?php echo $products->getId(); ?>','<?php echo $products->getPrice(); ?>'); return false;">
<span><span><?php echo $helper->__('Cancel') ?></span></span>
</button>
</span>
Phtml code for QTY
<?php
$selllermpassignproduct=Mage::getModel('mpassignproduct/mpassignproduct')->getAssignProDetails($products->getId());
//Zend_Debug::dump($selllermpassignproduct,null,true);
$stock_item=Mage::getModel('cataloginventory/stock_item')->loadByProduct($products->getId());
$SellerQty=isset($selllermpassignproduct['sellerqty'])?$selllermpassignproduct['sellerqty']:$stock_item->getQty();
$assignqty=isset($selllermpassignproduct['assignqty'])?$selllermpassignproduct['assignqty']:0;
?>
<input class="ama1" type = "text" id = "qty_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" name = "stock" value = "<?php echo (int) $SellerQty; ?>" />
<input type="hidden" value="<?php echo (int) $SellerQty; ?>" id="currqty_<?php echo $products->getId(); ?>">
<p id="updatedqty_<?php echo $products->getId(); ?>" style = "display:none;color:red; position:relative; top:16px;">Updated</p>
<br/>
<button id="reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideReset('<?php echo $products->getId(); ?>'); return false;" >
<span><span><?php echo $helper->__('Cancel') ?></span></span>
</button>
code to update price and quantity for all products by clicking one button
controller.php
public function massupdatesellerproAction(){
if($this->getRequest()->isPost()){
if(!$this->_validateFormKey()){
$this->_redirect('marketplace/marketplaceaccount/myproductslist/');
}
$ids= $this->getRequest()->getParam('product_mass_update');
$price= $this->getRequest()->getParam('price');
$qty = $this->getRequest()->getParam('qty');
foreach ($ids as $key => $value) {
$product = Mage::getModel('catalog/product')->load($value);
$product->setPrice($price[$key]); // price
$product->setQty($qty[$key]); //qty
$product->save();
}
Mage::getSingleton('core/session')->addSuccess( Mage::helper('marketplace')->__('Products has been sucessfully deleted from your account'));
$this->_redirect('marketplace/marketplaceaccount/myproductslist/');
}}