简体   繁体   中英

How to get the tags of the products from a category?

I have a few categories with products in each of them. Each product has some tags assigned to them.

On the category view, I want to display all the tags ONLY the products from that category are having.

I can get all the tags from the shop, and all the products from that category, but how can I take just the tags of the products from that category?

I was thinking to iterate all the products and all the tags and check if each product has that tag and build a list with them (I don't know if it's optimal). Can I check somehow if a product has a specific tag? Or is there any other way to get all the tags of the products I have in my category?

Thanks a lot

First get the product list of a specfic category using category id. Then iterate thorugh all the products to display their tags in the view

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM