Retroceder   Foros del Web > Diseño de Sitios web > Aplicaciones pre-fabricadas

Respuesta
 
Herramientas Desplegado
Antiguo 23-feb-2004, 21:08   #1 (permalink)
2Fast To You ha deshabilitado el karma
 
Fecha de Ingreso: septiembre-2003
Ubicación: Santo Domingo - R. Dominicana
Mensajes: 594
Enviar un mensaje por MSN a 2Fast To You Enviar un mensaje por Yahoo  a 2Fast To You
Shipping en osCommerce

Hola a Todos

Bueno, tengo a osCOmmerce como mi Web de Venta, entonses utiliso un Calculador de Shipping que osCommerce trae. El archivo se llama zonesworld.php

Solo trae para 3 Zonas. Yo nesesito ese mismo pero para 8 Zona. Tiene el Siguinete Codigo ese Archivo.

Código PHP:
<?php

  
class zonesworld {
    var 
$code$title$description$enabled$num_zonesworld;

// class constructor
    
function zonesworld() {
      
$this->code 'zonesworld';
      
$this->title MODULE_SHIPPING_ZONESWORLD_TEXT_TITLE;
      
$this->description MODULE_SHIPPING_ZONESWORLD_TEXT_DESCRIPTION;
      
$this->sort_order MODULE_SHIPPING_ZONESWORLD_SORT_ORDER;
      
$this->icon '';
      
$this->enabled = ((MODULE_SHIPPING_ZONESWORLD_STATUS == 'True') ? true false);

      
// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
      
$this->num_zonesworld 3;
    }

// class methods
    
function quote($method '') {
      global 
$order$shipping_weight;

      
$dest_country $order->delivery['country']['iso_code_2'];
      
$dest_zone 0;
      
$error false;

      for (
$i=1$i<=$this->num_zonesworld$i++) {
        
$countries_table constant('MODULE_SHIPPING_ZONESWORLD_COUNTRIES_' $i);
        
$country_zones split("[,]"$countries_table);
        if (
in_array($dest_country$country_zones)) {
          
$dest_zone $i;
          break;
        }
      }

      
// elari - Added to select default country if not in listing
      
if ($dest_zone == 0) {
        
$dest_zone $this->num_zonesworld;    // the zone is the lastest zone avalaible
      
}
      
// elari - Added to select default country if not in listing
      
if ($dest_zone == 0) {
        
$error true;      // this can no more achieve since by default the value is set to the max number of zones
      
} else {
        
$shipping = -1;
        
$zones_cost constant('MODULE_SHIPPING_ZONESWORLD_COST_' $dest_zone);

        
$zones_table split("[:,]" $zones_cost);
        
$size sizeof($zones_table);
        for (
$i=0$i<$size$i+=2) {
          if (
$shipping_weight <= $zones_table[$i]) {
            
$shipping $zones_table[$i+1];
            
$shipping_method MODULE_SHIPPING_ZONESWORLD_TEXT_WAY ' ' $dest_country ' : ' $shipping_weight ' ' MODULE_SHIPPING_ZONESWORLD_TEXT_UNITS;
            break;
          }
        }

        if (
$shipping == -1) {
          
$shipping_cost 0;
          
$shipping_method MODULE_SHIPPING_ZONESWORLD_UNDEFINED_RATE;
        } else {
          
$shipping_cost = ($shipping constant('MODULE_SHIPPING_ZONESWORLD_HANDLING_' $dest_zone));
        }
      }

      
$this->quotes = array('id' => $this->code,
                            
'module' => MODULE_SHIPPING_ZONESWORLD_TEXT_TITLE,
                            
'methods' => array(array('id' => $this->code,
                                                     
'title' => $shipping_method,
                                                     
'cost' => $shipping_cost)));

      if (
tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon$this->title);

      if (
$error == true$this->quotes['error'] = MODULE_SHIPPING_ZONESWORLD_INVALID_ZONE;

      return 
$this->quotes;
    }

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

    
// elari - Added to select default country if not in listing
    
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 ('Enable Zones Method', 'MODULE_SHIPPING_ZONESWORLD_STATUS', 'True', 'Do you want to offer zone rate shipping?', '6', '0', '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 ('Sort order of display.', 'MODULE_SHIPPING_ZONESWORLD_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
      for (
$i 1$i <= $this->num_zonesworld$i++) {
        
$default_countries '';
        if (
$i == 1) {
          
$default_countries 'FR';
          
$shipping_table '3:6,7:10.50,99:100.00';
        }
        if (
$i == 2) {
          
$default_countries 'AT,BE,GB,DE,GL,IS,IE,IT,NO,NL,DK,PL,ES,SE,CH,FI,PT,IL,GR';
          
$shipping_table '3:7,7:11,99:150.00';
        }
        if (
$i == 3) {
          
$default_countries 'All Others'// this must be the lastest zone
          
$shipping_table '3:8,7:12,99:200.00';
        }
        
tep_db_query("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " $i ." Countries', 'MODULE_SHIPPING_ZONESWORLD_COUNTRIES_" $i ."', '" $default_countries "', 'Comma separated list of two character ISO country codes that are part of Zone " $i ".', '6', '0', now())");
        
tep_db_query("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " $i ." Shipping Table', 'MODULE_SHIPPING_ZONESWORLD_COST_" $i ."', '" $shipping_table "', 'Shipping rates to Zone " $i " destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone " $i " destinations.', '6', '0', now())");
        
tep_db_query("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " $i ." Handling Fee', 'MODULE_SHIPPING_ZONESWORLD_HANDLING_" $i ."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");
      }
    }
   
// elari - Added to select default country if not in listing

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

    function 
keys() {
      
$keys = array('MODULE_SHIPPING_ZONESWORLD_STATUS''MODULE_SHIPPING_ZONESWORLD_SORT_ORDER');

      for (
$i=1$i<=$this->num_zonesworld$i++) {
        
$keys[] = 'MODULE_SHIPPING_ZONESWORLD_COUNTRIES_' $i;
        
$keys[] = 'MODULE_SHIPPING_ZONESWORLD_COST_' $i;
      }

      return 
$keys;
    }
  }
?>
Como puedo Clonar la Zona 3 y así saco 5 veses ese Codigo y obtendré 8 Zonas.

Ayudenme por Favor. .
2Fast To You está desconectado   Responder Citando
Respuesta
No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 20:23.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93