Skip Navigation

[Resolved] WooCommerce Views log error 'ID called the wrong way'

This support ticket is created 6 years, 1 month 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 9 replies, has 3 voices.

Last updated by olivierH-2 6 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1149211

I am trying to:
Correct an error that is known by the WordPress debug log. it is related with a Woocomerce shop using Toolset Woocommerce views to display products.

Link to a page where the issue can be seen: hidden link

I expected to see: no error on the log.

Instead, I got:

1/ There is a minor issue on this page : a duplicate of product lists. The first list is the correct one (displayed by a Toolset view). I don't understand how the second is generated (probably by Woocomerce).

2/ An issue is show by the WordPress debug log. Is strongly suspect this is related to Woomerce views, because when I disable the Woomerce views plugin, the error is not shown. Every time a refresh the page, about 500k bytes (!) of the message below are added to the log :
[19-Nov-2018 13:47:47 UTC] PHP Notice: id est appelée de la mauvaise manière. Les propriétés du produit ne doivent pas être accessible directement. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), do_action('template_redirect'), WP_Hook->do_action, WP_Hook->apply_filters, Class_WooCommerce_Views->woocommerce_views_activate_archivetemplate_redirect, include('/plugins/woocommerce-views/templates/archive-product.php'), the_ddlayout, get_the_ddlayout, WPDD_Layouts->get_layout_content_for_render, WPDD_Layouts_RenderManager->get_layout_content_for_render, WPDD_Layouts_RenderManager->get_rendered_layout_content, WPDD_layout_render->render, WPDD_layout_render->render_to_html, WPDD_layout->frontend_render, WPDD_layout_row->frontend_render, WPDD_layout_cell->frontend_render, WPDD_layout_cell_text->frontend_render_cell_content, WPDD_layout_cell_text->handle_content_filters, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, WP_Views->short_tag_wpv_view, W in /var/www/html/wp-includes/functions.php on line 4161

This error is a bit overwhelming and seems to creates server issues (503 errors).

I understand this is related to an issue of (backwards?) compatibility of Woomerce views. Please notice that I am not at all a js/php dev.

Both Woocommerce and Toolset plugins are fully up-to-date.

Best regards,
Olivier

#1149423

Hi, I'll be glad to take a look. Please try the following troubleshooting steps first:
- Temporarily switch to a default theme like Twenty Seventeen and deactivate all plugins except WooCommerce, Toolset and WPML plugins. Test again and watch the logs.
- If the problem was resolved, reactivate your theme and other plugins one by one until the problem returns.
- If the problem was not resolved, please share more information about your site's Layouts. If you have a Layout assigned to the Products Archive, please take a screenshot of the Layout editor so I can see how it's set up.

Let me know the results and we can go from there.

#1150533

Hi, and thanks,
- I tried to switch the theme, deactivated all plugins except WooCommerce, Toolset and WPML plugins. the log stopped to increment.
- I reactivated the theme and plugins one by one. The log started to increment again when I reactivated a plugin named "Restrict Content pro". The error message is still the same.
Thank you,

#1150660

Okay thank you. Can you provide a copy of that plugin so I can run some tests locally? I will activate a private reply field here where you can share a download link.

#1151335

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Olivier,

As Christian is currently on vacation, I will be handling your ticket.

Could you let me know exactly what you did that generated this issue ?

I've installed the plugin but im not sure what you did to replicate the problem.

Thanks,
Shane

#1152952

Hi,
Actually it is impossible for me to say what generated the problem. It was probably, I guess, generated monthes ago by some plugin update, but I never noticed. The fact is that a copy of this website was placed an another server last week and this copy suffers from 503 issues, so I tried to investigate and I discovered with problem by activating the debug.log. Both this website and its copy suffer from this error linked above: was I visit the shop page, around 150Kb of this error message are generated. This happens only on this shop page, not on any content page. This shop page uses a Toolset Woocomerce view to generated the product list.
Christian helped us to find that this error occurs when I visit the shop page and both Toolset Woocommerce views and Restrict Content Pro plugins are enabled.
I hope this helps,
Thank you,
Olivier

#1153271

Hi, I just set up a test site with only Twenty Seventeen, WooCommerce 3.5.1 and Restrict Content Pro 2.6.14 active. I see the same notice appear in my debug logs when I visit the Shop page:

