91863
Goto Top

Befehl Ereg decreased

Hallo,

ab 5.3 PHP ist der Befehl Ereg decreased Veraltet.
Weiss wer , wie die Zeile
if (ereg('^GIFT', addslashes($gv_result['products_model']))) {   
neu aussehen muss. Komme bei der Beschreibung vom PHP nicht zurecht-

Gruss
Ralf

Content-Key: 224018

Url: https://administrator.de/contentid/224018

Printed on: April 19, 2024 at 06:04 o'clock

Member: LordGurke
LordGurke Dec 08, 2013 at 14:36:34 (UTC)
Goto Top
"deprecated" ist das Wort,. was du suchst face-wink

Was versuchst du denn zu matchen? Falls es dir darum geht, dass die Zeichenkette "GIFT" am Anfang des Strings steht, musst du nicht ändern - außer dass du ggf. delimiter an Anfang und Ende des Ausdrucks stellen musst.

Also als Beispiel:

if ( preg_match('/^GIFT/', $gv_result['products_model']) )  

Bei den PREG-Funktionen musst du die Eingabezeichenkette eigentlich nicht mehr escapen, deshalb habe ich das hier mal direkt weggelassen.
Mitglied: 91863
91863 Dec 08, 2013 at 14:49:39 (UTC)
Goto Top
Hoi,

danke. Damit schein es zu gehen. Habe nur nun wo anderst ein Fehler face-smile Muss schauen.

Gruss
Ralf
Mitglied: 91863
91863 Dec 08, 2013, updated at Dec 09, 2013 at 09:37:46 (UTC)
Goto Top
Weisst Du zufällig wie die Zeile noch in PHP 5.3 aussehen muss ? Dann würde bei mir wieder alles gehen face-smile
 if ($this->include_tax == 'false') $order_total=$order_total-$order->info['tax'];  
if ($this->include_shipping == 'false') $order_total=$order_total-$order->info['shipping_cost'];  
return $order_total;
Member: LordGurke
LordGurke Dec 08, 2013 at 15:04:17 (UTC)
Goto Top
An der Syntax sollte sich eigentlich nichts geändert haben....?
Was funktioniert denn nicht?

Schalte ggf. mal brachiale Fehlermeldungen ein, a.k.a.
error_reporting(E_ALL);
am Beginn des Scripts.

Vielleicht werden irgendwo irgendwelche Variablen nicht richtig gesetzt, weil auf register_globals zurückgegriffen wird?
Mitglied: 91863
91863 Dec 08, 2013 at 15:43:49 (UTC)
Goto Top
Da bringt er nur die gleiche Meldung.

Gruss
Rlaf
Member: LordGurke
LordGurke Dec 08, 2013 at 15:45:51 (UTC)
Goto Top
Könntest du die Meldung einmal hier posten? So ganz ohne ist halt stochern im Nebel face-sad
Mitglied: 91863
91863 Dec 08, 2013 at 15:47:52 (UTC)
Goto Top
Hallo,

ok klar. War gar nicht gepostet ;)
Parse error: syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) in C:\xampp\htdocs\includes\modules\order_total\ot_modul_spesen.php on line 111

Gruss
Ralf
Member: LordGurke
LordGurke Dec 08, 2013 at 15:54:33 (UTC)
Goto Top
Welches von den beiden IF ist denn in Zeile 111?
Bei solchen Fehlermeldungen liegt der Fehler normalerweise eine Zeile über dem, was angeblich falsch ist...
Mitglied: 91863
91863 Dec 08, 2013, updated at Dec 09, 2013 at 09:37:25 (UTC)
Goto Top
111 ist das hier :

  if ($this->include_tax == 'false') $order_total=$order_total-$order->info['tax'];  
obendran steht noc eine }

Gruss
Ralf
Member: LordGurke
LordGurke Dec 08, 2013 at 15:59:21 (UTC)
Goto Top
Kannst du die letzten 5 Codezeilen über der Zeile 111 bitte einmal posten?
Irgendwas lässt PHP glauben du willst nicht "IF" sondern "function ...." schreiben - das dürfte bedeuten, dass die geschweifte Klammer an der falschen Stelle oder überzählig ist und du damit versehentlich die aktuelle "function"-Definition beendest.
Mitglied: 91863
91863 Dec 08, 2013, updated at Dec 09, 2013 at 09:35:50 (UTC)
Goto Top
Hoi,

