Resolved - Mass Action - Mass Database Update in Magento Grid The Next CEO of Stack OverflowExclude a specific categoryCreate categories through installerMass action in Sales order gridUpdate to 1.9.2.4 breaks custom Sales Order Grid mass ActionMass Action in Order GridShopping cart is empty after cancel the payment in magento-1.9.1.1Solved - Adding Mass Delete Action to the GridValidate mass action columnShipment grid custom mass action problem with UiComponentFactory::argumentsResolver()Get Shipment Id while creating Shipment in Magento 1.9

Multi tool use
Multi tool use

Rotate a column

Bold, vivid family

What does convergence in distribution "in the Gromov–Hausdorff" sense mean?

Multiple labels for a single equation

Why does standard notation not preserve intervals (visually)

Why do professional authors make "consistency" mistakes? And how to avoid them?

Interfacing a button to MCU (and PC) with 50m long cable

Is "for causing autism in X" grammatical?

Unreliable Magic - Is it worth it?

How did people program for Consoles with multiple CPUs?

Why has the US not been more assertive in confronting Russia in recent years?

How do I transpose the 1st and -1th levels of an arbitrarily nested array?

How to avoid supervisors with prejudiced views?

Why am I allowed to create multiple unique pointers from a single object?

Can we say or write : "No, it'sn't"?

Real integral using residue theorem - why doesn't this work?

How to invert MapIndexed on a ragged structure? How to construct a tree from rules?

Which kind of appliances can one connect to electric sockets located in a airplane's toilet?

Can I equip Skullclamp on a creature I am sacrificing?

Elegant way to replace substring in a regex with optional groups in Python?

Received an invoice from my ex-employer billing me for training; how to handle?

Is there a way to save my career from absolute disaster?

Does it take more energy to get to Venus or to Mars?

WOW air has ceased operation, can I get my tickets refunded?



Resolved - Mass Action - Mass Database Update in Magento Grid



The Next CEO of Stack OverflowExclude a specific categoryCreate categories through installerMass action in Sales order gridUpdate to 1.9.2.4 breaks custom Sales Order Grid mass ActionMass Action in Order GridShopping cart is empty after cancel the payment in magento-1.9.1.1Solved - Adding Mass Delete Action to the GridValidate mass action columnShipment grid custom mass action problem with UiComponentFactory::argumentsResolver()Get Shipment Id while creating Shipment in Magento 1.9










0















I have this grid developed for the custom module. I added the mass delete action which works fine. But the mass Approve/Disapprove actions work only for one value, when I select multiple values I get this error.
Please help to resolve this:



enter image description here



Here is the code for the approve function in controller file:



 public function massApproveAction() 
$requestIds = $this->getRequest()->getParam('id');
if(!is_array($requestIds))
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select reqeust(s)'));
else
try

foreach ($requestIds as $requestId)
$RequestData = Mage::getModel('cpstest_productcomment/cps')->load($requestId);
$id = $this->getRequest()->getParam('id');
$data = array('comment_status'=>'Approved');
$model = Mage::getModel('cpstest_productcomment/cps')->addData($data);

$model->setId($id)->save();
echo "Data updated successfully.";

catch (Exception $e)
echo $e->getMessage();












