You are here

function commerce_product_new in Commerce Core 7

Returns an initialized product object.

Parameters

$type: The machine-readable type of the product.

Return value

A product object with all default fields initialized.

8 calls to commerce_product_new()
CommerceBaseTestCase::createDummyProduct in tests/commerce_base.test
Creates a dummy product for use with other tests.
CommerceProductCRUDTestCase::testCommerceProductCrud in modules/product/tests/commerce_product.test
Test the product CRUD functions.
CommerceProductCRUDTestCase::testCommerceProductRevisions in modules/product/tests/commerce_product.test
Test product revision management.
CommerceProductCRUDTestCase::testCommerceProductTokens in modules/product/tests/commerce_product.test
Test product Token replacement.
commerce_product_handler_field_product_link_delete::render in modules/product/includes/views/handlers/commerce_product_handler_field_product_link_delete.inc
Render the field.

... See full list

File

modules/product/commerce_product.module, line 482
Defines the core Commerce product entity, including the entity itself, the bundle definitions (product types), and various API functions to manage products and interact with them through forms and autocompletes.

Code

function commerce_product_new($type = '') {
  return entity_get_controller('commerce_product')
    ->create(array(
    'type' => $type,
  ));
}