I was trying to use DS with views, and i setup a display block, and when i use this settings in views:

FORMAT
Format:Grid | Settings
Show:Display suite fields | Settings

this error is displayed and nothing show in the block;
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'commerce_line_item.nid' in 'field list'

Any ideas?

Ps. DS is great!

CommentFileSizeAuthor
#6 1441248-6.patch588 bytesswentel
#1 DS_block_error.jpg45.8 KBanibal

Comments

anibal’s picture

StatusFileSize
new45.8 KB
swentel’s picture

Status: Active » Postponed (maintainer needs more info)

Sorry for getting late back at this: does this also happen with default fields from views ? If so, then this has nothing todo with ds at all (and can't really think of one either at this moment)

nicholsonma’s picture

I was all set to create a new issue on this but then found this existing one so I thought I'd post my info here since it adds more details about what's going on.

I'm trying to use DS view modes to create a view where the first row would use one view mode and subsequent rows would use a different one (just like I learned in swentel's wonderful screencast series!). However the data I'm using is Products and Product Displays from the Commerce module and the field I'm trying to have display differently in the two view modes is an image field in the referenced Product. Here are the issues I'm running into:

  • if I create a view showing Content of type Product Displays then the DS view modes I create only show up in the Display Suite Settings menu in the view editor if they are defined for the Product Display type itself (as opposed to the referenced Product type). But when you define the view mode for the Product Display type the only formatter options for fields that come from the referenced Product available to you are Visible and Hidden. A message on the screen tells you to go to the manage display screen for the Product type to make actual changes to the format. So trying to do what I'm doing using a view of Product Displays doesn't work. I even tried setting the view modes on both the Product Display and the Product types hoping that the view mode might be somehow passed through but that didn't work. Although it uses the view mode I specified for the Product Display it uses the Default view mode for the fields from the referenced Product.
  • So the next thing I tried was creating a view showing Commerce Products of type Product. If you do this your options for the row style are Display Suite fields, Fields, and Rendered entity. If you select Display Suite fields then you get a SQL error as follows:
  • SQLSTATE[42S22]: Column not found: 1054 Unknown column 'commerce_product.nid' in 'field list'

I'm guessing that the query is assuming that the commerce product has a node id and is trying to reference that field which apparently doesn't exist. So I can't do things this way.

I can workaround this by putting the image field in the Product Display instead of the Product and I'll do this for now but I'm hoping that DS and Commerce play together better in the future and that's why I'm reporting this.

Ravenight’s picture

Version: 7.x-1.5 » 7.x-2.x-dev

Just wanted to follow up on this one. I am having the same issue and I am not sure where root of the issue lies so I am tagging on here to see if we can fix this as being able to use DS to layout my Commerce Products via Format: Style -> Display Suite Fields would make my life better :)

Currently running:

  • DS - 7.x-2.0-beta1+5-dev
  • Views - 7.x-3.3
  • Commerce - 7.x-1.3

This is from a block view based on the Commerce Product entity.
Here is the First SQL Query:
Setup in views is: FORMAT -> Show -> Fields

SELECT commerce_product.product_id AS product_id, 
commerce_product.title AS commerce_product_title,  
'commerce_product' AS field_data_field_product_msrp_commerce_product_entity_type
FROM 
{commerce_product} commerce_product
LIMIT 1 OFFSET 0

Here is the second SQL Query:
Setup in views is: FORMAT -> Show -> Display Suite Fields

SELECT commerce_product.product_id AS product_id, 
commerce_product.title AS commerce_product_title, 
commerce_product.nid AS commerce_product_nid, 
'commerce_product' AS field_data_field_product_msrp_commerce_product_entity_type
FROM 
{commerce_product} commerce_product
LIMIT 1 OFFSET 0

The root question it seems is: Why is this [ commerce_product.nid AS commerce_product_nid ] being inserted when using "Show -> Display Suite Fields" but not "Show -> Fields" and how/where do we fix it?

Here is the Exported View for reference:

$view = new view;
$view->name = 'commerce_products_daily_deals';
$view->description = 'Blocks for each type of Daily Deal Product';
$view->tag = 'default';
$view->base_table = 'commerce_product';
$view->human_name = 'Commerce Products: Daily Deals';
$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'] = 'Todays Daily Deals';
$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']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$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'] = 'ds_fields';
/* 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']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 1;
$handler->display->display_options['fields']['title']['alter']['path'] = 'node/[nid]';
$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_whitespace'] = 0;
$handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['element_type'] = 'h2';
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
$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']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['title']['link_to_product'] = 0;
/* Field: Commerce Product: MSRP */
$handler->display->display_options['fields']['field_product_msrp']['id'] = 'field_product_msrp';
$handler->display->display_options['fields']['field_product_msrp']['table'] = 'field_data_field_product_msrp';
$handler->display->display_options['fields']['field_product_msrp']['field'] = 'field_product_msrp';
$handler->display->display_options['fields']['field_product_msrp']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_product_msrp']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_product_msrp']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['element_label_colon'] = 1;
$handler->display->display_options['fields']['field_product_msrp']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_product_msrp']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_product_msrp']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['field_product_msrp']['settings'] = array(
  'thousand_separator' => ',',
  'decimal_separator' => '.',
  'scale' => '2',
  'prefix_suffix' => 1,
);
$handler->display->display_options['fields']['field_product_msrp']['field_api_classes'] = 0;

/* Display: (Block) Primary */
$handler = $view->new_display('block', '(Block) Primary', 'block_1');
$handler->display->display_options['display_description'] = 'Primary Daily Deal Product';

DS FTW!

swentel’s picture

Status: Postponed (maintainer needs more info) » Active

I know where the problem lies, I'll try to add a patch soon for this

swentel’s picture

Status: Active » Needs review
StatusFileSize
new588 bytes

This should fix the SQL errors.

Ravenight’s picture

You are the man! Works perfectly.

swentel’s picture

Status: Needs review » Closed (fixed)

Fix commerce fields.

rphillipsfeynman’s picture

Issue summary: View changes

I think you should also add to the patch:

'commerce_order' => 'order_id',

This was driving me mad with exactly the same problem but with commerce_order when I tried to use Display Suite to create a custom shopping cart.