Copy link to clipboard
Copied
Hi,
I’m trying to add a link “add to favorites” on a custom liquid web app detail page (without using the default detail template).
I must be missing something because it won’t render on the details page view.
(I'm using custom templates for different languages)
I’ve used the examples from the docs
https://docs.worldsecuresystems.com/developers/liquid/enable-other-Liquid-objects
which are used on a module template.
What I’ve done so far.
1. created a page template
2. created an include on the page template which retrieves the custom liquid template
{% include"/Layouts/Custom/layouts/customLiquidTemplate.tpl" -%}
3. inserted the code on the custom liquid template
{{ favorites | json }}
{tag_addtofavorites,, collection="favorites" template=""} null
5. other test
{tag_addtofavorites,/images/add.png,/images/remove.png }
{% endcapture -%}
{{ favorites | json }}
6. result
"\t{ tag_addtofavorites,/images/add.png,/images/remove.png }\n”
7. I also had a look at the Universalis BC template, but it doesn’t have a whish list/add to favorites enabled
So, my questions are:
What piece of the code am I missing?
Can you use it only on a page where on the back-end-site the tags from “data” in the “toolbox” are available / visible?
If yes, how can I implement an “add to favorites” on my page template in combination with a custom template?
Thanks for any help.
Kind regards,
Carla
Copy link to clipboard
Copied
Older tags Carla will only render in the primary layouts. If you have includes in those layouts, while the newer liquid tags will work, the older ones will not.
I would say - Observe the rendered fav tag - You can replicate this.
Copy link to clipboard
Copied
Hi Liam, that explains why it will not render. One part of the puzzle solved. Leaves open the new name for add-to-favorites.
In the reference I can't find any new liquid tag-name for add-to-favorites. There is a cross reference from the old-tag-name to the {module_favorites} which doesn't contain the new name.
I could spend hours observing the fav tag as you suggest. But I'm a what "code-blinded" as I would call it, for finding a solution.
Also in the doc's I can't find anything about the new name. Could you please give me a hint?
Thanks, Carla
Copy link to clipboard
Copied
Its a render output tag, not a data tag so you will not see a tag released for this in liquid.
Put it in your normal layout to look at the HTML it renders. You do not have to have a tag for it to function. You just need to replace the values it needs with the dynamic data (Liquid).
Copy link to clipboard
Copied
Sorry to cut in Carla but is this what you mean Liam?
<a href="/FavoriteProcess.aspx?OID={{id}}&OTYPE=7"><span class="fa fa-heart-o pr-1" aria-hidden="true"></span></a>
<a href="/FavoriteProcess.aspx?A=Remove&OID={{id}}&OTYPE=7"><span class="fa fa-heart pr-1" aria-hidden="true"></span></a>
This was added into the News List.
Copy link to clipboard
Copied
I don't mind. The more people join, the better it is to share information.
I came across the same code as you provided. (For web-apps the code is 35). I wasn't sure if that would be the right procedure for adding favorites links in combination with liquid.
Thanks for sharing.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks, I will try that. I noticed that in the given example a legacy tag tag_addtofavorites was used together with liquid. It makes it a little confusing.
Copy link to clipboard
Copied
To make this work with liquid enabled on pages I've done the following:
adding a favorite:
<a class="favoritelink" title="Save this" href="/FavoriteProcess.aspx?OID={module_oid}&OTYPE=35"> <i class="fi-heart icon-font__social"> </i> </a>
removing a favorite:
<a class="favoritelink" title="Remove from favorites" href="/FavoriteProcess.aspx?A=Remove&OID={{item.itemid}}&OTYPE=35">
This can be extended with a JS-script to toggle between add/remove which I've found on bcacademe.com on one of their tutorials.