This one permission and DB query filter would enable a multi seller environment (YES via one payment 'gateway').

Introduction

Its rather rudimentary but I have been able to build up views of products created by a each user and sprinkle a few redirect rules inplace on creation of products to their respective pages. How ever there are a few kinks in the way at the moment that other 'store owners' in this context some one that can create a product as their uid is in the product they created its rather simple to get their respective orders and what not to their accounts. Have it all up and working at the moment except this one pain in my butt this missing permission.

So I am starting the work to get this to a sold point.

Right now is a brute force sort of thing.
- there is a new permission 'Access own products'.
- I have added the condition onto the query that does the look up.

The permission is doing nothing right now but it will be tied to the additional query parameter that is working. So rigt now you can throw this patch on dev and if a user has created a product they will now see only the product they created in the reference field. Admins will see all products..

I used

if(!in_array("administrator", $user->roles)) {

Sure that can be cleaner.. But its a start.

With out further babble from my part here is the first stab at this issue.

diff --git a/modules/product/commerce_product.module b/modules/product/commerce_product.module
index e28a713..63ad28e 100644
--- a/modules/product/commerce_product.module
+++ b/modules/product/commerce_product.module
@@ -239,6 +239,11 @@ function commerce_product_permission() {
       'title' => t('Access products'),
       'description' => t('Allows users to view lists of products in the Store admin and reference lists.'),
     ),
+    //TODO: NOTE MAY NEED TO MAKE THIS AN ADMIN PERMISSION??? RIGHT NOW I ASSUME I REVOKE THE ABOVE AND ENABLE THIS.
+    'access own products'=> array(
+      'title' => t('Access own products'),
+      'description' => t('Allows users to view lists of products they have created under their store profile and referenc
+    ),
   );
 
   // Add product type specific permissions. Note that users with administer
@@ -588,7 +593,12 @@ function commerce_product_access($op, $product = NULL, $account = NULL) {
   if ($op == 'view' && user_access('access products', $account)) {
     return TRUE;
   }
-
+  
+  //TODO: ACCESS OWN PRODUCTS
+  if ($op == 'view' && user_access('access own products', $account) && $product->uid == $account->uid) {
+    return TRUE;
+  }
+  
   if (isset($product) && is_string($product) && $op == 'create' && user_access('create ' . $product . ' products', $accou
     return TRUE;
   }
@@ -803,6 +813,16 @@ function _commerce_product_match_products_standard($instance, $string = '', $mat
   $product_title_alias = $query->addField('cp', 'title');
   $product_type_alias = $query->addField('cp', 'type');
 
+
+  //TODO: FORCING FILTER TO USER ID IF NOT ADMIN
+  $product_uid_alias = $query->addField('cp', 'uid');

Comments

roam2345’s picture

woops here is the missing bit from my diff

@@ -803,6 +813,16 @@ function _commerce_product_match_products_standard($instance, $string = '', $mat
   $product_title_alias = $query->addField('cp', 'title');
   $product_type_alias = $query->addField('cp', 'type');
 
+
+  //TODO: FORCING FILTER TO USER ID IF NOT ADMIN
+  $product_uid_alias = $query->addField('cp', 'uid');
+  global $user;
+  
+  if(!in_array("administrator", $user->roles)) {
+    $query->condition($product_uid_alias, array($user->uid), 'IN');
+  }
+  
+  
   // Add a condition to the query to filter by matching product types.
   if (!empty($instance['settings']['referenceable_types'])) {
     $types = array_diff(array_values($instance['settings']['referenceable_types']), array(0, NULL));
@@ -811,7 +831,7 @@ function _commerce_product_match_products_standard($instance, $string = '', $mat
     if (!empty($types)) {
       $query->condition('cp.type', $types, 'IN');
     }
-  }
+  }  
 
   if ($string !== '') {
     $args = array();

roam2345’s picture

After further thought here is a real working solution.

This is mind melding commerce assumes ATM that any user that can access a create / edit on a display content type they can select a and use a product reference.
THAT MEANS
- If the user can create a product display they see all product types in the reference field. (THERE IS NO PERMISSION TO LIMIT IT UNTILL NOW :) )
- also means we can now limit the list of available products a user can see on the product list views aka admin/commerce/products but per user add an argument
- ill get those views exported in the morrow here for others to play with.

Here is my diff.

diff --git a/modules/product/commerce_product.module b/modules/product/commerce_product.module
index e28a713..218941e 100644
--- a/modules/product/commerce_product.module
+++ b/modules/product/commerce_product.module
@@ -239,6 +239,10 @@ function commerce_product_permission() {
       'title' => t('Access products'),
       'description' => t('Allows users to view lists of products in the Store admin and reference lists.'),
     ),
+    'access own products'=> array(
+      'title' => t('Access own products'),
+      'description' => t('Allows users to view lists of products they have created under their store profile and reference lists.'),
+    ),
   );
 
   // Add product type specific permissions. Note that users with administer
@@ -588,7 +592,11 @@ function commerce_product_access($op, $product = NULL, $account = NULL) {
   if ($op == 'view' && user_access('access products', $account)) {
     return TRUE;
   }
-
+  
+  if ($op == 'view' && user_access('access own products', $account) && $product->uid == $account->uid) {
+    return TRUE;
+  }
+  
   if (isset($product) && is_string($product) && $op == 'create' && user_access('create ' . $product . ' products', $account)) {
     return TRUE;
   }
@@ -802,7 +810,21 @@ function _commerce_product_match_products_standard($instance, $string = '', $mat
   $product_sku_alias = $query->addField('cp', 'sku');
   $product_title_alias = $query->addField('cp', 'title');
   $product_type_alias = $query->addField('cp', 'type');
-
+  $product_uid_alias = $query->addField('cp', 'uid');
+  
+  // Limit the results of this function baised on the users permissions.  
+  if (!user_access('administer products', $user) && !user_access('access products', $user) && !user_access('access own products', $user)) {
+    return array();
+  } elseif (!user_access('administer products', $user) && !user_access('access products', $user)) {    
+    if (user_access('access own products', $user)) {
+      $query->condition($product_uid_alias, array($user->uid), 'IN');
+    }
+  }
+  
+  
   // Add a condition to the query to filter by matching product types.
   if (!empty($instance['settings']['referenceable_types'])) {
     $types = array_diff(array_values($instance['settings']['referenceable_types']), array(0, NULL));
@@ -811,7 +833,7 @@ function _commerce_product_match_products_standard($instance, $string = '', $mat
     if (!empty($types)) {
       $query->condition('cp.type', $types, 'IN');
     }
-  }
+  }  
 
   if ($string !== '') {
     $args = array();
roam2345’s picture

Here is the view I am using to 'mimic' the product list view that exists under the store admin.

For this to work out the 'box' you need to add a extra field on the user account 'store_name' and add a value.

$view = new view;
$view->name = 'store_products';
$view->description = 'Display a list of products for a store.';
$view->tag = 'store admin';
$view->base_table = 'commerce_product';
$view->human_name = 'Store admin products';
$view->core = 0;
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');q
$handler->display->display_options['title'] = 'Store products admin';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'edit own product products';
$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(
  'sku' => 'sku',
  'title' => 'title',
  'type' => 'type',
  'commerce_price' => 'commerce_price',
  'operations' => 'operations',
);
$handler->display->display_options['style_options']['default'] = '-1';
$handler->display->display_options['style_options']['info'] = array(
  'sku' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
  ),
  'title' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
  ),
  'type' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
  ),
  'commerce_price' => array(
    'sortable' => 0,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
  ),
  'operations' => array(
    'align' => '',
    'separator' => '',
  ),
);
$handler->display->display_options['style_options']['override'] = 1;
$handler->display->display_options['style_options']['sticky'] = 0;
$handler->display->display_options['style_options']['empty_table'] = 0;
/* Header: Global: Text area */
$handler->display->display_options['header']['area']['id'] = 'area';
$handler->display->display_options['header']['area']['table'] = 'views';
$handler->display->display_options['header']['area']['field'] = 'area';
$handler->display->display_options['header']['area']['label'] = 'Link to add a product.';
$handler->display->display_options['header']['area']['empty'] = TRUE;
$handler->display->display_options['header']['area']['content'] = '<a href="/admin/commerce/products/add">Add a product</a>';
$handler->display->display_options['header']['area']['tokenize'] = 0;
/* No results behavior: Global: Text area */
$handler->display->display_options['empty']['text']['id'] = 'text';
$handler->display->display_options['empty']['text']['table'] = 'views';
$handler->display->display_options['empty']['text']['field'] = 'area';
$handler->display->display_options['empty']['text']['empty'] = FALSE;
$handler->display->display_options['empty']['text']['content'] = 'No products have been created yet.';
/* Relationship: Commerce Product: Creator */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'commerce_product';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
$handler->display->display_options['relationships']['uid']['required'] = 1;
/* 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']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['sku']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['sku']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['sku']['alter']['external'] = 0;
$handler->display->display_options['fields']['sku']['alter']['trim'] = 0;
$handler->display->display_options['fields']['sku']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['sku']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['sku']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['sku']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['sku']['alter']['html'] = 0;
$handler->display->display_options['fields']['sku']['element_label_colon'] = 1;
$handler->display->display_options['fields']['sku']['element_default_classes'] = 1;
$handler->display->display_options['fields']['sku']['hide_empty'] = 0;
$handler->display->display_options['fields']['sku']['empty_zero'] = 0;
$handler->display->display_options['fields']['sku']['link_to_product'] = 0;
/* Field: Commerce Product: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'commerce_product';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['external'] = 0;
$handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 1;
$handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['title']['alter']['max_length'] = '40';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['element_label_colon'] = 1;
$handler->display->display_options['fields']['title']['element_default_classes'] = 1;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_product'] = 1;
/* Field: Commerce Product: Type */
$handler->display->display_options['fields']['type']['id'] = 'type';
$handler->display->display_options['fields']['type']['table'] = 'commerce_product';
$handler->display->display_options['fields']['type']['field'] = 'type';
$handler->display->display_options['fields']['type']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['type']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['type']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['type']['alter']['external'] = 0;
$handler->display->display_options['fields']['type']['alter']['trim'] = 0;
$handler->display->display_options['fields']['type']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['type']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['type']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['type']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['type']['alter']['html'] = 0;
$handler->display->display_options['fields']['type']['element_label_colon'] = 1;
$handler->display->display_options['fields']['type']['element_default_classes'] = 1;
$handler->display->display_options['fields']['type']['hide_empty'] = 0;
$handler->display->display_options['fields']['type']['empty_zero'] = 0;
$handler->display->display_options['fields']['type']['link_to_product'] = 0;
/* Field: 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']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['commerce_price']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['commerce_price']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['commerce_price']['alter']['external'] = 0;
$handler->display->display_options['fields']['commerce_price']['alter']['trim'] = 0;
$handler->display->display_options['fields']['commerce_price']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['commerce_price']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['commerce_price']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['commerce_price']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['commerce_price']['alter']['html'] = 0;
$handler->display->display_options['fields']['commerce_price']['element_label_colon'] = 1;
$handler->display->display_options['fields']['commerce_price']['element_default_classes'] = 1;
$handler->display->display_options['fields']['commerce_price']['hide_empty'] = 0;
$handler->display->display_options['fields']['commerce_price']['empty_zero'] = 0;
$handler->display->display_options['fields']['commerce_price']['click_sort_column'] = 'amount';
$handler->display->display_options['fields']['commerce_price']['type'] = 'commerce_price_formatted_amount';
$handler->display->display_options['fields']['commerce_price']['field_api_classes'] = 0;
/* Field: Commerce Product: Operations links */
$handler->display->display_options['fields']['operations']['id'] = 'operations';
$handler->display->display_options['fields']['operations']['table'] = 'commerce_product';
$handler->display->display_options['fields']['operations']['field'] = 'operations';
$handler->display->display_options['fields']['operations']['label'] = 'Operations';
$handler->display->display_options['fields']['operations']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['operations']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['operations']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['operations']['alter']['external'] = 0;
$handler->display->display_options['fields']['operations']['alter']['trim'] = 0;
$handler->display->display_options['fields']['operations']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['operations']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['operations']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['operations']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['operations']['alter']['html'] = 0;
$handler->display->display_options['fields']['operations']['element_label_colon'] = 1;
$handler->display->display_options['fields']['operations']['element_default_classes'] = 1;
$handler->display->display_options['fields']['operations']['hide_empty'] = 0;
$handler->display->display_options['fields']['operations']['empty_zero'] = 0;
/* Sort criterion: Commerce Product: SKU */
$handler->display->display_options['sorts']['sku']['id'] = 'sku';
$handler->display->display_options['sorts']['sku']['table'] = 'commerce_product';
$handler->display->display_options['sorts']['sku']['field'] = 'sku';
/* Contextual filter: User: Store Name (field_store_name) */
$handler->display->display_options['arguments']['field_store_name_value']['id'] = 'field_store_name_value';
$handler->display->display_options['arguments']['field_store_name_value']['table'] = 'field_data_field_store_name';
$handler->display->display_options['arguments']['field_store_name_value']['field'] = 'field_store_name_value';
$handler->display->display_options['arguments']['field_store_name_value']['relationship'] = 'uid';
$handler->display->display_options['arguments']['field_store_name_value']['default_action'] = 'default';
$handler->display->display_options['arguments']['field_store_name_value']['title_enable'] = 1;
$handler->display->display_options['arguments']['field_store_name_value']['title'] = '%1\'s product admin';
$handler->display->display_options['arguments']['field_store_name_value']['breadcrumb'] = 'Store';
$handler->display->display_options['arguments']['field_store_name_value']['default_argument_type'] = 'node';
$handler->display->display_options['arguments']['field_store_name_value']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['field_store_name_value']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['field_store_name_value']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['field_store_name_value']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['field_store_name_value']['glossary'] = 0;
$handler->display->display_options['arguments']['field_store_name_value']['limit'] = '0';
$handler->display->display_options['arguments']['field_store_name_value']['case'] = 'ucfirst';
$handler->display->display_options['arguments']['field_store_name_value']['path_case'] = 'lower';
$handler->display->display_options['arguments']['field_store_name_value']['transform_dash'] = 1;
$handler->display->display_options['arguments']['field_store_name_value']['break_phrase'] = 0;

/* Display: Store products admin */
$handler = $view->new_display('page', 'Store products admin', 'admin_page');
$handler->display->display_options['path'] = 'store/%/admin/products';
$handler->display->display_options['menu']['type'] = 'default tab';
$handler->display->display_options['menu']['title'] = 'Products';
$handler->display->display_options['menu']['weight'] = '-1';
$handler->display->display_options['tab_options']['type'] = 'normal';
$handler->display->display_options['tab_options']['title'] = 'Store admin';
$handler->display->display_options['tab_options']['description'] = 'Manage products, displays and support tickets.';
$handler->display->display_options['tab_options']['weight'] = '';
$handler->display->display_options['tab_options']['name'] = 'user-menu';
$translatables['store_products'] = array(
  t('Defaults'),
  t('Store products admin'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('- All -'),
  t('Offset'),
  t('Link to add a product.'),
  t('<a href="/admin/commerce/products/add">Add a product</a>'),
  t('No products have been created yet.'),
  t('Product creator'),
  t('SKU'),
  t('Title'),
  t('Type'),
  t('Price'),
  t('Operations'),
  t('All'),
  t('%1\'s product admin'),
  t('Store'),
);

Then a view to admin their product displays.

$view = new view;
$view->name = 'store_display_products';
$view->description = 'Display a list of product displays for a store.';
$view->tag = 'store admin';
$view->base_table = 'node';
$view->human_name = 'Store admin display products';
$view->core = 7;
$view->api_version = '3.0-alpha1';
$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'] = 'Admin product displays';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['access']['perm'] = 'edit own product_display content';
$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'] = '25';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['pager']['options']['expose']['items_per_page_options_all'] = 0;
$handler->display->display_options['style_plugin'] = 'table';
$handler->display->display_options['style_options']['columns'] = array(
  'title' => 'title',
  'status' => 'status',
  'changed' => 'changed',
);
$handler->display->display_options['style_options']['default'] = 'title';
$handler->display->display_options['style_options']['info'] = array(
  'title' => array(
    'sortable' => 1,
    'default_sort_order' => 'desc',
    'align' => '',
    'separator' => '',
  ),
  'status' => array(
    'sortable' => 1,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
  ),
  'changed' => array(
    'sortable' => 1,
    'default_sort_order' => 'asc',
    'align' => '',
    'separator' => '',
  ),
);
$handler->display->display_options['style_options']['override'] = 1;
$handler->display->display_options['style_options']['sticky'] = 0;
$handler->display->display_options['style_options']['order'] = 'desc';
$handler->display->display_options['style_options']['empty_table'] = 0;
/* Header: Global: Text area */
$handler->display->display_options['header']['area']['id'] = 'area';
$handler->display->display_options['header']['area']['table'] = 'views';
$handler->display->display_options['header']['area']['field'] = 'area';
$handler->display->display_options['header']['area']['label'] = 'create product display';
$handler->display->display_options['header']['area']['empty'] = TRUE;
$handler->display->display_options['header']['area']['content'] = '<a href="/node/add/product-display">Create a product display</a>';
$handler->display->display_options['header']['area']['tokenize'] = 0;
/* No results behavior: Global: Text area */
$handler->display->display_options['empty']['area']['id'] = 'area';
$handler->display->display_options['empty']['area']['table'] = 'views';
$handler->display->display_options['empty']['area']['field'] = 'area';
$handler->display->display_options['empty']['area']['empty'] = FALSE;
$handler->display->display_options['empty']['area']['content'] = 'You have not created any product displays yet, you products on not publicly visible on the store yet.';
$handler->display->display_options['empty']['area']['tokenize'] = 0;
/* Relationship: Content: Author */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'node';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
$handler->display->display_options['relationships']['uid']['required'] = 1;
/* Relationship: Content: Referenced product */
$handler->display->display_options['relationships']['field_product_reference_product_id']['id'] = 'field_product_reference_product_id';
$handler->display->display_options['relationships']['field_product_reference_product_id']['table'] = 'field_data_field_product_reference';
$handler->display->display_options['relationships']['field_product_reference_product_id']['field'] = 'field_product_reference_product_id';
$handler->display->display_options['relationships']['field_product_reference_product_id']['required'] = 1;
/* Field: Content: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['exclude'] = TRUE;
$handler->display->display_options['fields']['nid']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['nid']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['nid']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['nid']['alter']['external'] = 0;
$handler->display->display_options['fields']['nid']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['nid']['alter']['trim'] = 0;
$handler->display->display_options['fields']['nid']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['nid']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['nid']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['nid']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['nid']['alter']['html'] = 0;
$handler->display->display_options['fields']['nid']['element_label_colon'] = 1;
$handler->display->display_options['fields']['nid']['element_default_classes'] = 1;
$handler->display->display_options['fields']['nid']['hide_empty'] = 0;
$handler->display->display_options['fields']['nid']['empty_zero'] = 0;
$handler->display->display_options['fields']['nid']['link_to_node'] = 0;
/* Field: Product: Image */
$handler->display->display_options['fields']['field_product_image']['id'] = 'field_product_image';
$handler->display->display_options['fields']['field_product_image']['table'] = 'field_data_field_product_image';
$handler->display->display_options['fields']['field_product_image']['field'] = 'field_product_image';
$handler->display->display_options['fields']['field_product_image']['relationship'] = 'field_product_reference_product_id';
$handler->display->display_options['fields']['field_product_image']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_product_image']['alter']['make_link'] = 1;
$handler->display->display_options['fields']['field_product_image']['alter']['path'] = 'node/[nid]';
$handler->display->display_options['fields']['field_product_image']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_product_image']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_product_image']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_product_image']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_product_image']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_product_image']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_product_image']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_product_image']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_product_image']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_product_image']['element_label_colon'] = 1;
$handler->display->display_options['fields']['field_product_image']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_product_image']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_product_image']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_product_image']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_product_image']['settings'] = array(
  'image_style' => 'more-from-store',
  'image_link' => '',
);
$handler->display->display_options['fields']['field_product_image']['group_rows'] = 1;
$handler->display->display_options['fields']['field_product_image']['delta_limit'] = '1';
$handler->display->display_options['fields']['field_product_image']['delta_offset'] = '0';
$handler->display->display_options['fields']['field_product_image']['delta_reversed'] = 0;
$handler->display->display_options['fields']['field_product_image']['field_api_classes'] = 0;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['external'] = 0;
$handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 1;
$handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['title']['alter']['max_length'] = '40';
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['element_label_colon'] = 1;
$handler->display->display_options['fields']['title']['element_default_classes'] = 1;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Field: Content: Published */
$handler->display->display_options['fields']['status']['id'] = 'status';
$handler->display->display_options['fields']['status']['table'] = 'node';
$handler->display->display_options['fields']['status']['field'] = 'status';
$handler->display->display_options['fields']['status']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['status']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['status']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['status']['alter']['external'] = 0;
$handler->display->display_options['fields']['status']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['status']['alter']['trim'] = 0;
$handler->display->display_options['fields']['status']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['status']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['status']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['status']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['status']['alter']['html'] = 0;
$handler->display->display_options['fields']['status']['element_label_colon'] = 1;
$handler->display->display_options['fields']['status']['element_default_classes'] = 1;
$handler->display->display_options['fields']['status']['hide_empty'] = 0;
$handler->display->display_options['fields']['status']['empty_zero'] = 0;
$handler->display->display_options['fields']['status']['not'] = 0;
/* Field: Content: Updated date */
$handler->display->display_options['fields']['changed']['id'] = 'changed';
$handler->display->display_options['fields']['changed']['table'] = 'node';
$handler->display->display_options['fields']['changed']['field'] = 'changed';
$handler->display->display_options['fields']['changed']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['changed']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['changed']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['changed']['alter']['external'] = 0;
$handler->display->display_options['fields']['changed']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['changed']['alter']['trim'] = 0;
$handler->display->display_options['fields']['changed']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['changed']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['changed']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['changed']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['changed']['alter']['html'] = 0;
$handler->display->display_options['fields']['changed']['element_label_colon'] = 1;
$handler->display->display_options['fields']['changed']['element_default_classes'] = 1;
$handler->display->display_options['fields']['changed']['hide_empty'] = 0;
$handler->display->display_options['fields']['changed']['empty_zero'] = 0;
$handler->display->display_options['fields']['changed']['date_format'] = 'long';
/* Field: Content: Edit link */
$handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
$handler->display->display_options['fields']['edit_node']['table'] = 'node';
$handler->display->display_options['fields']['edit_node']['field'] = 'edit_node';
$handler->display->display_options['fields']['edit_node']['label'] = 'Operations';
$handler->display->display_options['fields']['edit_node']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['external'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['trim'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['edit_node']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['edit_node']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['html'] = 0;
$handler->display->display_options['fields']['edit_node']['element_label_colon'] = 1;
$handler->display->display_options['fields']['edit_node']['element_default_classes'] = 1;
$handler->display->display_options['fields']['edit_node']['hide_empty'] = 0;
$handler->display->display_options['fields']['edit_node']['empty_zero'] = 0;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Contextual filter: User: Store Name (field_store_name) */
$handler->display->display_options['arguments']['field_store_name_value']['id'] = 'field_store_name_value';
$handler->display->display_options['arguments']['field_store_name_value']['table'] = 'field_data_field_store_name';
$handler->display->display_options['arguments']['field_store_name_value']['field'] = 'field_store_name_value';
$handler->display->display_options['arguments']['field_store_name_value']['relationship'] = 'uid';
$handler->display->display_options['arguments']['field_store_name_value']['default_action'] = 'default';
$handler->display->display_options['arguments']['field_store_name_value']['title_enable'] = 1;
$handler->display->display_options['arguments']['field_store_name_value']['title'] = '%1\'s product displays admin';
$handler->display->display_options['arguments']['field_store_name_value']['default_argument_type'] = 'node';
$handler->display->display_options['arguments']['field_store_name_value']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['field_store_name_value']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['field_store_name_value']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['field_store_name_value']['summary_options']['items_per_page'] = '25';
$handler->display->display_options['arguments']['field_store_name_value']['glossary'] = 0;
$handler->display->display_options['arguments']['field_store_name_value']['limit'] = '0';
$handler->display->display_options['arguments']['field_store_name_value']['case'] = 'ucfirst';
$handler->display->display_options['arguments']['field_store_name_value']['path_case'] = 'lower';
$handler->display->display_options['arguments']['field_store_name_value']['transform_dash'] = 1;
$handler->display->display_options['arguments']['field_store_name_value']['break_phrase'] = 0;
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'product_display' => 'product_display',
);

/* Display: Store display products */
$handler = $view->new_display('page', 'Store display products', 'page');
$handler->display->display_options['path'] = 'store/%/admin/display';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'Displays';
$handler->display->display_options['menu']['weight'] = '0';
$translatables['store_display_products'] = array(
  t('Master'),
  t('Admin product displays'),
  t('more'),
  t('Apply'),
  t('Reset'),
  t('Sort by'),
  t('Asc'),
  t('Desc'),
  t('Items per page'),
  t('- All -'),
  t('Offset'),
  t('create product display'),
  t('<a href="/node/add/product-display">Create a product display</a>'),
  t('You have not created any product displays yet, you products on not publicly visible on the store yet.'),
  t('user'),
  t('Product'),
  t('Nid'),
  t('Image'),
  t('node/[nid]'),
  t('Title'),
  t('Published'),
  t('Updated date'),
  t('Operations'),
  t('All'),
  t('%1\'s product displays admin'),
  t('Store display products'),
);

Here are the rules I used to redirect people off the default return page to their .

Store redirect product delete

{ "rules_store_owner_redirect_delete" : {
    "LABEL" : "Store redirect product delete",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "commerce_product" ],
    "ON" : [ "commerce_product_delete" ],
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "4" : "4" } }
        }
      },
      { "AND" : [] },
      { "NOT data_is_empty" : { "data" : [ "site:current-user:field-store-name" ] } }
    ],
    "DO" : [
      { "redirect" : { "url" : "store\/[site:current-user:field-store-name]\/admin\/products" } }
    ]
  }
}

