Skip Navigation

[Resolved] Add to Compare and add to Favorite Button

This support ticket is created 5 years, 4 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 5 replies, has 2 voices.

Last updated by Nigel 5 years, 4 months ago.

Assisted by: Nigel.

Author
Posts
#1457573

Tell us what you are trying to do?
I want to add these buttons to my custom post type

1. Add to Favorite button
2. Add to Compare button

. I tried to see the tutorial but I can't seem to make it worl

Is there any documentation that you are following? No, only tutorial by Agnes in youtube

Is there a similar example that we can see?
Please check this website
mylegacyproperty.net

What is the link to your site? helperhub.biz

#1458065

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

There isn't an easy way to add a favourites button. It is possible, but it is awkward trying to implement this with forms and you can get a much smoother experience by using a dedicated plugin such as favoriteposts (hidden link).

It likely needs some custom work for it to work seamlessly with Toolset, but if you have a specific task you want to accomplish with it then I can try and help.

Regarding the "compare" button, where are you getting stuck?

The documentation page which accompanies the video is here: https://toolset.com/learn/create-an-ecommerce-wordpress-site/product-comparison/

It is an older documentation page that assumes you are using Layouts, but the key parts are the two Views and the form you manually create within one of the Views to link them.

If you can let me know how far you got and where you got stuck I can try and help.

#1465291

Hi Nigel, I will look into that Favorites plug in. But actually I don't want to get the website bloated with plugins. But okey let me try this first.

About the Add to compare, I actually followed Agnes tutorial on youtube. But it seems the reason why it is not working is because I created a view with search and pagination and it is not similar to what agnes has done in that add to compare button, thus even if I insert HTML (input type="radio") inside the container it doesn't really work.

after I check the add to compare radio button and click on Go to Compare button, it directs me to the compare page. But when I check all the custom posts are there. I am expecting only the Custom post which I ticked the add to compare.

So please help me to finish this task and your step by step guide will be highly appreciated

#1469553

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Sorry for the delay getting back to you.

One thing I'm not clear on from your posts is whether you are trying to implement this the same way as the tutorial, namely, are you using Layouts for this. I expect the tutorial will get updated at some point to work with the Block editor.

As the existing tutorial already has step-by-step instructions for doing this with Layouts, I'm guessing you want something else, e.g. to use the Block editor?

#1472069

Hi Nigel, before trying to implement this add to compare function. I actually followed one of Agnes tutorial on custom Search with results and pagination tutorial. After I accomplish this using views. I came accross this add to compare tutorial which I really wanted to implement in my project.

But the problem is that in Agnes tutorial in add to compare. She added a form and a submit button then added this add to card checkbox

When trying to duplicate this using block editor, I am having trouble. Although I added the check box "add to compare" but when I test it and applied to some of the custom post. All the custom posts are there in the compare page. I was expecting that only those posts that added to compare will show up.

So Nigel, my question is how I am going to add this add to compare to my custom search page. Thanks

#1473147

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Dennis

I went through the tutorial, trying to recreate it using Blocks instead of Layouts, and realised when arriving at Step 3 (to connect the two Views by editing the markup of the View output to wrap it inside a form) that you cannot, it's not possible to edit the markup in the Block editor in the same way as with the classic Views editor (which is what is described in the original tutorial, using a View cell inside a Layout).

So I needed to create the Views inside the classic Views editor, which it sounds like you have done according to your last reply.

I followed the steps in the tutorial (https://toolset.com/learn/create-an-ecommerce-wordpress-site/product-comparison/), the only change I made was to ignore the parts about using Layouts. So I created the Views (at Toolset > Views) and then inserted them onto the respective pages.

I made the edits to the Products to compare View to include a form, as described in this section: https://toolset.com/learn/create-an-ecommerce-wordpress-site/product-comparison/#step-1-adding-a-form-to-the-products-to-compare-view

I then added a Query Filter to the Comparison results View as described in this section: https://toolset.com/learn/create-an-ecommerce-wordpress-site/product-comparison/#step-2-adding-a-filter-to-the-comparison-results-view

The only gotcha I found was that in Step 1 it said "Open your Compare products View for editing", and I had named the first View "Products to compare" after the page it was inserted on, and so that could lead to confusion about which View to edit.

I can take a look at your site if you like to see if I can spot what you've done that might explain why the Query Filter isn't working?

I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.

Can you also confirm the pages where you inserted the Views, they have the same names as the tutorial?