Jump to content

get fatal error, no idea what I did wrong


Laurie

Recommended Posts

I'm trying to add a CVV code contribution to OS Commerce.  After following the steps, I get this message.  Fatal error: Call to undefined function: tep_not_null() in /hsphere/local/home/comprace/computechracing.com/catalog/includes/classes/language.php on line 74.  Can you help me?

Thanks, Laurie

 

Here is the php document

<?php

/*

  $Id: language.php,v 1.6 2003/06/28 16:53:09 dgw_ Exp $

 

  osCommerce, Open Source E-Commerce Solutions

  http://www.oscommerce.com

 

  Copyright © 2003 osCommerce

 

  Released under the GNU General Public License

 

  browser language detection logic Copyright phpMyAdmin (select_lang.lib.php3 v1.24 04/19/2002)

                                  Copyright Stephane Garin <[email protected]> (detect_language.php v0.1 04/02/2002)

*/

 

  class language {

    var $languages, $catalog_languages, $browser_languages, $language;

 

    function language($lng = '') {

      $this->languages = array('ar' => 'ar([-_][[:alpha:]]{2})?|arabic',

                              'bg' => 'bg|bulgarian',

                              'br' => 'pt[-_]br|brazilian portuguese',

                              'ca' => 'ca|catalan',

                              'cs' => 'cs|czech',

                              'da' => 'da|danish',

                              'de' => 'de([-_][[:alpha:]]{2})?|german',

                              'el' => 'el|greek',

                              'en' => 'en([-_][[:alpha:]]{2})?|english',

                              'es' => 'es([-_][[:alpha:]]{2})?|spanish',

                              'et' => 'et|estonian',

                              'fi' => 'fi|finnish',

                              'fr' => 'fr([-_][[:alpha:]]{2})?|french',

                              'gl' => 'gl|galician',

                              'he' => 'he|hebrew',

                              'hu' => 'hu|hungarian',

                              'id' => 'id|indonesian',

                              'it' => 'it|italian',

                              'ja' => 'ja|japanese',

                              'ko' => 'ko|korean',

                              'ka' => 'ka|georgian',

                              'lt' => 'lt|lithuanian',

                              'lv' => 'lv|latvian',

                              'nl' => 'nl([-_][[:alpha:]]{2})?|dutch',

                              'no' => 'no|norwegian',

                              'pl' => 'pl|polish',

                              'pt' => 'pt([-_][[:alpha:]]{2})?|portuguese',

                              'ro' => 'ro|romanian',

                              'ru' => 'ru|russian',

                              'sk' => 'sk|slovak',

                              'sr' => 'sr|serbian',

                              'sv' => 'sv|swedish',

                              'th' => 'th|thai',

                              'tr' => 'tr|turkish',

                              'uk' => 'uk|ukrainian',

                              'tw' => 'zh[-_]tw|chinese traditional',

                              'zh' => 'zh|chinese simplified');

 

      $this->catalog_languages = array();

      $languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order");

      while ($languages = tep_db_fetch_array($languages_query)) {

        $this->catalog_languages[$languages['code']] = array('id' => $languages['languages_id'],

                                                            'name' => $languages['name'],

                                                            'image' => $languages['image'],

                                                            'directory' => $languages['directory']);

      }

 

      $this->browser_languages = '';

      $this->language = '';

 

      $this->set_language($lng);

    }

 

    function set_language($language) {

      if ( (tep_not_null($language)) && (isset($this->catalog_languages[$language])) ) {

        $this->language = $this->catalog_languages[$language];

      } else {

        $this->language = $this->catalog_languages[DEFAULT_LANGUAGE];

      }

    }

 

    function get_browser_language() {

      $this->browser_languages = explode(',', getenv('HTTP_ACCEPT_LANGUAGE'));

 

      for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) {

        reset($this->languages);

        while (list($key, $value) = each($this->languages)) {

          if (eregi('^(' . $value . ')(;q=[0-9]\\.[0-9])?$', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {

            $this->language = $this->catalog_languages[$key];

            break 2;

          }

        }

      }

    }

  }

?>

 

I didn't change anything in this for there to be anything left out.  I added 6 other php pages and can't find anything that refers to tep_not_null and went back and checked them to be sure I got it all.  Any other suggestions?  Is more information necessary to solve this problem?

 

Thanks

nevermind the if statement is not your problem try putting the function below which is tep_not_null in the code file should get rid of the undefined error since it exists in the file

 

 


<?php

function tep_not_null($value) {
      if (is_array($value)) {
        if (sizeof($value) > 0) {
          return true;
        } else {
          return false;
        }
      } else {
        if (($value != '') && (strtolower($value) != 'null') && (strlen(trim($value)) > 0)) {
          return true;
        } else {
          return false;
        }
      }
    }?>

Okay, I checked my database, and there were three sql queries I needed to run (first - ALTER TABLE `orders` ADD `cvvnumber` VARCHAR(4) default NULL AFTER `cc_expires`;)

Did that, and it worked okay.

 

Second one - INSERT INTO configuration VALUES ( 141, 'CVV Max Length', 'CVVNUMBER_MAX_LENGTH', 4, 'Maximum Length of CVV Number', 3, 19, '2003-02-20 10:31:00', '2003-02-20 10:31:00', NULL , NULL );

 

and third one - INSERT INTO configuration VALUES ( 141, 'CVV Max Length', 'CVVNUMBER_MAX_LENGTH', 4, 'Maximum Length of CVV Number', 3, 19, '2003-02-20 10:31:00', '2003-02-20 10:31:00', NULL , NULL );

 

I'm a beginner at this, and taking over after someone else did this that is no longer at the company.  I get an error that says "Error

 

SQL query:

 

INSERT INTO configuration

VALUES ( 141, 'CVV Max Length', 'CVVNUMBER_MAX_LENGTH', 4, 'Maximum Length of CVV Number', 3, 19, '2003-02-20 10:31:00', '2003-02-20 10:31:00', NULL , NULL ) ;

 

MySQL said: Documentation

#1062 - Duplicate entry '141' for key 1"

 

This may be a dumb question, but how do I figu out what would be the next configuration_ID and sort_order(group 2) for my database. 

 

I think if I get that handled, this script may work.  If not, I'll try your code suggestion too.  Thanks,

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.