插入数据
//设置操作的表
$table_regoods=Mage::getSingleton('core/resource')->getTableName('sales_flat_return_goods');
//插入新数据
$write->insert($table_regoods,array('parent_id'=> $orderId, 'buyer_backgoods_memo' => $buyermemo));
删除数据
//删除商店
public function deleteGroupStore($storeInfo) {
try {
$write = Mage::getSingleton("core/resource")->getConnection('core_write');
$table = Mage::getSingleton('core/resource')->getTableName('core_store_group');
$write->delete($table, array('name=?' => $storeInfo['store_name']));
} catch (Exception $e) {
throw new Exception($e->getMessage());
}
}
修改数据
//修改order_grid 列表
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$table = Mage::getSingleton('core/resource')->getTableName('sales_flat_order_grid'); //设置操作的表
$write->update($table, array('base_grand_total' => $bgt + $shippingfee, 'grand_total' => $gt + $shippingfee, 'shipping_fee' => $shippingfee), array('entity_id=?' => $orderId));
}
查询数据
public function getOrderId() {
$customerId = Mage::getSingleton('customer/session')->getCustomer()->getEntityId();
$handle = Mage::getSingleton('core/resource')->getConnection('core_read');
$result = $handle->query("select entity_id from sales_flat_order where customer_id=" . $customerId . " order by entity_id desc");
$row = $result->fetch();
return $row['entity_id'];
}