Skip Navigation

[Resolved] Problems with the rendering of views in footer woocommerce products

This support ticket is created 6 years, 11 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 19 replies, has 4 voices.

Last updated by Francisco Ramón Molina Busquiel 6 years, 11 months ago.

Assisted by: Beda.

Author
Posts
#598542

In order to try to solve this satisfyingly, I need to know exactly how that View is added to your Site.

I understand this happens with Custom Code.

1. Please confirm that when you insert render_view() in your Theme's Footer, this shows exactly as expected in any location of your site, since well, you add the code the Footer with PHP, so it shall display wherever the footer is visible.

Instead of this use render_view():

<? php echo do_shortcode ('[et_pb_section global_module = "35417"] [/ et_pb_section]'); ?>

It is nowhere documented that you can output nested ShortCodes with 3rd party ShortCodes using PHP, this is due to break, for reasons explained several times.
We will not add compatibility to such features, as they are simply wrong in the approach.

2. Please try to add that View with our ShortCodes to the_content() (your post body) in different locations and types.
It will show wether or not that View works fine if used as suggested.

It should always use the same style and format.

I understand this issue happens only and solely when you display the View through a Custom ShortCode though Custom PHP on the Theme's files.

I am also downloading the package to test the above myself, but I am sure this is the solution to it.
I will get back at you if I find any other way to solve the issue.

Thank you

#598601
image__03.jpg
image__02.jpg
image__01.jpg

Beda,
The custom code is a trivial code that is usually used in DIVI to display an item in the DIVI Library.
The code in Functions.php is:

function showmodule_shortcode($moduleid) {
  extract(shortcode_atts(array('id' =>'*'),$moduleid)); 
  return do_shortcode('[et_pb_section global_module="'.$id.'"][/et_pb_section]');
}
add_shortcode('showmodule', 'showmodule_shortcode');

In footer.php I put the code:

<?php echo do_shortcode('[et_pb_section global_module="35417"][/et_pb_section]'); ?>

However, Toolset has more problems than I thought.
Trying to do more tests, just as you advise me, I have done a test with regrettable results.
The same element of the DIVI library that I use to render the footer I has been imported into a standard Toolset content template and I have included it in the normal way with your 'Fields and Views' button in the product form of 'JfControls Standard' product.
hidden link

[wpv-post-body view_template="sendafooter_ct"]

When I try to show the product page:
hidden link
It is shown an error of:
"Content not shown because it produces an infinite loop"
Look at the screenshots.

I will continue to do tests, but as you will see the first test has been quite horrible. ?

Another test:
I tried to replace my custom shortcode in the file footer.php with the function render_view(), but it does not render anything.
Surely I have done something wrong.
This is the code that I have used:

			<footer id="main-footer">
				<?php /*echo do_shortcode('[et_pb_section global_module="35417"][/et_pb_section]');*/
$args = array('title' => 'SendaFooter_CT');
echo render_view($args);
 ?>

Thanks for your help.

#598623

As the message says, it's not a BUG but a tool that helps you to narrow down issues.

Here we have an infinite call to the post body within the post body.

Hence it can not work.

On the site you shared the login (username) is not valid anymore. Has it been deleted?

I deployed your Site's copy locally and on single products, turning on WP Debug an doing nothing else, I see:

( ! ) Notice: Trying to get property of non-object in .../plugins/unicorn-assistant/unicorn-assistant.php on line 116

I removed it.
I understand it is a DIVI Plugin, but it produces an error, that happens even if you fully disable Toolset, hence it's not related to a conflict and we need to have a clean page to test the issue.

I then commented the line in your theme's footer:

//echo do_shortcode('[et_pb_section global_module="35417"][/et_pb_section]'); 

And used render_view() instead, which is not solving anything, it makes it worse.
I solved this by using the suggested approach of assigning a Content Template to the single Post of Products.
Then it works.

Then also your custom ShortCode works.

So, the solution is also here, to use the suggested and documented approaches.