habe mal paar Zeilen mehr, die unterste ist 111

 for ($i=0; $i<sizeof($products); $i++) {
        $t_prid = tep_get_prid($products[$i]['id']);  
        $gv_query = tep_db_query("select products_price, products_tax_class_id, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");  
        $gv_result = tep_db_fetch_array($gv_query);
        if ( preg_match('/^GIFT/', $gv_result['products_model']) )  
        $qty = $cart->get_quantity($t_prid);
          $products_tax = tep_get_tax_rate($gv_result['products_tax_class_id']);  
          if ($this->include_tax =='false') {  
            $gv_amount = $gv_result['products_price'] * $qty;  
          } else {
            $gv_amount = ($gv_result['products_price'] + tep_calculate_tax($gv_result['products_price'],$products_tax)) * $qty;  
          }
          $order_total=$order_total - $gv_amount;
        }
      if ($this->include_tax == 'false') $order_total=$order_total-$order->info['tax'];  
Gruss
Ralf
Member: LordGurke
LordGurke Dec 08, 2013 at 16:10:11 (UTC)
Goto Top
Hm....
ich kann da jetzt keinen echten Fehler oder überzählige Klammern sehen face-sad
Aber dieser Fehler deutet definitiv darauf hin, dass da irgendwo eine geschweifte Klammer steht, wo keine hingehört.

Sind diese Anweisungen innerhalb einer "function" und diese innerhalb einer Klasse?
Mitglied: 91863
91863 Dec 08, 2013, updated at Dec 09, 2013 at 09:36:28 (UTC)
Goto Top
ICh weiss nicht. Ist einfach mein Webshop der nicht mehr lauft, weil PHP nun aktueller ist.

das ist die gesamte Datei
*/
    class ot_modul_spesen {
   var $title, $output;
    
    function ot_modul_spesen() {
      global $payment;
      
      $this->code = 'ot_modul_spesen';  
      $this->title = MODULE_MODUL_SPESEN_TITLE;
      $this->description = MODULE_MODUL_SPESEN_DESCRIPTION;
      // bol ct: dynamic title/description of fee
      if (isset($payment)) {
        $table = preg_split("/[:,]/" , MODULE_MODUL_SPESEN_TYPE_DESCRIPTION);  
        for ($i = 0; $i < count($table); $i+=2) {
          if ($payment == $table[$i]) {
            $this->title = $table[$i+1];
            $this->description = $table[$i+1];
          }
        }
      }
      // eol ct: dynamic title/description of fee
      $this->enabled = MODULE_MODUL_SPESEN_STATUS;
      $this->sort_order = MODULE_MODUL_SPESEN_SORT_ORDER;
      $this->type = MODULE_MODUL_SPESEN_TYPE;
      $this->tax_class = MODULE_MODUL_SPESEN_TAX_CLASS;
      $this->output = array();
    }

    function process() {
      global $order, $ot_subtotal, $currencies;
      
      $od_amount = $this->calculate_charge($this->get_order_total());
      if ($od_amount != 0) {
        $this->deduction = $od_amount;
        $this->output = array('title' => $this->title . ':',  
                                'text' => $currencies->format($od_amount),  
                                'value' => $od_amount);  
	      $order->info['total'] = $order->info['total'] + $od_amount;  
        if ($this->sort_order < $ot_subtotal->sort_order) {
          $order->info['subtotal'] = $order->info['subtotal'] - $od_amount;  
        }
      }
    }

    function calculate_charge($amount) {
      global $order, $customer_id, $payment;
      $od_amount=0;
      $table = preg_split("/[:,]/" , MODULE_MODUL_SPESEN_TYPE);  
      for ($i = 0; $i < count($table); $i+=2) {
        if ($payment == $table[$i]) {
          $od_am=$table[$i+1];
          
          // use either a fixed amount or percentage of total incl. shipping
          if (substr($od_am,0,1) == '%') {  
            $od_am=substr($od_am, 1);
            $od_am=round($amount/100*$od_am,1); // choose the decimal position for rounding
          }
          
          if (MODULE_MODUL_SPESEN_TAX_CLASS > 0) {
            $tod_rate = tep_get_tax_rate(MODULE_MODUL_SPESEN_TAX_CLASS);
            $tod_description = tep_get_tax_description(MODULE_MODUL_SPESEN_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);  
            $tod_amount =  tep_calculate_tax($od_am, $tod_rate);
            $order->info['tax'] += $tod_amount;  
            $order->info['tax_groups'][$tod_description] += tep_calculate_tax($table[$i+1], $tod_rate);  
          }
          
          if (DISPLAY_PRICE_WITH_TAX) { 
            $od_amount = $od_am + $tod_amount;
          } else {       
            $od_amount = $od_am;
            $order->info['total'] += $tod_amount;  
          }
        }
      }
      return $od_amount;
    }

    function get_order_total() {
      global  $order, $cart;
      $order_total = $order->info['total'];  
      // Check if gift voucher is in cart and adjust total
      $products = $cart->get_products();
      for ($i=0; $i<sizeof($products); $i++) {
        $t_prid = tep_get_prid($products[$i]['id']);  
        $gv_query = tep_db_query("select products_price, products_tax_class_id, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");  
        $gv_result = tep_db_fetch_array($gv_query);
        if ( preg_match('/^GIFT/', $gv_result['products_model']) )  
        $qty = $cart->get_quantity($t_prid);
          $products_tax = tep_get_tax_rate($gv_result['products_tax_class_id']);  
          if ($this->include_tax =='false') {  
            $gv_amount = $gv_result['products_price'] * $qty;  
          } else {
            $gv_amount = ($gv_result['products_price'] + tep_calculate_tax($gv_result['products_price'],$products_tax)) * $qty;  
          }
          $order_total=$order_total - $gv_amount;
        }
      if ($this->include_tax == 'false') $order_total=$order_total-$order->info['tax'];  
      if ($this->include_shipping == 'false') $order_total=$order_total-$order->info['shipping_cost'];  
      return $order_total;
    }

    function check() {
      if (!isset($this->check)) {
        $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_MODUL_SPESEN_STATUS'");  
        $this->check = tep_db_num_rows($check_query);
      }
      
      return $this->check;
    }

    function keys() {
      return array('MODULE_MODUL_SPESEN_STATUS', 'MODULE_MODUL_SPESEN_SORT_ORDER', 'MODULE_MODUL_SPESEN_TYPE', 'MODULE_MODUL_SPESEN_TYPE_DESCRIPTION', 'MODULE_MODUL_SPESEN_TAX_CLASS');  
    }

    function install() {
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zeige Modul-Spesen', 'MODULE_MODUL_SPESEN_STATUS', 'true', 'Möchten Sie die Modul-Spesen anzeigen?', '6', '1','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");  
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sortierung', 'MODULE_MODUL_SPESEN_SORT_ORDER', '79', 'Sortierreihenfolge.', '6', '2', now())");  
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zahlungsweisen', 'MODULE_MODUL_SPESEN_TYPE', 'nachnahme:15,rechnung:%3', 'Spezifische Zahlungsweisen welche belastet werden.', '6', '2', now())");  
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zahlungsweisen Beschreibung', 'MODULE_MODUL_SPESEN_TYPE_DESCRIPTION', 'nachnahme:Nachnahme-Gebühren,rechnung:3% Rechnungs-Spesen', 'Spezifische Beschreibung zu jeder Zahlungsweise.', '6', '3', now())");  
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Steuer Klasse', 'MODULE_MODUL_SPESEN_TAX_CLASS', '0', 'Folgende Steuer-Klasse mit Modul-Spesen verwenden.', '6', '6', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");  
    }

    function remove() {
      $keys = '';  
      $keys_array = $this->keys();
      for ($i=0; $i<sizeof($keys_array); $i++) {
        $keys .= "'" . $keys_array[$i] . "',";  
      }
      $keys = substr($keys, 0, -1);

      tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");  
    }
  }   