share|improve this question




























    0















    I have this grid developed for the custom module. I added the mass delete action which works fine. But the mass Approve/Disapprove actions work only for one value, when I select multiple values I get this error.
    Please help to resolve this:



    enter image description here



    Here is the code for the approve function in controller file:



     public function massApproveAction() 
    $requestIds = $this->getRequest()->getParam('id');
    if(!is_array($requestIds))
    Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select reqeust(s)'));
    else
    try

    foreach ($requestIds as $requestId)
    $RequestData = Mage::getModel('cpstest_productcomment/cps')->load($requestId);
    $id = $this->getRequest()->getParam('id');
    $data = array('comment_status'=>'Approved');
    $model = Mage::getModel('cpstest_productcomment/cps')->addData($data);

    $model->setId($id)->save();
    echo "Data updated successfully.";

    catch (Exception $e)
    echo $e->getMessage();












    share|improve this question


























      0












      0








      0








      I have this grid developed for the custom module. I added the mass delete action which works fine. But the mass Approve/Disapprove actions work only for one value, when I select multiple values I get this error.
      Please help to resolve this:



      enter image description here



      Here is the code for the approve function in controller file:



       public function massApproveAction() 
      $requestIds = $this->getRequest()->getParam('id');
      if(!is_array($requestIds))
      Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select reqeust(s)'));
      else
      try

      foreach ($requestIds as $requestId)
      $RequestData = Mage::getModel('cpstest_productcomment/cps')->load($requestId);
      $id = $this->getRequest()->getParam('id');
      $data = array('comment_status'=>'Approved');
      $model = Mage::getModel('cpstest_productcomment/cps')->addData($data);

      $model->setId($id)->save();
      echo "Data updated successfully.";

      catch (Exception $e)
      echo $e->getMessage();












      share|improve this question
















      I have this grid developed for the custom module. I added the mass delete action which works fine. But the mass Approve/Disapprove actions work only for one value, when I select multiple values I get this error.
      Please help to resolve this:



      enter image description here



      Here is the code for the approve function in controller file:



       public function massApproveAction() 
      $requestIds = $this->getRequest()->getParam('id');
      if(!is_array($requestIds))
      Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select reqeust(s)'));
      else
      try

      foreach ($requestIds as $requestId)
      $RequestData = Mage::getModel('cpstest_productcomment/cps')->load($requestId);
      $id = $this->getRequest()->getParam('id');
      $data = array('comment_status'=>'Approved');
      $model = Mage::getModel('cpstest_productcomment/cps')->addData($data);

      $model->setId($id)->save();
      echo "Data updated successfully.";

      catch (Exception $e)
      echo $e->getMessage();









      magento-1.9 module grid custom massaction






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 6 '17 at 18:22







      bestwebdevs

















      asked Apr 6 '17 at 0:24









      bestwebdevsbestwebdevs

      122213




      122213




















          1 Answer
          1






          active

          oldest

          votes


















          1














          Everything is correct but at the time of saving data you set all request params in setId method. Please find below line and correct it.



          $model->setId($id)->save();


          Replace with below code



          $model->setId($requestId)->save();





          share|improve this answer

























          • Thanks for your respond. With this code I don't get the error any more, but it still saves only one value.

            – bestwebdevs
            Apr 6 '17 at 16:58












          • Your solution is correct, I made a mistake and put it outside the loop, that's why it was only saving 1 value. Then I put it in the foreach loop and it works great :) Thank you!

            – bestwebdevs
            Apr 6 '17 at 17:34











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f167880%2fresolved-mass-action-mass-database-update-in-magento-grid%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Everything is correct but at the time of saving data you set all request params in setId method. Please find below line and correct it.



          $model->setId($id)->save();


          Replace with below code



          $model->setId($requestId)->save();





          share|improve this answer

























          • Thanks for your respond. With this code I don't get the error any more, but it still saves only one value.

            – bestwebdevs
            Apr 6 '17 at 16:58












          • Your solution is correct, I made a mistake and put it outside the loop, that's why it was only saving 1 value. Then I put it in the foreach loop and it works great :) Thank you!

            – bestwebdevs
            Apr 6 '17 at 17:34















          1














          Everything is correct but at the time of saving data you set all request params in setId method. Please find below line and correct it.



          $model->setId($id)->save();


          Replace with below code



          $model->setId($requestId)->save();





          share|improve this answer

























          • Thanks for your respond. With this code I don't get the error any more, but it still saves only one value.

            – bestwebdevs
            Apr 6 '17 at 16:58












          • Your solution is correct, I made a mistake and put it outside the loop, that's why it was only saving 1 value. Then I put it in the foreach loop and it works great :) Thank you!

            – bestwebdevs
            Apr 6 '17 at 17:34













          1












          1








          1







          Everything is correct but at the time of saving data you set all request params in setId method. Please find below line and correct it.



          $model->setId($id)->save();


          Replace with below code



          $model->setId($requestId)->save();





          share|improve this answer















          Everything is correct but at the time of saving data you set all request params in setId method. Please find below line and correct it.



          $model->setId($id)->save();


          Replace with below code



          $model->setId($requestId)->save();






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 4 mins ago









          Teja Bhagavan Kollepara

          3,01241949




          3,01241949










          answered Apr 6 '17 at 6:25









          ARVIND KARKARARVIND KARKAR

          4722418




          4722418












          • Thanks for your respond. With this code I don't get the error any more, but it still saves only one value.

            – bestwebdevs
            Apr 6 '17 at 16:58












          • Your solution is correct, I made a mistake and put it outside the loop, that's why it was only saving 1 value. Then I put it in the foreach loop and it works great :) Thank you!

            – bestwebdevs
            Apr 6 '17 at 17:34

















          • Thanks for your respond. With this code I don't get the error any more, but it still saves only one value.

            – bestwebdevs
            Apr 6 '17 at 16:58












          • Your solution is correct, I made a mistake and put it outside the loop, that's why it was only saving 1 value. Then I put it in the foreach loop and it works great :) Thank you!

            – bestwebdevs
            Apr 6 '17 at 17:34
















          Thanks for your respond. With this code I don't get the error any more, but it still saves only one value.

          – bestwebdevs
          Apr 6 '17 at 16:58






          Thanks for your respond. With this code I don't get the error any more, but it still saves only one value.

          – bestwebdevs
          Apr 6 '17 at 16:58














          Your solution is correct, I made a mistake and put it outside the loop, that's why it was only saving 1 value. Then I put it in the foreach loop and it works great :) Thank you!

          – bestwebdevs
          Apr 6 '17 at 17:34





          Your solution is correct, I made a mistake and put it outside the loop, that's why it was only saving 1 value. Then I put it in the foreach loop and it works great :) Thank you!

          – bestwebdevs
          Apr 6 '17 at 17:34

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f167880%2fresolved-mass-action-mass-database-update-in-magento-grid%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          9 Vdrdzx5Pcrsvfq1,ZaenTSSixb EtvJH1PeT7vZoxU8 R,r9,GdSVwA2uVacN9eA9A2,f ZbulMI4Ii1p
          F Cl1lWX n acxldjMfJYqbi97yvAm4pB l7bqa2w W c y6 nVMKeJ5XQWLx,XtZfBnC5J9r47QBsQS,Oobrpx1NdOunxMDm2CsOIQ1G,Y8g

          Popular posts from this blog

          No such entity with customerId The Next CEO of Stack OverflowTruncate table using resource model in Magento 2Custom Customer Attribute (string) get function not workingGetting current customer in custom REST API moduleSubstitute existing Customer EAV AttributesMagento 2 - Best practice for extending customer entityFatal error: Call to a member function create() on nullProduct custom attribute import with CSV Magento 2.2What is the distinction between defining a customer attribute as “system” versus not “user defined”?Custom EAV Entity Type Missing “default_attribute_set_id” In ModelMagento 2.2: Add Customer Attribute to Custom Tab in AdminHow to mass update custom dropdown customer attribute to all customers? PHP or SQL

          Буцька Катерина Петрівна Зміст Біографія | Фільмографія | Дублювання та озвучення українською | Дублювання та озвучення російською | Озвучення реклами | Навігаційне менюперевірена109 змінвиправивши або дописавши її

          Лель (журнал) Зміст Історія | Редакція | Автори і рубрики | Інтерв'ю, статті, рецензії | Див. також | Посилання | Навігаційне менюперевірена1 змінаСергій Чирков: «Плейбой» і «Пентхауз» у кіосках з'явилися вже після того, як зник «Лель»«Лель», підшивка 10 номерів (1992, 1993)Ніч з «Другом Читача»: казки на ніч для дорослихІнформація про журнал на сервері журналістів у ВР УкраїниНаталія Патрікєєва. Лель. Перший український еротичний журналр