Skip Navigation

[Resolved] I want to display custom taxonomy name in product item displayed on archive page

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

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

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by Noman 6 years, 8 months ago.

Assisted by: Noman.

Author
Posts
#562328
what-i-have.jpg
what-i-want.jpg

I used Toolset to create 2 new taxonomies for products: Artist and Label. I connected my products (Albums) with the Artist and the Label. Now I would like to display the name of the Artist on my product items - on home page, archive page and product page.

Here is my website: hidden link
You need to login with: gl and pass: gl!

I want to do it using Toolset without any coding. I've tried Views but with no effect.

Many thanks for help!

#562355

Noman
Supporter

Languages: English (English )

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

Hi Tom,

Thank you for reaching out to us. I am not able to access your site with Username: gl and Password: gl!

Use the below shortcode in your Content template/View to display name of the Artist on home page, archive page and product page:

[wpv-post-taxonomy type="student-class" separator=", " format="link" show="name" order="asc"]

Replace ”student-class” with your taxonomy slug in the above shortcode.

Thank you

#562385

Hi Noman,

Thank you for your help, but I don't understand where I should put this shortcode.
What is wrong with the password (it was only to pass a browser security modal not for wp-admin)?
Can you see the website on this url: hidden link?

My goal is to change a single product item that is displaying on for e.g. home page. I added (using visual composer) a block with 4 best selling products. But they have not enough information.

Maybe it will be easier if I give you access to wp-admin?

#562478

Noman
Supporter

Languages: English (English )

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

I tried password multiple times in browser security modal but it keeps on showing that modal. However, I can see the issue.

In the Homepage you are using Visual Composer element to display products, Toolset cannot modify or edit element that is being created with Visual Composer. That requires code level updates on that particular VC element to include Custom Taxonomy assigned to each Product.

1. But what you can do is re-create that section as a “View” using Toolset Views plugin >> to list products using that >> and insert your fields into this Archive View (fields = product image, product name, price, etc…) and Custom taxonomy as well (the shortcode that I provided above.

2. To add Product related fields you would need to install Toolset WooCommerce Views plugin which will allow to insert these fields in the View.

- Doc shows how to add WooCommerce product fields into View (see from point #5. Scroll down to the Loop Output section): https://toolset.com/learn/create-an-ecommerce-wordpress-site/designing-woocommerce-product-catalog/

- Here is a video on creating a basic View: hidden link

Please note: For homepage you can just create a normal View and add the needed fields into that. We don’t need to do anything to Archive page for this.

3. Then finally insert the newly created View into the Homepage (you can add it in a text block of VC) and remove the old Visual Composer element from there. You may need to add some styling to adjust the look as like to have.

Thanks

#563217

Ok, I want to create a block with 4 best selling products. How should I do it using views?

#563321

Noman
Supporter

Languages: English (English )

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

VC Element - Best Selling Products.png

You can show list or grid of products but Views does not have any builtin way to show “best selling products” of WooCommerce.

After further research I found that you can use builtin element of Visual Composer called “Best Selling Products” and we can modify it with some code to show product category, please follow below steps:

1. Currently your site or theme might be using some other VC element to display these products, so please delete that if that is the case.
2. Then insert VC element in your page called >> Best Selling Products (see attached screenshot).
3. Please add this code in your theme’s or child theme’s functions.php file to show Product Category:

/** WooCommerce - Display Product Category Title on Shop Page */

add_action( 'woocommerce_before_shop_loop_item_title', 'add_product_cat', 25);
function add_product_cat()
{
    global $product;
    $product_cats = wp_get_post_terms($product->id, 'product_cat');
    $count = count($product_cats);
    foreach($product_cats as $key => $cat)
    {
        echo 
  '<span class="category_title">
  <span class="category_title_'.$cat->slug.'">'.$cat->name.'</span></span>';
        if($key < ($count-1))
        {
            echo ',';
        }
        else
        {
            echo ' ';
        }
    }
}

Please note that this code may or may not need some change based on your theme or site setup.
Thanks

#563330

It doesn't work 🙁 After puting your code in functions.php I get error 500. I am not really sure it will work, because what I want to do is show one specific custom taxonomy from Toolset. I am not a php developer but from what I understand this funkction will show all categories.

Maybe best selling products is not an answer. Can I show 4 products in a block made in Views that is a "featured product"? I am talking about the products with start icon clicked in Products module.

#563331

You can also check my website again. We changed login and pass to abc / abc.

#563379

Noman
Supporter

Languages: English (English )

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

Limit.png

Can I show 4 products in a block made in Views that is a "featured product"?
==> Yes, you can do that using Views, please see video here:
hidden link

And to Limit products display to 4 products -- see attached screenshot.

Thanks

The forum ‘Types Community Support’ is closed to new topics and replies.

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