Skip Navigation

[Closed] How to create a Woocommerce sub-category sidebar in Woocommerce Product Archive

This support ticket is created 4 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by Christian Cox 4 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1741211

** THIS IS CARRYING ON FROM THIS TICKET = https://toolset.com/forums/topic/how-to-create-a-woocommerce-sub-category-sidebar-in-woocommerce-product-archive/
I tried clicking ‘I still need assistance’ to enter my next reply, but I get an error message saying ‘ERROR: Topic is closed’, so I have had no choice but to open a new ticket for the same thread 🙁 I was speaking with Christian, which is why my first reply is marked to his attention **

Tell us what you are trying to do?
I am using the Toolset Woocommerce Views plugin to create my Woocommerce layouts (for individual product pages and for category pages / archives). What I want is to be able to create a sidebar in my archives layout for example, which shows all of the sub-categories (children) of the current selected category page.
I can see that there is in fact a 'Widget' which seems to achieve most of what I want, which is called 'Product Categories', however I am unsure how I could load this widget into my Tooolset 'View' that I am building. Please can you help?
Or is there an easier way to achieve what I want to do already built into Toolset Woocommerce Views plugin? Many thanks
Is there any documentation that you are following? I've tried looking through toolset docs and forum but couldn't find anything which solved this.
Is there a similar example that we can see? You will see this style of category navigation on most good e-commerce websites
What is the link to your site? N/A, currently being developed
Thank you very much for your assistance 🙂

#1741213
extra taxonomy 'view' I created to load into my products archive page.png
My Toolset 'Dashboard' Page.png
my Toolset woocommerce views page.png
my 'products archive' template page.png
the-front-end-sidebar-is-just-blank.jpg
code-being-loaded-in-my-sidebar.jpg

Hi Christian, thank you for explaining to me the difference between a Product Archive and a Product Category Archive, that make sense now 🙂
Also, sorry for the delay getting back, but I had to down tools on this project for a few weeks.

OK, so to make things easier and so I don't confuse things, at this point I am just going to concentrate on the 'Products Archive' to get that working (so what is on the URL myshop.com/shop).

I have tried to set it up as per your instructions, however, my 'shop' page still shows nothing (where I am expecting there to appear a vertical sidebar to the right of the products grid which should contain links to my top level shop categories, of which there are 4) so I will run you through exactly how I have set things up, and hopefully you can see / explain what I have done wrong:

- Within Toolset, my 'WooCommerce Views', I have set the 'Product Archive Template File' to 'WooCommerce Views plugin default product archive template' (screenshot attached 'my Toolset woocommerce views page.png')

- I have also attached the screenshot 'My Toolset Dashboard Page.png' to show you that I have the 'Products' Archive setup with a file 'Products Archive (Shop Page)'

- I have then also uploaded a screenshot showing my full settings for the 'Products Archive (Shop Page)' (the name for my Products Archive 'View') in Toolset (called 'my products archive template page.png').
Within that image, I draw your attention to the 'Loop Editor' box, where you can see my code, then within that please see the <div> on lines 18 to 20, which contains an extra Toolset 'View' which I have made. This is the sidebar where on this 'Shop' page, I would be expecting to see the top level Shop Categories (of which there should be 4 of them).

- The next uploaded screenshot ('extra taxonomy view I created to load into my products archive page.png'), shows the extra View I mentioned above, which has been loaded in, by shortcode, within the sidebar on my Product Archive. On that screenshot you can see all of my settings, which from reading what you have said, I would expect to be correct (You can see in the 'Loop Item' I have the text 'Test' and then the taxonomy title and taxonomy url) however in the front end nothing is appearing, it is just blank. I only want the Taxonomy name (so the Product Category) to show, with a URL attached to it, but I put in the 'test' text along with the title and the url just to try and see if I can get anything to load in, but I can't).

- The next attached screenshot is a shot of the front end ('the-front-end-sidebar-is-just-blank.jpg'), to show you that nothing appears where the sidebar menu should be appearing.

- Strangely, if I right click on the blank sidebar in the front end and go to Dev Tools to look at the code, you will see from the final screenshot ('code-being-loaded-in-my-sidebar.jpg'), that the View is loading in 4 "li" elements (so it seems 1 for each of the top level categories as expected), however there is nothing inside of those "li" elements (where I would expect there to be the text 'Test', then the taxonomy title, then the taxonomy url, appearing).

Are you able to see from what I have explained above, and from the screenshots, where I am going wrong, and why nothing is appearing in the sidebar?

Again, thank you very much for your help, and if it's easier I can provide admin access to my site for you (it's on a staging environment but I can provide access).

Cheers,

Keith

#1742361

Are you able to see from what I have explained above, and from the screenshots, where I am going wrong, and why nothing is appearing in the sidebar?
Okay yes, there is currently a known issue with Taxonomy Views displayed inside a Taxonomy Archive, where the contents inside the Loop Template of that View are not being displayed as expected. The workaround is to move the contents from the loop template into the loop itself. More information about this bug:
https://toolset.com/errata/the-loop-content-template-of-a-taxonomy-view-placed-inside-a-wordpress-archive-returns-nothing/

So in your shop-page-product-archive View, you must replace this shortcode in the Loop Editor with the actual contents of that template:

[wpv-post-body view_template="loop-item-in-product-parent-sidebar"]

Copy the contents of that template and paste them in place of the shortcode above:

Test
[wpv-taxonomy-title]
[wpv-taxonomy-url]

Perform any other changes you want to make in the actual loop editor, not in the loop template editor, and those changes should be immediately reflected on the front-end of the site. I hope this clarifies things enough that you can continue development. If not, feel free to reach out for more guidance.

The topic ‘[Closed] How to create a Woocommerce sub-category sidebar in Woocommerce Product Archive’ is closed to new replies.