Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: Ab Warenwert X keine Nachnahmegebühr mehr?

    Matt

    • Experte
    • Beiträge: 4.241
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #15 am: 16. November 2011, 21:32:27
    Hab mir das COD-Modul jetzt mal angesehen. Meine Fre....

    Das Problem ist, dass mit dem Code, der derzeit in ot_cod_fee.php eingefügt wird, nur die Ausgabe unterdrückt wird, aber nicht verhindert wird, dass der Betrag addiert wird.

    Die Datei mal in ihren Ursprungszustand zurückversetzen und dann:
    Zeile 106:

    Code: PHP  [Auswählen]
    if ($cod_country) {

    ersetzen durch:

    Code: PHP  [Auswählen]
    if ($cod_country && $order->info['total']<75) {

    [...]
    Somit haben wir zumindest schonmal. 2 gleiche Abfragen. ;-)
    [...]

    Ich tendiere zu "kleiner 75", denn 74,50 kostet ja noch die NN-Gebühr.

    Sick

    • Fördermitglied
    • Beiträge: 570
    • Geschlecht:
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #16 am: 16. November 2011, 23:11:53
    Hallo ihr Beiden.
    Erstmal danke...

    @Markus, du meintest doch sicher die "/includes/modules/order_total/ot_cod_fee.php", oder?

    @Matt
    Deine Änderung in oben genannter Datei habe ich durchgeführt.
    Zeile 106

    Code: PHP  [Auswählen]
          if ($cod_country && $order->info['total']<75) {

    In meiner "/includes/modules/payment/cod.php" steht jetzt immer noch folgendes:

    Code: PHP  [Auswählen]
            if (!$cod_cost_value) {
               $cod_cost_value=$cod_cost;
               $cod_cost= $xtPrice->xtcFormat($cod_cost,true);
            }
            $this->cost = '+ '.$cod_cost;
              if( $order->info['total'] > 75 )
                $this->cost = '';
           
          }

    Ist das richtig, oder hätte das auch rausgemusst, damit deine Anpassung funktioniert?

    Es geht nämlich leider immer noch nicht.
    Immer noch das gleiche Problem, ab 69 Euro wird die Nachnahmegebühr nicht mehr angezeigt, aber noch berechnet.
    Ab 75 Euro passt es, da wird dann keine Gebühr mehr eingerechnet.

    Gruß

    Edit: Teste gerade nochmal mit unterschiedlichen Preisen:

    bis 69.20 Euro funktioniert die Anzeige der Gebühren
    Ab 69.30 Euro wird die Gebühr nicht mehr angezeigt.
    Evtl. hilft das ja was.

    Gruß

    Matt

    • Experte
    • Beiträge: 4.241
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #17 am: 17. November 2011, 09:04:09
    Das in "/includes/modules/payment/cod.php" bleibt, da geht es ja nur um die Anzeige auf der Seite davor.

    Und ansonsten funktioniert das hier zuverlässig, gerade mal ein Testszenario zusammengesteckt.

    Wie sieht denn deine komplette "ot_cod_fee.php" aus? Lass dir doch doch mal $order->info['total'] ausgeben, bevor der "if" kommt, was da drin steht, ob der wirklich 69.20/69.30 ist.

    Sick

    • Fördermitglied
    • Beiträge: 570
    • Geschlecht:
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #18 am: 17. November 2011, 10:17:41
    Moin,

    kann es evtl. daran liegen, dass die 5 Euro Gebühr dann in die 75 Euro Grenze schon eingerechnet werden?

    Dann wäre es zwar immer noch nicht genau, aber wir wären schon nahe an den 75 dran.

    Die "ot_cod_fee.php" poste ich heute Abend, komme da gerade nicht ran.

    Wo muss ich die Abfrage $order->info['total'] genau eingeben?

    Danke und Gruß

    Matt

    • Experte
    • Beiträge: 4.241
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #19 am: 17. November 2011, 12:59:04
    [...]
    kann es evtl. daran liegen, dass die 5 Euro Gebühr dann in die 75 Euro Grenze schon eingerechnet werden?
    [...]

    Nein, das habe ich bereits geprüft.

    [...]
    Wo muss ich die Abfrage $order->info['total'] genau eingeben?
    [...]

    Einfach mit "echo" ausgeben, z.B. direkt über dem "if". Steht dann ganz oben in der Ecke der Seite, ist ja aber auch nur zum Debugging.

    Sick

    • Fördermitglied
    • Beiträge: 570
    • Geschlecht:
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #20 am: 17. November 2011, 22:04:04
    So, leider erst sehr spät, aber hier isse.
    Habe die Copyrighthinweise wegen Platz hier mal nicht mit reinkopiert.

    Gruß
    Code: PHP  [Auswählen]
    <?php  class ot_cod_fee {
        var $title, $output;

        function ot_cod_fee() {
                    global $xtPrice;
          $this->code = 'ot_cod_fee';
          $this->title = MODULE_ORDER_TOTAL_COD_FEE_TITLE;
          $this->description = MODULE_ORDER_TOTAL_COD_FEE_DESCRIPTION;
          $this->enabled = ((MODULE_ORDER_TOTAL_COD_FEE_STATUS == 'true') ? true : false);
          $this->sort_order = MODULE_ORDER_TOTAL_COD_FEE_SORT_ORDER;


          $this->output = array();
        }

        function process() {
          global $order, $xtPrice, $cod_cost, $cod_country, $shipping;

          if (MODULE_ORDER_TOTAL_COD_FEE_STATUS == 'true') {

            //Will become true, if cod can be processed.
            $cod_country = false;

            //check if payment method is cod. If yes, check if cod is possible.
            if ($_SESSION['payment'] == 'cod') {
              //process installed shipping modules
                       // BOF - Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3
              if ($_SESSION['shipping']['id'] == 'flat_flat') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_FLAT);
              if ($_SESSION['shipping']['id'] == 'item_item') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ITEM);
              if ($_SESSION['shipping']['id'] == 'table_table') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_TABLE);
              if ($_SESSION['shipping']['id'] == 'zones_zones') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
              if ($_SESSION['shipping']['id'] == 'ap_ap') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_AP);
              if ($_SESSION['shipping']['id'] == 'dp_dp') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DP);

                        // module chp
              if ($_SESSION['shipping']['id'] == 'chp_ECO') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
              if ($_SESSION['shipping']['id'] == 'chp_PRI') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);
              if ($_SESSION['shipping']['id'] == 'chp_URG') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHP);

              // module chronopost
              if ($_SESSION['shipping']['id'] == 'chronopost_chronopost') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_CHRONOPOST);

              // module DHL
              if ($_SESSION['shipping']['id'] == 'dhl_ECX') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
              if ($_SESSION['shipping']['id'] == 'dhl_DOX') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
              if ($_SESSION['shipping']['id'] == 'dhl_SDX') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
              if ($_SESSION['shipping']['id'] == 'dhl_MDX') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
              if ($_SESSION['shipping']['id'] == 'dhl_WPX') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_DHL);
             // UPS
              if ($_SESSION['shipping']['id'] == 'ups_ups') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_UPS);
              if ($_SESSION['shipping']['id'] == 'upse_upse') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_UPSE);

              // Free Shipping
              if ($_SESSION['shipping']['id'] == 'free_free') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_COD_FEE_FREE);
              if ($_SESSION['shipping']['id'] == 'freeamount_freeamount') $cod_zones = preg_split("/[:,]/", MODULE_ORDER_TOTAL_FREEAMOUNT_FREE);
                      // EOF - Hetfield - 2009-08-18 - replaced deprecated function split with preg_split to be ready for PHP >= 5.3

                for ($i = 0; $i < count($cod_zones); $i++) {
                if ($cod_zones[$i] == $order->delivery['country']['iso_code_2']) {
                      $cod_cost = $cod_zones[$i + 1];
                      $cod_country = true;
                      break;
                    } elseif ($cod_zones[$i] == '00') {
                      $cod_cost = $cod_zones[$i + 1];
                      $cod_country = true;
                      break;
                    } else {
                    }
                  $i++;
                }
              } else {
                //COD selected, but no shipping module which offers COD
              }

          if ($cod_country && $order->info['total']<75) {

                $cod_tax = xtc_get_tax_rate(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
                $cod_tax_description = xtc_get_tax_description(MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']);
            if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
                $order->info['tax'] += xtc_add_tax($cod_cost, $cod_tax)-$cod_cost;
                $order->info['tax_groups'][TAX_ADD_TAX . "$cod_tax_description"] += xtc_add_tax($cod_cost, $cod_tax)-$cod_cost;
                $order->info['total'] += $cod_cost + (xtc_add_tax($cod_cost, $cod_tax)-$cod_cost);
                $cod_cost_value= xtc_add_tax($cod_cost, $cod_tax);
                $cod_cost= $xtPrice->xtcFormat($cod_cost_value,true);
            }
            if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
                $order->info['tax'] += xtc_add_tax($cod_cost, $cod_tax)-$cod_cost;
                $order->info['tax_groups'][TAX_NO_TAX . "$cod_tax_description"] += xtc_add_tax($cod_cost, $cod_tax)-$cod_cost;
                $cod_cost_value=$cod_cost;
                $cod_cost= $xtPrice->xtcFormat($cod_cost,true);
                $order->info['subtotal'] += $cod_cost_value;
                $order->info['total'] += $cod_cost_value;
            }
            if (!$cod_cost_value) {
               $cod_cost_value=$cod_cost;
               $cod_cost= $xtPrice->xtcFormat($cod_cost,true);
               $order->info['total'] += $cod_cost_value;
            }
                $this->output[] = array('title' => $this->title . ':',
                                        'text' => $cod_cost,
                                        'value' => $cod_cost_value);
            } else {
    //Following code should be improved if we can't get the shipping modules disabled, who don't allow COD
    // as well as countries who do not have cod
    //          $this->output[] = array('title' => $this->title . ':',
    //                                  'text' => 'No COD for this module.',
    //                                  'value' => '');
            }
          }
        }

        function check() {
          if (!isset($this->_check)) {
            $check_query = xtc_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_COD_FEE_STATUS'");
            $this->_check = xtc_db_num_rows($check_query);
          }
          return $this->_check;
        }

        function keys() {
          return array('MODULE_ORDER_TOTAL_COD_FEE_STATUS', 'MODULE_ORDER_TOTAL_COD_FEE_SORT_ORDER', 'MODULE_ORDER_TOTAL_COD_FEE_FLAT', 'MODULE_ORDER_TOTAL_COD_FEE_ITEM', 'MODULE_ORDER_TOTAL_COD_FEE_TABLE','MODULE_ORDER_TOTAL_COD_FEE_CHRONOPOST','MODULE_ORDER_TOTAL_COD_FEE_DHL','MODULE_ORDER_TOTAL_COD_FEE_CHP', 'MODULE_ORDER_TOTAL_COD_FEE_ZONES', 'MODULE_ORDER_TOTAL_COD_FEE_AP', 'MODULE_ORDER_TOTAL_COD_FEE_UPS', 'MODULE_ORDER_TOTAL_COD_FEE_UPSE', 'MODULE_ORDER_TOTAL_COD_FEE_DP', 'MODULE_ORDER_TOTAL_COD_FEE_FREE', 'MODULE_ORDER_TOTAL_FREEAMOUNT_FREE', 'MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS');
        }

        function install() {
          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, set_function, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_STATUS', 'true', '6', '0', 'xtc_cfg_select_option(array(\'true\', \'false\'), ', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_SORT_ORDER', '35', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_FLAT', 'AT:3.00,DE:3.58,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_ITEM', 'AT:3.00,DE:3.58,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_TABLE', 'AT:3.00,DE:3.58,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_ZONES', 'CA:4.50,US:3.00,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_AP', 'AT:3.63,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_DP', 'DE:4.00,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_CHP', 'CH:4.00,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_CHRONOPOST', 'FR:4.00,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_DHL', 'AT:3.00,DE:3.58,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_UPS', 'AT:3.00,DE:3.58,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_UPSE', 'AT:3.00,DE:3.58,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_FREE', 'AT:3.00,DE:3.58,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, date_added) values ('MODULE_ORDER_TOTAL_FREEAMOUNT_FREE', 'AT:3.00,DE:3.58,00:9.99', '6', '0', now())");

          xtc_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function, date_added) values ('MODULE_ORDER_TOTAL_COD_FEE_TAX_CLASS', '0', '6', '0', 'xtc_get_tax_class_title', 'xtc_cfg_pull_down_tax_classes(', now())");
        }

        function remove() {
          xtc_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
        }
      }
    ?>

    Matt

    • Experte
    • Beiträge: 4.241
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #21 am: 17. November 2011, 23:16:21
    Das sieht eigentlich gut aus. Hast du dir den Wert mal ausgeben lassen, bevor die Überprüfung gemacht wird?

    Sick

    • Fördermitglied
    • Beiträge: 570
    • Geschlecht:
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #22 am: 17. November 2011, 23:35:00
    Zumindest versucht.  :oops:

    Ich kapier nicht ganz, wie ich das machen kann.

    Habe vor dem

    Code: PHP  [Auswählen]
    if echo "$order->info['total']"

    eingefügt, da bekomme ich einen Smarty Error.
    Auch wenn ich es ohne echo, also nur

    Code: PHP  [Auswählen]
    $order->info['total']

    einfüge...

    Gruß

    franky_n

    • Experte
    • Beiträge: 4.950
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #23 am: 18. November 2011, 08:14:29
    Hallo Sick,

    vor das if ein:

    Code: PHP  [Auswählen]
    echo $order->info['total'];

    setzen, ohne Anführungszeichen, denn Du willst ja nicht den Text $order->info['total'] ausgeben lassen, sondern das, was drin steht!

    Viele Grüße

    Franky

    Matt

    • Experte
    • Beiträge: 4.241
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #24 am: 18. November 2011, 10:41:34
    Und nicht im Template, sondern in der "ot_cod_fee.php", ist ja php-Code.

    Sick

    • Fördermitglied
    • Beiträge: 570
    • Geschlecht:
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #25 am: 18. November 2011, 10:50:02
    Hallo Matt und franky_n, danke erstmal.
    Ja ich hatte das in der "ot_cod_fee.php" getestet, aber wie man sieht falsch.

    Sobald ich wieder zu Hause bin, werde ich das nochmal testen.

    Gruß

    Sick

    • Fördermitglied
    • Beiträge: 570
    • Geschlecht:
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #26 am: 18. November 2011, 22:35:35
    Abend zusammen,

    also der echo Befehl gibt mir bei 69,20 bereits 75 aus und bei 69,30 gibt er 75,1 aus.

    Ich verwende als Versandmodul Tabellarische Versandkosten mit der Einstellung Preis bis.

    Einstellungen per Screen

    Ich tippe mal, das da der Fehler liegt, oder habt ihr eine andere Vermutung?

    Danke und Gruß

    Matt

    • Experte
    • Beiträge: 4.241
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #27 am: 19. November 2011, 12:47:25
    Es liegt in der Tat daran, dass $order->info['total'] die Versandkosten enthält (mein Testshop hat keine, deshalb gab's da auch kein Problem. :)

    Mach mal die Überprüfung daher auf $order->info['subtotal'].

    Sick

    • Fördermitglied
    • Beiträge: 570
    • Geschlecht:
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #28 am: 19. November 2011, 20:33:53
    Hallo Matt,

    also mit "subtotal" wird es richtig berechnet.
    Also ohne die 5 Euro Gebühr.

    Wäre es also richtig in der "ot_cod_fee.php" ca. Zeile 106 folgendes zu schreiben?

    Code: PHP  [Auswählen]
      if ($cod_country && $order->info['subtotal']<75) {

    Gruß

    EDIT: Gerade getestet, funktioniert mit "subtotal" auch nicht...

    franky_n

    • Experte
    • Beiträge: 4.950
    Re: Ab Warenwert X keine Nachnahmegebühr mehr?
    Antwort #29 am: 19. November 2011, 23:57:39
    Hallo Sick,

    warum gibst Du nicht einfach in der Summe im Modul brutto an?

    Zitat
    89.25:5.79831,11900:0.00

    Viele Grüße

    Franky
    13 Antworten
    5205 Aufrufe
    13. April 2013, 19:54:27 von rockky
    3 Antworten
    3024 Aufrufe
    06. Oktober 2012, 17:29:53 von Andre Kern
    11 Antworten
    7843 Aufrufe
    15. Dezember 2010, 21:32:07 von Tomcraft