You are here

function uc_order_new in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_order/uc_order.module \uc_order_new()
  2. 6.2 uc_order/uc_order.module \uc_order_new()

Generates and saves a new order.

Parameters

$uid: The user ID to assign the order to.

$state: The initial state of the order.

9 calls to uc_order_new()
UbercartCartCheckoutTestCase::createOrder in uc_cart/tests/uc_cart.test
Creates a new order.
UbercartCreditCardTestCase::createOrder in payment/uc_credit/tests/uc_credit.test
Helper function. Creates a new order.
UbercartOrderTestCase::testEntityHooks in uc_order/tests/uc_order.test
Tests order entity CRUD hooks.
UbercartOrderTestCase::testOrderApi in uc_order/tests/uc_order.test
Tests order entity API functions.
UbercartOrderTestCase::ucCreateOrder in uc_order/tests/uc_order.test
Helper function for creating an order programmatically.

... See full list

File

uc_order/uc_order.module, line 931

Code

function uc_order_new($uid = 0, $state = 'in_checkout') {
  $order = new UcOrder($uid, $state);
  module_invoke_all('entity_presave', $order, 'uc_order');
  drupal_write_record('uc_orders', $order);
  uc_order_module_invoke('new', $order, NULL);
  module_invoke_all('entity_insert', $order, 'uc_order');
  return $order;
}