Sauter la navigation

[Résolu] Using WooCommerce Views Calculated Fields w/ 2500+ products

This support ticket is created Il y a 7 années. 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Marqué : ,

Ce sujet contient 7 réponses, a 3 voix.

Dernière mise à jour par Luo Yang Il y a 5 années et 1 mois.

Assisté par: Luo Yang.

Auteur
Publications
#594516

Tell us what you are trying to do?

We run nightly product imports. After every import, we need to make sure the Calculated Fields are recalculated. I have on way of know if it's completing, whether or not it uses a proper Async library like WooCommerce does, etc. I see that it pulls all product IDs at once and loops through them. This doesn't look like it would succeed in a single web request with 2500+ products. How am I supposed to do this properly? Am I missing something? - Screenshot: lien caché

Is there any documentation that you are following?

Yes, but it doesn't say anything about IF it actually batch processes, timeouts, whether or not it can handle 2500+ products, whether or not you have to call it more than once, etc

Docs: https://toolset.com/documentation/user-guides/woocommerce-views-calculated-fields-and-batch-update/

Is there a similar example that we can see?

Nothing really to show. Just need help understanding exactly how it works.

What is the link to your site?

lien caché

#594616

Dear zachary,

I assume we are talking about the option of Woocommerce Views plugin, in Dashboard-> Toolset-> Woocommerce Views
option "Static Product Fields for Parametric Searches".

For your question:
This doesn't look like it would succeed in a single web request with 2500+ products. How am I supposed to do this properly?
That depends on your server capability and server settings.
Have you tried the option "Manually", and click button "Calculate Now"?
Did you get any PHP debug logs when you run the "batch update"?
If you get a "Connection Timed Out" error, you can try to increase the PHP execute time limitation:
https://codex.wordpress.org/Common_WordPress_Errors#Connection_Timed_Out

#594816

RE: "I assume we are talking about the option of Woocommerce Views plugin, in Dashboard-> Toolset-> Woocommerce Views
option "Static Product Fields for Parametric Searches"."

Yes

RE: "Have you tried the option "Manually", and click button "Calculate Now"?"

Yes, and it shows no indication that it actually finished. The progress indicator sits there and spins forever, and disappears if you refresh the page. This is also not an option for the production environment as the import runs automatically every night and it has to occur at ~4am, so running it manually everyday isn't going to work.

RE: "Did you get any PHP debug logs when you run the "batch update"?"

Yes, I'm getting the following errors:

- Fatal Errors:
-- Maximum execution time of 30 seconds exceeded

- Slow Running Errors for the following functions:
-- wc_setup_product_data()
-- wcviews_setup_product_data()
-- ajax_process_wc_views_batchprocessing()

RE: "If you get a "Connection Timed Out" error, you can try to increase the PHP execute time limitation"

This is never an option, so I'm not sure why you're suggesting it. All managed WordPress Hosting Platforms (Flywheel, WPEngine, etc) definitely do not allow you to change the PHP execute time limitation. Shared hosts also do not allow you to change this. Those 2 providers cover the majority of the Internet as far as hosted WordPress sites go.

WooCommerce itself doesn't even attempt to do expensive operations like this in one script execution. The utilize the following classes to process expensive operations as a background process: lien caché

In my experience, you can't perform operations like that on more than ~500 items in one script request, so I imagine this operation is failing miserably on a TON of sites using Toolset WooCommerce Views.

Can you guys please fix this? I was supposed to put a site live this week and just realized this and now my imports fail every night and it wasn't until I looked in the logs today that I knew for sure it was timing out. The GUI gives you no indication that it failed.

#594901

Thanks for the details, for the question:
Can you guys please fix this?
Please provide a database dump file (ZIP file) of your website in below private detail box, I need to duplicate same problem and debug it in my localhost, thanks

#595191

A database dump of this particular site would be huge, and the file structure is quite large too, plus the site itself isn't really relevant to the issue, so here's what I'm going to do to help you guys out:

I'm in the process of writing a temporary solution that utilizes Async Tasks to run the WooCommerce Views Static Fields processing. Once I have this working, I will package it up, along with 2500 products (of some sort), and send it over so you can test both your current solution, and mine as a reference for a way to solve the issue.

I'll be in touch as soon as possible!

#595508

I have forwarded your question to our 2nd tier supporters, hope there is a workaround for you, and I will update this thread if there is anything news.

#598134

Hi Zachary,

I"m Mohammed, the Toolset support team leader.

I'm posting here because I asked Luo to grab a copy of your website o at least a database dump so that the second tier support can work on the issue.

Unfortunately, Without having this data, we will not be able to work on the issue.

So, even the database dump will be big, we will try to work on and will do our best to fix the issue or improve the way we process this function.

So, I'm kindly asking you to provide Luo the needed information so that we can work on the issue.

Thanks.

#1383717

Hello,

Here is the feedback from our developers, this issue is fixed in the latest version of Woocommerce Views plugin, you can download it here:
https://toolset.com/account/downloads/

Please test it, and feedback if it is fixed. thanks