Code:
///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC *INSERTS* HERE //////
//extra product fields
$tmp_value = zen_db_prepare_input($_POST['file_1']);
$file_1 = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_2']);
$file_2 = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_3']);
$file_3 = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_4']);
$file_4 = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_1_title']);
$file_1_title = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_2_title']);
$file_2_title = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_3_title']);
$file_3_title = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_4_title']);
$file_4_title = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['video']);
$video = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['video_title']);
$video_title = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['extra_field']);
$extra_field = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['height']);
$height = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['width']);
$width = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['specs']);
$specs = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['dimensions']);
$dimensions = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['compatibility']);
$compatibility = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['weight']);
$weight = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['warranty']);
$warranty = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['warranty']);
$warranty = ($tmp_value=='') ? "null" : $tmp_value;
$sql_data_array = array('products_id' => $products_id,
'extra_field' => $extra_field,
'video_title' => $video_title,
'file_1' => $file_1,
'file_2' => $file_2,
'file_3' => $file_3,
'file_4' => $file_4,
'file_1_title' => $file_1_title,
'file_2_title' => $file_2_title,
'file_3_title' => $file_3_title,
'file_4_title' => $file_4_title,
'video' => $video,
'height' => $height,
'width' => $width,
'specs' => $specs,
'dimensions' => $dimensions,
'compatibility' => $compatibility,
'weight' => $weight,
'package' => $package,
'warranty' => $warranty
);
zen_db_perform(TABLE_PRODUCT_EXTRA_FIELDS, $sql_data_array);
//// *END OF PRODUCT-TYPE-SPECIFIC INSERTS* ////////
///////////////////////////////////////////////////////
} elseif ($action == 'update_product') {
$update_sql_data = array( 'products_last_modified' => 'now()',
'master_categories_id' => ($_POST['master_category'] > 0 ? zen_db_prepare_input($_POST['master_category']) : zen_db_prepare_input($_POST['master_categories_id'])));
$sql_data_array = array_merge($sql_data_array, $update_sql_data);
zen_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
// reset products_price_sorter for searches etc.
zen_update_products_price_sorter((int)$products_id);
///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
//extra product fields
$tmp_value = zen_db_prepare_input($_POST['file_1']);
$file_1 = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_2']);
$file_2 = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_3']);
$file_3 = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_4']);
$file_4 = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_1_title']);
$file_1_title = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_2_title']);
$file_2_title = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_3_title']);
$file_3_title = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['file_4_title']);
$file_4_title = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['video']);
$video = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['video_title']);
$video_title = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['extra_field']);
$extra_field = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['height']);
$height = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['width']);
$width = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['specs']);
$specs = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['dimensions']);
$dimensions = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['weight']);
$weight = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['compatibility']);
$compatibility = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['package']);
$package = ($tmp_value=='') ? "null" : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['warranty']);
$warranty = ($tmp_value=='') ? "null" : $tmp_value;
$sql_data_array = array('extra_field' => $extra_field,
'file_1' => $file_1,
'file_2' => $file_2,
'file_3' => $file_3,
'file_4' => $file_4,
'file_1_title' => $file_1_title,
'file_2_title' => $file_2_title,
'file_3_title' => $file_3_title,
'file_4_title' => $file_4_title,
'video' => $video,
'video_title' => $video_title,
'height' => $height,
'width' => $width,
'specs' => $specs,
'dimensions' => $dimensions,
'weight' => $weight,
'compatibility' => $compatibility,
'package' => $package,
'warranty' => $warranty
);
Bookmarks