Comments

mkadin’s picture

Views obeys all of the access control rules from the site's overall permissions page. Are the nodes published? Is the permission for 'access content' on for anonymous users? I don't know commerce very well, but is there a 'view commerce products' permission that needs to be turned on for anonymous users?

Turn on 'no results behavior' in views and add a little text in there. If that text is showing up for anonymous users, than EVA is doing its job of embedding the view, but the anonymous user isn't allowed to view any of the content that the view is presenting.

mqbeers’s picture

Thanks for the speedy reply. I did as you suggested and created a message for 'no results behavior' and that message did show up. So, I will just have to keep hunting down the access permissions. I suspect it had something to do with the Commerce Product type and the fact that you have to use a Product Display in order to access the actual product nodes.

I will soldier on.
Thanks again.

mkadin’s picture

Status: Active » Closed (works as designed)

Sorry I can't be of much more use, but I haven't had much commerce experience. I'd post a similar question to the commerce issue queue or on IRC. Good luck!

ofry’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
Issue summary: View changes
Status: Closed (works as designed) » Active

I have Commerce Backoffice, so forms displays via Views.

I created custom EVA field with this exported view:

$view = new view();
$view->name = 'commerce_client_profile';
$view->description = '';
$view->tag = 'commerce';
$view->base_table = 'commerce_customer_profile';
$view->human_name = 'Профиль клиента в удобном виде';
$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['use_more_always'] = FALSE;
$handler->display->display_options['use_more_text'] = 'ещё';
$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['query']['options']['disable_sql_rewrite'] = TRUE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['submit_button'] = 'Применить';
$handler->display->display_options['exposed_form']['options']['reset_button_label'] = 'Сбросить';
$handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = 'Сортировать по';
$handler->display->display_options['exposed_form']['options']['sort_asc_label'] = 'По возрастанию';
$handler->display->display_options['exposed_form']['options']['sort_desc_label'] = 'По убыванию';
$handler->display->display_options['pager']['type'] = 'some';
$handler->display->display_options['pager']['options']['items_per_page'] = '1';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Связь: Commerce Профиль Клиента: Владелец */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'commerce_customer_profile';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
$handler->display->display_options['relationships']['uid']['required'] = TRUE;
/* Поле: Commerce Профиль Клиента: ID профиля */
$handler->display->display_options['fields']['profile_id']['id'] = 'profile_id';
$handler->display->display_options['fields']['profile_id']['table'] = 'commerce_customer_profile';
$handler->display->display_options['fields']['profile_id']['field'] = 'profile_id';
$handler->display->display_options['fields']['profile_id']['exclude'] = TRUE;
$handler->display->display_options['fields']['profile_id']['link_to_profile'] = 0;
/* Поле: Commerce Профиль клиента: Адрес доставки */
$handler->display->display_options['fields']['commerce_customer_address']['id'] = 'commerce_customer_address';
$handler->display->display_options['fields']['commerce_customer_address']['table'] = 'field_data_commerce_customer_address';
$handler->display->display_options['fields']['commerce_customer_address']['field'] = 'commerce_customer_address';
$handler->display->display_options['fields']['commerce_customer_address']['exclude'] = TRUE;
$handler->display->display_options['fields']['commerce_customer_address']['click_sort_column'] = 'country';
$handler->display->display_options['fields']['commerce_customer_address']['settings'] = array(
  'use_widget_handlers' => 1,
  'format_handlers' => array(
    'address' => 'address',
  ),
);
/* Поле: Commerce Профиль клиента: Контактный телефон */
$handler->display->display_options['fields']['field_phone_contact']['id'] = 'field_phone_contact';
$handler->display->display_options['fields']['field_phone_contact']['table'] = 'field_data_field_phone_contact';
$handler->display->display_options['fields']['field_phone_contact']['field'] = 'field_phone_contact';
$handler->display->display_options['fields']['field_phone_contact']['exclude'] = TRUE;
$handler->display->display_options['fields']['field_phone_contact']['click_sort_column'] = 'number';
/* Поле: Commerce Профиль клиента: Комментарий к заказу */
$handler->display->display_options['fields']['field_comment_to_order']['id'] = 'field_comment_to_order';
$handler->display->display_options['fields']['field_comment_to_order']['table'] = 'field_data_field_comment_to_order';
$handler->display->display_options['fields']['field_comment_to_order']['field'] = 'field_comment_to_order';
$handler->display->display_options['fields']['field_comment_to_order']['element_type'] = 'div';
$handler->display->display_options['fields']['field_comment_to_order']['element_class'] = 'pane-content';
$handler->display->display_options['fields']['field_comment_to_order']['element_label_type'] = 'h4';
$handler->display->display_options['fields']['field_comment_to_order']['element_label_class'] = 'pane-title';
$handler->display->display_options['fields']['field_comment_to_order']['hide_empty'] = TRUE;
/* Поле: Пользователь: E-mail */
$handler->display->display_options['fields']['mail']['id'] = 'mail';
$handler->display->display_options['fields']['mail']['table'] = 'users';
$handler->display->display_options['fields']['mail']['field'] = 'mail';
$handler->display->display_options['fields']['mail']['relationship'] = 'uid';
$handler->display->display_options['fields']['mail']['exclude'] = TRUE;
/* Поле: Глобальный: Пользовательский текст */
$handler->display->display_options['fields']['nothing']['id'] = 'nothing';
$handler->display->display_options['fields']['nothing']['table'] = 'views';
$handler->display->display_options['fields']['nothing']['field'] = 'nothing';
$handler->display->display_options['fields']['nothing']['label'] = 'Контактная информация';
$handler->display->display_options['fields']['nothing']['alter']['text'] = '<strong>Адрес доставки:</strong> [commerce_customer_address]
<br />
<strong>Контактный e-mail:</strong> [mail]
<br />
<strong>Телефон:</strong> [field_phone_contact]';
$handler->display->display_options['fields']['nothing']['element_type'] = 'div';
$handler->display->display_options['fields']['nothing']['element_class'] = 'pane-content';
$handler->display->display_options['fields']['nothing']['element_label_type'] = 'h4';
$handler->display->display_options['fields']['nothing']['element_label_class'] = 'pane-title';
/* Контекстный фильтр: Commerce Профиль Клиента: ID профиля */
$handler->display->display_options['arguments']['profile_id']['id'] = 'profile_id';
$handler->display->display_options['arguments']['profile_id']['table'] = 'commerce_customer_profile';
$handler->display->display_options['arguments']['profile_id']['field'] = 'profile_id';
$handler->display->display_options['arguments']['profile_id']['default_action'] = 'not found';
$handler->display->display_options['arguments']['profile_id']['exception']['title'] = 'Все';
$handler->display->display_options['arguments']['profile_id']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['profile_id']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['profile_id']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['profile_id']['summary_options']['items_per_page'] = '25';
/* Критерий фильтра: Commerce Профиль Клиента: Тип */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'commerce_customer_profile';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'billing' => 'billing',
);