[26-Nov-2018 18:18:57 UTC] PHP Notice:  id was called <strong>incorrectly</strong>. Product properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/plugins/woocommerce/templates/archive-product.php'), wc_get_template_part, load_template, require('/plugins/woocommerce/templates/content-product.php'), wc_product_class, wc_get_product_class, apply_filters('post_class'), WP_Hook->apply_filters, wc_product_post_class, WC_Product->is_purchasable, apply_filters('woocommerce_is_purchasable'), WP_Hook->apply_filters, RCP_WooCommerce->is_purchasable, WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Please see <a href="https://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information. (This message was added in version 3.0.) in /path/to/site/wp-includes/functions.php on line 4161
[26-Nov-2018 18:18:57 UTC] PHP Stack trace:
[26-Nov-2018 18:18:57 UTC] PHP   1. {main}() /path/to/site/index.php:0
[26-Nov-2018 18:18:57 UTC] PHP   2. require() /path/to/site/index.php:17
[26-Nov-2018 18:18:57 UTC] PHP   3. require_once() /path/to/site/wp-blog-header.php:19
[26-Nov-2018 18:18:57 UTC] PHP   4. include() /path/to/site/wp-includes/template-loader.php:74
[26-Nov-2018 18:18:57 UTC] PHP   5. wc_get_template_part() /path/to/site/wp-content/plugins/woocommerce/templates/archive-product.php:72
[26-Nov-2018 18:18:57 UTC] PHP   6. load_template() /path/to/site/wp-content/plugins/woocommerce/includes/wc-core-functions.php:178
[26-Nov-2018 18:18:57 UTC] PHP   7. require() /path/to/site/wp-includes/template.php:690
[26-Nov-2018 18:18:57 UTC] PHP   8. wc_product_class() /path/to/site/wp-content/plugins/woocommerce/templates/content-product.php:27
[26-Nov-2018 18:18:57 UTC] PHP   9. wc_get_product_class() /path/to/site/wp-content/plugins/woocommerce/includes/wc-template-functions.php:648
[26-Nov-2018 18:18:57 UTC] PHP  10. apply_filters() /path/to/site/wp-content/plugins/woocommerce/includes/wc-template-functions.php:637
[26-Nov-2018 18:18:57 UTC] PHP  11. WP_Hook->apply_filters() /path/to/site/wp-includes/plugin.php:203
[26-Nov-2018 18:18:57 UTC] PHP  12. wc_product_post_class() /path/to/site/wp-includes/class-wp-hook.php:286
[26-Nov-2018 18:18:57 UTC] PHP  13. WC_Product_Simple->is_purchasable() /path/to/site/wp-content/plugins/woocommerce/includes/wc-template-functions.php:488
[26-Nov-2018 18:18:57 UTC] PHP  14. apply_filters() /path/to/site/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php:1480
[26-Nov-2018 18:18:57 UTC] PHP  15. WP_Hook->apply_filters() /path/to/site/wp-includes/plugin.php:203
[26-Nov-2018 18:18:57 UTC] PHP  16. RCP_WooCommerce->is_purchasable() /path/to/site/wp-includes/class-wp-hook.php:286
[26-Nov-2018 18:18:57 UTC] PHP  17. WC_Product_Simple->__get() /path/to/site/wp-content/plugins/restrict-content-pro/includes/integrations/class-rcp-woocommerce.php:223
[26-Nov-2018 18:18:57 UTC] PHP  18. wc_doing_it_wrong() /path/to/site/wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-product.php:72
[26-Nov-2018 18:18:57 UTC] PHP  19. _doing_it_wrong() /path/to/site/wp-content/plugins/woocommerce/includes/wc-deprecated-functions.php:116
[26-Nov-2018 18:18:57 UTC] PHP  20. trigger_error() /path/to/site/wp-includes/functions.php:4161

I don't think it's Toolset-specific, as no Toolset files are listed in the stacktrace and I don't have any custom code in place. I think there's a problem with this plugin.

#1153282

Hi, and thank you for this kind answer. So this Restrict content plugin is clearly the source of the issue?
To your knowledge is there any easy solution to this problem? Shall I contact the devs of this plugin?
Thanks, and best regards,
Olivier

#1153325

Sorry but I'm not really qualified to debug another plugin's code or analyze the ramifications of this notice. I can't say for sure if there is an easy solution. I recommend reaching out to their support forum for the best advice. A quick search led me here: https://restrictcontentpro.com/support/

I would submit a ticket and let them know that a PHP Notice is appearing in your site's debug log on the shop page with only WooCommerce and RCP active. Copy + paste one repetition of the code from your debug log so they can analyze it.

#1153670

Thank you very much for your help ! I appreciate,

Best regards

Olivier