I get this error when trying to create a rss from commerce product entities.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'node.created' in 'field list'

Screengrab attached.

CommentFileSizeAuthor
view.png96.69 KBfarald
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maciej.zgadzaj’s picture

Ah yes, the date selection works for node-based views only now... Is it Drupal Commerce module you are using here?

farald’s picture

Yes, it's a view of a commerce core entity (commerce_product). I was trying to create a rss of products going below a certain stock feed, so that backorder systems could pick products from that feed.

Is there any way to patch the module so it can be independent of this node.created field? I don't see any other reason for it not working with other entities once this issue is fixed.

<?php
function views_rss_core_views_query_alter(&$view, &$query) {
  if ($view->style_plugin->definition['handler'] == 'views_plugin_style_rss_fields') {
    // Select the most recent node creation date for <pubDate> element.
    $query->fields['views_rss_created'] = array(
      'field' => 'created',
      'table' => 'node',
      'alias' => 'views_rss_created',
    );
    // Select the most recent node update date for <lastBuildDate> element.
    $query->fields['views_rss_changed'] = array(
      'field' => 'changed',
      'table' => 'node',
      'alias' => 'views_rss_changed',
    );
  }
}
;?>

Maybe there could be a way to override these dates in the views config, eventually with another field from the view?

maciej.zgadzaj’s picture

I have added a new hook for other modules to be able to define new sources for date elements (<pubDate> and <lastBuildDate>). All core Drupal's view types will be predefined, but all others (like commerce_product in your case) would need to be provided by an external module.

It is not pushed yet though, as at the moment I am in the middle of pretty heavy changes (new and updated existing hooks, moving around and renaming files, probably renaming theme functions as well - essentially decided on some proper cleaning, as it was all a bit messy there before).

Also, still considering dropping in a row plugin, even though I have rejected it before - haven't finally made my mind about it yet.

maciej.zgadzaj’s picture

Status: Active » Closed (fixed)

Fixed in the most recent dev version, just pushed. Please clone from git of wait for d.o to rebuild archive files.

Also, please note that there were some big changes in file names/locations, theme function names etc, so I'd suggest to delete old module files completely before fetching one ones. Also, if you kept configuration of your old view, it's not going to work anymore either, as the structure on plugin options changed as well.

maciej.zgadzaj’s picture

farald’s picture

This is just great!
Thank you lots for this fix! :)