im logger (cao) wird das products_userfield[7] korrekt übergeben...
leider bleibt das DB-Feld jedoch leer.
Mein verwendetes / geändertes Skript:
Code: Alles auswählen
<?php
//--------------------------------------------------------------
... (einiges entfernt) ...
function ProductsUpdate ()
{
global $_POST, $LangID;
$products_id = tep_db_prepare_input($_POST['pID']);
// product laden
$SQL = "select products_quantity,products_model,products_ean,products_image,products_price,products_date_available,products_weight,products_status,products_tax_class_id, manufacturers_id, manufacturers_model";
if (DREI_PRODUKTBILDER == true)
{
$SQL .= ", products_image_medium, products_image_large ";
}
$count_query = tep_db_query($SQL . " from " . TABLE_PRODUCTS . " where products_id='" . $products_id . "'");
if ($product = tep_db_fetch_array($count_query))
{
$exists = 1;
// aktuelle Produktdaten laden
$products_quantity = $product['products_quantity'];
$products_model = $product['products_model'];
$products_ean = $product['products_ean'];
$products_userfield_7 = $product['products_userfield'][7];
$products_image = $product['products_image'];
if (DREI_PRODUKTBILDER == true)
{
$products_image_med = $product['products_image_medium'];
$products_image_large = $product['products_image_large'];
}
$products_price = $product['products_price'];
$products_date_available = $product['products_date_available'];
$products_weight = $product['products_weight'];
$products_status = $product['products_status'];
$products_tax_class_id = $product['products_tax_class_id'];
$manufacturers_id = $product['manufacturers_id'];
$manufacturers_model = $product['manufacturers_model'];
}
else $exists = 0;
// Variablen nur ueberschreiben wenn als Parameter vorhanden !!!
if (isset($_POST['products_quantity'])) $products_quantity = tep_db_prepare_input($_POST['products_quantity']);
if (isset($_POST['products_model'])) $products_model = tep_db_prepare_input($_POST['products_model']);
if (isset($_POST['products_ean'])) $products_ean = tep_db_prepare_input($_POST['products_ean']);
if (isset($_POST['products_userfield'][7])) $products_userfield_7 = tep_db_prepare_input($_POST['products_userfield'][7]);
if (isset($_POST['products_image'])) $products_image = tep_db_prepare_input($_POST['products_image']);
if (DREI_PRODUKTBILDER == true)
{
if (isset($_POST['products_image_med'])) $products_image_med = tep_db_prepare_input($_POST['products_image_med']);
if (isset($_POST['products_image_large'])) $products_image_large = tep_db_prepare_input($_POST['products_image_large']);
}
if (isset($_POST['products_price'])) $products_price = tep_db_prepare_input($_POST['products_price']);
if (isset($_POST['products_date_available'])) $products_date_available = tep_db_prepare_input($_POST['products_date_available']);
if (isset($_POST['products_weight'])) $products_weight = tep_db_prepare_input($_POST['products_weight']);
if (isset($_POST['products_status'])) $products_status = tep_db_prepare_input($_POST['products_status']);
if (isset($_POST['products_tax_class_id'])) $products_tax_class_id = tep_db_prepare_input($_POST['products_tax_class_id']);
if (isset($_POST['manufacturers_id'])) $manufacturers_id = tep_db_prepare_input($_POST['manufacturers_id']);
if (isset($_POST['manufacturers_model'])) $manufacturers_model = tep_db_prepare_input($_POST['manufacturers_model']);
if (file_exists('cao_produpd_1.php')) { include('cao_produpd_1.php'); }
$products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';
if (DREI_PRODUKTBILDER == true)
{
$sql_data_array = array('products_id' => $products_id,
'products_quantity' => $products_quantity,
'products_model' => $products_model,
'products_ean' => $products_ean,
'products_userfield_7' => $products_userfield_7,
'products_image' => ($products_image == 'none') ? '' : $products_image,
'products_image_medium' => ($products_image_med == 'none') ? '' : $products_image_med,
'products_image_large' => ($products_image_large == 'none') ? '' : $products_image_large,
'products_price' => $products_price,
'products_date_available' => $products_date_available,
'products_weight' => $products_weight,
'products_status' => $products_status,
'products_tax_class_id' => $products_tax_class_id,
'manufacturers_id' => $manufacturers_id,
'manufacturers_model' => $manufacturers_model);
}
else
{
$sql_data_array = array('products_id' => $products_id,
'products_quantity' => $products_quantity,
'products_model' => $products_model,
'products_ean' => $products_ean,
'products_userfield_7' => $products_userfield[7],
'products_image' => ($products_image == 'none') ? '' : $products_image,
'products_price' => $products_price,
'products_date_available' => $products_date_available,
'products_weight' => $products_weight,
'products_status' => $products_status,
'products_tax_class_id' => $products_tax_class_id,
'manufacturers_id' => $manufacturers_id,
'manufacturers_model' => $manufacturers_model);
}
if ($exists==0) // Neuanlage (ID wird an CAO zurueckgegeben !!!)
{
$mode='APPEND';
$insert_sql_data = array('products_date_added' => 'now()');
$sql_data_array = /*tep_*/array_merge($sql_data_array, $insert_sql_data);
tep_db_perform(TABLE_PRODUCTS, $sql_data_array);
$products_id = tep_db_insert_id();
}
elseif ($exists==1) //Update
{
$mode='UPDATE';
$update_sql_data = array('products_last_modified' => 'now()');
$sql_data_array = /*tep_*/array_merge($sql_data_array, $update_sql_data);
tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', 'products_id = \'' . tep_db_input($products_id) . '\'');
}
$languages = tep_get_languages();
for ($i = 0, $n = sizeof($languages); $i < $n; $i++)
{
$language_id = $languages[$i]['id'];
// Bestehende Daten laden
$SQL = "select products_id,products_name,products_description,products_url,products_viewed,language_id";
if (HEADERTAGS == true)
{
$SQL .= ", products_head_title_tag, products_head_desc_tag, products_head_keywords_tag";
}
$desc_query = tep_db_query($SQL . " from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id='" . $products_id . "' and language_id='" . $language_id . "'");
if ($desc = tep_db_fetch_array($desc_query))
{
$products_name = $desc['products_name'];
$products_description = $desc['products_description'];
$products_url = $desc['products_url'];
if (HEADERTAGS == true)
{
$products_head_title_tag = $desc['products_head_title_tag'];
$products_head_desc_tag = $desc['products_head_desc_tag'];
$products_head_keywords_tag = $desc['products_head_keywords_tag'];
}
}
// uebergebene Daten einsetzen
if (isset($_POST['products_name'][$LangID])) $products_name =tep_db_prepare_input($_POST['products_name'][$LangID]);
if (isset($_POST['products_description'][$LangID])) $products_description =tep_db_prepare_input($_POST['products_description'][$LangID]);
if (isset($_POST['products_url'][$LangID])) $products_url =tep_db_prepare_input($_POST['products_url'][$LangID]);
if (isset($_POST['products_meta_title'][$LangID])) $products_head_title_tag =tep_db_prepare_input($_POST['products_meta_title'][$LangID]);
if (isset($_POST['products_meta_description'][$LangID])) $products_head_desc_tag =tep_db_prepare_input($_POST['products_meta_description'][$LangID]);
if (isset($_POST['products_meta_keywords'][$LangID])) $products_head_keywords_tag=tep_db_prepare_input($_POST['products_meta_keywords'][$LangID]);
$sql_data_array = array('products_name' => $products_name,
'products_description' => $products_description,
'products_url' => $products_url);
if (HEADERTAGS == true)
{
$sql_data_array2 = array('products_head_title_tag' => $products_head_title_tag,
'products_head_desc_tag' => $products_head_desc_tag,
'products_head_keywords_tag' => $products_head_keywords_tag);
$sql_data_array = /*tep_*/array_merge($sql_data_array, $sql_data_array2);
}
if ($exists==0) // Insert
{
$insert_sql_data = array('products_id' => $products_id,
'language_id' => $language_id);
$sql_data_array = /*tep_*/array_merge($sql_data_array, $insert_sql_data);
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
}
elseif (($exists==1)and($LangID==$language_id)) // Update
{
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', 'products_id = \'' . tep_db_input($products_id) . '\' and language_id = \'' . $language_id . '\'');
}
}
if (file_exists('cao_produpd_2.php')) { include('cao_produpd_2.php'); }
print_xml_status (0, $_POST['action'], 'OK', $mode, 'PRODUCTS_ID', $products_id);
}
//--------------------------------------------------------------
... (einiges entfernt)...
?>