Skip Navigation

[Resolved] Split: Add "this product also fits…" section to a WooCommerce product page

This support ticket is created 5 years, 11 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+00:00)

Author
Posts
#1178939

Great stuff Nigel,

It works fine now.

Can you help me with something else, this time on the single product page?

Or should I create a new ticket?

I basically want a "this part also fits" as a tab on the bottom, when that tab is clicked it displays all the model that a product is assigned to.

As a table or list.

#1178966

Good morning,

What I want to achieve is:

On the single product page. In the tabs underneath, or a separate row. A section called "Parts Suitable for".

In there a list of all the models that that Product as been assigned to, as well as the Manufacturer.

So a little like this. Ignore the repeated models. Just to give an idea.

DAF CF65, CF67, CF65, CF67, CF65, CF67, CF65, CF67, CF65, CF67, CF65, CF67, CF65, CF67, CF65, CF67, CF65,
CF67,

Mercedes Avego, Actro1, Actros 2, Avego, Actro1, Actros 2, Avego, Actro1, Actros 2, Avego, Actro1, Actros 2, Avego,
Actro1, Actros 2.

But the text needs to be a URL, so clicking on any of the models, would send you to that page of Model (post type) where there all the parts for that are just another section of the shop.

#1179020

Nigel
Supporter

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

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

The pages that these links link to are also a kind of archive page.

Up to now we've been working with the product archive page (which behaves a little differently than normal, living at the URL of a static shop page defined in the WooCommerce settings), which displays a list of product posts.

Now we are dealing with taxonomy archive pages, which have a default URL format of site.com/taxonomy-slug/term-slug/.

So at the URL site.com/model/cf65 we would see all the posts (specifically, the product posts) which have the term CF65 of the model taxonomy assigned.

Similarly, site.com/model/avego would show the products assigned to the avego model.

You need to create a new custom archive at Toolset > WordPress Archives to design the output of these archives as you want. You can assign the custom design to multiple archives, so you will only need to make one custom archive which can be used both for the model taxonomy and the make taxonomy if you like.

Note that you cannot re-use the existing custom archive, because these taxonomy archives cannot contain the custom search filters. If you are at a URL site.com/model/avego this is interpreted by WordPress as the archive of posts with the avego term assigned, and other posts (e.g. posts with the CF65 term assigned) cannot be displayed at this URL.

If you want the output of the products to look the same, you can, however, copy the Loop Output section from your existing custom archive to the new custom archive, so that it points to the same template that you already designed.

So, that deals with setting up the target pages.

As for generating the links themselves, you can output these using the wpv-post-taxonomy shortcode.

Use the Fields and Views button to insert the model taxonomy, for example, and the default options will display the assigned terms as archive links in a comma separated list.

#1179029

That sounds really complicated!

Ill give it a go, but it probably wont work ha ha.

Can you just have a quick look at this site, and see if you can figure out how they have done it?

You will see whatever you choose on the top, be it make or product category. The buttons on the top bar, drop down and if you choose DAF. The filter then just show the models on the left. As it already know that you have selected DAF.

Similarly, when click products, you are then just allowed to choose Make & Model. But it also picks the Sub Category because it knows you have selected Exhausts.

Is the way I am doing it the best way to achieve what I want?

The layout of their site, and the ease of navigation/filtering is exactly what I need. Or does WooCommerce/Toolset simply just not offer this?

#1179030

doh!

hidden link

#1179082

Nigel
Supporter

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

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

OK, that site didn't just happen, it's a custom site that does not use WordPress, and so doesn't have to follow any of the WordPress conventions, they designed and built it how they wanted it to work. (It is not clear what it was built on just from looking at the page source, but it is not WordPress.)

Let me clarify one of the things I stated in my last reply given what you are aiming for: a taxonomy archive page cannot include custom search for terms of that taxonomy. It can include search for terms of other taxonomies.

So, instead of creating one new custom archive, create two. (You can copy and paste the Loop Output section from your original custom shop archive so that the products appear the same.)

Create a custom archive with search to be used for the make taxonomy archive.

Add a filter for the model taxonomy, and design the output (probably copying and pasting the Loop Output section from your shop archive).

Now, whenever a URL such as site.com/mercedes/ is visited, that will display all products for use with Mercedes, and it will include a filter where a specific model can be selected to narrow the search down further.

That looks closer to what you want.

If it also makes sense to have a model archive (i.e. show products for a specific model), then you could go ahead and create that second new custom archive (but without search filters).

On the homepage of the site you linked to they displayed links to each make.

You could generate a similar list by creating a View where the content selection is the make taxonomy itself, and in the Loop Output section you output the taxonomy archive links, so you will get a list, DAF, Mercedes etc. as links to the archive page you just designed, where the visitor can continue by searching for the model.