Page 10 of 30 FirstFirst ... 8910111220 ... LastLast
Results 91 to 100 of 298
  1. #91
    Join Date
    Feb 2008
    Posts
    1,336
    Plugin Contributions
    1

    Default Re: Currency Update (Automatic)

    Hello Kuroi
    I am trying to get this mod working on my site but I keep getting errors when I run the cron job.

    I have a few websites on the same hosting package. Is it possible to get this to work with all the different website Knowing that they are all using Zen cart 1.38a?
    At the moment I am trying to test the cron job on one website. but I keep getting an error in the cron job
    Warning: require_once(/ohiospeedshop/includes/configure.php) [function.require-once]: failed to open stream: No such file or directory in /home/coolcarp/public_html/currency_update_curled.php on line 20

    Fatal error: require_once() [function.require]: Failed opening required '/ohiospeedshop/includes/configure.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/coolcarp/public_html/currency_update_curled.php on line 20
    I have the file in the root of the public html ( /public_html/currency_update_curled.php/) The website I am trying to install this mod on is an addon domain so the link to the site is /public_html/ohiospeedshop/
    This is the code I am using on my site
    Code:
    <?php
    /**
     *  Automatic Currency Update v3.0 
     * Originally by Richard Fink (masterblaster)  based on Zen Cart manual currency update
     * updated by Kuroi to include Zen Cart's currency uplift ratio
     * further updated by Kuroi to use European Central Bank reference rates  (adapted from ECB-supplied code)
     *
     * @package currencies
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: currency_update.php 1 2008-12-16 12:47:23Z kuroi $
      */
    
    // This describes the path from the location where you install this file to the root directory of your Zen Cart
    // It is normally the only line that you will need to edit.  See readme for guidance.
    DEFINE('PATH_TO_STORE_ROOT','/ohiospeedshop/');
    
    // Get Zen Cart configuration data
    require_once(PATH_TO_STORE_ROOT . 'includes/configure.php');
    require_once(PATH_TO_STORE_ROOT . 'includes/database_tables.php');
    
    //connet to database
    $link = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die("Could not connect");
    
    //get default currency
    $currency_default = mysql_db_query(DB_DATABASE, "select configuration_value from " . TABLE_CONFIGURATION . " WHERE configuration_key='DEFAULT_CURRENCY' LIMIT 1 ", $link);
    $currency_default= mysql_fetch_array($currency_default);
    define('DEFAULT_CURRENCY', $currency_default[0]);
     
    //get currency conversion ratio
    $currency_uplift_ratio =  mysql_db_query(DB_DATABASE, "select configuration_value from " . TABLE_CONFIGURATION . " WHERE configuration_key='CURRENCY_UPLIFT_RATIO' LIMIT 1 ", $link);
    $currency_uplift_ratio= mysql_fetch_array($currency_uplift_ratio);
    define('CURRENCY_UPLIFT_RATIO', $currency_uplift_ratio[0]); 
    
    // Define currency file
    $ECBFile = "http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml";
    $XMLContent = @file($ECBFile);
    if (!is_array($XMLContent) && function_exists('curl_init')) {
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $ECBFile);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      $XMLContent = explode("\n", curl_exec ($ch));
      curl_close($ch);
    }
    
    $currencyArray['EUR'] = 1;
    foreach ($XMLContent as $line) {
      if (ereg("currency='([[:alpha:]]+)'",$line,$currencyCode)) {
        if (ereg("rate='([[:graph:]]+)'",$line,$rate)) {
          $currencyArray[$currencyCode[1]] = (float)$rate[1];
        }
      }
    }
    
    if (sizeof($currencyArray) > 1)
    {
      $currencyQuery = mysql_db_query(DB_DATABASE, "select currencies_id, code from " . TABLE_CURRENCIES . "", $link);
      while ($currency = mysql_fetch_array($currencyQuery)) {
        if ($currency['code'] == DEFAULT_CURRENCY)
        {
          $rate = 1;
        }
        else
        { 
          $rate = ($currencyArray[$currency['code']] / $currencyArray[DEFAULT_CURRENCY]) * CURRENCY_UPLIFT_RATIO;
        }
        $updateSql = "UPDATE " . TABLE_CURRENCIES . "
                      SET value = '" . $rate . "',
                          last_updated = now()
                      WHERE currencies_id = '" . $currency['currencies_id']. "'";
        mysql_db_query(DB_DATABASE, $updateSql, $link);
      }
    }
    
    mysql_close($link);
    ?>
    I am sure I have something wrong somewhere maybe you can help?

  2. #92
    Join Date
    Jan 2007
    Posts
    1,483
    Plugin Contributions
    10

    Default Re: Currency Update (Automatic)

    Quote Originally Posted by Glamorousshoe View Post
    Code:
    DEFINE('PATH_TO_STORE_ROOT','/ohiospeedshop/');
    wouldn't the PATH_TO_STORE_ROOT need to be '/home/coolcarp/public_html/ohiospeedshop/'?

    EDIT: I just checked mine and I have'./' for my root directory so you would need './ohiospeedshop/' but maybe I've always had it wrong and never noticed! :-)
    Last edited by lankeeyankee; 28 Jan 2009 at 08:15 AM.

    Zen Cart and it's community are the best!!

  3. #93
    Join Date
    Mar 2005
    Location
    California
    Posts
    663
    Plugin Contributions
    0

    Default Re: Currency Update (Automatic)

    Hi, just a quick question, it is better to use the curled version by Nogal (post #85) than the one in the download area, correct?

  4. #94
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Currency Update (Automatic)

    I haven't looked at the curled version, but if it works for you, go with it. It's less likely to stop working in the future as a result of upgrades by your host.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #95
    Join Date
    Feb 2009
    Posts
    29
    Plugin Contributions
    0

    customer issue Re: Currency Update (Automatic)

    Hi I have just uploaded currency_update_curled.php

    I wrote on line 17 DEFINE('/public_html/magicmods','');

    I created a a Cronjob

    a Table shows

    www.magicmods.com/images/Cron.tiff

    It doesn't seem to work, I've put my email in but I'm not getting any error logs sent to me.

    Are my paths correct?

    Thanks
    Iain

  6. #96
    Join Date
    Mar 2005
    Location
    California
    Posts
    663
    Plugin Contributions
    0

    Default Re: Currency Update (Automatic)

    I think you need to put the full path, something like
    /home/username/public_html/magicmods


    for the cronjob, again, you might need the full path plus might also need to define php.
    Something like:
    php /home/username/public_html/magicmods/currency_update_curled.php

  7. #97
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Currency Update (Automatic)

    Quote Originally Posted by Electrobumps View Post
    Hi I have just uploaded currency_update_curled.php

    I wrote on line 17 DEFINE('/public_html/magicmods','');

    I created a a Cronjob

    a Table shows

    www.magicmods.com/images/Cron.tiff

    It doesn't seem to work, I've put my email in but I'm not getting any error logs sent to me.

    Are my paths correct?

    Thanks
    Iain
    Try

    DEFINE('PATH_TO_STORE_ROOT','magicmods/');
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  8. #98
    Join Date
    Jan 2009
    Posts
    71
    Plugin Contributions
    0

    Default Re: Currency Update (Automatic)

    Just to double check... the ECB site that the live currency add-on uses... only updates once per day??

    So is there a faster way to test if it's actually working besides waiting until tommorow?

  9. #99
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Currency Update (Automatic)

    Correct. For testing you could set the CRON to run more frequently and edit the rates manually in your database.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  10. #100
    Join Date
    Jan 2009
    Posts
    71
    Plugin Contributions
    0

    Default Re: Currency Update (Automatic)

    It's not working... where do I start to debug?

 

 
Page 10 of 30 FirstFirst ... 8910111220 ... LastLast

Similar Threads

  1. Automatic Currency Updates - curl version problem
    By mtimber in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 10 Dec 2008, 07:53 PM
  2. Automatic Currency Selection for a domain
    By [email protected] in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 3
    Last Post: 5 Jun 2007, 09:38 AM
  3. Automatic Currency Updates
    By dustyservers in forum Customization from the Admin
    Replies: 6
    Last Post: 28 Jun 2006, 12:38 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR