Skip Navigation

[Resolved] Attribute not working in Output Editor

This support ticket is created 2 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by nicolaS-3 2 years, 3 months ago.

Assisted by: Waqar.

Author
Posts
#2266559

Hi all,
I have implemented an Add to Favorites/Remove from Favorities system on classifieds that works fine. The only issue I have is related to the view (in the single classified post content template) that loops over the favorities CP (of the current user) and checks if the current single classified displayed is already a favorite or not, in order to show the proper button.
During the loop I have a conditional test that tests if the classified ID in the Favorities custom post is equal to the ID the current single classified displayed (passed to the view as attribute): if yes, the "Remove from favorities" button is displayed, and this works fine. If not the "Add to favorities" button is displayed, but it is as many times the total number of favorities the user has, not just once ! and this is "correct" in terms of the loop, but not for the user of course.

I tried to move the test to the Output Editor and it works, the "Add to favorities" button is displayed just once, but it is also when the "Remove from favorities" button is displayed. Unfortunately the test doesn't work in the Output Editor because the attribute is not passed there and it's empty.

I need a way to display the "Add to favorities" button just once:
- If it was VB I'd create a variable that I'd increment during the loop and test against at the end, but what in Toolset ? or
- is there a way to pass the attribute also to the Output Editor so that the test works ?
Or please suggest any other solution.
Thanks
Nicola

#2268073

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Nicola,

Thank you for contacting us and I'd be happy to assist.

In my tests, I was able to access the value passed through the view's shortcode attribute in the "Output Editor" section as well.
( using the "wpv-attribute" shortcode https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-attribute )

Can you please share temporary admin login details, along with the link to an example page where this view can be seen? I'll be in a better position to suggest the next steps, accordingly.

Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.

regards,
Waqar

#2268575

Hello Waquar,
considering the conflict between the two forms, I have decided to use a favorites plugin instead of the Toolset solution. This is a pity because the solution could work by itself. You can close the ticket.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.