• Resolved okayaelectric

    (@okayaelectric)


    Hello-

    Is there a way to put a shortcode in the twig syntax for loading a view in CRM with a lookup?

    I have a view called TFT on Website and one of the fields is a lookup called “Sub-Subject.” I want to filter on that field with the title of the current page.

    Is this something that’s possible?

    Thank you.
    -Joe

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author alexacrm

    (@alexacrm)

    @okayaelectric

    can you explain what do you mean by “filter on that field with the title”? Do you want to show the records where display name of the lookup matches the title of the page?

    Where does the title come from? Is it hard-coded per page or comes from elsewhere like query string? If it’s built dynamically, how the pages (with different titles) are linked to – how the links are built?

    Just trying to understand the bigger picture as there might be some better ways to achieve the result.

    Thanks
    George

    Thread Starter okayaelectric

    (@okayaelectric)

    Hi George-

    Yes, I would like to filter on the title of the page. The title is coming from the WordPress admin > Pages. That title field at the top.

    I’m attempting to do something similar to the Steak Knives sample site you sent to me — creating the product list like the sample code does it. But my only difference is filtering on the field in my views called “Sub-Subject” which would be the same as the title of the web page the user is looking at.

    Unless you have a better thought on how to accomplish this?

    I hope this makes sense.

    Thank you.
    -Joe

    Plugin Author alexacrm

    (@alexacrm)

    Hi Joe,

    I wouldn’t filter on the page title – too volatile. I would instead use parameter substitution in views and hard-code GUIDs of the lookups you’re filtering on (you are hardcoding the pages anyway).

    For something like a product list I would consider building a single page, adding a dropdown with lookup values (e.g. categories) and then build view dynamically to filter on the selected lookup value. A bit more work but clean and easier to maintain.

    Thanks
    George

    Thread Starter okayaelectric

    (@okayaelectric)

    Hey George-

    Thank you very much for the assistance and guidance. I really, really appreciate it!

    -Joe

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Twig syntax for view with lookup’ is closed to new replies.