/* Display: EVA Field */
$handler = $view->new_display('entity_view', 'EVA Field', 'entity_view_1');
$handler->display->display_options['entity_type'] = 'commerce_customer_profile';
$handler->display->display_options['bundles'] = array(
  0 => 'billing',
);
$translatables['commerce_client_profile'] = array(
  t('Master'),
  t('ещё'),
  t('Применить'),
  t('Сбросить'),
  t('Сортировать по'),
  t('По возрастанию'),
  t('По убыванию'),
  t('Владелец профиля'),
  t('ID профиля'),
  t('Адрес доставки'),
  t('Контактный телефон'),
  t('Комментарий к заказу'),
  t('E-mail'),
  t('Контактная информация'),
  t('<strong>Адрес доставки:</strong> [commerce_customer_address]
<br />
<strong>Контактный e-mail:</strong> [mail]
<br />
<strong>Телефон:</strong> [field_phone_contact]'),
  t('Все'),
  t('EVA Field'),
);

If I disable rewriting SQL, all shows up OK. But if I enable it (without any access requirements, as you see in view), I not see it via anonymous. Yes, I think it's permissions issue.

You can contact me via Skype ofryaka, I will give you access in my local copy of production site (dev environment).

MLZR’s picture

Issue summary: View changes

Hi,

I am not using commerce bud expirience the same issue. A view, in my case also a EVA, only works for admin, not for other users.

This solution works for me:
https://www.drupal.org/node/1969208

ferrum’s picture

I also have an EVA view in a commerce environment which is shown to admin only. I found that in case the view should be generated for another user the db query has a condition '1 = 0' added. This is the reason for an empty result. I currently don't know where this condition is set. Solution from #5 does not work for me. My workaround is using hook_query_alter and unsetting that condition.

geek-merlin’s picture

> db query has a condition '1 = 0' added

Another access module like nodetype_access?

hevr’s picture

Version: 7.x-1.x-dev » 8.x-2.1

In my case the 'view' permission was missing in combination with the nodeaccess Module to render the EVA View. But as the missing 'view' permission is intentionally in this case, my solution was to "Disable SQL rewriting" in the according EVA Views advanced query settings. But think about the implications, when using this feature. This might also apply to some of the above described problem cases.

I'm also in a commerce2 setting.