2

we are using magento multi vendor site.

For single Product we are displaying price, selling price , quantity...etc in vendor account.

we gave an option for vendor to update all the textfields of single product by clicking on one "update" button.

we are using following code for this.

PHTML

<button id="update_button_<?php echo $products->getId(); ?>" class="button wk_mp_btn1" onclick="updateAllFields('<?php echo $products->getId(); ?>'); return false;"  >
<span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
</button>

Javascript

function updateAllFields(product_id) {
            updateFieldPrice(product_id);
            updateFieldSpecialPrice(product_id);
            updateField(product_id);

            }

enter image description here

Now we want to provide an option for update all textfields of multiple products by clicking on one "update" button. Ex: for one product we will edit price , for second we will edit price and qty, for third price, quantity , special price . we edit all textfield values and enter the button "save all".

In the image, last but one column, you can see "save all" button. once we click on that button it should save all the field values.

3
  • add more detail to understand this question.. Dec 17, 2015 at 14:59
  • @Baby in Magento ,what is the problem
    – Amit Bera
    Feb 4, 2016 at 7:33
  • @Amit seller can able to update all products all attributes values by clicking on only one "button" :) Feb 4, 2016 at 9:27

1 Answer 1

1
+350

you can add product id as in array same as for price field and special price field

 <input type="hidden" name="product_mass_update[]"  value="<?php echo $products->getEntityId(); ?>"/>
    <input class="ama1" type = "text" id = "price_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" name= "price[]" value = "<?php echo $products->getPrice(); ?>" style = ""/>
        <input class="ama1" type = "text" id = "specialprice_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" name = "specialprice[]" value = "<?php echo $products->getSpecialPrice(); ?>" onblur="updateFieldSpecialPrice('<?php echo $products->getId(); ?>')" style = ""/>

for massupdate for all record

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');
        $special= $this->getRequest()->getParam('specialprice');
        foreach ($ids as $key => $id) {
    $product = Mage::getModel('catalog/product')->load($id);
    $product->setPrice($price[$key]);
    $product->setSpecialPrice($special[$key]);
    $product->save();
        }
        Mage::getSingleton('core/session')->addSuccess( Mage::helper('marketplace')->__('Products has been sucessfully deleted from your account'));
        $this->_redirect('marketplace/marketplaceaccount/myproductslist/');


    }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.