Inconsistent column order in CSV template

Created on 20 April 2025, 3 months ago

Problem/Motivation

When generating a CSV template in the feeds module, the columns appear in a random order. This creates confusion for the user, especially when trying to fill in the template based on instructions or documentation. The structure of the template does not match the expected or documented order.

Steps to reproduce

download multiple .csv feeds template from different countertypes alternating and some clear cache in the mix

Proposed resolution

Expected Behavior:
The columns in the CSV template should appear in a consistent and logical order, for example order of fields on contenttype form
Optionally allow manual configuration of column order per feed type, weights system.

User interface changes

none, for fixed order basesd on contenttype form weights
Optionally: extra tab for defining template field order.

Feature request
Status

Active

Version

3.0

Component

Code

Created by

🇧🇪Belgium ikeigenwijs

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @ikeigenwijs
  • 🇳🇱Netherlands megachriz

    Thanks for creating the issue. At first I could not reproduce it. I created several feed types and for each one the CSV template matched the order of the mappings.

    But then I decided to edit the mappings of a feed type and created a new CSV source for the first mapping.

    First the mappings where this:

    And that resulted into the following CSV template:

    title,url,status
    

    Then I mapping a source called "title2" to "Title (title)", and I got the following CSV template:

    title,url,status,title2
    

    I see the issues here are:

    • title2 appears at last, even though it is used on the first mapping row.
    • title still appears in the template, even if it is no longer used in the mappings.

    Expected CSV template should have been:

    title2,url,status
    

    Am I correct that this is what the issue is about?

    I also sense a request here to be able to change the order of mappings. That should be handled in a different issue. Or is it the order of custom sources?

  • 🇧🇪Belgium ikeigenwijs

    That's also a valid issue, but not the same maybe related.
    But we have/ had changes in order without change in mapping.
    its a large migration project with multiple users getting the templates (and getting different ones)

    I can test if you can pick this up.

    related in previous version
    https://www.drupal.org/project/feeds/issues/3181081
    https://www.drupal.org/project/feeds/issues/3520229 Inconsistent column order in CSV template Active

  • 🇳🇱Netherlands megachriz

    Alright, so the following is a different issue for you:

    title,url,status,title2
    I see the issues here are:

    • title2 appears at last, even though it is used on the first mapping row.
    • title still appears in the template, even if it is no longer used in the mappings.

    Expected CSV template should have been:

    title2,url,status

    Can you be more specific with the issue that you experience and provide a step by step plan with how to reproduce it?

Production build 0.71.5 2024