Skip Navigation

[Resuelto] Issues with custom product templates using WooCommerce Views

This support ticket is created hace 6 años, 2 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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)

Etiquetado: 

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por Valeriia hace 6 años, 2 meses.

Asistido por: Nigel.

Autor
Mensajes
#1117674

Hi,

I'm using WooCommerce Views to build the loop of products with custom taxonomies but running into some problems with single product template because of that.

Yesterday I finished the layout of single product single-product.php and it was working fine. In WooCommerce Views settings I selected - Product Template File: Theme Custom Product Template.

Today all I did is to add archive-product.php to my theme and set the settings "Product Archive Template File" to "Theme Custom Product Archive Template". The archive page is working fine. But in single product the content disappeared. I.e. everything that was shown as

<?php the_content(); ?>

yesteday is not visible anymore.

In the settings I see the line "Congrats! You've selected your own blank template for products. Next, you need to create a Content Template for products" in WooCommerce Views settings. I suppose this is why the template is empty.

My question is: how do I make the system display the product content in my single-product.php without using Content Template (as it was yesterday)?

Thanks.

#1118162

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Screenshot 2018-10-01 at 08.45.59.png

Hi Valeria

I've tried to reproduce this issue, but I'm not sure I have understood.

I copied the following files from /plugins/woocommerce/templates to themes/twentyseventeen/woocommerce:

single-product.php
content-single-product.php
archive-product.php

I edited the single product templates to add H1 tags to show they were being used.

WooCommerce templates don't output the_content() directly, so I added the_content() to the top of the content-single-product.php file, immediately after my H1 tag.

I then went to Toolset > WooCommerce Views and in the settings specified the twentyseventeen theme single product template.

You can see the results in the screenshot. "Pellentesque habitant morbi tristique..." is the post content (used as the description by WC).

I then updated the settings for product archive to also use the twentyseventeen theme template.

I see the "Congrats! You've selected your own blank template for products." message.

When I visit a single product on the front end, it looks exactly the same as before, no discernible change.

Because I haven't made any changes to the product archive template, the shop page also looks exactly the same.

Apart from the misleading message about needing to create a Content Template for products (which is wrong because we are using the theme template), I can't see anything wrong.

#1118255

Hi Nigel,

Thank you for the reply.

No, my configuration is different. I don't have woocommerce folder in my theme. I added single-product.php to the theme itself and it was working like a charm until I changed the settings for archives (as it seems).

I tried to add woocommerce folder now and put single-product.php inside, but it gives the same result. It only works when I choose "Product Template File" : "WooCommerce Plugin Default Templates". I does not work even with your "WooCommerce Views plugin default single product template".

I kind of hate customizing the WooCommerce, such a headache every time plus it is constantly updating. This is why I was so happy to be able to use just my own single-product.php thanks to Toolset. I really really want it to work out.

Here is the screenshot with the settings I have (Kameleon is renamed TwentySeventeen): enlace oculto

(I could not upload the screenshot here again, the button "Upload an image" is not responding. I'm using Yandex browser.)

I uploaded the site online. I can give you the access to check it out if you can't reproduce the issue this time as well.

Thanks.

#1118280

Nigel
Supporter

Idiomas: Inglés (English ) Español (Español )

Zona horaria: Europe/London (GMT+00:00)

Hi Valeria

OK, so this time I simply duplicated single.php -> single-product.php and archive.php to archive-product.php, adding an h1 to each to identify them on the front end.

I changed the settings at Toolset > WooCommerce Views to use both, and everything from the templates was output as expected.

There must be something specific to the templates you have created that accounts for why the single product template no longer works correctly.

Before going any further in trying to identify what, if the only reason you are using Toolset WooCommerce Views is to enable you to use your own custom PHP templates for single products and the product archive, why use it at all?

If you create a woocommerce folder in your theme/child theme and create a single-product.php and an archive-product.php in that folder, they will be automatically used instead of the standard templates that ship with WooCommerce.

#1118316

The problem is that it does not.

To be completely sure, I just deactivated WooCommerce Views, recovered the backup from the day before the issue occured, and did as you said: put single-product.php and archive-product.php inside woocommerce folder in my theme.

The result is that it uses anything but my single-product.php and archive-product.php.

Earlier last week I've spend a few hours trying to figure out why it does not want to read my archive-product.php regardless of where I put it. The only way I managed to display my archive is with WooCommerce Views by setting "Product Archive Template File" to "Theme Custom Product Archive Template".

The good news is now, after I activated WooCommerce Views again, everything works as it should. A bit of а mystique, but no need for your intervention. Closing the ticket.

Thanks for pushing me in right direction and have a nice day.