ich versuche aus diesem code:
ein dropdown der Länder zu machen die dann die richtige tabelle ausgibt zu machen.. leider scheitere ich kläglich mangels php kenntnissen.. kann mir hier jemand nachhelfen?
Lg
PHP:
<?php
/*
* shipping_table.php
* Lies alle Einstellungen/Versandkosten aus und erzeugt eine übersictliche Tabelle
* Copyright 2005 by Sergej Stroh.
* 22.12.2005
*/
$module_smarty = new Smarty;
$module_smarty->assign('tpl_path','templates/'.CURRENT_TEMPLATE.'/');
//-- DIESEN TEIL KANN MAN WEITER ERWEITERN --
$shipping_array = array('DP','UPS','UPSE', 'AP','ZONES'); // Versandart definieren
$shipping_names = array('Deutsche Post','United Parcel Service (UPS)','United Parcel Service Express (UPS Express)','Austrian Post','Versand nach Zonen'); // Versandartbezeichnung
$num_of_zones = array('7','8','15','9','35'); // Anzahl der Zonen +1
//-- AB HIER KEINE ÄNDERUNGEN MEHR --
// array mit allen Versandarten bilden um eine Liste zu erzeugen
$shipping_count = count($shipping_array);
// Länder array
$countries_array = array();
$shipping_list = array();
for($w = 0; $w < $shipping_count; $w++){
// Modul aktiv?
$active_query = xtc_db_query("SELECT configuration_value FROM ".TABLE_CONFIGURATION."
WHERE configuration_key = 'MODULE_SHIPPING_$shipping_array[$w]_STATUS'");
$active = xtc_db_fetch_array($active_query);
// active?
if($active['configuration_value'] == 'True' || $active['configuration_value'] == 'true'){
$module_smarty->assign('MODUL_ACTIVE', '1');
// Übersicht-Liste erzeugen
$shipping_list[] = array(
'NAME' => $shipping_names[$w],
'LINK' => $_SERVER['SCRIPT_NAME']);
// Bearbeitungsgebühr für diese Versandart in Euro
// MODULE_SHIPPING_HANDLING
$handling_query = xtc_db_query("SELECT configuration_value FROM ".TABLE_CONFIGURATION."
WHERE configuration_key = 'MODULE_SHIPPING_$shipping_array[$w]_HANDLING'");
$handling = xtc_db_fetch_array($handling_query);
$module_smarty->assign('COUNTRY_SHIPPING_HANDLING_TEXT', COUNTRY_SHIPPING_HANDLING_TEXT);
// Versand erlaubt nur nach,
// MODULE_SHIPPING_ALLOWED
$shipping_allowed_query = xtc_db_query("SELECT configuration_value FROM ".TABLE_CONFIGURATION."
WHERE configuration_key = 'MODULE_SHIPPING_$shipping_array[$w]_ALLOWED'");
$shipping_allowed = xtc_db_fetch_array($shipping_allowed_query);
$shipping_allowed_true = xtc_db_num_rows($shipping_allowed);
$module_smarty->assign('COUNTRY_SHIPPING_ALLOWED_TEXT', COUNTRY_SHIPPING_ALLOWED_TEXT);
// Array bilden
$countries_array[$w] = array(
'SHIPPING_NAME' => $shipping_names[$w],
'SHIPPING_HANDLING' => $handling['configuration_value'],
'SHIPPING_ALLOWED' => $shipping_allowed['configuration_value'],
'TOP_LINK' => $_SERVER['SCRIPT_NAME'],
'SHIPPING_MODUL' => ''); // countries anhängen
/* NOCH NICHT FERTIG
if($shipping_allowed_true > 0){
// -- Länder laden --
$countries_allowed_table = preg_split('[,]', $shipping_allowed['configuration_value']);
$countries_allowed_count = count($countries_allowed_table);
// versandkosten in diese länder filtern
}else{
// falls keine einzelne versandzonen vorhanden
*/
for($i = 1; $i < $num_of_zones[$w]; $i++){
$countries_query = xtc_db_query("SELECT configuration_value FROM ".TABLE_CONFIGURATION."
WHERE configuration_key = 'MODULE_SHIPPING_$shipping_array[$w]_COUNTRIES_".$i."'");
$countries = xtc_db_fetch_array($countries_query);
$cost_query = xtc_db_query("SELECT configuration_value FROM ".TABLE_CONFIGURATION."
WHERE configuration_key = 'MODULE_SHIPPING_$shipping_array[$w]_COST_".$i."'");
$cost = xtc_db_fetch_array($cost_query);
// -- Länder laden --
$countries_table = preg_split('[,]', $countries['configuration_value']);
$countries_count = count($countries_table);
for($a=0; $a<$countries_count; $a++){
$new_countries_list .= $countries_table[$a];
// letzte kommata entfernen und neu bilden
if($a+1 != $countries_count) $new_countries_list .= ', ';
}
// -- Kosten und Gewicht laden ---
$cost_table = preg_split('/[:,]+/', $cost['configuration_value']);
$cost_count = count($cost_table);
for($b=0; $b<$cost_count; $b++){
$new_weight_cost_list .= '<tr><td bgcolor="'.($b%4?'#eeeeee':'#ffffff').'">'. COUNTRY_COST_BY . $cost_table[$b] . COUNTRY_WEIGHT .'</td>';
$new_weight_cost_list .= '<td bgcolor="'.($b%4?'#eeeeee':'#ffffff').'"> '. $cost_table[$b+1] . COUNTRY_COST_EUR .'</td></tr>';
$b++;
}
$countries_array[$w]['SHIPPING_MODUL'][$i] = array(
'COUNTRIES' => $new_countries_list,
'WEIGHT_COST' => $new_weight_cost_list);
$new_countries_list = ''; // Liste leeren
$new_weight_cost_list = '';
} // Kosten EOF
//} // IF allowed
} // IF active
} // FOR shipping
$module_smarty->assign('shipping_modules',$countries_array);
$module_smarty->assign('modul_list',$shipping_list);
// Text
$module_smarty->assign('COUNTRY_SHIPPING_TEXT', COUNTRY_SHIPPING);
$module_smarty->assign('COUNTRY_COST_TEXT', COUNTRY_COST);
$module_smarty->assign('language', $_SESSION['language']);
$module_smarty->assign('COUNTRY_SHIPPING_TRUE_TEXT', COUNTRY_SHIPPING_TRUE);
// kein cache
$module_smarty->caching = 0;
echo $module_smarty->fetch(CURRENT_TEMPLATE.'/module/shipping_table.html');
?>
ein dropdown der Länder zu machen die dann die richtige tabelle ausgibt zu machen.. leider scheitere ich kläglich mangels php kenntnissen.. kann mir hier jemand nachhelfen?
Lg
Zuletzt bearbeitet: