How to fix a server redirection error on my CRON task ?
If you received a message from Google that indicates that your data feed file is incomplete (or that its format is invalid), it may be due to a number of redirects too important compared to your server configuration.
How to know if it's a redirects maximal number issue ?
You are going to make yourselves the diagnosis :
In the module configuration, go to the "My feeds" tab and click on "Physical file + CRON task" --> "Use this solution". At the CRON URL's list level, check all the feeds you want to update in the same time, save and move to "My general cron URL". Click on the blue button ("Execute the cron on the browser"):
- If you get a white page : that has nothing to do with a redirects number issue. Contact our technical support to ask a diagnosis.
- If you get this server's error : "This page has a redirect loop Error 310 : (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects", this is well a redirects maximal number configuration issue.
Indeed, if your server configuration doesn't match with your catalog volum and with the module configuration you've done (more precisely, to the number of products per cycle processed by the CRON task), your server may send you an "error on redirects loops". It means that your server was overloaded and that you have to adapt its configuration so that it can execute the CRON task entirely. We explain you how to do it in the next section.
How to fix the redirects maximal number issue ?
You have 2 options :
1) Contact your web hosting, and ask them to increase the "maximum number of redirects" of your web server.
You can give these two documentations to your technical contact, according to the server type (Apache or NGINX):
2) Increase your number of products per cycle processed by the CRON task. It's up to you to do it in the module configuration : in "Basic settings" tab --> "Number of products per cycle".
To know what value to fill in, divide by 10 your catalog products total number and fill a value a little higher. For example, if you have 9.560 products, by dividing it by 10, this will make 956 products to process by cycle but, for security reasons, fill in the value 1000.
However, don't forget that, on a shared server, the number of products per cycle increase may have consequences on execution time or on memory allowed. If it's the case, here is the procedure:
In the /config/config.inc.php file in PrestaShop installation directory, add these 2 following lines:
@ini_set('max_execution_time', 3600); // 1 hour
@ini_set('memory_limit', '1024M'); // 1 gigabyte
We put 1 hour for the execution time and 1 GB for the memory allowed. This is just an example and they can be different depending on what your web hosting allows. Indeed, you may be limited by the latter on the execution time and memory limit directive values. In this case, the procedure is: if when you increase the products number by cycle you meet some loading time difficulties, put the "max_execution_time" et "memory_limit" values to the maximum allowed by your web hosting, and then, progressively decrease the products number by cycle in the module configuration, until you get the best compromise.