Page 30 of 30 FirstFirst ... 20282930
Results 291 to 298 of 298
  1. #291
    Join Date
    Apr 2010
    Posts
    262
    Plugin Contributions
    1

    Default Re: Currency Update (Automatic)

    Quote Originally Posted by Design75 View Post
    PHP Code:
    #!/usr/bin/php 
    Was used in version 4 and presumably earlier. As of version 5 it is no longer in the currency_update.php file.
    That's what I figured. Do you have any insight to thie error I am getting emailed?
    /home2/redsauto/public_html/currency_update.php: line 1: ?php: No such file or directory
    /home2/redsauto/public_html/currency_update.php: line 2: /0: Permission denied
    /home2/redsauto/public_html/currency_update.php: line 3: access-logs: command not found
    /home2/redsauto/public_html/currency_update.php: line 4: syntax error near unexpected token `('
    /home2/redsauto/public_html/currency_update.php: line 4: ` * Originally by Richard Fink (masterblaster) based on Zen Cart manual currency update'
    It looks like the cron job isn't recognizing that it is a php file.

  2. #292
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: Currency Update (Automatic)

    Quote Originally Posted by vanhorn_s View Post
    That's what I figured. Do you have any insight to thie error I am getting emailed?


    It looks like the cron job isn't recognizing that it is a php file.
    Can you past the contents of your currency_update.php? I suspect you are missing some characters at the start of the file

  3. #293
    Join Date
    Apr 2010
    Posts
    262
    Plugin Contributions
    1

    Default Re: Currency Update (Automatic)

    Quote Originally Posted by Design75 View Post
    Can you past the contents of your currency_update.php? I suspect you are missing some characters at the start of the file
    Code:
    <?php
    /*
     * Automatic Currency Update v5.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)
     * updated by Zen4All (design75) use Zen Cart standard coding
     *
     * Rework for PHP 5.3 compatibility (ereg and mysql_db_query functions deprecated in PHP 5.3.0)
     * switched to using SimpleXML and mysqli instead.
     * JeRo www.jero.co.nz 18/06/2010
     *
     * license: GNU Public License V2.0
     *
     */
    
    require_once('includes/application_top.php');
    /*
     *  Get default currency.
     */
    $defaulCurrency = $db->Execute("SELECT configuration_value
                                    FROM " . TABLE_CONFIGURATION . "
                                    WHERE configuration_key = 'DEFAULT_CURRENCY' LIMIT 1 ");
    
    /* 
     * Get currency conversion ratio.
     */
    $currencyUpliftRatio = $db->Execute("SELECT configuration_value
                                         FROM " . TABLE_CONFIGURATION . "
                                         WHERE configuration_key = 'CURRENCY_UPLIFT_RATIO' LIMIT 1 ");
    
    /*
     * Create new SimpleXML element from the Euro zone file
     * If your PHP configuration does not have allow_url_fopen, you may need to
     * write a script to pick it up using wget:
     * wget -O eurofxref-daily.xml www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml
     * and then uncomment/comment these next two lines:
     * $xml = new SimpleXMLElement(file_get_contents("eurofxref-daily.xml"));
     */
    $xml = new SimpleXMLElement(file_get_contents("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"));
    
    /*
     * extract your preferred currency's exchange rate.
     */
    $nzd = $xml->xpath("//*[@currency='" . $defaulCurrency->fields['configuration_value'] . "']");
    $base = (float)$nzd[0]['rate'];
    
    # If our default currency is the Euro, it won't be in the XML,
    # so set the base exchange rate to 1
    if ($defaulCurrency->fields['configuration_value'] == 'EUR') {
      $base = (float)1;
    }
    
    /*
     * Get array of currency data from the XML file.
     */
    $currencies = $xml->xpath("//*[@currency]");
    
    /*
     *  Iterate over array, pulling out currency code and rate.
     * Convert into your preferred currency.
     * Pump it into the database.
     */
    foreach ($currencies as $curr) {
      $cc = $curr[0]['currency'];
      $rr = (float)$curr[0]['rate'] * $currencyUpliftRatio->fields['configuration_value'];
      $new = $rr / $base;
    /*
     * But don't uplift your default currency!
     */
      if ($cc != $defaulCurrency->fields['configuration_value']) {
        $sql_data_array = array('value' => $new,
                                'last_updated' => 'now()',
                                'code' => $cc);
        zen_db_perform(TABLE_CURRENCIES, $sql_data_array, 'update', "code = '" . $cc . "'");
      }
    }
    
    /*
     * Feed is based on the Euro, which is not included in the feed,
     * therefore we need to update it manually,
     * unless of course our preferred currency is the Euro
     */
    $cc = 'EUR';
    $rr = 1 / $base * CURRENCY_UPLIFT_RATIO;
    if ($defaulCurrency->fields['configuration_value'] != $cc) {
      $sql_data_array = array('value' => $rr,
                              'last_updated' => 'now()',
                              'code' => $cc);
      zen_db_perform(TABLE_CURRENCIES, $sql_data_array, 'update', "code = '" . $cc . "'");
    }

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

    Default Re: Currency Update (Automatic)

    The error YOU yourself postd:

    Code:
    /home2/redsauto/public_html/currency_update.php: line 1: ?php: No such file or directory
    Seemingly indicates that line 1 is missing the very first character... the "<" before "?php".

    You said you upgraded to V6 (my code) but you just posted code from V5.

    I *think* what you did was copy all but the first character from my code.

  5. #295
    Join Date
    Apr 2010
    Posts
    262
    Plugin Contributions
    1

    Default Re: Currency Update (Automatic)

    Quote Originally Posted by s_mack View Post
    The error YOU yourself postd:

    Code:
    /home2/redsauto/public_html/currency_update.php: line 1: ?php: No such file or directory
    Seemingly indicates that line 1 is missing the very first character... the "<" before "?php".

    You said you upgraded to V6 (my code) but you just posted code from V5.

    I *think* what you did was copy all but the first character from my code.
    The v6 was a typo. I meant v5. I downloaded the latest one last week from here: https://www.zen-cart.com/downloads.php?do=file&id=286
    I did not edit it, I only uploaded the file as I downloaded it. What I posted above, is the contents of that file.

  6. #296
    Join Date
    Mar 2009
    Posts
    176
    Plugin Contributions
    0

    Default Re: Currency Update (Automatic)

    Should this work with Zencart v 1.5.6 and PHP v8.0?

    I ran it through a PHP tester and got the following:
    Warning: require_once(): open_basedir restriction in effect. File(includes/application_top.php) is not within the allowed path(s): (/var/tmp/) in /tmp/31yrgpkae1ktco5pkq/tester.php on line 17 Warning: require_once(includes/application_top.php): Failed to open stream: Operation not permitted in /tmp/31yrgpkae1ktco5pkq/tester.php on line 17 Fatal error: Uncaught Error: Failed opening required 'includes/application_top.php' (include_path='.:') in /tmp/31yrgpkae1ktco5pkq/tester.php:17 Stack trace: #0 {main} thrown in /tmp/31yrgpkae1ktco5pkq/tester.php on line 17

  7. #297
    Join Date
    May 2006
    Location
    Orangeburg, SC
    Posts
    72
    Plugin Contributions
    0

    Default Re: Currency Update (Automatic)

    Anyone have an updated version for 1.5.8 (1.5.8a)? or will this current version 5.0 work with it?

  8. #298
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: Currency Update (Automatic)

    As mentioned on the plugin page, this is now built-in:
    NOTE: In Zen Cart 1.5.5 and above, the admin/currency_cron.php facility can be used.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

 

 
Page 30 of 30 FirstFirst ... 20282930

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