Follow by Email

Thursday, October 15, 2015

Update record with condition in custom module in magento

I have create a Model and for some development i had to implement Update method. It is very easy. I also try for conditional update. But i am using the following code which will fulfill your requirement for conditional update.



foreach($cart as $item_id=>$item){
        $olddata_id = Mage::getModel('custom/csaabandonedcart')->getCollection()
                ->addFieldToFilter('csa_id', Mage::getSingleton('customer/session')->getCustomerId())
                 ->addFieldToFilter('customer_id', $retailer)->addFieldToFilter('product_id', $item_id)
                ->getColumnValues('id');
                                                                                               
     $abandonedcart = Mage::getModel('custom/csaabandonedcart')->load($olddata_id[0]);
            $abandonedcart->setQuantity($item['qty']);
             $abandonedcart->save();           
 }
 

8 comments:

  1. Your post urges me to create a business website, of course I will free download magento as soon as possible. Magento is truly the best platform ever. Its extensions is also awesome. Thank you.

    ReplyDelete
  2. Do you know what is Magento 2. This is the new era of Magento E-commerce

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. I am very happy when read this blog post because blog post written in good manner and write on good topic. Thanks for sharing valuable information.
    Bangalore Web Designing Company, UI Designing Company Bangalore

    ReplyDelete
  6. The blog is absolutely truly incredible. Lots of large information and inspiration, both of which we all need.
    UI UX Design Companies in Bangalore, Web Application Development in Bangalore

    ReplyDelete