Follow by Email

Thursday, October 15, 2015

Delete record with condition in custom module in magento

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

foreach($pid as $spid){
         $items = Mage::getModel('custom/csaabandonedcart')->getCollection()
        ->addFieldToFilter('csa_id', Mage::getSingleton('customer/session')->getCustomerId())
        ->addFieldToFilter('customer_id', $retailer)->addFieldToFilter('product_id', $spid);
 foreach($items as $item){

1 comment:

  1. I have bookmarked your blog, the articles are way better than other similar blogs.. thanks for a great blog!