Store redirect product save

{ "rules_store_owner_redirect_save" : {
    "LABEL" : "Store redirect product save",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "commerce_product" ],
    "ON" : [ "commerce_product_insert" ],
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "4" : "4" } }
        }
      },
      { "AND" : [] },
      { "NOT data_is_empty" : { "data" : [ "site:current-user:field-store-name" ] } }
    ],
    "DO" : [ { "redirect" : { "url" : "node\/add\/product-display" } } ]
  }
}

Store redirect product update

{ "rules_store_redirect_product_update" : {
    "LABEL" : "Store redirect product update",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "commerce_product" ],
    "ON" : [ "commerce_product_update" ],
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "4" : "4" } }
        }
      },
      { "AND" : [] },
      { "NOT data_is_empty" : { "data" : [ "site:current-user:field-store-name" ] } }
    ],
    "DO" : [
      { "redirect" : { "url" : "store\/[site:current-user:field-store-name]\/admin\/display" } }
    ]
  }
}

Their we have it now there a bunch of permissions you should assign off to a separate role sate store owner.... and now users can upload and create their own products.. I have views or displaying their own orders and statistics around the orders but I leave that up to you to discover. PS: the relationships and group by are the keys to those.

roam2345’s picture

Status: Active » Needs review

Would like some eye's over the solution I got here, plz.

rszrama’s picture

Status: Needs review » Closed (duplicate)

Today's your lucky day! Damien is working out a patch for #927090: Revamp / unify entity access that will add this permission in along with a lot of others thanks to a unified model of defining permissions and performing access checks... it's pretty unbelievable. : )