Skip to content

Creating a Cron Job

lat9 edited this page Feb 27, 2024 · 2 revisions

The GPSF2 feed-generator can be run via a cron job. For the examples that follows, the site's

  • HTTPS_SERVER is https://mysite.com.
  • DIR_WS_CATALOG is /store/.
  • Configuration :: Google Product Search Feeder II :: Security Key is set to xyzzy.

Identifying the Feed's Language

To create a product-feed in the site's default (or only) language, you'll enter the following command for the associated cron job (don't forget the leading and trailing single-quotes!):

wget 'https://mysite.com/store/gpsf_main_controller.php?key=xyzzy'

For v1.0.1 and later, if your site supports multiple languages and you want to generate a feed in each language, you'll include a language parameter on that command to identify which language should be used. If, for example, your site supports both English (en) and Spanish (es), you'll use this for the English-language feed

wget 'https://mysite.com/store/gpsf_main_controller.php?key=xyzzy&language=en'

and this for the Spanish-language feed

wget 'https://mysite.com/store/gpsf_main_controller.php?key=xyzzy&language=es'

Note: v1.0.0 used a problematic language_id parameter that identified the id of the associated language, e.g. 1 for Spanish and 2 for English:

wget 'https://mysite.com/store/gpsf_main_controller.php?key=xyzzy&language_id=2'

v1.0.1 and later of the feed-generator issues a PHP Warning if it finds a no-longer-supported language_id parameter supplied!

Identifying the Feed's Currency

The feed-generation uses the currency specified in Configuration :: Google Product Search Feeder II :: Feed Currency unless overridden by the currency_code parameter. That parameter must contain a 3-character currency identifier, e.g. USD or EUR, associated with a currency defined in your site's Localization :: Currencies or a PHP Warning or Error will occur!

Building on the examples in the previous section, if your multi-language site's English feed should provide pricing in USD while the Spanish feed should use EUR, you'll use these cron-job commands (respectively):

wget 'https://mysite.com/store/gpsf_main_controller.php?key=xyzzy&language=en&currency_code=USD'

wget 'https://mysite.com/store/gpsf_main_controller.php?key=xyzzy&language=es&currency_code=EUR'

Admin Tool "Helper" Display

If your site supports multiple languages, Tools :: Google Product Search Feeder II (v1.0.1 and later) displays a cron job suggestion for each language supported:

image

Otherwise, the tool's cron job suggestion doesn't supply that unneeded language parameter:

image

Clone this wiki locally