[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 product_types.php

Zen Cart 源代码 product_types.php




下载文件

文件名: product_types.php
文件类型: PHP文件
文件大小: 25.43 KiB
MD5: 42f2756c678f607886883b7aed8202eb

product_types.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2012 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version GIT: $Id: Author: Ian Wilson  Tue Aug 7 15:17:58 2012 +0100 Modified in v1.5.1 $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  13.  
  14.   if (zen_not_null($action)) {
  15.     switch ($action) {
  16.       case 'layout_save':
  17.         // demo active test
  18.         if (zen_admin_demo()) {
  19.           $_GET['action']= '';
  20.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  21.           zen_redirect(zen_href_link(FILENAME_PRODUCT_TYPES, 'gID=' . $_GET['gID'] . '&cID=' . $cID));
  22.         }
  23.         $configuration_value = zen_db_prepare_input($_POST['configuration_value']);
  24.         $cID = zen_db_prepare_input($_GET['cID']);
  25.  
  26.         $db->Execute("update " . TABLE_PRODUCT_TYPE_LAYOUT . "
  27.                      set configuration_value = '" . zen_db_input($configuration_value) . "',
  28.                          last_modified = now() where configuration_id = '" . (int)$cID . "'");
  29.         $configuration_query = 'select configuration_key as cfgkey, configuration_value as cfgvalue
  30.                          from ' . TABLE_PRODUCT_TYPE_LAYOUT;
  31.  
  32.         // set the WARN_BEFORE_DOWN_FOR_MAINTENANCE to false if DOWN_FOR_MAINTENANCE = true
  33.         if ( (WARN_BEFORE_DOWN_FOR_MAINTENANCE == 'true') && (DOWN_FOR_MAINTENANCE == 'true') ) {
  34.         $db->Execute("update " . TABLE_CONFIGURATION . "
  35.                      set configuration_value = 'false', last_modified = '" . NOW . "'
  36.                      where configuration_key = 'WARN_BEFORE_DOWN_FOR_MAINTENANCE'"); }
  37.  
  38.         $configuration_query = 'select configuration_key as cfgkey, configuration_value as cfgvalue
  39.                          from ' . TABLE_CONFIGURATION;
  40.  
  41.  
  42.         zen_redirect(zen_href_link(FILENAME_PRODUCT_TYPES, 'gID=' . $_GET['gID'] . '&cID=' . $cID . '&ptID=' . $_GET['ptID'] . '&action=layout'));
  43.         break;
  44.       case 'insert':
  45.       case 'save':
  46.         if (isset($_GET['ptID'])) $type_id = zen_db_prepare_input($_GET['ptID']);
  47.         $type_name = zen_db_prepare_input($_POST['type_name']);
  48.         $handler = zen_db_prepare_input($_POST['handler']);
  49.         $allow_add_to_cart =  zen_db_prepare_input(($_POST['catalog_add_to_cart'] ? 'Y' : 'N'));
  50.  
  51.         $sql_data_array = array('type_name' => $type_name,
  52.                                 'type_handler' => $handler,
  53.                                 'allow_add_to_cart' => $allow_add_to_cart);
  54.  
  55.         if ($action == 'insert') {
  56.           $insert_sql_data = array('date_added' => 'now()');
  57.  
  58.           $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
  59.  
  60.           zen_db_perform(TABLE_PRODUCT_TYPES, $sql_data_array);
  61.           $type_id = $db->Insert_ID();
  62.         } elseif ($action == 'save') {
  63.           $master_type = zen_db_prepare_input($_POST['master_type']);
  64.  
  65.           $update_sql_data = array('last_modified' => 'now()',
  66.                                    'type_master_type' => $master_type
  67.            );
  68.  
  69.           $sql_data_array = array_merge($sql_data_array, $update_sql_data);
  70.  
  71.           zen_db_perform(TABLE_PRODUCT_TYPES, $sql_data_array, 'update', "type_id = '" . (int)$type_id . "'");
  72.         }
  73.  
  74.         $type_image = new upload('default_image');
  75.         $type_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
  76.         if ( $type_image->parse() &&  $type_image->save()) {
  77.           // remove image from database if none
  78.           if ($type_image->filename != 'none') {
  79.             $db->Execute("update " . TABLE_PRODUCT_TYPES . "
  80.                          set default_image = '" .  zen_db_input($_POST['img_dir'] . $type_image->filename) . "'
  81.                          where type_id = '" . (int)$type_id . "'");
  82.           } else {
  83.             $db->Execute("update " . TABLE_PRODUCT_TYPES . "
  84.                          set default_image = ''
  85.                          where type_id = '" . (int)$type_id . "'");
  86.           }
  87.         }
  88.  
  89.         zen_redirect(zen_href_link(FILENAME_PRODUCT_TYPES, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'ptID=' . $type_id));
  90.         break;
  91.       case 'deleteconfirm':
  92.         // demo active test
  93.         if (zen_admin_demo()) {
  94.           $_GET['action']= '';
  95.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  96.           zen_redirect(zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page']));
  97.         }
  98.         $type_id = zen_db_prepare_input($_POST['ptID']);
  99.  
  100.         if (isset($_POST['delete_image']) && ($_POST['delete_image'] == 'on')) {
  101.           $product_type = $db->Execute("select default_image
  102.                                        from " . TABLE_PRODUCT_TYPES . "
  103.                                        where type_id = '" . (int)$type_id . "'");
  104.  
  105.           $image_location = DIR_FS_CATALOG_IMAGES . $product_type->fields['default_image'];
  106.  
  107.           if (file_exists($image_location)) @unlink($image_location);
  108.         }
  109.  
  110.         $db->Execute("delete from " . TABLE_PRODUCT_TYPES . "
  111.                      where type_id = '" . (int)$type_id . "'");
  112. //        $db->Execute("delete from " . TABLE_PRODUCT_TYPES_INFO . "
  113. //                      where manufacturers_id = '" . (int)$manufacturers_id . "'");
  114.  
  115.         if (isset($_POST['delete_products']) && ($_POST['delete_products'] == 'on')) {
  116.           $products = $db->Execute("select products_id
  117.                                    from " . TABLE_PRODUCTS . "
  118.                                    where products_type = '" . (int)$type_id . "'");
  119.  
  120.           while (!$products->EOF) {
  121.             zen_remove_product($products->fields['products_id']);
  122.             $products->MoveNext();
  123.           }
  124.         } else {
  125.           $db->Execute("update " . TABLE_PRODUCTS . "
  126.                        set products_type = '1'
  127.                        where products_type = '" . (int)$type_id . "'");
  128.         }
  129.  
  130.         zen_redirect(zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page']));
  131.         break;
  132.     }
  133.   }
  134. ?>
  135. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  136. <html <?php echo HTML_PARAMS; ?>>
  137. <head>
  138. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  139. <title><?php echo TITLE; ?></title>
  140. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  141. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  142. <script language="javascript" src="includes/menu.js"></script>
  143. <script language="javascript" src="includes/general.js"></script>
  144. <script type="text/javascript">
  145.   <!--
  146.   function init()
  147.   {
  148.     cssjsmenu('navbar');
  149.     if (document.getElementById)
  150.     {
  151.       var kill = document.getElementById('hoverJS');
  152.       kill.disabled = true;
  153.     }
  154.   }
  155.   // -->
  156. </script>
  157. </head>
  158. <body onLoad="init()">
  159. <!-- header //-->
  160. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  161. <!-- header_eof //-->
  162.  
  163. <!-- body //-->
  164. <?php
  165. if ($_GET['action'] == 'layout' || $_GET['action'] == 'layout_edit') {
  166.   $sql = "select type_name from " . TABLE_PRODUCT_TYPES . "
  167.          where type_id = '"   . (int)$_GET['ptID'] . "'";
  168.   $type_name = $db->Execute($sql);
  169.  
  170.  
  171. ?>
  172. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  173.   <tr>
  174. <!-- body_text //-->
  175.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  176.       <tr>
  177.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  178.           <tr>
  179.             <td class="pageHeading"><?php echo HEADING_TITLE_LAYOUT .  $type_name->fields['type_name']; ?></td>
  180.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  181.           </tr>
  182.         </table></td>
  183.       </tr>
  184.       <tr>
  185.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  186.           <tr>
  187.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  188.               <tr class="dataTableHeadingRow">
  189.                 <td class="dataTableHeadingContent" width="55%"><?php echo TABLE_HEADING_CONFIGURATION_TITLE; ?></td>
  190.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_VALUE; ?></td>
  191.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  192.               </tr>
  193. <?php
  194.   $configuration = $db->Execute("select configuration_id, configuration_title, configuration_value, configuration_key,
  195.                                        use_function from " . TABLE_PRODUCT_TYPE_LAYOUT . "
  196.                                        where product_type_id = '" . (int)$_GET['ptID'] . "'
  197.                                        order by sort_order");
  198.   while (!$configuration->EOF) {
  199.     if (zen_not_null($configuration->fields['use_function'])) {
  200.       $use_function = $configuration->fields['use_function'];
  201.       if (preg_match('/->/', $use_function)) {
  202.         $class_method = explode('->', $use_function);
  203.         if (!is_object(${$class_method[0]})) {
  204.           include(DIR_WS_CLASSES . $class_method[0] . '.php');
  205.           ${$class_method[0]} = new $class_method[0]();
  206.         }
  207.         $cfgValue = zen_call_function($class_method[1], $configuration->fields['configuration_value'], ${$class_method[0]});
  208.       } else {
  209.         $cfgValue = zen_call_function($use_function, $configuration->fields['configuration_value']);
  210.       }
  211.     } else {
  212.       $cfgValue = $configuration->fields['configuration_value'];
  213.     }
  214.  
  215.     if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $configuration->fields['configuration_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
  216.       $cfg_extra = $db->Execute("select configuration_key, configuration_description, date_added,
  217.                                        last_modified, use_function, set_function
  218.                                 from " . TABLE_PRODUCT_TYPE_LAYOUT . "
  219.                                 where configuration_id = '" . (int)$configuration->fields['configuration_id'] . "'");
  220.       $cInfo_array = array_merge($configuration->fields, $cfg_extra->fields);
  221.       $cInfo = new objectInfo($cInfo_array);
  222.     }
  223.  
  224.     if ( (isset($cInfo) && is_object($cInfo)) && ($configuration->fields['configuration_id'] == $cInfo->configuration_id) ) {
  225.       echo '                  <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_PRODUCT_TYPES, 'ptID=' . $_GET['ptID'] . '&cID=' . $cInfo->configuration_id . '&action=layout_edit') . '\'">' . "\n";
  226.     } else {
  227.       echo '                  <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_PRODUCT_TYPES, 'ptID=' . $_GET['ptID'] . '&cID=' . $configuration->fields['configuration_id'] . '&action=layout_edit') . '\'">' . "\n";
  228.     }
  229. ?>
  230.                 <td class="dataTableContent"><?php echo $configuration->fields['configuration_title']; ?></td>
  231.                 <td class="dataTableContent"><?php echo htmlspecialchars($cfgValue, ENT_COMPAT, CHARSET, TRUE); ?></td>
  232.                 <td class="dataTableContent" align="right"><?php if ( (isset($cInfo) && is_object($cInfo)) && ($configuration->fields['configuration_id'] == $cInfo->configuration_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'ptID=' . $_GET['ptID'] . '&cID=' . $configuration->fields['configuration_id'] . '&action=layout') . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  233.               </tr>
  234. <?php
  235.     $configuration->MoveNext();
  236.   }
  237. ?>
  238.             </table></td>
  239. <?php
  240.   $heading = array();
  241.   $contents = array();
  242.  
  243.   switch ($action) {
  244.     case 'layout_edit':
  245.       $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
  246.  
  247.       if ($cInfo->set_function) {
  248.         eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value, ENT_COMPAT, CHARSET, TRUE) . '");');
  249.       } else {
  250.         $value_field = zen_draw_input_field('configuration_value', htmlspecialchars($cInfo->configuration_value, ENT_COMPAT, CHARSET, TRUE), 'size="60"');
  251.       }
  252.  
  253.       $contents = array('form' => zen_draw_form('configuration', FILENAME_PRODUCT_TYPES, 'ptID=' . $_GET['ptID'] . '&cID=' . $cInfo->configuration_id . '&action=layout_save'));
  254.       if (ADMIN_CONFIGURATION_KEY_ON == 1) {
  255.         $contents[] = array('text' => '<strong>Key: ' . $cInfo->configuration_key . '</strong><br />');
  256.       }
  257.       $contents[] = array('text' => TEXT_EDIT_INTRO);
  258.       $contents[] = array('text' => '<br><b>' . $cInfo->configuration_title . '</b><br>' . $cInfo->configuration_description . '<br>' . $value_field);
  259.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'action=layout&ptID=' . $_GET['ptID'] . '&cID=' . $cInfo->configuration_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  260.       break;
  261.     default:
  262.       if (isset($cInfo) && is_object($cInfo)) {
  263.         $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
  264.  
  265.         if (ADMIN_CONFIGURATION_KEY_ON == 1) {
  266.           $contents[] = array('text' => '<strong>Key: ' . $cInfo->configuration_key . '</strong><br />');
  267.         }
  268.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'ptID=' . $_GET['ptID'] . '&cID=' . $cInfo->configuration_id . '&action=layout_edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>' . '&nbsp;<a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'ptID=' . $_GET['ptID'] . '&cID=' . $cInfo->configuration_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  269.         $contents[] = array('text' => '<br>' . $cInfo->configuration_description);
  270.         $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . zen_date_short($cInfo->date_added));
  271.         if (zen_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($cInfo->last_modified));
  272.       }
  273.       break;
  274.   }
  275.  
  276.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  277.     echo '            <td width="25%" valign="top">' . "\n";
  278.  
  279.     $box = new box;
  280.     echo $box->infoBox($heading, $contents);
  281.  
  282.     echo '            </td>' . "\n";
  283.   }
  284. ?>
  285.           </tr>
  286.         </table></td>
  287.       </tr>
  288.     </table></td>
  289. <!-- body_text_eof //-->
  290.   </tr>
  291. </table>
  292. <?php
  293. } else {
  294. ?>
  295. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  296.   <tr>
  297. <!-- body_text //-->
  298.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  299.       <tr>
  300.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  301.           <tr>
  302.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  303.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  304.           </tr>
  305.         </table></td>
  306.       </tr>
  307.       <tr>
  308.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  309.           <tr>
  310.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  311.               <tr class="dataTableHeadingRow">
  312.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT_TYPES; ?></td>
  313.                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_PRODUCT_TYPES_ALLOW_ADD_TO_CART; ?></td>
  314.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  315.               </tr>
  316. <?php
  317.   $product_types_query_raw = "select * from " . TABLE_PRODUCT_TYPES;
  318.   $product_types_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $product_types_query_raw, $product_types_query_numrows);
  319.   $product_types = $db->Execute($product_types_query_raw);
  320.   while (!$product_types->EOF) {
  321.     if ((!isset($_GET['ptID']) || (isset($_GET['ptID']) && ($_GET['ptID'] == $product_types->fields['type_id']))) && !isset($ptInfo) && (substr($action, 0, 3) != 'new')) {
  322.       $product_type_products = $db->Execute("select count(*) as products_count
  323.                                             from " . TABLE_PRODUCTS . "
  324.                                             where products_type = '" . (int)$product_types->fields['type_id'] . "'");
  325.  
  326.       $ptInfo_array = array_merge($product_types->fields, $product_type_products->fields);
  327.  
  328.       $ptInfo = new objectInfo($ptInfo_array);
  329.     }
  330.  
  331.     if (isset($ptInfo) && is_object($ptInfo) && ($product_types->fields['type_id'] == $ptInfo->type_id)) {
  332.       echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&ptID=' . $product_types->fields['type_id'] . '&action=layout' ) . '\'">' . "\n";
  333.     } else {
  334.       echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&ptID=' . $product_types->fields['type_id']) . '\'">' . "\n";
  335.     }
  336. ?>
  337.                 <td class="dataTableContent"><?php echo $product_types->fields['type_name']; ?></td>
  338.                 <td class="dataTableContent" align="center"><?php echo $product_types->fields['allow_add_to_cart']; ?></td>
  339.                 <td class="dataTableContent" align="right"><?php if ( (isset($ptInfo) && is_object($ptInfo)) && ($product_types->fields['type_id'] == $ptInfo->type_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'ptID=' . $product_types->fields['type_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;  </td>
  340.               </tr>
  341. <?php
  342.     $product_types->MoveNext();
  343.   }
  344. ?>
  345.               <tr>
  346.                 <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  347.                   <tr>
  348.                     <td class="smallText" valign="top"><?php echo $product_types_split->display_count($product_types_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCT_TYPES); ?></td>
  349.                     <td class="smallText" align="right"><?php echo $product_types_split->display_links($product_types_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  350.                   </tr>
  351.                 </table></td>
  352.               </tr>
  353.             </table></td>
  354. <?php
  355.   $heading = array();
  356.   $contents = array();
  357.  
  358.   switch ($action) {
  359.     case 'new':
  360.       $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_PRODUCT_TYPE . '</b>');
  361.  
  362.       $contents = array('form' => zen_draw_form('new_product_type', FILENAME_PRODUCT_TYPES, 'action=insert', 'post', 'enctype="multipart/form-data"'));
  363.       $contents[] = array('text' => TEXT_NEW_INTRO);
  364.       break;
  365.     case 'edit':
  366.       $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_PRODUCT_TYPE . ' :: ' . $ptInfo->type_name . '</b>');
  367.  
  368.       $contents = array('form' => zen_draw_form('product_types', FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&ptID=' . $ptInfo->type_id . '&action=save', 'post', 'enctype="multipart/form-data"'));
  369.       $contents[] = array('text' => TEXT_EDIT_INTRO);
  370.       $contents[] = array('text' => '<br />' . TEXT_PRODUCT_TYPES_NAME . '<br>' . zen_draw_input_field('type_name', $ptInfo->type_name, zen_set_field_length(TABLE_PRODUCT_TYPES, 'type_name')));
  371.       $contents[] = array('text' => '<br />' . TEXT_PRODUCT_TYPES_IMAGE . '<br>' . zen_draw_file_field('default_image') . '<br />' . $ptInfo->default_image);
  372.       $dir = @dir(DIR_FS_CATALOG_IMAGES);
  373.       $dir_info[] = array('id' => '', 'text' => "Main Directory");
  374.       while ($file = $dir->read()) {
  375.         if (is_dir(DIR_FS_CATALOG_IMAGES . $file) && strtoupper($file) != 'CVS' && $file != "." && $file != "..") {
  376.           $dir_info[] = array('id' => $file . '/', 'text' => $file);
  377.         }
  378.       }
  379.       $dir->close();
  380.       $default_directory = substr( $ptInfo->default_image, 0,strpos( $ptInfo->default_image, '/')+1);
  381.       $contents[] = array('text' => '<BR />' . TEXT_PRODUCTS_IMAGE_DIR . zen_draw_pull_down_menu('img_dir', $dir_info, $default_directory));
  382.       $contents[] = array('text' => '<br />' . zen_info_image($ptInfo->default_image, $ptInfo->type_name));
  383.       $contents[] = array('text' => '<br />' . TEXT_PRODUCT_TYPES_HANDLER . '<br>' . zen_draw_input_field('handler', $ptInfo->type_handler, zen_set_field_length(TABLE_PRODUCT_TYPES, 'type_handler')));
  384.        $contents[] = array('text' => '<br />' . TEXT_PRODUCT_TYPES_ALLOW_ADD_CART . '<br>' . zen_draw_checkbox_field('catalog_add_to_cart', $ptInfo->allow_add_to_cart, ($ptInfo->allow_add_to_cart == 'Y' ? true : false)));
  385.        $sql = "select type_id, type_name from " . TABLE_PRODUCT_TYPES;
  386.        $product_type_list = $db->Execute($sql);
  387.        while (!$product_type_list->EOF) {
  388.          $product_type_array[] = array('text' => $product_type_list->fields['type_name'], 'id' => $product_type_list->fields['type_id']);
  389.          $product_type_list->MoveNext();
  390.        }
  391.       $contents[] = array('text' => '<br />' . TEXT_MASTER_TYPE . zen_draw_pull_down_menu('master_type', $product_type_array, $ptInfo->type_master_type));
  392.  
  393.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&ptID=' . $ptInfo->type_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  394.       break;
  395.     case 'delete':
  396.       $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_PRODUCT_TYPE . '</b>');
  397.  
  398.       $contents = array('form' => zen_draw_form('manufacturers', FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('ptID', $ptInfo->type_id));
  399.       $contents[] = array('text' => TEXT_DELETE_INTRO);
  400.       $contents[] = array('text' => '<br><b>' . $ptInfo->type_name . '</b>');
  401.       $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_image', '', true) . ' ' . TEXT_DELETE_IMAGE);
  402.  
  403.       if ($ptInfo->products_count > 0) {
  404.         $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS);
  405.         $contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $ptInfo->products_count));
  406.       }
  407.  
  408.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&ptID=' . $ptInfo->type_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  409.       break;
  410.     default:
  411.       if (isset($ptInfo) && is_object($ptInfo)) {
  412.         $heading[] = array('text' => '<b>' . $ptInfo->type_name . '</b>');
  413. // remove delete for now to avoid issues
  414. //        $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&ptID=' . $ptInfo->type_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&ptID=' . $ptInfo->type_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&ptID=' . $ptInfo->type_id . '&action=layout') . '">' . zen_image_button('button_layout.gif', IMAGE_LAYOUT) . '</a>' );
  415.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&ptID=' . $ptInfo->type_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&ptID=' . $ptInfo->type_id . '&action=layout') . '">' . zen_image_button('button_layout.gif', IMAGE_LAYOUT) . '</a>' );
  416.         $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . zen_date_short($ptInfo->date_added));
  417.         if (zen_not_null($ptInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($ptInfo->last_modified));
  418.         $contents[] = array('text' => '<br>' . zen_info_image($ptInfo->manufacturers_image, $ptInfo->manufacturers_name));
  419.         $contents[] = array('text' => '<br>' . TEXT_PRODUCTS . ' ' . $ptInfo->products_count);
  420.       }
  421.       break;
  422.   }
  423.  
  424.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  425.     echo '            <td width="25%" valign="top">' . "\n";
  426.  
  427.     $box = new box;
  428.     echo $box->infoBox($heading, $contents);
  429.  
  430.     echo '            </td>' . "\n";
  431.   }
  432. ?>
  433.           </tr>
  434.         </table></td>
  435.       </tr>
  436.     </table></td>
  437. <!-- body_text_eof //-->
  438.   </tr>
  439. </table>
  440. <?php
  441. }
  442. ?>
  443. <!-- body_eof //-->
  444.  
  445. <!-- footer //-->
  446. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  447. <!-- footer_eof //-->
  448. <br>
  449. </body>
  450. </html>
  451. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


cron