2
Answers
Vote up!
0
Vote down!

Bulk edit of stock (inventory)?

Is there a module, or a way perhaps to create a view, to bulk edit the stock level? I'm using the stock module, which works great, however, we have about 30 different things we sell (mainly t-shirts with their various sizes). We sell these offline too at certain events, so after each event, we have to update the online inventory.

Right now, we are clicking edit on each product, updating the stock value, savings, then going to the next one. It's tedious and as we add products, it will become a problem.

What I'd like is to set up an editable list that has the SKU, Title, Price and Stock for everything we have (filtering it would be nice too!), so we can just quickly type in the the new stock value for everything, hit save once and its all updated.

It's obviously opossible programmically speaking, but wanted to see if there was a way to do it already.

Thanks!

Asked by: ncarty97
on September 19, 2013

2 Answers

Vote up!
0
Vote down!

Ok, one minor problem. Since I am doing T-Shirts, I have 5 sizes for each product. I use the product display to group them of course and that's great. On my list for updating inventory, I have the Content:Title (from the display), Size, SKU, Price, Stock. I've exposed three filters:
Type, Active and Content:Title.

Type and Active have drop down boxes for the selection, which is great. Content:Title does not and I can't figure out why. I'm guessing it has something to do with being a Node Reference?

Here is my view:

[code]
$view = new view();
$view->name = 'inventory_management';
$view->description = 'Use this view to update Store Inventory';
$view->tag = 'default';
$view->base_table = 'commerce_product';
$view->human_name = 'Inventory Management';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Inventory Management';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '50';
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
'product_id' => 'product_id',
'commerce_price' => 'commerce_price',
'sku' => 'sku',
'commerce_stock' => 'commerce_stock',
'title' => 'title',
);
$handler->display->display_options['style_options']['default'] = 'sku';
$handler->display->display_options['style_options']['info'] = array(
'product_id' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'commerce_price' => array(
'sortable' => 0,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'sku' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'commerce_stock' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
'title' => array(
'sortable' => 1,
'default_sort_order' => 'asc',
'align' => '',
'separator' => '',
'empty_column' => 0,
),
);
/* Relationship: Commerce Product: Referencing Node */
$handler->display->display_options['relationships']['field_product']['id'] = 'field_product';
$handler->display->display_options['relationships']['field_product']['table'] = 'commerce_product';
$handler->display->display_options['relationships']['field_product']['field'] = 'field_product';
/* Field: Content: Title */
$handler->display->display_options['fields']['title_1']['id'] = 'title_1';
$handler->display->display_options['fields']['title_1']['table'] = 'node';
$handler->display->display_options['fields']['title_1']['field'] = 'title';
$handler->display->display_options['fields']['title_1']['relationship'] = 'field_product';
$handler->display->display_options['fields']['title_1']['label'] = 'Product';
$handler->display->display_options['fields']['title_1']['link_to_node'] = FALSE;
/* Field: Commerce Product: Size */
$handler->display->display_options['fields']['field_size']['id'] = 'field_size';
$handler->display->display_options['fields']['field_size']['table'] = 'field_data_field_size';
$handler->display->display_options['fields']['field_size']['field'] = 'field_size';
$handler->display->display_options['fields']['field_size']['settings'] = array(
'field_formatter_class' => '',
);
/* Field: Commerce Product: SKU */
$handler->display->display_options['fields']['sku']['id'] = 'sku';
$handler->display->display_options['fields']['sku']['table'] = 'commerce_product';
$handler->display->display_options['fields']['sku']['field'] = 'sku';
$handler->display->display_options['fields']['sku']['link_to_product'] = 0;
/* Field: Commerce Product: Price */
$handler->display->display_options['fields']['commerce_price']['id'] = 'commerce_price';
$handler->display->display_options['fields']['commerce_price']['table'] = 'field_data_commerce_price';
$handler->display->display_options['fields']['commerce_price']['field'] = 'commerce_price';
$handler->display->display_options['fields']['commerce_price']['click_sort_column'] = 'amount';
$handler->display->display_options['fields']['commerce_price']['settings'] = array(
'calculation' => '0',
'field_formatter_class' => '',
);
/* Field: Commerce Product: Stock */
$handler->display->display_options['fields']['commerce_stock']['id'] = 'commerce_stock';
$handler->display->display_options['fields']['commerce_stock']['table'] = 'field_data_commerce_stock';
$handler->display->display_options['fields']['commerce_stock']['field'] = 'commerce_stock';
$handler->display->display_options['fields']['commerce_stock']['type'] = 'editable';
$handler->display->display_options['fields']['commerce_stock']['settings'] = array(
'click_to_edit' => 0,
'empty_text' => '',
'fallback_format' => 'number_integer',
'fallback_settings' => array(
'thousand_separator' => ' ',
'prefix_suffix' => 1,
),
'field_formatter_class' => '',
);
/* Filter criterion: Commerce Product: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'commerce_product';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['group'] = 1;
$handler->display->display_options['filters']['type']['exposed'] = TRUE;
$handler->display->display_options['filters']['type']['expose']['operator_id'] = 'type_op';
$handler->display->display_options['filters']['type']['expose']['label'] = 'Type';
$handler->display->display_options['filters']['type']['expose']['operator'] = 'type_op';
$handler->display->display_options['filters']['type']['expose']['identifier'] = 'type';
$handler->display->display_options['filters']['type']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
5 => 0,
4 => 0,
3 => 0,
);
/* Filter criterion: Commerce Product: Status */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'commerce_product';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 'All';
$handler->display->display_options['filters']['status']['exposed'] = TRUE;
$handler->display->display_options['filters']['status']['expose']['operator_id'] = '';
$handler->display->display_options['filters']['status']['expose']['label'] = 'Active';
$handler->display->display_options['filters']['status']['expose']['operator'] = 'status_op';
$handler->display->display_options['filters']['status']['expose']['identifier'] = 'status';
$handler->display->display_options['filters']['status']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
5 => 0,
4 => 0,
3 => 0,
);
/* Filter criterion: Content: Title */
$handler->display->display_options['filters']['title']['id'] = 'title';
$handler->display->display_options['filters']['title']['table'] = 'node';
$handler->display->display_options['filters']['title']['field'] = 'title';
$handler->display->display_options['filters']['title']['relationship'] = 'field_product';
$handler->display->display_options['filters']['title']['exposed'] = TRUE;
$handler->display->display_options['filters']['title']['expose']['operator_id'] = 'title_op';
$handler->display->display_options['filters']['title']['expose']['label'] = 'Product';
$handler->display->display_options['filters']['title']['expose']['operator'] = 'title_op';
$handler->display->display_options['filters']['title']['expose']['identifier'] = 'title';
$handler->display->display_options['filters']['title']['expose']['remember_roles'] = array(
2 => '2',
1 => 0,
5 => 0,
4 => 0,
3 => 0,
);
$handler->display->display_options['filters']['title']['group_info']['label'] = 'Title';
$handler->display->display_options['filters']['title']['group_info']['identifier'] = 'title';
$handler->display->display_options['filters']['title']['group_info']['remember'] = FALSE;
$handler->display->display_options['filters']['title']['group_info']['group_items'] = array(
1 => array(),
2 => array(),
3 => array(),
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'inventory-management';
[/code]

Answer by: ncarty97
Posted: Sep 19, 2013