Shop Hosting
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: Update v1.06 rev 4642 SP2 auf SP3 - Problem mit included/classes/shipping.php

    WeXsler

    • Viel Schreiber
    • Beiträge: 536
    da doch das ein oder andere verändert wurde, gehe ich gerade Datei für Datei für das update durch und hänge nun an der included/classes/shipping.php. Wenn ich diese nach Anleitung update, kommt im Warenkorb beim Deutschlandversand: "Es ist leider kein Versand in dieses Land möglich (Deutschland)". In der checkout_shipping.php erscheint der Satz auch, die Bestellung ist aber ausführbar. Für die Auswahl anderer Länder im Warenkorb ist alles prima. Für Deutschland nutze ich das table Modul und Ausland zones. Das table Modul habe ich auch schon deinstalliert und neu installiert, in den Kundengruppen geschaut ob etwas nicht passt - aber alles sieht da sauber aus. Weiß jemand Rat?

    Hier mal meine bisherige shipping.php:
    Code: PHP  [Auswählen]
    <?php
    /* -----------------------------------------------------------------------------------------
       $Id: shipping.php 2807 2012-04-29 18:11:28Z web28 $

       modified eCommerce Shopsoftware
       http://www.modified-shop.org

       Copyright (c) 2009 - 2013 [www.modified-shop.org]
       -----------------------------------------------------------------------------------------
       based on:
       (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
       (c) 2002-2003 osCommerce(shipping.php,v 1.22 2003/05/08); www.oscommerce.com
       (c) 2003 nextcommerce (shipping.php,v 1.9 2003/08/17); www.nextcommerce.org
       (c) 2006 XT-Commerce (shipping.php 1305 2005-10-14)

       Released under the GNU General Public License
       ---------------------------------------------------------------------------------------*/


      //web28 ignore shipping modules
      define ('IGNORE_CHEAPEST_MODULES', 'selfpickup');

      class shipping {
        var $modules;

        // class constructor
        function shipping($module = '') {
          global $PHP_SELF,$order;

          if (defined('MODULE_SHIPPING_INSTALLED') && xtc_not_null(MODULE_SHIPPING_INSTALLED)) {
            $this->modules = explode(';', MODULE_SHIPPING_INSTALLED);

            $include_modules = array();

            if ( (xtc_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) {
              $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)));
            } else {
              reset($this->modules);
              while (list(, $value) = each($this->modules)) {
                $class = substr($value, 0, strrpos($value, '.'));
                $include_modules[] = array('class' => $class, 'file' => $value);
              }
            }
            // load unallowed modules into array - remove spaces and line breaks by web28
            $unallowed_modules = preg_replace("'[\r\n\s]+'",'',$_SESSION['customers_status']['customers_status_shipping_unallowed'].','.$order->customer['shipping_unallowed']);
            $unallowed_modules = explode(',',$unallowed_modules);
            for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
              if (!in_array(str_replace('.php', '', $include_modules[$i]['file']), $unallowed_modules)) {
                // check if zone is alowed to see module
                if (constant('MODULE_SHIPPING_' . strtoupper(str_replace('.php', '', $include_modules[$i]['file'])) . '_ALLOWED') != '') {
                  $unallowed_zones = explode(',', constant('MODULE_SHIPPING_' . strtoupper(str_replace('.php', '', $include_modules[$i]['file'])) . '_ALLOWED'));
                } else {
                  $unallowed_zones = array();
                }
                if (in_array($_SESSION['delivery_zone'], $unallowed_zones) == true || count($unallowed_zones) == 0) {
                  include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/shipping/' . $include_modules[$i]['file']);
                  include(DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file']);
                  $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];
                }
              }
            }
          }
        }

        function quote($method = '', $module = '') {
          global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;

          $quotes_array = array();

          if (is_array($this->modules)) {
            $shipping_quoted = '';
            $shipping_num_boxes = 1;
            $shipping_weight = $total_weight;

            if (SHIPPING_BOX_WEIGHT >= $shipping_weight*SHIPPING_BOX_PADDING/100) {
              $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT;
            } else {
              $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100);
            }

            if ($shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes
              $shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT);
              $shipping_weight = $shipping_weight/$shipping_num_boxes;
            }

            $include_quotes = array();

            reset($this->modules);
            while (list(, $value) = each($this->modules)) {
              $class = substr($value, 0, strrpos($value, '.'));
              if (xtc_not_null($module) && isset($GLOBALS[$class])) {
                if ( ($module == $class) && ($GLOBALS[$class]->enabled) ) {
                  $include_quotes[] = $class;
                }
              } elseif ($GLOBALS[$class]->enabled) {
                $include_quotes[] = $class;
              }
            }

             for ($i=0, $size = sizeof($include_quotes); $i<$size; $i++) {
              $quotes = $GLOBALS[$include_quotes[$i]]->quote($method);
              // BOF - Tomcraft - 2011-02-01 - Paypal Express Modul
              // if (is_array($quotes)) $quotes_array[] = $quotes;
              if (!isset ($quotes['error'])) {
                if (is_array($quotes)) $quotes_array[] = $quotes;
              }
              // EOF - Tomcraft - 2011-02-01 - Paypal Express Modul
            }
          }

          return $quotes_array;
        }

        function cheapest() {

          if (is_array($this->modules)) {
            $rates = array();

            $ignore_cheapest_array = explode(',',IGNORE_CHEAPEST_MODULES); //web28 ignore shipping modules

            reset($this->modules);
            while (list(, $value) = each($this->modules)) {
              $class = substr($value, 0, strrpos($value, '.'));
              if (isset($GLOBALS[$class]) && $GLOBALS[$class]->enabled) {
                $quotes = $GLOBALS[$class]->quotes;
               //BOF - Dokuman - 2009-10-02 - set undefined index
                //$size = sizeof($quotes['methods']);
                $size = isset($quotes['methods']) && is_array($quotes['methods']) ? sizeof($quotes['methods']) : 0;
                //BOF - Dokuman - 2009-10-02 - set undefined index
                for ($i=0; $i<$size; $i++) {
                  // BOF - Tomcraft - 2011-02-01 - Paypal Express Modul
                  //if(array_key_exists("cost",$quotes['methods'][$i])) {
                  if(array_key_exists("cost",$quotes['methods'][$i]) && !isset ($quotes['error'][$i]) && !in_array($quotes['id'],$ignore_cheapest_array)) { //web28 ignore shipping modules
                  // EOF - Tomcraft - 2011-02-01 - Paypal Express Modul
                    $rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'],
                                     'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')',
                                     'cost' => $quotes['methods'][$i]['cost']);
                                    // echo $quotes['methods'][$i]['cost'];
                  }
                }
              }
            }

            $cheapest = false;
            for ($i=0, $size = sizeof($rates); $i<$size; $i++) {
              if (is_array($cheapest)) {
                if ($rates[$i]['cost'] < $cheapest['cost']) {
                  $cheapest = $rates[$i];
                }
              } else {
                $cheapest = $rates[$i];
              }
            }
            return $cheapest;

          }

        }
      }
    ?>


    Linkback: https://www.modified-shop.org/forum/index.php?topic=34682.0
    Werbung / Banner buchen

    WeXsler

    • Viel Schreiber
    • Beiträge: 536
    es würde erst mal auch schon helfen, wenn mir jemand sagen könnte, ob ich einfach mit der nächsten Datei weiter machen kann. Nicht, dass ich am Ende alles zurückbauen muß, Das wäre ziemlich mächtig :-(
    Marktplatz - Eine große Auswahl an neuen und hilfreichen Modulen sowie modernen Templates für die modified eCommerce Shopsoftware
    4 Antworten
    4458 Aufrufe
    16. Januar 2011, 15:26:23 von Selo
    2 Antworten
    3133 Aufrufe
    25. April 2013, 15:35:37 von cassi
    12 Antworten
    3863 Aufrufe
    01. Januar 2017, 15:56:08 von bellagio
               
    anything