Ankündigung

Einklappen
Keine Ankündigung bisher.

Payment Type Discount Modul

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Payment Type Discount Modul

    Hi,
    im Downloadbereich gibt es ja das Payment Type Discount Modul, wo man für verschiedene Zahlungsarten entweder Rabatte oder Zusatzgebühren verrechnen kann. Das geht immer nur prozentuell, habe auch auf zen-cart.com nichts anderes gefunden.
    Kennt wer eine Möglichkeit das Modul auf absolute Werte umzustellen?
    So dass man z.B. für Kreditkartenzahlung fix eine bestimmte handling fee festlegen kann?
    Grüße
    webchills

    #2
    Also ich muß passen, da ich das Modul garnicht kenne!

    Vielleicht weiß jemand rat, der dies auch verwendet!

    Gruß
    Lissy

    Kommentar


      #3
      Ich wverwende es zwar nicht, aber wenn ich so in den Code schau der Datei ot_payment.php tippe ich mal auf Zeile 68

      $od_amount = round($amount*10)/10*$od_pc/100;

      Versuch mal bitte die obige Zeile durch diese zu ersetzen

      $od_amount = $amount+$od_pc;

      und poste bitte das Ergebnis.

      Gruß
      MaleBorg

      Kommentar


        #4
        Danke für den Tipp MaleBorg. Funkt aber leider nicht. Wenn ich die Zeile entsprechend ändere wird gar kein Discount mehr berechnet oder ausgewiesen.
        Ich verwende ein erweitertes Modul von zencartbuilder.com, mit dem man nicht nur eine Ermäßigung sondern auch eine Gebühr für die verschiedenen Zahlungsarten einstellen kann. Bei der normalen ot_payment.php geht nur ein Discount.
        Leider ist aber auch mit der erweiterten nur eine prozentuelle Angabe möglich.
        Ich poste hier mal die ot_payment_type.php um die es geht:
        Code:
        <?php
        class ot_payment_type
        {
          var $title, $output;
        
          function ot_payment_type()
          {
            $this->code = 'ot_payment_type';
            $this->title = MODULE_PAYMENT_TYPE_DESCRIPTION;
            $this->description = sprintf(MODULE_PAYMENT_TYPE_TITLE, MODULE_PAYMENT_TYPE_DESCRIPTION_FEE . '/' . MODULE_PAYMENT_TYPE_DESCRIPTION_DISC);
            $this->enabled = MODULE_PAYMENT_TYPE_STATUS;
            $this->sort_order = MODULE_PAYMENT_TYPE_SORT_ORDER;
            $this->include_shipping = MODULE_PAYMENT_TYPE_INC_SHIPPING;
            $this->include_tax = MODULE_PAYMENT_TYPE_INC_TAX;
            $this->fee_maximum = (float)MODULE_PAYMENT_TYPE_FEE_MAXIMUM;
            $this->disc_minimum = (float)MODULE_PAYMENT_TYPE_DISC_MINIMUM;
            $this->calculate_tax = MODULE_PAYMENT_TYPE_CALC_TAX;
            $this->operator = 'none';
            $this->output = array();
          }
        
          function process()
          {
            global $order, $currencies;
        
            $delta = $this->calculate($this->get_order_total());
            if ($delta > 0)
            {
              $this->output[] = array('title' => $this->title,
                                      'text' => $this->operator . $currencies->format($delta),
                                      'value' => $delta);
        	    $order->info['total'] = $this->add_subtract($order->info['total'], $delta);
        		}
          }
        
        
          function calculate($amount)
          {
            global $order, $customer_id;
            $delta = 0;
            
            // check for fee
            $table = split("[,]", MODULE_PAYMENT_TYPE_FEE_TYPES);
            for ($i = 0, $j = count($table); $i < $j; $i++)
            {
              if ($_SESSION['payment'] == $table[$i])
                $this->operator = '+';// fee
            }
            
            // check for discount - if dupe, pass without anything
            $table = split("[,]", MODULE_PAYMENT_TYPE_DISC_TYPES);
            for ($i = 0, $j = count($table); $i < $j; $i++)
            {
              if ($_SESSION['payment'] == $table[$i])
              {
                if ($this->operator == 'none')
                {
                  $this->operator = '-';// discount
                }
                else
                {
                  $this->operator = 'none';
              }
            }
            }
            
            // set required vars for each type
            $process = false;
            switch ($this->operator)
            {
              case '+':// fee
                if ($order->info['total'] < $this->fee_maximum)
                {
                  $this->percentage = (zen_not_null(MODULE_PAYMENT_TYPE_FEE_PERCENTAGE) ? (float)MODULE_PAYMENT_TYPE_FEE_PERCENTAGE : 0);
                  $this->title = sprintf((defined('MODULE_PAYMENT_TYPE_TITLE_CHECKOUT') ? MODULE_PAYMENT_TYPE_TITLE_CHECKOUT : MODULE_PAYMENT_TYPE_TITLE), MODULE_PAYMENT_TYPE_DESCRIPTION_FEE);
                  $process = true;
                }
                break;
              case '-':// disc
                if ($order->info['total'] > $this->disc_minimum)
                {
                  $this->percentage = (zen_not_null(MODULE_PAYMENT_TYPE_DISC_PERCENTAGE) ? (float)MODULE_PAYMENT_TYPE_DISC_PERCENTAGE : 0);
                  $this->title = sprintf((defined('MODULE_PAYMENT_TYPE_TITLE_CHECKOUT') ? MODULE_PAYMENT_TYPE_TITLE_CHECKOUT : MODULE_PAYMENT_TYPE_TITLE), MODULE_PAYMENT_TYPE_DESCRIPTION_DISC);
                  $process = true;
                }
                break;
              default:
                // pass - no fee/disc
            }
            
            if ($process && $this->enabled == 'true')
            {
              // calculate percentage amount of total order
              $delta = round($amount, 2) * ($this->percentage / 100);// percentage of total order
              
        	    if ($this->calculate_tax == 'true')
        	    {
        				// update ot tax to include fee/disc
        	      $tax_delta = round($order->info['tax'], 2) * ($this->percentage / 100);
        	      $order->info['tax'] = $this->add_subtract($order->info['tax'], $tax_delta);
        	      
        				// update ot tax group to include fee/disc
        	      reset($order->info['tax_groups']);
        	      while (list($key, $value) = each($order->info['tax_groups']))
        	      {
        	        $tax_group_delta = round($value, 2) * ($this->percentage / 100);
        	        $order->info['tax_groups'][$key] = $this->add_subtract($order->info['tax_groups'][$key], $tax_group_delta);
        	      }
        	      // add tax percentage amount to total - add/subtract performed in process method 
        	      $delta = $delta + $tax_delta;
        	    }
            }
            return $delta;
          }
          
          function add_subtract($a, $b)
          {
            if ($this->operator == '+')
              return $a + $b;// fee
            
            if ($this->operator == '-')
              return $a - $b;// disc
          }
        
          function get_order_total()
          {
            global  $order, $db;
            $order_total = $order->info['total'];
            // Check if gift voucher is in cart and adjust total
            if (is_object($_SESSION['cart']))
            {
              $products = $_SESSION['cart']->get_products();
              for ($i = 0, $j = sizeof($products); $i < $j; $i++)
              {
                $t_prid = zen_get_prid($products[$i]['id']);
                $gv_result = $db->Execute("select products_price, products_tax_class_id, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'");
                if (ereg('^GIFT', addslashes($gv_result->fields['products_model'])))
                {
                  $qty = $_SESSION['cart']->get_quantity($t_prid);
                  $products_tax = zen_get_tax_rate($gv_result->fields['products_tax_class_id']);
                  if ($this->include_tax == 'false')
                  {
                    $gv_amount = $gv_result->fields['products_price'] * $qty;
                  }
                  else
                  {
                    $gv_amount = ($gv_result->fields['products_price'] + zen_calculate_tax($gv_result->fields['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'];
            // echo $order_total.' + order total
        ';
            return $order_total;
          }
        
          function check()
          {
          global $db;
            if (!isset($this->check))
            {
              $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_TYPE_STATUS'");
              $this->check = $check_query->RecordCount();
            }
            return $this->check;
          }
        
          function keys()
          {
            return array('MODULE_PAYMENT_TYPE_STATUS', 'MODULE_PAYMENT_TYPE_SORT_ORDER', 'MODULE_PAYMENT_TYPE_DISC_PERCENTAGE', 'MODULE_PAYMENT_TYPE_FEE_PERCENTAGE', 'MODULE_PAYMENT_TYPE_DISC_MINIMUM', 'MODULE_PAYMENT_TYPE_FEE_MAXIMUM', 'MODULE_PAYMENT_TYPE_FEE_TYPES', 'MODULE_PAYMENT_TYPE_DISC_TYPES', 'MODULE_PAYMENT_TYPE_INC_SHIPPING', 'MODULE_PAYMENT_TYPE_INC_TAX', 'MODULE_PAYMENT_TYPE_CALC_TAX');
          }
        
          function install()
          {
          global $db;
            $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Module Enabled?', 'MODULE_PAYMENT_TYPE_STATUS', 'false', 'Do you want to enable the Payment Type Discount/Fee module?', '6', '1','zen_cfg_select_option(array(\'true\', \'false\'), ', now())");
            $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_PAYMENT_TYPE_SORT_ORDER', '220', 'Sort order of display.', '6', '2', now())");
            $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Include Shipping', 'MODULE_PAYMENT_TYPE_INC_SHIPPING', 'true', 'Include Shipping in calculation', '6', '5', 'zen_cfg_select_option(array(\'true\', \'false\'), ', now())");
            $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Include Tax', 'MODULE_PAYMENT_TYPE_INC_TAX', 'false', 'Include Tax in calculation.', '6', '6','zen_cfg_select_option(array(\'true\', \'false\'), ', now())");
            $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Discount Percentage', 'MODULE_PAYMENT_TYPE_DISC_PERCENTAGE', '1.50', 'Amount of discount (percentage).', '6', '7', now())");
            $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Fee Percentage', 'MODULE_PAYMENT_TYPE_FEE_PERCENTAGE', '2.50', 'Amount of fee (percentage).', '6', '7', now())");
            $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function ,date_added) values ('Calculate Tax', 'MODULE_PAYMENT_TYPE_CALC_TAX', 'true', 'Re-calculate Tax on discount/fee-included amount?', '6', '5','zen_cfg_select_option(array(\'true\', \'false\'), ', now())");
            $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Minimum Discounted Order Total', 'MODULE_PAYMENT_TYPE_DISC_MINIMUM', '50', 'Minimum order amount for application of discount', '6', '2', now())");
            $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum Charged Order Total', 'MODULE_PAYMENT_TYPE_FEE_MAXIMUM', '2000', 'Maximum order amount for addition of fee', '6', '2', now())");
            $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Discounted Payment Type(s)', 'MODULE_PAYMENT_TYPE_DISC_TYPES', 'moneyorder', 'Payment Type(s) to apply discount to.
        (Use payment class name - Eg. bankdeposit,moneyorder)', '6', '2', now())");
            $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Charged Payment Type(s)', 'MODULE_PAYMENT_TYPE_FEE_TYPES', 'paypal,cc', 'Payment Type(s) to apply fee to.
        (Use payment class name - Eg. cc,paypal)', '6', '2', now())");
          }
        
          function remove()
          {
          global $db;
            $keys = '';
            $keys_array = $this->keys();
            for ($i=0; $i<sizeof($keys_array); $i++)
            {
              $keys .= "'" . $keys_array[$i] . "',";
            }
            $keys = substr($keys, 0, -1);
        
            $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");
          }
        }
        ?>

        Kommentar


          #5
          Hmm, also ich habe jetzt mehrfach versucht das hier im Download vorhandene Modul von 2006 zu installieren. Leider spuckt es mir immer nur eine Fehlermeldung aus.

          Habe sie zwar wegbekommen, aber irgendwie zeigt der keinen Rabatt für die Zahlungsart an. Dadurch wird natürlich das Testen und Knobeln unmöglich.

          In dem obigen Modul tippe ich mal auf diese Zeile. Jedefalls spricht der Kommentar dafür:

          // calculate percentage amount of total order
          $delta = round($amount, 2) * ($this->percentage / 100);// percentage of total order

          Versuch dort mal

          // calculate percentage amount of total order
          $delta = $this->percentage;// percentage of total order

          Gruß
          MaleBorg

          Kommentar


            #6
            Hi MaleBorg,
            super, das wars!
            Danke!
            webchills

            Kommentar


              #7
              Leider funktioniert das Modul bei mir auch nicht. Es kommt immer diese Fehlermeldung:
              Fatal error: Cannot use object of type queryFactoryResult as array in /...shop/includes/modules/order_total/ot_payment.php on line 88


              Ich würde gerne auf Vorauskasse Skonto geben aber leider funktioniert das Modul nicht mehr. Ich verwende Zen cart 1.3.7.

              Lg yps

              Kommentar


                #8
                Zeile 88 ersetzen mit
                Code:
                if (ereg('^GIFT', addslashes($gv_result->fields['products_model']))) {
                Der Fehler ist weg aber es wird einfach nix abgezogen .

                Vielleicht hilft es noch jemanden:

                Das Modul von Peter Anastos scheint das richtige zu sein: Surcharge Fee by Payment Method Order Total Module
                This is the support site for the popular Zen Cart e-commerce shopping cart software.


                einfach bei den % Aufschlag ein - davor setzen und schon wird es abgezogen. Auf den ersten Blick scheint es richtig zu arbeiten .

                (Achtung dt. Sprachdatei fehlt)

                Lg yps

                Kommentar


                  #9
                  Eine funktionierende Version ist ab sofort im Downloadbereich verfügbar:
                  Zuletzt geändert von webchills; 12.02.2009, 23:49.

                  Kommentar


                    #10
                    Vielen Dank webchills, das war genau das richtige

                    Lg yps

                    Kommentar


                      #11
                      Hallo,

                      habe den "Rabatt für Zahlungsart 2.0" installiert und habe versucht für eine Zahlungsgebühr bei Rabatt den Wert% -2.50 zu geben.

                      Geht scheinbar nicht

                      Ist es also nur möglich Rabatte zu geben ?

                      Kommentar


                        #12
                        @webchills oder
                        @hugo13

                        Ich glaube hier ist ein Fehler in der ot_payment_discount
                        PHP-Code:
                            $table split("[,]"MODULE_PAYMENT_DISCOUNT_DISCOUNT_TYPES);
                            for (
                        $i 0$j count($table); $i $j$i++)
                            {
                              if (
                        $_SESSION['payment'] == $table[$i])
                              {
                                if (
                        $this->operator == 'none')
                                {
                                  
                        $this->operator '-';// discount
                                
                        }
                                else
                                {
                                  
                        $this->operator 'none';
                              }
                            }
                            } 
                        müsste m. E. so richtig sein

                        PHP-Code:
                            $table split("[,]"MODULE_PAYMENT_DISCOUNT_DISCOUNT_TYPES);
                            for (
                        $i 0$j count($table); $i $j$i++)
                            {
                              if (
                        $_SESSION['payment'] == $table[$i])
                              {
                                if (
                        $this->operator == 'none')
                                {
                                  
                        $this->operator '-';// discount
                                
                        }
                                else
                                {
                                  
                        $this->operator '+';
                              }
                            }
                            } 
                        also im else Teil statt 'none' ein'+'

                        Kommentar


                          #13
                          Zitat von Miroir Beitrag anzeigen
                          Hallo,
                          habe den "Rabatt für Zahlungsart 2.0" installiert und habe versucht für eine Zahlungsgebühr bei Rabatt den Wert% -2.50 zu geben.
                          Geht scheinbar nicht
                          Ist es also nur möglich Rabatte zu geben ?
                          Hier liegt ein Missverständnis vor:
                          Das Modul Rabatt für Zahlungsart aus dem Downloadbereich kann nur einen prozentualen Rabatt geben, so ists auch in der readme beschrieben.
                          Das hat nichts mit diesem Modul Surcharge Fee by Pament Method von hier zu tun:
                          This is the support site for the popular Zen Cart e-commerce shopping cart software.

                          Rabatt für Zahlungsart ist dafür gedacht, den Kunden für die Verwendung von bestimmten Zahlungsarten (z.B. Bar bei Abholung) zu belohnen und nicht ihn für die Verwendung einer Zahlungsart (z.B. Kreditkarte) zu "bestrafen".
                          Für die Zahlung mittels Kreditkarte oder PayPal eine Zusatzgebühr zu verrechnen ist rechtlich problematisch, daher findet sich beim Modul Surcharge Fee auch der Hinweis:
                          "This is not legal and/or against Terms of Service of most countries/credit cards and is against Paypal Terms of Use and you are not allowed to use this module to break said rules as per the Terms of Use in the Readme file."
                          Und daher wurde dieses Modul auch nicht übersetzt und hier bereitgestellt.

                          Kommentar


                            #14
                            Danke webschills für die Antwort.

                            Ich habe gesehen das in der Schweiz auch grosse "Ladenketten" in Ihrem Shop Transaktionskosten sichtbar verrechnen, darum dachte ich natürlich nicht dass es nicht legal ist. Zum Beispiel hier: "zahlung"
                            und darum dachte ich, wenn die grossen dass dürfen dann warum nicht auch die kleinen.

                            Dann muss ich es mir noch überlegen wie ich dass machen werde.

                            Kommentar


                              #15
                              @webchills
                              frage: und wofür ist dann die function gut wenns "nur" einen Rabett gibt ?
                              Man beachte die Kommentare
                              undodumented feature ?

                              PHP-Code:
                                function add_subtract($a$b)
                                {
                                  if (
                              $this->operator == '+')
                                    return 
                              $a $b;// fee
                                  
                                  
                              if ($this->operator == '-')
                                    return 
                              $a $b;// disc
                                


                              hab mal was ausprobiert und hier eingestellt:
                              Zuletzt geändert von rsagb; 21.06.2009, 12:39.

                              Kommentar

                              Info zu diesem Forenarchiv:
                              Mit Release von 1.5.7 wurde die deutsche Zen Cart Version auf eine reine DIY-Lösung umgestellt.
                              Für einen Support via Forum stehen keine personellen und zeitlichen Ressourcen mehr zur Verfügung.
                              Dieses Supportforum bleibt im Nur-Lesen-Modus als Wissensarchiv noch online verfügbar.
                              PM Funktionalität, Registrierung und Posten neuer Beiträge sind deaktiviert.
                              Zugriff auf Anhänge in den Postings ist auch ohne Registrierung/Einloggen möglich.
                              FAQ und Downloadbereich des Forums wurden in die neue umfangreiche Knowledgebase auf der zen-cart-pro.at Website übernommen.

                              Das Development der deutschen Zen Cart Version geht wie bisher auf Github weiter.
                              Wir werden auch weiterhin neue Versionen bereitstellen und die Onlinedokumentation/Knowledgebase aktualisieren.
                              Fehler in der Software können auf Github als Issues gemeldet werden.
                              Follow us
                              aktuelle version
                              Zen Cart 1.5.7g deutsch
                              vom 12.12.2023
                              [Download]
                              Lädt...
                              X