When I set up a feed for a View and set the style as CSV File the separator is not there. The data is separated with a space. This happens no matter what I use for a separator.

To help my problem I hardcoded the "," into \views_bonus\export\views-bonus-export-csv.tpl.php but that isn't ideal...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chales’s picture

I found that the fix for the legacy misspelling issue is the problem. This is in views_bonus_export.theme.inc on line 17.

  // Make sure we catch saved options that are misspelled. LEGACY
  if (isset($vars['options']['separator'])) {
    $vars['options']['separator'] = $vars['options']['seperator'];
  }
  // Support old misspelled templates. LEGACY
  $vars['seperator'] =
    $vars['separator'] = $vars['options']['separator'];

Change the above to:

  // Make sure we catch saved options that are misspelled. LEGACY
  if (isset($vars['options']['seperator'])) {
    $vars['options']['separator'] = $vars['options']['seperator'];
  }
  // Support old misspelled templates. LEGACY
  $vars['separator'] = $vars['options']['separator'];
dca123’s picture

Ok. Great! I'll look into this.

mansspams’s picture

yes, same here, views 3. Template receives separator value NULL.

kiero63’s picture

I have the same issue and the #1 comment solved my problem.

Thanks

WillHall’s picture

Actually - There still seems to be a mistake - they seem to be backwards.

This works for me:

  // Make sure we catch saved options that are misspelled. LEGACY
  if (isset($vars['options']['separator'])) {
    $vars['options']['separator'] = $vars['options']['separator'];
  }
  // Support old misspelled templates. LEGACY
    $vars['separator'] = $vars['options']['seperator'];
idflood’s picture

subscribing

edit: Seems it may be better to use the hook_update_N to update each mysql view and totally remove this logic.

idflood’s picture

maybe we could do something like this ( not tested )

in a new views_bonus_export.install

/**
 * Make sure we catch saved options that are misspelled. LEGACY
 */
function views_bonus_export_update_6001() {
  module_load_include('inc', 'views', 'includes/view');
  
  $views = view::load_views();
  foreach( $views as $key => $view ) {
    foreach( $view->display as $key2 => $display ) {
      if( isset( $display->display_options["style_options"]) ) {
        if( isset($display->display_options["style_options"]["seperator"]) ) {
          $display->display_options["style_options"]["separator"] = $display->display_options["style_options"]["seperator"];
          unset($display->display_options["style_options"]["seperator"]);
          $view->save();
        }
      }
    }
  }
}

in views_bonus_export.theme.inc

function template_preprocess_views_bonus_export_csv(&$vars) {
  // TODO Replace items with themed_rows.
  _views_bonus_export_shared_preprocess($vars);

  // Special handling when quoted values are involved.
  if ($vars['options']['quote']) {
  ...
nicknickoli’s picture

I'm also having this nissue.

nicknickoli’s picture

Priority: Normal » Major
ahtih’s picture

Title: Separator not showing on feed » [PATCH] Separator not showing on feed
Status: Active » Needs review
FileSize
815 bytes

Here is a patch (against CVS HEAD) implementing a similar fix as #5. It is slightly different, as I think #5 is buggy (it assigns $vars['options']['separator'] to itself, essentially having no effect).

mshepherd’s picture

Status: Needs review » Reviewed & tested by the community

Patch at #10 works well.

WillHall’s picture

Confirmed: #10 wfm.

amateescu’s picture

FileSize
576 bytes

Here is the correct patch for this issue.

The whole point of this code:

if (isset($vars['options']['separator'])) {
  $vars['options']['separator'] = $vars['options']['seperator'];
}

is to check for an old option named 'seperator'. But the problem is that it checks for 'separator' instead of 'seperator'.

maksim24’s picture

good job boys, thans for code

cYu’s picture

Agree with #13. Tested the patch there and it works fine for my old views and new views.

jzornig’s picture

Patch in #13 worked for me. Thanks.

neclimdul’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (outdated)