I am using Marketplace in My Website i used to delete product from order
public function deleteproductAction()
{
$order_id = $this->getRequest()->getParam('order_id');
$product_id = $this->getRequest()->getParam('product_id');
$_order = Mage::getModel('sales/order')->load($order_id);
$items = $_order->getAllItems();
$updateQty = 0;
foreach ($items as $item){
$base_grand_total = $_order->getBaseGrandTotal();
$base_subtotal = $_order->getBaseSubtotal();
$base_tva = $_order->getBaseTaxAmount();
$grand_total = $_order->getGrandTotal();
$subtotal = $_order->getSubtotal();
$tva = $_order->getTaxAmount();
$base_subtotal_incl_tax = $_order->getBaseSubtotalInclTax();
$subtotal_incl_tax = $_order->getSubtotalInclTax();
$total_item_count = $_order->getTotalItemCount();
if($item->getProductId()==$product_id){
$marketplaceSales = Mage::getModel('marketplace/saleslist')->getCollection()
->addFieldToFilter('mageproid',$product_id)
->addFieldToFilter('mageorderid',$_order->getId());
$item_price = $item->getPrice();
$item_tva = $item->getTaxAmount();
$item->delete();
$updateQty = $updateQty+1;
if($id = $marketplaceSales->getFirstItem()->getAutoid()) {
$saleslist = Mage::getModel('marketplace/saleslist')->load($id);
$saleslist->delete();
}
$_order->setBaseGrandTotal($base_grand_total-$item_price-$item_tva);
$_order->setBaseSubtotal($base_subtotal-$item_price);
$_order->setBaseTaxAmount($base_tva-$item_tva);
$_order->setGrandTotal($grand_total-$item_price-$item_tva);
$_order->setSubtotal($subtotal-$item_price);
$_order->setTaxAmount($tva-$item_tva);
$_order->setBaseSubtotalInclTax($base_subtotal_incl_tax-$item_price);
$_order->setSubtotalInclTax($subtotal_incl_tax-$item_price);
$_order->setTotalItemCount(count($items)-1);
$_order->save();
}
}
$orderModel = Mage::getModel('sales/order')->load($_order->getId());
$orderModel->setTotalQtyOrdered($orderModel->getTotalQtyOrdered()-$updateQty);
$orderModel->setBaseTotalQtyOrdered($orderModel->getBaseTotalQtyOrdered()-$updateQty);
$orderModel->save();
Mage::getSingleton('adminhtml/session')
->addSuccess('Order Updated Successfully');
$this->_redirect('adminhtml/sales_order/view', array('order_id' => $_order->getId()));
}
Let us Assume I have 1 order that order contain 2 Seller Product assume Seller A & Seller B I delete Seller B product after that i go to Seller A Dashboard i try to process order but i can't process because that seller B order id Store Some where how to find that in Database there is no table i cross checked.
marketplace/saleslist
table i think they have the seller id and product id.