Vote to Improve PrestaShop

PrestaShop Forum: Build a free online shop. Count on the Community!

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum: Build a free online shop. Count on the Community!

Jump to content

Photo

Prestashop and cron jobs or cli

cron jobs cli include command line

  • Please log in to reply
3 replies to this topic
sadlyblue

    PrestaShop Apprentice

  • Members
  • PipPip
  • 304 posts

Posted 09 July 2013 - 11:28 AM

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

creaweb06

    PrestaShop Apprentice

  • Members
  • PipPip
  • 226 posts

Posted 24 July 2013 - 08:16 AM

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

creaweb06

    PrestaShop Apprentice

  • Members
  • PipPip
  • 226 posts

Posted 24 July 2013 - 08:25 AM

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

emokemi

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts

Posted 27 July 2013 - 05:35 PM

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