Skip Navigation

[Closed] Archive grouping products by taxo or tag without duplicates.

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by Minesh 4 months, 1 week ago.

Assisted by: Minesh.

Author
Posts
#2653843

Hello,

I need some help figuring out the logical way of doing this, or if it's even possible.

I've made this conditional look in the single product template:
hidden link

Basically checks the product_tag and shows all products with the same tag in a box, to display the multiple brand / prices. Works great.

What I would want to do is the same but for the archive posts, ie: category posts. The first and obvious issue is that the products will be duplicated. If I put a similar template in the category_archive of say, clutches, it will show all the diferent prices etc based on product_tag but it will also duplicate, since it's showing all products within the category.

I've thought of a couple ways, including using custom queries, Views API.

The way I thought to approach it was to use some php to recount which products have already been displayed and return null when they have already. Maybe using the #wpv_filter_force_template. But I'm not sure it would work.

I would like some help from the experts in figuring out the best approach asuming it's possible, before I set out to actually program every bit of code etc.

Thank you!

#2653939

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share taxonomy URL and tell me with example what product you want to display and what product that are duplicates you want to remove?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2654077

Hey Minesh,

It's not precisely a problem, I'm mostly looking towards help with the building logic.

The navigation of my site uses product_cat for the archives, those cats can be clutchs, brake parts, etc. If you look at the link I provided, you can see in the single post product I already have set up what I want to translate into an archive. In the link provided there are three separate products displayed with their prices, that is using a View that queries the product_tag and retrieves all products with that tag.

The thing with an archive of a product_cat is that it will show all products of that cat, so if I use a template that in turn uses a View to query the product_tag, I can obviously reproduce that same behaviour in the archive, but since all products of that category will be shown in the archive, the products will not so much duplicate in a strict sense, since it will show unique SKUs, but since I'm showing in a single product 'box' multiples products that have the same tag, it will propagate.

So:

SKU1's box will show, SKU2 & SKU3
then
SKU2's box will show, SKU1 & SKU3
then
SKU3's box will show, SKU1 & SKU2

Is it clear what I'm saying so far?

I was thinking of building custom code to monitor some of this, but before diving into coding I was hoping to get some feedback, since I'm not 100% sure what I'm trying to do is feasible.

#2654835

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I understand that you do not want to duplicate the product within the same tag/category on taxonomy archive and you have specific requirement about displaying the product matching the unique SKUs and/or price.

To filter the taxonomy archive query you can use the standard WordPress "pre_get_posts" hook.

You can not use "wpv_filter_force_template" hook as its not for use of archive, its for filtering the single post content template.

If you have multiple archive per term then you can switch the archive based on your desired condition using the hook:
- wpv_filter_force_wordpress_archive
=> https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_force_wordpress_archive

If you can help me with real life problem URL of your tags archive and tell me what products you want to include/display with that archive and what products you want to remove and based on what condition, once I review all those information I will be able to guide you in the right direction and tell you what would be the best possible workaround/solution in that case.

For that I will require admin access details and all the required information that you can share with few screenshots (if possible/required).

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

The topic ‘[Closed] Archive grouping products by taxo or tag without duplicates.’ is closed to new replies.