Skip to content
OpenCart · User manual

Search Pro

Version 0.8.1 Product page
Chapter 11

Cron job

The index updates itself when the panel opens and every day. A server cron is optional: it is for shops that import products often and do not want to wait.

When you need it

You do not need a cron if you add and edit products by hand in the OpenCart administration: each product is indexed again the moment you save it.

Set up the cron when products change in other ways:

  • You import products with an import tool or a supplier feed.
  • Another extension changes products in the background.
  • You publish products with a future available date and want them to appear on time.
  • Nobody opens the Search Pro panel for days.

Without a cron, those changes reach the search the next time the panel is opened.

Finding your cron address

  1. Open the Overview tab.
  2. In the Search index card, open Optional: server cron.
  3. Copy the address shown. It looks like this:
https://www.example.com/catalog/devman_search_pro.php?action=cron&key=0123456789abcdef0123456789abcdef

The key at the end is unique to your shop and is created the first time the panel opens. Copy the address from your own panel, not from this manual.

Creating the cron job

Create a cron job in your hosting control panel (cPanel, Plesk or similar) that calls the address every 15 minutes. With the usual tools the command is one of these, with your own address between the quotation marks:

*/15 * * * * curl -s "https://www.example.com/catalog/devman_search_pro.php?action=cron&key=YOUR_KEY" > /dev/null
*/15 * * * * wget -q -O /dev/null "https://www.example.com/catalog/devman_search_pro.php?action=cron&key=YOUR_KEY"

If your hosting panel asks for the schedule and the command separately, the schedule is "every 15 minutes" and the command is the part that starts with curl or wget. If you are not sure how to add a cron job, ask your hosting provider and give them the address.

What each call does

  • It reads the products changed since the last call, and the products whose available date has arrived, and indexes them again.
  • It rebuilds the whole index when a category, attribute, option or manufacturer changed since the last rebuild, or when the last full rebuild is more than 24 hours old.

The call answers with a short text that tells what was done, for example:

{"rebuilt":0,"synced":12}

synced is the number of products indexed again and rebuilt the number of indexes (one per store and language) built from scratch.

Forcing a full rebuild

Add &full=1 to the address to rebuild every index in that call:

https://www.example.com/catalog/devman_search_pro.php?action=cron&key=YOUR_KEY&full=1

Use it right after a large import, for example as the last step of your import routine. It does the same as Rebuild now in the panel.

If the call fails

AnswerCause and fix
{"error":"key"}The key is wrong or incomplete. Copy the address again from the panel.
{"error":"unavailable"}The file could not run on your server. Open the address in your browser to check, and see Troubleshooting.

Still need help?

Open a support ticket from your account and our team will look at your store with you.