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

Jump to content

Photo

Prestashop and cron jobs or cli

cron jobs cli include command line

#1

Posted 09 July 2013 - 11:28 AM

sadlyblue

    PrestaShop Apprentice

  • Members
  • PipPip
  • 308 Active Posts
Hi,

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/config.inc.php'); 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/settings.inc.php'); 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 1.5.4.1

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

#2

Posted 24 July 2013 - 08:16 AM

creaweb06

    PrestaShop Apprentice

  • Members
  • PipPip
  • 227 Active Posts
I have the same bug.
In PHP-CLI, this line doen't work correctly :
// line 90 from config.inc.php
$context->shop = Shop::initialize();

CreaWeb06.fr - Création web, modules prestashop

#3

Posted 24 July 2013 - 08:25 AM

creaweb06

    PrestaShop Apprentice

  • Members
  • PipPip
  • 227 Active Posts
I found the solution here :
http://forge.prestas...owse/PSCFV-9135

Edited by creaweb06, 24 July 2013 - 08:49 AM.

CreaWeb06.fr - Création web, modules prestashop

#4

Posted 27 July 2013 - 05:35 PM

emokemi

    PrestaShop Newbie

  • Members
  • Pip
  • 4 Active Posts
I found a simpler solution to this problem. In your script, just before you include the config.inc.php 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