To solve the problem please head to Toolset > WooCommerce Views > Product Template File and choose "WooCommerce Views plugin default single product template"
Then create a Content Template to style your products and assign it to Products
After, check a single product to see the correctly rendered view in the footer.

As soon I re-enable "WooCommerce Plugin Default Templates" in the WooCommerce Views settings the issue will come back.

So, it should not be a BUG, since this is the recommended way, and what we integrate with, if you use DIVI and Toolset.
I even tested this on your duplicator re-enabling the error causing plugin mentioned above.

#598630

I have not deleted the user 'Toolset'.
You must login on the web through
hidden link
If you mean this link:
hidden link
I was wrong, the correct one is:
hidden link

Regarding the announcement of the unicorn plugin, I contacted its developers, but they told me that it did not matter, it was just a 'notice', not an error that affected the operation of the plugin.

I am afraid to use a content template for the pages of each product, since I suppose I will have multiple appearance problems by using the Toolset shortcodes in product pages, however, I will try to make the template for these pages.
One of the problems that I am sure I will have is that the rendering of the short description of a product does not take into account the html format of its content.

By the way, I would like to know what I was doing wrong when I tried to use render_view(), what did I do wrong?
What is the correct code to use render_view() and render the content template 'SendaFooter_CT'?

Well, I'm going to dare, I'm going to make the template for single products.

Thanks for your help Beda.

#598650
2017-12-13_18-48-55.jpg
2017-12-13_18-25-45.jpg
2017-12-13_18-25-11.jpg
2017-12-13_18-24-51.jpg
2017-12-13_18-24-17.jpg

Well, I've already made the template for the product pages and as I thought there are numerous problems in the appearance.
In addition to the problems in the format of the header page, something that must be resolved by the developers of Toolset regarding the incompatibility between the CSS of DIVI and the CSS of Bootstrap. You can also see the smaller size of the internal elements, the small images, the margins of the elements, the margins of the page, the short description has been rendered without format.
You can see the differences in appearance between the original appearance and the new one in the screenshots.
If you can solve all these problems and also solve all the problems of Toolset Access it would be fabulous.

Thanks for your help Beda.

#598842

it was just a 'notice', not an error that affected the operation of the plugin.

Sure, this is not up to me to decide.
It will just fill up your debug log, if you have one, and produce a long chain of errors in the front end if debug rendering is activated.
But yes, it's just a notice, which tells us that the information we try to get will not be provided.

Anyway, this is not up to us to decide, we will just leave this plugin out of the game in this debug process.

What is the correct code to use render_view() and render the content template 'SendaFooter_CT'?

None, because render_view() is rendering a View - not a Content Template.
The Content Template is rendered (if you use the API) with render_view_template():
https://toolset.com/documentation/programmer-reference/views-api/#render_view_template

The main question of this ticket is to solve the reported bug.

Does the reported BUG still appear now that you followed the suggested steps above and used a Content Template with proper WooCommerce Views Settings?

If so, we can close this here.

Related to the DIVI issues with CSS, please, if not already, add them to the DIVI main Ticket:
https://toolset.com/forums/topic/style-conflicts-with-bootstrap-and-3rd-party-plugins-or-themes/

Related to Access, I understand those are already reported in tickets, correct?

#598874

Yes. The problem of this ticket has been solved, although the solution has caused other problems. One of them, the appearance of the page, and another, the rendering of the short description of woocommerce products, since Toolset does not support the rendering of the short description of the products.
As you insisted so much with the function render_view, that's why I asked you about that function. Yes, you are right, it is a content template where the footer of the page is and therefore it can not be used, it would have been necessary to have put the whole layout in a view.
Regarding Toolset Access I understood that you were going to help me in all those problems of the plugin, since in the tickets the only thing that was done is to check all the limitations that Toolset Access has to make a membership site and the problems with other plugins, but nothing was solved. But hey, if the conclusion is that it cannot be used to make sites membership, I accept it. I disable the plugin and install plugins that can be used for that purpose.
I close the ticket.