You are here

function commerce_product_load_multiple in Commerce Core 7

Loads multiple products by ID or based on a set of matching conditions.

Parameters

$product_ids: An array of product IDs.

$conditions: An array of conditions on the {commerce_product} table in the form 'field' => $value.

$reset: Whether to reset the internal product loading cache.

Return value

An array of product objects indexed by product_id.

See also

entity_load()

11 calls to commerce_product_load_multiple()
CommerceProductCRUDTestCase::testCommerceProductCrud in modules/product/tests/commerce_product.test
Test the product CRUD functions.
CommerceProductUIAdminTest::testCommerceProductUIDeleteProduct in modules/product/tests/commerce_product_ui.test
Test deleting a product.
CommerceTaxUIAdminTest::testCommerceTaxUIApplyVAT in modules/tax/tests/commerce_tax_ui.test
Check if a 'VAT' tax type is correctly applied in a given product.
CommerceTaxUIAdminTest::testCommerceTaxUIApplyVATInclusive in modules/tax/tests/commerce_tax_ui.test
Check if a 'VAT' tax type is correctly applied in a given product.
commerce_cart_add_to_cart_form in modules/cart/commerce_cart.module
Builds an Add to Cart form for a set of products.

... See full list

File

modules/product/commerce_product.module, line 545
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_load_multiple($product_ids = array(), $conditions = array(), $reset = FALSE) {
  if (empty($product_ids) && empty($conditions)) {
    return array();
  }
  return entity_load('commerce_product', $product_ids, $conditions, $reset);
}