Results 1 to 10 of 11

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Cron job updating currencies is logging a warning... working, but warning

    I've used a currency updating script for ages without problems (I think I wrote it, but I don't recall for sure lol). Anyway, now that I'm finally updating to 1.5.4 I found the current rendition of automatic currency updating but I get a warning logged everytime the cron job runs. It looks like this:

    [26-Oct-2015 07:07:01 MST] PHP Warning: session_start(): Cannot send session cookie - headers already sent in /home/smartiep/public_html/test/includes/functions/sessions.php on line 107
    I think I get what's happening. The "new" way for the currency updating is to start the file with "require_once('includes/application_top.php');" and I think that tries to begin a session. Since nobody's home, no cookie can be set and it tries to output a "turn on your cookies" message but (again) nobody's home so the message can't output and it throws that warning. That's kind of a guess, but I'm thinking I'm close.

    So is calling application_top the wrong way to do it? Or is there a way to treat the cron 'session' as a bot so the cookies aren't tried?

    Or am I way off base?

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Cron job updating currencies is logging a warning... working, but warning

    When I wrote the cron script for v160 I started by setting the user agent, but then discovered it was better to simply set a new $loader_prefix to point to a dedicated auto_loader script which skipped starting any sessions.

    https://github.com/zencart/zencart/b...rency_cron.php
    https://github.com/zencart/zencart/b..._cron.core.php

    Actually most of the commits related to implementing this are summarized here: https://github.com/zencart/zencart/c...rency_cron.php
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Cron job updating currencies is logging a warning... working, but warning

    Is this going to be backward applicable to 1.5.4?

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Cron job updating currencies is logging a warning... working, but warning

    A variation of it has been backported into the upcoming v155.

    And so far it seems to work fine with this new plugin I made for openexchangerates, inspired from your post the other day: https://www.zen-cart.com/downloads.php?do=file&id=2035
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Cron job updating currencies is logging a warning... working, but warning

    Ah, well then... you're welcome :)

    Is 1.5.5 imminent?

  6. #6
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Cron job updating currencies is logging a warning... working, but warning

    Btw, in the instructions for that you say "Login to your Admin, go to Admin->Configuration->My Store, and set the primary currency server to openexchangerates"... primary whatnow? No such setting exists.

    And I see you say it can easily be set with a cron in 1.5.5... but what about 1.5.4? The contrib suggests it is compatibel with 1.5.4
    Last edited by s_mack; 29 Oct 2015 at 05:53 AM.

 

 

Similar Threads

  1. v151 Cron Job
    By Cenkki in forum General Questions
    Replies: 19
    Last Post: 8 Sep 2014, 02:54 PM
  2. Logging In produces Security warning
    By kevinmc3 in forum General Questions
    Replies: 5
    Last Post: 14 Dec 2010, 04:41 AM
  3. Cron Job for Updating QTY
    By ryanb4614 in forum General Questions
    Replies: 2
    Last Post: 9 Aug 2010, 07:13 AM
  4. CRON job help
    By Jeff G in forum General Questions
    Replies: 10
    Last Post: 9 Oct 2008, 12:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg