2

I'm selling music albums in Commerce. The product type has an entity reference field with unlimited values for the content type 'tracks' which I'm using to display the tracklist of an album. I'd like to output this field as a numbered list so the track I reference are displayed like this:

  1. track title
  2. track title etc.

I also need to be able to export the track number from a View via Views Data Export.

Any ideas as to how achieve this?

1 Answer 1

0

Its pretty simple, in this example I will use title instead of an entity reference field, but it's the same process.

Step 1) add Global: View result counter as a field.

enter image description here

Step 2) Uncheck create label, and checkmark hide from display.

enter image description here

Step 3) Re-arrange so your counter is above your entity reference field.

enter image description here

Step 4) Re-write results and use replacement patterns to format your title field.

enter image description here

4
  • The OP asked about creating a numbered list with the unlimited values of a single field. This will probably involve using a views field to create a sub-view of only the values of this particular field and embed it within the view of the entity
    – argiepiano
    Commented Sep 4, 2016 at 21:49
  • @argiepiano the question was tagged with the views tag.
    – No Sssweat
    Commented Sep 4, 2016 at 22:30
  • hi @argiepiano. Sorry about the long wait. I actually need to be able to do both (display the list in a view and on a node). ANy thoughts on how to do it on a node? Commented Oct 26, 2017 at 18:13
  • 1
    Something like that would involve creating a new "view mode" for the referred entities (for example with modules Display Suite or Entity view modes) and tweaking the template to add the numbered bullet. Ask a new question if you want more detailed explanations
    – argiepiano
    Commented Oct 27, 2017 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.