?>
Member: LordGurke
LordGurke Dec 08, 2013 at 16:22:55 (UTC)
Goto Top
Bei mir unter PHP 5.3.3 läuft die Datei ohne Probleme - und da das ein Parse-Error ist, müsste der sofort auftreten wenn man versucht diese Datei auszuführen - unabhängig davon welche Werte man welchen Methoden übergibt.
Kannst du sicherstellen, dass die Datei die den Fehler wirft auch wirklich den selben Inhalt hat, den sie haben sollte?
Evtl. ist da irgendeine Synchronisation (z.B. per FTP) fehlgeschlagen und die Datei ist beschädigt bzw. unvollständig übertragen worden.
Mitglied: 91863
91863 Dec 08, 2013 at 16:28:05 (UTC)
Goto Top
Hallo,

die Datei liegt noch lokal auf meinem PC. Ich baue meinen alten Shop über Xamp local neu auf.

Gruss
Ralf
Mitglied: 91863
91863 Dec 08, 2013 at 16:31:10 (UTC)
Goto Top
ich habe mal die Datei neu abgespeichert. Nun geht nur eine andere Dati mit Fehler auf face-smile

Fatal error: Call to undefined function tep_remove_order() in C:\xampp\htdocs\includes\modules\payment\bitpay.php on line 119
Da steht face-smile
tep_remove_order($insert_id, $restock = true);

Gruss
Ralf
Member: LordGurke
LordGurke Dec 08, 2013 at 16:34:27 (UTC)
Goto Top
Das riecht doch sehr danach als wäre das mehreren Dateien wiederfahren... face-sad
Vermutlich sind mehrere Dateien nicht korrekt auf dem Server gelandet, synchronisiere am Besten mal *alle* Dateien neu.
Mitglied: 91863
91863 Dec 12, 2013 at 15:13:26 (UTC)
Goto Top
Hallo,

das Problem ist in Luft aufgegangen. Testet man das im Xampp geht es nicht. aBer Online JA

Danlke und Gruss
Ralf