You are here

function commerce_bpc_add_page in Commerce Bulk Product Creation 7.2

Same name and namespace in other branches
  1. 7 commerce_bpc.pages.inc \commerce_bpc_add_page()

Page callback: Displays a list of product types that the user can create.

Path: admin/commerce/products/add-bulk

See also

commerce_bpc_menu()

1 string reference to 'commerce_bpc_add_page'
commerce_bpc_menu in ./commerce_bpc.module
Implements hook_menu().

File

./commerce_bpc.pages.inc, line 13
Page generation callbacks for the Commerce bulk product creation module.

Code

function commerce_bpc_add_page() {
  $item = menu_get_item();
  $content = system_admin_menu_block($item);

  // $content can only be empty if user has the 'administer product types'
  // permission.
  if (!$content && count(commerce_product_types()) > 0) {

    // If there is no $content, but there are products to create
    // that means that there no bulk-able product types.
    return '<p>' . t('None of the product types you have created so far are available for bulk creation. In order to be avalable for bulk creation, a product type must have at least one field that supports it, such as a list field. Go to the <a href="@manage-product-types">manage product types page</a> to add fields to your product types.', array(
      '@manage-product-types' => url('admin/commerce/products/types'),
    )) . '</p>';
  }
  return theme('product_add_list', array(
    'content' => $content,
  ));
}