$manufacturers_name); if ($action == 'insert') { $insert_sql_data = array('date_added' => 'now()'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); tep_db_perform(TABLE_MANUFACTURERS, $sql_data_array); $manufacturers_id = tep_db_insert_id(); } elseif ($action == 'save') { $update_sql_data = array('last_modified' => 'now()'); $sql_data_array = array_merge($sql_data_array, $update_sql_data); tep_db_perform(TABLE_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . (int)$manufacturers_id . "'"); } if ($manufacturers_image = new upload('manufacturers_image', DIR_FS_CATALOG_IMAGES)) { tep_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_image = '" . $manufacturers_image->filename . "' where manufacturers_id = '" . (int)$manufacturers_id . "'"); } $languages = tep_get_languages(); for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $manufacturers_url_array = $HTTP_POST_VARS['manufacturers_url']; $language_id = $languages[$i]['id']; $sql_data_array = array('manufacturers_url' => tep_db_prepare_input($manufacturers_url_array[$language_id])); if ($action == 'insert') { $insert_sql_data = array('manufacturers_id' => $manufacturers_id, 'languages_id' => $language_id); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array); } elseif ($action == 'save') { tep_db_perform(TABLE_MANUFACTURERS_INFO, $sql_data_array, 'update', "manufacturers_id = '" . (int)$manufacturers_id . "' and languages_id = '" . (int)$language_id . "'"); } } if (USE_CACHE == 'true') { tep_reset_cache_block('manufacturers'); } tep_redirect(tep_href_link(FILENAME_MANUFACTURERS, (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] . '&' : '') . 'mID=' . $manufacturers_id)); break; case 'deleteconfirm': $manufacturers_id = tep_db_prepare_input($HTTP_GET_VARS['mID']); if (isset($HTTP_POST_VARS['delete_image']) && ($HTTP_POST_VARS['delete_image'] == 'on')) { $manufacturer_query = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$manufacturers_id . "'"); $manufacturer = tep_db_fetch_array($manufacturer_query); $image_location = DIR_FS_DOCUMENT_ROOT . DIR_WS_CATALOG_IMAGES . $manufacturer['manufacturers_image']; if (file_exists($image_location)) @unlink($image_location); } tep_db_query("delete from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$manufacturers_id . "'"); tep_db_query("delete from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)$manufacturers_id . "'"); if (isset($HTTP_POST_VARS['delete_products']) && ($HTTP_POST_VARS['delete_products'] == 'on')) { $products_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where manufacturers_id = '" . (int)$manufacturers_id . "'"); while ($products = tep_db_fetch_array($products_query)) { tep_remove_product($products['products_id']); } } else { tep_db_query("update " . TABLE_PRODUCTS . " set manufacturers_id = '' where manufacturers_id = '" . (int)$manufacturers_id . "'"); } if (USE_CACHE == 'true') { tep_reset_cache_block('manufacturers'); } tep_redirect(tep_href_link(FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'])); break; } } ?> > <?php echo TITLE; ?>
'' . TEXT_HEADING_NEW_MANUFACTURER . ''); $contents = array('form' => tep_draw_form('manufacturers', FILENAME_MANUFACTURERS, 'action=insert', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_NEW_INTRO); $contents[] = array('text' => '
' . TEXT_MANUFACTURERS_NAME . '
' . tep_draw_input_field('manufacturers_name')); $contents[] = array('text' => '
' . TEXT_MANUFACTURERS_IMAGE . '
' . tep_draw_file_field('manufacturers_image')); $manufacturer_inputs_string = ''; $languages = tep_get_languages(); for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $manufacturer_inputs_string .= '
' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('manufacturers_url[' . $languages[$i]['id'] . ']'); } $contents[] = array('text' => '
' . TEXT_MANUFACTURERS_URL . $manufacturer_inputs_string); $contents[] = array('align' => 'center', 'text' => '
' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; case 'edit': $heading[] = array('text' => '' . TEXT_HEADING_EDIT_MANUFACTURER . ''); $contents = array('form' => tep_draw_form('manufacturers', FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=save', 'post', 'enctype="multipart/form-data"')); $contents[] = array('text' => TEXT_EDIT_INTRO); $contents[] = array('text' => '
' . TEXT_MANUFACTURERS_NAME . '
' . tep_draw_input_field('manufacturers_name', $mInfo->manufacturers_name)); $contents[] = array('text' => '
' . TEXT_MANUFACTURERS_IMAGE . '
' . tep_draw_file_field('manufacturers_image') . '
' . $mInfo->manufacturers_image); $manufacturer_inputs_string = ''; $languages = tep_get_languages(); for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $manufacturer_inputs_string .= '
' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('manufacturers_url[' . $languages[$i]['id'] . ']', tep_get_manufacturer_url($mInfo->manufacturers_id, $languages[$i]['id'])); } $contents[] = array('text' => '
' . TEXT_MANUFACTURERS_URL . $manufacturer_inputs_string); $contents[] = array('align' => 'center', 'text' => '
' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; case 'delete': $heading[] = array('text' => '' . TEXT_HEADING_DELETE_MANUFACTURER . ''); $contents = array('form' => tep_draw_form('manufacturers', FILENAME_MANUFACTURERS, 'page=' . $HTTP_GET_VARS['page'] . '&mID=' . $mInfo->manufacturers_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_DELETE_INTRO); $contents[] = array('text' => '
' . $mInfo->manufacturers_name . ''); $contents[] = array('text' => '
' . tep_draw_checkbox_field('delete_image', '', true) . ' ' . TEXT_DELETE_IMAGE); if ($mInfo->products_count > 0) { $contents[] = array('text' => '
' . tep_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS); $contents[] = array('text' => '
' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $mInfo->products_count)); } $contents[] = array('align' => 'center', 'text' => '
' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; default: if (isset($mInfo) && is_object($mInfo)) { $heading[] = array('text' => '' . $mInfo->manufacturers_name . ''); $contents[] = array('align' => 'center', 'text' => '' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '' . tep_image_button('button_delete.gif', IMAGE_DELETE) . ''); $contents[] = array('text' => '
' . TEXT_DATE_ADDED . ' ' . tep_date_short($mInfo->date_added)); if (tep_not_null($mInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($mInfo->last_modified)); $contents[] = array('text' => '
' . tep_info_image($mInfo->manufacturers_image, $mInfo->manufacturers_name)); $contents[] = array('text' => '
' . TEXT_PRODUCTS . ' ' . $mInfo->products_count); } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' ' . "\n"; } ?>
manufacturers_id)) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } ?>
 
manufacturers_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?> 
display_count($manufacturers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_MANUFACTURERS); ?> display_links($manufacturers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?>
manufacturers_id . '&action=new') . '">' . tep_image_button('button_insert.gif', IMAGE_INSERT) . ''; ?>
' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '