$customer = Mage::getModel('customer/customer'); $customer->setData('firstname', 'John'); $customer->setData('lastname', 'Doe'); $customer->save();
$product = Mage::getModel('catalog/product'); $product->setData('name', 'Red Widget'); $product->setData('sku', 'RW001'); $product->setData('price', 19.99); $product->save();
$order = Mage::getModel('sales/order'); $order->setData('customer_email', 'john.doe@example.com'); $order->setData('status', 'processing'); $order->setData('subtotal', 50.00); $order->setData('grand_total', 60.00); $order->save();This code creates a new order object, sets the customer email, status, subtotal, and grand total using the setData function, and saves the order to the database. Package library: Magento\Sales\Model\Order