ZenCart_Documentation  1.5.0
http://www.collinsharper.com
C:/xampp/htdocs/zen-cart/admin/product_types.php
Go to the documentation of this file.
00001 <?php
00010   require('includes/application_top.php');
00011 
00012   $action = (isset($_GET['action']) ? $_GET['action'] : '');
00013 
00014   if (zen_not_null($action)) {
00015     switch ($action) {
00016       case 'layout_save':
00017         // demo active test
00018         if (zen_admin_demo()) {
00019           $_GET['action']= '';
00020           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
00021           zen_redirect(zen_href_link(FILENAME_PRODUCT_TYPES, 'gID=' . $_GET['gID'] . '&cID=' . $cID));
00022         }
00023         $configuration_value = zen_db_prepare_input($_POST['configuration_value']);
00024         $cID = zen_db_prepare_input($_GET['cID']);
00025 
00026         $db->Execute("update " . TABLE_PRODUCT_TYPE_LAYOUT . "
00027                       set configuration_value = '" . zen_db_input($configuration_value) . "',
00028                           last_modified = now() where configuration_id = '" . (int)$cID . "'");
00029         $configuration_query = 'select configuration_key as cfgkey, configuration_value as cfgvalue
00030                           from ' . TABLE_PRODUCT_TYPE_LAYOUT;
00031 
00032         // set the WARN_BEFORE_DOWN_FOR_MAINTENANCE to false if DOWN_FOR_MAINTENANCE = true
00033         if ( (WARN_BEFORE_DOWN_FOR_MAINTENANCE == 'true') && (DOWN_FOR_MAINTENANCE == 'true') ) {
00034         $db->Execute("update " . TABLE_CONFIGURATION . "
00035                       set configuration_value = 'false', last_modified = '" . NOW . "'
00036                       where configuration_key = 'WARN_BEFORE_DOWN_FOR_MAINTENANCE'"); }
00037 
00038         $configuration_query = 'select configuration_key as cfgkey, configuration_value as cfgvalue
00039                           from ' . TABLE_CONFIGURATION;
00040 
00041 
00042         zen_redirect(zen_href_link(FILENAME_PRODUCT_TYPES, 'gID=' . $_GET['gID'] . '&cID=' . $cID . '&ptID=' . $_GET['ptID'] . '&action=layout'));
00043         break;
00044       case 'insert':
00045       case 'save':
00046         if (isset($_GET['ptID'])) $type_id = zen_db_prepare_input($_GET['ptID']);
00047         $type_name = zen_db_prepare_input($_POST['type_name']);
00048         $handler = zen_db_prepare_input($_POST['handler']);
00049         $allow_add_to_cart =  zen_db_prepare_input(($_POST['catalog_add_to_cart'] ? 'Y' : 'N'));
00050 
00051         $sql_data_array = array('type_name' => $type_name,
00052                                 'type_handler' => $handler,
00053                                 'allow_add_to_cart' => $allow_add_to_cart);
00054 
00055         if ($action == 'insert') {
00056           $insert_sql_data = array('date_added' => 'now()');
00057 
00058           $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
00059 
00060           zen_db_perform(TABLE_PRODUCT_TYPES, $sql_data_array);
00061           $type_id = $db->Insert_ID();
00062         } elseif ($action == 'save') {
00063           $master_type = zen_db_prepare_input($_POST['master_type']);
00064 
00065           $update_sql_data = array('last_modified' => 'now()',
00066                                    'type_master_type' => $master_type
00067            );
00068 
00069           $sql_data_array = array_merge($sql_data_array, $update_sql_data);
00070 
00071           zen_db_perform(TABLE_PRODUCT_TYPES, $sql_data_array, 'update', "type_id = '" . (int)$type_id . "'");
00072         }
00073 
00074         $type_image = new upload('default_image');
00075         $type_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
00076         if ( $type_image->parse() &&  $type_image->save()) {
00077           // remove image from database if none
00078           if ($type_image->filename != 'none') {
00079             $db->Execute("update " . TABLE_PRODUCT_TYPES . "
00080                           set default_image = '" .  zen_db_input($_POST['img_dir'] . $type_image->filename) . "'
00081                           where type_id = '" . (int)$type_id . "'");
00082           } else {
00083             $db->Execute("update " . TABLE_PRODUCT_TYPES . "
00084                           set default_image = ''
00085                           where type_id = '" . (int)$type_id . "'");
00086           }
00087         }
00088 
00089         zen_redirect(zen_href_link(FILENAME_PRODUCT_TYPES, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'ptID=' . $type_id));
00090         break;
00091       case 'deleteconfirm':
00092         // demo active test
00093         if (zen_admin_demo()) {
00094           $_GET['action']= '';
00095           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
00096           zen_redirect(zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page']));
00097         }
00098         $type_id = zen_db_prepare_input($_POST['ptID']);
00099 
00100         if (isset($_POST['delete_image']) && ($_POST['delete_image'] == 'on')) {
00101           $product_type = $db->Execute("select default_image
00102                                         from " . TABLE_PRODUCT_TYPES . "
00103                                         where type_id = '" . (int)$type_id . "'");
00104 
00105           $image_location = DIR_FS_CATALOG_IMAGES . $product_type->fields['default_image'];
00106 
00107           if (file_exists($image_location)) @unlink($image_location);
00108         }
00109 
00110         $db->Execute("delete from " . TABLE_PRODUCT_TYPES . "
00111                       where type_id = '" . (int)$type_id . "'");
00112 //        $db->Execute("delete from " . TABLE_PRODUCT_TYPES_INFO . "
00113 //                      where manufacturers_id = '" . (int)$manufacturers_id . "'");
00114 
00115         if (isset($_POST['delete_products']) && ($_POST['delete_products'] == 'on')) {
00116           $products = $db->Execute("select products_id
00117                                     from " . TABLE_PRODUCTS . "
00118                                     where products_type = '" . (int)$type_id . "'");
00119 
00120           while (!$products->EOF) {
00121             zen_remove_product($products->fields['products_id']);
00122             $products->MoveNext();
00123           }
00124         } else {
00125           $db->Execute("update " . TABLE_PRODUCTS . "
00126                         set products_type = '1'
00127                         where products_type = '" . (int)$type_id . "'");
00128         }
00129 
00130         zen_redirect(zen_href_link(FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page']));
00131         break;
00132     }
00133   }
00134 ?>
00135 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
00136 <html <?php echo HTML_PARAMS; ?>>
00137 <head>
00138 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
00139 <title><?php echo TITLE; ?></title>
00140 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
00141 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
00142 <script language="javascript" src="includes/menu.js"></script>
00143 <script language="javascript" src="includes/general.js"></script>
00144 <script type="text/javascript">
00145   <!--
00146   function init()
00147   {
00148     cssjsmenu('navbar');
00149     if (document.getElementById)
00150     {
00151       var kill = document.getElementById('hoverJS');
00152       kill.disabled = true;
00153     }
00154   }
00155   // -->
00156 </script>
00157 </head>
00158 <body onLoad="init()">
00159 <!-- header //-->
00160 <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
00161 <!-- header_eof //-->
00162 
00163 <!-- body //-->
00164 <?php
00165 if ($_GET['action'] == 'layout' || $_GET['action'] == 'layout_edit') {
00166   $sql = "select type_name from " . TABLE_PRODUCT_TYPES . "
00167           where type_id = '"   . (int)$_GET['ptID'] . "'";
00168   $type_name = $db->Execute($sql);
00169 
00170 
00171 ?>
00172 <table border="0" width="100%" cellspacing="2" cellpadding="2">
00173   <tr>
00174 <!-- body_text //-->
00175     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00176       <tr>
00177         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00178           <tr>
00179             <td class="pageHeading"><?php echo HEADING_TITLE_LAYOUT .  $type_name->fields['type_name']; ?></td>
00180             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
00181           </tr>
00182         </table></td>
00183       </tr>
00184       <tr>
00185         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00186           <tr>
00187             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00188               <tr class="dataTableHeadingRow">
00189                 <td class="dataTableHeadingContent" width="55%"><?php echo TABLE_HEADING_CONFIGURATION_TITLE; ?></td>
00190                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CONFIGURATION_VALUE; ?></td>
00191                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
00192               </tr>
00193 <?php
00194   $configuration = $db->Execute("select configuration_id, configuration_title, configuration_value, configuration_key,
00195                                         use_function from " . TABLE_PRODUCT_TYPE_LAYOUT . "
00196                                         where product_type_id = '" . (int)$_GET['ptID'] . "'
00197                                         order by sort_order");
00198   while (!$configuration->EOF) {
00199     if (zen_not_null($configuration->fields['use_function'])) {
00200       $use_function = $configuration->fields['use_function'];
00201       if (preg_match('/->/', $use_function)) {
00202         $class_method = explode('->', $use_function);
00203         if (!is_object(${$class_method[0]})) {
00204           include(DIR_WS_CLASSES . $class_method[0] . '.php');
00205           ${$class_method[0]} = new $class_method[0]();
00206         }
00207         $cfgValue = zen_call_function($class_method[1], $configuration->fields['configuration_value'], ${$class_method[0]});
00208       } else {
00209         $cfgValue = zen_call_function($use_function, $configuration->fields['configuration_value']);
00210       }
00211     } else {
00212       $cfgValue = $configuration->fields['configuration_value'];
00213     }
00214 
00215     if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $configuration->fields['configuration_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
00216       $cfg_extra = $db->Execute("select configuration_key, configuration_description, date_added,
00217                                         last_modified, use_function, set_function
00218                                  from " . TABLE_PRODUCT_TYPE_LAYOUT . "
00219                                  where configuration_id = '" . (int)$configuration->fields['configuration_id'] . "'");
00220       $cInfo_array = array_merge($configuration->fields, $cfg_extra->fields);
00221       $cInfo = new objectInfo($cInfo_array);
00222     }
00223 
00224     if ( (isset($cInfo) && is_object($cInfo)) && ($configuration->fields['configuration_id'] == $cInfo->configuration_id) ) {
00225       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";
00226     } else {
00227       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";
00228     }
00229 ?>
00230                 <td class="dataTableContent"><?php echo $configuration->fields['configuration_title']; ?></td>
00231                 <td class="dataTableContent"><?php echo htmlspecialchars($cfgValue); ?></td>
00232                 <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>
00233               </tr>
00234 <?php
00235     $configuration->MoveNext();
00236   }
00237 ?>
00238             </table></td>
00239 <?php
00240   $heading = array();
00241   $contents = array();
00242 
00243   switch ($action) {
00244     case 'layout_edit':
00245       $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
00246 
00247       if ($cInfo->set_function) {
00248         eval('$value_field = ' . $cInfo->set_function . '"' . htmlspecialchars($cInfo->configuration_value) . '");');
00249       } else {
00250         $value_field = zen_draw_input_field('configuration_value', htmlspecialchars($cInfo->configuration_value, ENT_COMPAT, CHARSET, TRUE), 'size="60"');
00251       }
00252 
00253       $contents = array('form' => zen_draw_form('configuration', FILENAME_PRODUCT_TYPES, 'ptID=' . $_GET['ptID'] . '&cID=' . $cInfo->configuration_id . '&action=layout_save'));
00254       if (ADMIN_CONFIGURATION_KEY_ON == 1) {
00255         $contents[] = array('text' => '<strong>Key: ' . $cInfo->configuration_key . '</strong><br />');
00256       }
00257       $contents[] = array('text' => TEXT_EDIT_INTRO);
00258       $contents[] = array('text' => '<br><b>' . $cInfo->configuration_title . '</b><br>' . $cInfo->configuration_description . '<br>' . $value_field);
00259       $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>');
00260       break;
00261     default:
00262       if (isset($cInfo) && is_object($cInfo)) {
00263         $heading[] = array('text' => '<b>' . $cInfo->configuration_title . '</b>');
00264 
00265         if (ADMIN_CONFIGURATION_KEY_ON == 1) {
00266           $contents[] = array('text' => '<strong>Key: ' . $cInfo->configuration_key . '</strong><br />');
00267         }
00268         $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>');
00269         $contents[] = array('text' => '<br>' . $cInfo->configuration_description);
00270         $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . zen_date_short($cInfo->date_added));
00271         if (zen_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($cInfo->last_modified));
00272       }
00273       break;
00274   }
00275 
00276   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
00277     echo '            <td width="25%" valign="top">' . "\n";
00278 
00279     $box = new box;
00280     echo $box->infoBox($heading, $contents);
00281 
00282     echo '            </td>' . "\n";
00283   }
00284 ?>
00285           </tr>
00286         </table></td>
00287       </tr>
00288     </table></td>
00289 <!-- body_text_eof //-->
00290   </tr>
00291 </table>
00292 <?php
00293 } else {
00294 ?>
00295 <table border="0" width="100%" cellspacing="2" cellpadding="2">
00296   <tr>
00297 <!-- body_text //-->
00298     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00299       <tr>
00300         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
00301           <tr>
00302             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
00303             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
00304           </tr>
00305         </table></td>
00306       </tr>
00307       <tr>
00308         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00309           <tr>
00310             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00311               <tr class="dataTableHeadingRow">
00312                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCT_TYPES; ?></td>
00313                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_PRODUCT_TYPES_ALLOW_ADD_TO_CART; ?></td>
00314                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
00315               </tr>
00316 <?php
00317   $product_types_query_raw = "select * from " . TABLE_PRODUCT_TYPES;
00318   $product_types_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $product_types_query_raw, $product_types_query_numrows);
00319   $product_types = $db->Execute($product_types_query_raw);
00320   while (!$product_types->EOF) {
00321     if ((!isset($_GET['ptID']) || (isset($_GET['ptID']) && ($_GET['ptID'] == $product_types->fields['type_id']))) && !isset($ptInfo) && (substr($action, 0, 3) != 'new')) {
00322       $product_type_products = $db->Execute("select count(*) as products_count
00323                                              from " . TABLE_PRODUCTS . "
00324                                              where products_type = '" . (int)$product_types->fields['type_id'] . "'");
00325 
00326       $ptInfo_array = array_merge($product_types->fields, $product_type_products->fields);
00327 
00328       $ptInfo = new objectInfo($ptInfo_array);
00329     }
00330 
00331     if (isset($ptInfo) && is_object($ptInfo) && ($product_types->fields['type_id'] == $ptInfo->type_id)) {
00332       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";
00333     } else {
00334       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";
00335     }
00336 ?>
00337                 <td class="dataTableContent"><?php echo $product_types->fields['type_name']; ?></td>
00338                 <td class="dataTableContent" align="center"><?php echo $product_types->fields['allow_add_to_cart']; ?></td>
00339                 <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>
00340               </tr>
00341 <?php
00342     $product_types->MoveNext();
00343   }
00344 ?>
00345               <tr>
00346                 <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00347                   <tr>
00348                     <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>
00349                     <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>
00350                   </tr>
00351                 </table></td>
00352               </tr>
00353             </table></td>
00354 <?php
00355   $heading = array();
00356   $contents = array();
00357 
00358   switch ($action) {
00359     case 'new':
00360       $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_PRODUCT_TYPE . '</b>');
00361 
00362       $contents = array('form' => zen_draw_form('new_product_type', FILENAME_PRODUCT_TYPES, 'action=insert', 'post', 'enctype="multipart/form-data"'));
00363       $contents[] = array('text' => TEXT_NEW_INTRO);
00364       break;
00365     case 'edit':
00366       $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_PRODUCT_TYPE . ' :: ' . $ptInfo->type_name . '</b>');
00367 
00368       $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"'));
00369       $contents[] = array('text' => TEXT_EDIT_INTRO);
00370       $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')));
00371       $contents[] = array('text' => '<br />' . TEXT_PRODUCT_TYPES_IMAGE . '<br>' . zen_draw_file_field('default_image') . '<br />' . $ptInfo->default_image);
00372       $dir = @dir(DIR_FS_CATALOG_IMAGES);
00373       $dir_info[] = array('id' => '', 'text' => "Main Directory");
00374       while ($file = $dir->read()) {
00375         if (is_dir(DIR_FS_CATALOG_IMAGES . $file) && strtoupper($file) != 'CVS' && $file != "." && $file != "..") {
00376           $dir_info[] = array('id' => $file . '/', 'text' => $file);
00377         }
00378       }
00379       $dir->close();
00380       $default_directory = substr( $ptInfo->default_image, 0,strpos( $ptInfo->default_image, '/')+1);
00381       $contents[] = array('text' => '<BR />' . TEXT_PRODUCTS_IMAGE_DIR . zen_draw_pull_down_menu('img_dir', $dir_info, $default_directory));
00382       $contents[] = array('text' => '<br />' . zen_info_image($ptInfo->default_image, $ptInfo->type_name));
00383       $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')));
00384        $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)));
00385        $sql = "select type_id, type_name from " . TABLE_PRODUCT_TYPES;
00386        $product_type_list = $db->Execute($sql);
00387        while (!$product_type_list->EOF) {
00388          $product_type_array[] = array('text' => $product_type_list->fields['type_name'], 'id' => $product_type_list->fields['type_id']);
00389          $product_type_list->MoveNext();
00390        }
00391       $contents[] = array('text' => '<br />' . TEXT_MASTER_TYPE . zen_draw_pull_down_menu('master_type', $product_type_array, $ptInfo->type_master_type));
00392 
00393       $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>');
00394       break;
00395     case 'delete':
00396       $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_PRODUCT_TYPE . '</b>');
00397 
00398       $contents = array('form' => zen_draw_form('manufacturers', FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('ptID', $ptInfo->type_id));
00399       $contents[] = array('text' => TEXT_DELETE_INTRO);
00400       $contents[] = array('text' => '<br><b>' . $ptInfo->type_name . '</b>');
00401       $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_image', '', true) . ' ' . TEXT_DELETE_IMAGE);
00402 
00403       if ($ptInfo->products_count > 0) {
00404         $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_products') . ' ' . TEXT_DELETE_PRODUCTS);
00405         $contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $ptInfo->products_count));
00406       }
00407 
00408       $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>');
00409       break;
00410     default:
00411       if (isset($ptInfo) && is_object($ptInfo)) {
00412         $heading[] = array('text' => '<b>' . $ptInfo->type_name . '</b>');
00413 // remove delete for now to avoid issues
00414 //        $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>' );
00415         $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>' );
00416         $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . zen_date_short($ptInfo->date_added));
00417         if (zen_not_null($ptInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($ptInfo->last_modified));
00418         $contents[] = array('text' => '<br>' . zen_info_image($ptInfo->manufacturers_image, $ptInfo->manufacturers_name));
00419         $contents[] = array('text' => '<br>' . TEXT_PRODUCTS . ' ' . $ptInfo->products_count);
00420       }
00421       break;
00422   }
00423 
00424   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
00425     echo '            <td width="25%" valign="top">' . "\n";
00426 
00427     $box = new box;
00428     echo $box->infoBox($heading, $contents);
00429 
00430     echo '            </td>' . "\n";
00431   }
00432 ?>
00433           </tr>
00434         </table></td>
00435       </tr>
00436     </table></td>
00437 <!-- body_text_eof //-->
00438   </tr>
00439 </table>
00440 <?php
00441 }
00442 ?>
00443 <!-- body_eof //-->
00444 
00445 <!-- footer //-->
00446 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
00447 <!-- footer_eof //-->
00448 <br>
00449 </body>
00450 </html>
00451 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
 All Data Structures Namespaces Files Functions Variables Enumerations