Prestashop and cron jobs or cli - Configuring and using PrestaShop - PrestaShop

Jump to content


Prestashop and cron jobs or cli

cron jobs cli include command line


Posted 09 July 2013 - 11:28 AM


    PrestaShop Enthusiast

  • Members
  • PipPip
  • 311 Active Posts

I'm trying to use cron jobs to set some things up and don't have to do them everyday.
One example is the currency rate update, another is the search indexation, and a few modules/scripts i wrote myself.

I found that include('config/'); doesn't work for me from cli (and a cron job).
The script haults at this line, doesn't do anything, doesn't output an error, even after i turned display errors,...
I could use wget, but it's not quite the same and it creates file in root.
My only solution was to include('config/'); and use PDO to access the database. Which is ok, but this way i can't use the built in functions/classes/...

I reported on the currency update in http://forge.prestas...wse/PSCFV-8879. The answer being it was fixed. Maybe it is, i haven't updated from 1.5.2. But cron_currency_rates.php is the same. And refreshCUrrencies seems the same in

Am i the only one with these problems? Has anyone found a solution?


Posted 24 July 2013 - 08:16 AM


    PrestaShop Enthusiast

  • Members
  • PipPip
  • 229 Active Posts
I have the same bug.
In PHP-CLI, this line doen't work correctly :
// line 90 from
$context->shop = Shop::initialize(); - Agence Web et SEO à Troyes (France)


Posted 24 July 2013 - 08:25 AM


    PrestaShop Enthusiast

  • Members
  • PipPip
  • 229 Active Posts
I found the solution here :

Edited by creaweb06, 24 July 2013 - 08:49 AM. - Agence Web et SEO à Troyes (France)


Posted 27 July 2013 - 05:35 PM


    PrestaShop Newbie

  • Members
  • Pip
  • 4 Active Posts
I found a simpler solution to this problem. In your script, just before you include the file, add the following define:

define('_PS_ADMIN_DIR_', getcwd());

Problem solved!

Edited by emokemi, 27 July 2013 - 05:35 PM.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cookies help us deliver our services. By using our services, you agree to use our cookies.     Learn more