ZenCart_Documentation  1.5.0
http://www.collinsharper.com
C:/xampp/htdocs/zen-cart/admin/includes/modules/category_product_listing.php
Go to the documentation of this file.
00001 <?php
00009 if (!defined('IS_ADMIN_FLAG')) {
00010   die('Illegal Access');
00011 }
00012 
00013 if (isset($_GET['set_display_categories_dropdown'])) {
00014   $_SESSION['display_categories_dropdown'] = $_GET['set_display_categories_dropdown'];
00015 }
00016 if (!isset($_SESSION['display_categories_dropdown'])) {
00017   $_SESSION['display_categories_dropdown'] = 0;
00018 }
00019 ?>
00020     <table border="0" width="100%" cellspacing="0" cellpadding="2">
00021       <tr>
00022         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00023           <tr>
00024             <td class="pageHeading"><?php echo HEADING_TITLE; ?>&nbsp;-&nbsp;<?php echo zen_output_generated_category_path($current_category_id); ?></td>
00025             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
00026             <td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0">
00027               <tr>
00028                 <td class="smallText" align="right">
00029 <?php
00030     echo zen_draw_form('search', FILENAME_CATEGORIES, '', 'get');
00031 // show reset search
00032     if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
00033       echo '<a href="' . zen_href_link(FILENAME_CATEGORIES) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>&nbsp;&nbsp;';
00034     }
00035     echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id();
00036     if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
00037       $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
00038       echo '<br />' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
00039     }
00040     echo '</form>';
00041 ?>
00042                 </td>
00043               </tr>
00044               <tr>
00045                 <td class="smallText" align="right">
00046 <?php
00047   if ($_SESSION['display_categories_dropdown'] == 0) {
00048     echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'set_display_categories_dropdown=1&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_ICONS . 'cross.gif', IMAGE_ICON_STATUS_OFF) . '</a>&nbsp;&nbsp;';
00049     echo zen_draw_form('goto', FILENAME_CATEGORIES, '', 'get');
00050     echo zen_hide_session_id();
00051     echo HEADING_TITLE_GOTO . ' ' . zen_draw_pull_down_menu('cPath', zen_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"');
00052     echo '</form>';
00053   } else {
00054     echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'set_display_categories_dropdown=0&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_ICONS . 'tick.gif', IMAGE_ICON_STATUS_ON) . '</a>&nbsp;&nbsp;';
00055     echo HEADING_TITLE_GOTO;
00056   }
00057 ?>
00058                 </td>
00059               </tr>
00060             </table></td>
00061           </tr>
00062         </table></td>
00063       </tr>
00064       <tr>
00065         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00066           <tr>
00067             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00068               <tr class="dataTableHeadingRow">
00069 <?php if ($action == '') { ?>
00070                 <td class="dataTableHeadingContent" width="20" align="right"><?php echo TABLE_HEADING_ID; ?></td>
00071                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CATEGORIES_PRODUCTS; ?></td>
00072                 <td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_MODEL; ?></td>
00073                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE; ?></td>
00074                 <td class="dataTableHeadingContent" align="right">&nbsp;</td>
00075                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_QUANTITY; ?>&nbsp;&nbsp;&nbsp;</td>
00076                 <td class="dataTableHeadingContent" width="50" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
00077                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_CATEGORIES_SORT_ORDER; ?></td>
00078                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
00079 <?php } // action == '' ?>
00080               </tr>
00081 <?php
00082     switch ($_SESSION['categories_products_sort_order']) {
00083       case (0):
00084         $order_by = " order by c.sort_order, cd.categories_name";
00085         break;
00086       case (1):
00087         $order_by = " order by cd.categories_name";
00088       case (2);
00089       case (3);
00090       case (4);
00091       case (5);
00092       case (6);
00093       }
00094 
00095     $categories_count = 0;
00096     $rows = 0;
00097     if (isset($_GET['search'])) {
00098       $search = zen_db_prepare_input($_GET['search']);
00099 
00100       $categories = $db->Execute("select c.categories_id, cd.categories_name, cd.categories_description, c.categories_image,
00101                                          c.parent_id, c.sort_order, c.date_added, c.last_modified,
00102                                          c.categories_status
00103                                   from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
00104                                   where c.categories_id = cd.categories_id
00105                                   and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'
00106                                   and cd.categories_name like '%" . zen_db_input($search) . "%'" .
00107                                   $order_by);
00108     } else {
00109       $categories = $db->Execute("select c.categories_id, cd.categories_name, cd.categories_description, c.categories_image,
00110                                          c.parent_id, c.sort_order, c.date_added, c.last_modified,
00111                                          c.categories_status
00112                                   from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
00113                                   where c.parent_id = '" . (int)$current_category_id . "'
00114                                   and c.categories_id = cd.categories_id
00115                                   and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
00116                                   $order_by);
00117     }
00118     while (!$categories->EOF) {
00119       $categories_count++;
00120       $rows++;
00121 
00122 // Get parent_id for subcategories if search
00123       if (isset($_GET['search'])) $cPath = $categories->fields['parent_id'];
00124 
00125       if ((!isset($_GET['cID']) && !isset($_GET['pID']) || (isset($_GET['cID']) && ($_GET['cID'] == $categories->fields['categories_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
00126         //$category_childs = array('childs_count' => zen_childs_in_category_count($categories->fields['categories_id']));
00127         //$category_products = array('products_count' => zen_products_in_category_count($categories->fields['categories_id']));
00128 
00129         //$cInfo_array = array_merge($categories->fields, $category_childs, $category_products);
00130         $cInfo = new objectInfo($categories->fields);
00131       }
00132 
00133       if (isset($cInfo) && is_object($cInfo) && ($categories->fields['categories_id'] == $cInfo->categories_id) ) {
00134         echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\''  . zen_href_link(FILENAME_CATEGORIES, zen_get_path($categories->fields['categories_id'])) . '\'">' . "\n";
00135       } else {
00136         echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_CATEGORIES, zen_get_path($categories->fields['categories_id'])) . '\'">' . "\n";
00137       }
00138 ?>
00139 <?php if ($action == '') { ?>
00140                 <td class="dataTableContent" width="20" align="right"><?php echo $categories->fields['categories_id']; ?></td>
00141                 <td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, zen_get_path($categories->fields['categories_id'])) . '">' . zen_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '</a>&nbsp;<b>' . $categories->fields['categories_name'] . '</b>'; ?></td>
00142                 <td class="dataTableContent" align="center">&nbsp;</td>
00143                 <td class="dataTableContent" align="right">&nbsp;<?php echo zen_get_products_sale_discount('', $categories->fields['categories_id'], true); ?></td>
00144                 <td class="dataTableContent" align="center">&nbsp;</td>
00145                 <td class="dataTableContent" align="right" valign="bottom">
00146                   <?php
00147                   if (SHOW_COUNTS_ADMIN == 'false') {
00148                     // don't show counts
00149                   } else {
00150                     // show counts
00151                     $total_products = zen_get_products_to_categories($categories->fields['categories_id'], true);
00152                     $total_products_on = zen_get_products_to_categories($categories->fields['categories_id'], false);
00153                     echo $total_products_on . TEXT_PRODUCTS_STATUS_ON_OF . $total_products . TEXT_PRODUCTS_STATUS_ACTIVE;
00154                   }
00155                   ?>
00156                   &nbsp;&nbsp;
00157                 </td>
00158                 <td class="dataTableContent" width="50" align="left">
00159 <?php
00160       if ($categories->fields['categories_status'] == '1') {
00161         echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=setflag_categories&flag=0&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . '</a>';
00162       } else {
00163         echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=setflag_categories&flag=1&cID=' . $categories->fields['categories_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '</a>';
00164       }
00165       if (zen_get_products_to_categories($categories->fields['categories_id'], true, 'products_active') == 'true') {
00166         echo '&nbsp;&nbsp;' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED);
00167       }
00168 ?>
00169                 </td>
00170                 <td class="dataTableContent" align="right"><?php echo $categories->fields['sort_order']; ?></td>
00171                 <td class="dataTableContent" align="right">
00172                   <?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=edit_category' . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?>
00173                   <?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=delete_category') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?>
00174                   <?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=move_category') . '">' . zen_image(DIR_WS_IMAGES . 'icon_move.gif', ICON_MOVE) . '</a>'; ?>
00175 <?php
00176 // bof: categories meta tags
00177         if (zen_get_category_metatags_keywords($categories->fields['categories_id'], (int)$_SESSION['languages_id']) or zen_get_category_metatags_description($categories->fields['categories_id'], (int)$_SESSION['languages_id'])) {
00178           echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=edit_category_meta_tags') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_on.gif', ICON_METATAGS_ON) . '</a>';
00179         } else {
00180           echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories->fields['categories_id'] . '&action=edit_category_meta_tags') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_off.gif', ICON_METATAGS_OFF) . '</a>';
00181         }
00182 // eof: categories meta tags
00183 ?>
00184                 </td>
00185 <?php } // action == '' ?>
00186               </tr>
00187 <?php
00188       $categories->MoveNext();
00189     }
00190 
00191 
00192     switch ($_SESSION['categories_products_sort_order']) {
00193       case (0):
00194         $order_by = " order by p.products_sort_order, pd.products_name";
00195         break;
00196       case (1):
00197         $order_by = " order by pd.products_name";
00198         break;
00199       case (2);
00200         $order_by = " order by p.products_model";
00201         break;
00202       case (3);
00203         $order_by = " order by p.products_quantity, pd.products_name";
00204         break;
00205       case (4);
00206         $order_by = " order by p.products_quantity DESC, pd.products_name";
00207         break;
00208       case (5);
00209         $order_by = " order by p.products_price_sorter, pd.products_name";
00210         break;
00211       case (6);
00212         $order_by = " order by p.products_price_sorter DESC, pd.products_name";
00213         break;
00214       }
00215 
00216     $products_count = 0;
00217     if (isset($_GET['search']) && !empty($_GET['search']) && $action != 'edit_category') {
00218 // fix duplicates and force search to use master_categories_id
00219 /*
00220       $products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
00221                                        p.products_image, p.products_price, p.products_date_added,
00222                                        p.products_last_modified, p.products_date_available,
00223                                        p.products_status, p2c.categories_id,
00224                                        p.products_model,
00225                                        p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
00226                                        p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping,
00227                                        p.products_quantity_order_max, p.products_sort_order
00228                                 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
00229                                        . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
00230                                 where p.products_id = pd.products_id
00231                                 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
00232                                 and p.products_id = p2c.products_id
00233                                 and (
00234                                 pd.products_name like '%" . zen_db_input($_GET['search']) . "%'
00235                                 or pd.products_description like '%" . zen_db_input($_GET['search']) . "%'
00236                                 or p.products_model like '%" . zen_db_input($_GET['search']) . "%')" .
00237                                 $order_by);
00238 */
00239       $products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
00240                                        p.products_image, p.products_price, p.products_date_added,
00241                                        p.products_last_modified, p.products_date_available,
00242                                        p.products_status, p2c.categories_id,
00243                                        p.products_model,
00244                                        p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
00245                                        p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping,
00246                                        p.products_quantity_order_max, p.products_sort_order,
00247                                        p.master_categories_id
00248                                 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
00249                                        . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
00250                                 where p.products_id = pd.products_id
00251                                 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
00252                                 and (p.products_id = p2c.products_id
00253                                 and p.master_categories_id = p2c.categories_id)
00254                                 and (
00255                                 pd.products_name like '%" . zen_db_input($_GET['search']) . "%'
00256                                 or pd.products_description like '%" . zen_db_input($_GET['search']) . "%'
00257                                 or p.products_id = '" . zen_db_input($_GET['search']) . "'
00258                                 or p.products_model like '%" . zen_db_input($_GET['search']) . "%')" .
00259                                 $order_by);
00260 
00261     } else {
00262       $products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
00263                                        p.products_image, p.products_price, p.products_date_added,
00264                                        p.products_last_modified, p.products_date_available,
00265                                        p.products_status, p.products_model,
00266                                        p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
00267                                        p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping,
00268                                        p.products_quantity_order_max, p.products_sort_order
00269                                 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
00270                                 where p.products_id = pd.products_id
00271                                 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
00272                                 and p.products_id = p2c.products_id
00273                                 and p2c.categories_id = '" . (int)$current_category_id . "'" .
00274                                 $order_by);
00275     }
00276 // Split Page
00277 // reset page when page is unknown
00278 if (($_GET['page'] == '1' or $_GET['page'] == '') and $_GET['pID'] != '') {
00279   $old_page = $_GET['page'];
00280   $check_page = $db->Execute($products_query_raw);
00281   if ($check_page->RecordCount() > MAX_DISPLAY_RESULTS_CATEGORIES) {
00282     $check_count=1;
00283     while (!$check_page->EOF) {
00284       if ($check_page->fields['products_id'] == $_GET['pID']) {
00285         break;
00286       }
00287       $check_count++;
00288       $check_page->MoveNext();
00289     }
00290     $_GET['page'] = round((($check_count/MAX_DISPLAY_RESULTS_CATEGORIES)+(fmod_round($check_count,MAX_DISPLAY_RESULTS_CATEGORIES) !=0 ? .5 : 0)),0);
00291     $page = $_GET['page'];
00292     if ($old_page != $_GET['page']) {
00293 //      zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $_GET['cPath'] . '&pID=' . $_GET['pID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')));
00294     }
00295   } else {
00296     $_GET['page'] = 1;
00297   }
00298 }
00299     $products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_RESULTS_CATEGORIES, $products_query_raw, $products_query_numrows);
00300     $products = $db->Execute($products_query_raw);
00301 // Split Page
00302 
00303     while (!$products->EOF) {
00304       $products_count++;
00305       $rows++;
00306 
00307 // Get categories_id for product if search
00308       if (isset($_GET['search'])) $cPath = $products->fields['categories_id'];
00309 
00310       if ( (!isset($_GET['pID']) && !isset($_GET['cID']) || (isset($_GET['pID']) && ($_GET['pID'] == $products->fields['products_id']))) && !isset($pInfo) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
00311 // find out the rating average from customer reviews
00312         $reviews = $db->Execute("select (avg(reviews_rating) / 5 * 100) as average_rating
00313                                  from " . TABLE_REVIEWS . "
00314                                  where products_id = '" . (int)$products->fields['products_id'] . "'");
00315         $pInfo_array = array_merge($products->fields, $reviews->fields);
00316         $pInfo = new objectInfo($pInfo_array);
00317       }
00318 
00319 // Split Page
00320       $type_handler = $zc_products->get_admin_handler($products->fields['products_type']);
00321       if (isset($pInfo) && is_object($pInfo) && ($products->fields['products_id'] == $pInfo->products_id) ) {
00322         echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link($type_handler , 'page=' . $_GET['page'] . '&product_type=' . $products->fields['products_type'] . '&cPath=' . $cPath . '&pID=' . $products->fields['products_id'] . '&action=new_product' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '\'">' . "\n";
00323       } else {
00324         echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link($type_handler , 'page=' . $_GET['page'] . '&product_type=' . $products->fields['products_type'] . '&cPath=' . $cPath . '&pID=' . $products->fields['products_id'] . '&action=new_product' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '\'">' . "\n";
00325       }
00326 // Split Page
00327 ?>
00328                 <td class="dataTableContent" width="20" align="right"><?php echo $products->fields['products_id']; ?></td>
00329                 <td class="dataTableContent"><?php echo '<a href="' . zen_href_link($type_handler, 'cPath=' . $cPath . '&pID=' . $products->fields['products_id'] . '&action=new_product_preview&read=only' . '&product_type=' . $products->fields['products_type'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . '</a>&nbsp;' . $products->fields['products_name']; ?></td>
00330                 <td class="dataTableContent"><?php echo $products->fields['products_model']; ?></td>
00331                 <td colspan="2" class="dataTableContent" align="right"><?php echo zen_get_products_display_price($products->fields['products_id']); ?></td>
00332                 <td class="dataTableContent" align="right"><?php echo $products->fields['products_quantity']; ?></td>
00333                 <td class="dataTableContent" width="50" align="left">
00334 <?php
00335       if ($products->fields['products_status'] == '1') {
00336         echo zen_draw_form('setflag_products', FILENAME_CATEGORIES, 'action=setflag&pID=' . $products->fields['products_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : ''));?>
00337         <input type="image" src="<?php echo DIR_WS_IMAGES ?>icon_green_on.gif" title="<?php echo IMAGE_ICON_STATUS_ON; ?>" />
00338         <input type="hidden" name="flag" value="0" />
00339         </form>
00340 <?php
00341       } else {
00342         echo zen_draw_form('setflag_products', FILENAME_CATEGORIES, 'action=setflag&pID=' . $products->fields['products_id'] . '&cPath=' . $cPath . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . ((isset($_GET['search']) && !empty($_GET['search'])) ? '&search=' . $_GET['search'] : ''));?>
00343         <input type="image" src="<?php echo DIR_WS_IMAGES ?>icon_red_on.gif" title="<?php echo IMAGE_ICON_STATUS_OFF; ?>"/>
00344         <input type="hidden" name="flag" value="1" />
00345         </form>
00346 <?php
00347       }
00348       if (zen_get_product_is_linked($products->fields['products_id']) == 'true') {
00349         echo '&nbsp;&nbsp;' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '<br>';
00350       }
00351 ?>
00352                 </td>
00353 <?php if ($action == '') { ?>
00354                 <td class="dataTableContent" align="right"><?php echo $products->fields['products_sort_order']; ?></td>
00355                 <td class="dataTableContent" align="right">
00356         <?php echo '<a href="' . zen_href_link($type_handler, 'cPath=' . $cPath . '&product_type=' . $products->fields['products_type'] . '&pID=' . $products->fields['products_id']  . '&action=new_product' . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?>
00357         <?php echo '<a href="' . zen_href_link($type_handler, 'cPath=' . $cPath . '&product_type=' . $products->fields['products_type'] . '&pID=' . $products->fields['products_id'] . '&action=delete_product') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?>
00358         <?php echo '<a href="' . zen_href_link($type_handler, 'cPath=' . $cPath . '&product_type=' . $products->fields['products_type'] . '&pID=' . $products->fields['products_id'] . '&action=move_product') . '">' . zen_image(DIR_WS_IMAGES . 'icon_move.gif', ICON_MOVE) . '</a>'; ?>
00359         <?php echo '<a href="' . zen_href_link($type_handler, 'cPath=' . $cPath . '&product_type=' . $products->fields['products_type'] . '&pID=' . $products->fields['products_id'] .'&action=copy_to' ) . '">' . zen_image(DIR_WS_IMAGES . 'icon_copy_to.gif', ICON_COPY_TO) . '</a>'; ?>
00360 <?php
00361 // BOF: Attribute commands
00362 //if (!empty($products->fields['products_id']) && zen_has_product_attributes($products->fields['products_id'], 'false')) {
00363 ?>
00364 <?php
00365         if (zen_has_product_attributes($products->fields['products_id'], 'false')) {
00366           echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products->fields['products_id'] .'&action=attribute_features' . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . ((!empty($products->fields['products_id']) && zen_has_product_attributes($products->fields['products_id'], 'false')) ? zen_image(DIR_WS_IMAGES . 'icon_attributes_on.gif', ICON_ATTRIBUTES) : zen_image(DIR_WS_IMAGES . 'icon_attributes.gif', ICON_ATTRIBUTES)) . '</a>';
00367         } else {
00368           echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products->fields['products_id'] . '&current_category_id=' . $current_category_id) . '">' . zen_image(DIR_WS_IMAGES . 'icon_attributes.gif', ICON_ATTRIBUTES) . '</a>';
00369         }
00370 ?>
00371 <?php
00372 //} // EOF: Attribute commands
00373 ?>
00374 <?php
00375         if ($zc_products->get_allow_add_to_cart($products->fields['products_id']) == "Y") {
00376           echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products->fields['products_id'] . '&current_category_id=' . $current_category_id) . '">' . zen_image(DIR_WS_IMAGES . 'icon_products_price_manager.gif', ICON_PRODUCTS_PRICE_MANAGER) . '</a>';
00377         }
00378 // meta tags
00379         if (zen_get_metatags_keywords($products->fields['products_id'], (int)$_SESSION['languages_id']) or zen_get_metatags_description($products->fields['products_id'], (int)$_SESSION['languages_id'])) {
00380           echo ' <a href="' . zen_href_link($type_handler, 'page=' . $_GET['page'] . '&product_type=' . $products->fields['products_type'] . '&cPath=' . $cPath . '&pID=' . $products->fields['products_id']  . '&action=new_product_meta_tags') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_on.gif', ICON_METATAGS_ON) . '</a>';
00381         } else {
00382           echo ' <a href="' . zen_href_link($type_handler, 'page=' . $_GET['page'] . '&product_type=' . $products->fields['products_type'] . '&cPath=' . $cPath . '&pID=' . $products->fields['products_id']  . '&action=new_product_meta_tags') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit_metatags_off.gif', ICON_METATAGS_OFF) . '</a>';
00383         }
00384 ?>
00385 <?php } // action == '' ?>
00386 
00387                 </td>
00388               </tr>
00389 <?php
00390       $products->MoveNext();
00391     }
00392 
00393     $cPath_back = '';
00394     if (sizeof($cPath_array) > 0) {
00395       for ($i=0, $n=sizeof($cPath_array)-1; $i<$n; $i++) {
00396         if (empty($cPath_back)) {
00397           $cPath_back .= $cPath_array[$i];
00398         } else {
00399           $cPath_back .= '_' . $cPath_array[$i];
00400         }
00401       }
00402     }
00403 
00404     $cPath_back = (zen_not_null($cPath_back)) ? 'cPath=' . $cPath_back . '&' : '';
00405 ?>
00406 <?php if ($action == '') { ?>
00407               <tr>
00408                 <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00409                   <tr>
00410                     <td class="smallText"><?php echo TEXT_CATEGORIES . '&nbsp;' . $categories_count . '<br />' . TEXT_PRODUCTS . '&nbsp;' . $products_count; ?></td>
00411                     <td align="right" class="smallText"><?php if (sizeof($cPath_array) > 0) echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, $cPath_back . 'cID=' . $current_category_id) . '">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>&nbsp;'; if (!isset($_GET['search'])) echo (!$zc_skip_categories ? '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_category') . '">' . zen_image_button('button_new_category.gif', IMAGE_NEW_CATEGORY) . '</a>&nbsp;' : ''); ?>
00412 
00413 <?php if ($zc_skip_products == false) { ?>
00414 <form name="newproduct" action="<?php echo zen_href_link(FILENAME_CATEGORIES, '', 'NONSSL'); ?>" method = "get"><?php echo (empty($_GET['search']) ? zen_image_submit('button_new_product.gif', IMAGE_NEW_PRODUCT) : ''); ?>
00415 <?php
00416   $sql = "select ptc.product_type_id, pt.type_name from " . TABLE_PRODUCT_TYPES_TO_CATEGORY . " ptc, " . TABLE_PRODUCT_TYPES . " pt
00417           where ptc.category_id = '" . (int)$current_category_id . "'
00418           and pt.type_id = ptc.product_type_id";
00419   $restrict_types = $db->Execute($sql);
00420   if ($restrict_types->RecordCount() >0 ) {
00421     $product_restrict_types_array = array();
00422     while (!$restrict_types->EOF) {
00423       $product_restrict_types_array[] = array('id' => $restrict_types->fields['product_type_id'],
00424                                          'text' => $restrict_types->fields['type_name']);
00425       $restrict_types->MoveNext();
00426     }
00427    } else {
00428     $product_restrict_types_array = $product_types_array;
00429   }
00430 ?>
00431 <?php echo '&nbsp;&nbsp;' . zen_draw_pull_down_menu('product_type', $product_restrict_types_array);
00432 echo zen_hide_session_id(); ?>
00433            <input type="hidden" name="cPath" value="<?php echo $cPath; ?>">
00434            <input type="hidden" name="action" value="new_product">
00435           </form>
00436 <?php
00437   } else {
00438     echo CATEGORY_HAS_SUBCATEGORIES;
00439 ?>
00440 <?php } // hide has cats?>
00441           &nbsp;</td>
00442                   </tr>
00443                 </table></td>
00444               </tr>
00445 <?php } // turn off when editing ?>
00446             </table></td>
 All Data Structures Namespaces Files Functions Variables Enumerations