Advanced catalogue back-refs


Item has a rating of 5 (Liked by Adam)
#5741 (In Topic #1341)
Site director
Chris Graham is in the usergroup ‘Administrators’

This is to help out @KingBast who likes to do over-complicated stuff with catalogues :P. It follows on from an IRC conversation.

As I understand it, his use case is he has 3 catalogues. Let's make this abstract and call them a, b, c.

Catalogue 'a' has entries in it that fields in catalogues 'b' and 'c' are referencing (via "A reference to a catalogue entry in a catalogue" fields).

He wants it so that when you view catalogue 'a' entries you get links to the referencing entries in catalogue 'b' only.

Currently it is not possible, because the CATALOGUE_ENTRY_BACKREFS symbol is going to find back-references from all fields pointing to entries in 'a', there's no way to filter it down to individual fields.

I have fixed this in Allow tying catalogue field backref search to a particular field, use… · ocproducts/composr@8951633 · GitHub, which will be in the next patch release. Now you can filter your back-refs to only ones appearing in a particular field.

You need to dip into the database to find the field IDs. In my test site my catalogue 'b' reference field is #45, so that's what I'll use.

If I make CATALOGUE_a_ENTRY_SCREEN.tpl, to override how entries in catalogue 'a' are templated, I can include this code:


   <a href="{$PAGE_LINK*,site:catalogues:entry:{_loop_var}}">{$CATALOGUE_ENTRY_FIELD_VALUE*,{_loop_var},0}</a>

This works. It generates hyperlinks, with proper captions, pointing back to the entries in catalogue 'b'.

Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top


Site staff
Adam is in the usergroup ‘Super-moderators’
In the next release a little bug which returned too many results was fixed. Also you don't need to do any database dipping as the ID's will be shown next to the fields when editing a catalogue. This is really useful, especially the ID's ;) Thanks Chris.
Online now: No Back to the top
1 guest and 0 members have just viewed this.


Users online:

Manu, MVLipwig, Paul D, deepu_ms, mytracker


Forum statistics:
  • 1,361 topics, 5,910 posts, 7,290 members
  • Our newest member is advanceayurveda
Back to Top