http://www.barreto.net/ Based on: all_categories.php Ver. 1.6 by Christian Lescuyer History: 1.0 Creation 1.0a Correction: Extra Carriage Returns 1.1 added parameters to change display options -- mdt Copyright (c) 2020 Saphyra Interactive Released under the GNU General Public License */ // -> [SI-LINDER-PARTNER-2][OSC] - Refonte du site Internet pour supporter le Responsive Design /* ATTENTION - le design du site ne peut pas être passé en doctype html (html 5) dans la révision 1 du design. bien qu'une révision 2 sera instanciée plus tard (l'année prochaine), il faudra se contenter de nombreux workaround en restant en HTML TRANSITIONAL 4.01 Du fait du nombre massif des éléments DE CETTE PAGE (et de ce qui en découlerait) qui seront à revoir pour transformer le design en design responsive.. .. il est alors plus judicieux de globaliser un TAG unique pour cette tâche pour ne pas alourdir de commentaires le code déjà suffisemment alourdi comme cela! En gros, ici, pour cette méga-tâche, je vais utiliser un format maison de commentaires pour cette tâche précise: --> pour en comprendre les méandres, voir le fichier /[!] - Saphyra-Interactive-TaskList-Explanations/[SI-LINDER-PARTNER-2][OSC]--semantic.php */ // <- [SI-LINDER-PARTNER-2][OSC] - Refonte du site Internet pour supporter le Responsive Design ?>[SI-LINDER-PARTNER-2][OSC][MultiTaskDescriptions]:{ - 1/ contrairement aux boxes, dans la nouvelle version du design, les pages hors-boxes, on ne va pas les revoir entièrement, car il s'agit de pages qui peuvent êtres du coeur d'un MODULE ou de OSCOMMERCE, donc, en cas de mises à jours, il vaut mieux conserver une structure habituelle, ce sera plus facile pour effectuer des transitions du code source vers une version plus récente de OSCommerce ou d'un MODULE en particulier, par contre, on va fixer les petits soucis d'accents des commentaires, ici on va revoir: quelques micros-détails, et évidemment la mise en page - 2/ déjà, on va revoir le nom de la page (pas du fichier, mais de la page affichée à l'utilisateur) - 3/ on intègre un code concernant un test d'existence des images des catégories - 4/ on revoit le code concernant l'affichage des images des catégories on y prévoit notemment un redesign à l'aide de UI Kit, et de quelques classes CSS spécialement créées à cet effet on prévoit aussi pour le lien http de le styliser en liens UI Kit - 5/ on vide éventuellement les variables PHP utilisées ici dans le but de purger la mémoire du serveur et de libérer par extension la mémoire - 6/ ATTENTION depuis janvier 2021, suite à une demande tardive du client, on va devoir rencentrer les images dans les boites (cellules) - pour ce faire, on va juste ajouter une simple directive CSS en inline: display:grid; } // ([1])-->[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::BEGIN */ ?>BEGIN[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::END $item_div_options = 'style="text-align:center;font-weight:bold;font-size:larger;margin-top:5px;margin-bottom:5px;display:grid;"'; $item_subcategories_options = ''; //------------------------------------------------------------------------------------------------------ // CODE - do not change below here //------------------------------------------------------------------------------------------------------ // error checking on parameters if($item_column_number < 1) { $item_column_number = 1; } if($item_column_number > 9) { $item_column_number = 9; } if($item_title_on_newline) { $item_separator = '
'; } else { $item_separator = ' '; } // Preorder tree traversal function preorder($cid, $level, $foo, $cpath) { global $categories_string, $HTTP_GET_VARS; // Display link if ($cid != 0) { for ($i=0; $i<$level; $i++) $categories_string .= '  '; $categories_string .= ''; // 1.6 Are we on the "path" to selected category? $bold = strstr($HTTP_GET_VARS['cPath'], $cpath . $cid . '_') || $HTTP_GET_VARS['cPath'] == $cpath . $cid; // 1.6 If yes, use if ($bold) $categories_string .= ''; $categories_string .= $foo[$cid]['name']; if ($bold) $categories_string .= ''; $categories_string .= ''; // 1.4 SHOW_COUNTS is 'true' or 'false', not true or false if (SHOW_COUNTS == 'false') { $products_in_category = tep_count_products_in_category($cid); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '
'; } // Traverse category tree if (is_array($foo)) { foreach ($foo as $key => $value) { if ($foo[$key]['parent'] == $cid) { preorder($key, $level+1, $foo, ($level != 0 ? $cpath . $cid . '_' : '')); } } } } ?> [SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::BEGIN $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => "  " . '' . 'Nos Catégories' . ''); // ([2])-->[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::END new infoBoxHeading($info_box_contents, false, false); ////////// // Get categories list ////////// // 1.2 Test for presence of status field for compatibility with older versions //$status = tep_db_num_rows(tep_db_query('describe categories status')); // changed "categories" to "TABLE_CATEGORIES" in order to work with modified tablenames $status = tep_db_num_rows(tep_db_query('describe ' . TABLE_CATEGORIES . ' status')); $query = "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and c.status_categ = '1'"; // 1.3 Can't have 'where' in an if statement! if ($status >0) $query.= " and c.status = '1'"; $query.= " and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"; $categories_query = tep_db_query($query); // Initiate tree traverse $categories_string = ''; preorder(0, 0, $foo, ''); ////////// // Display box contents ////////// $info_box_contents = array(); $row = 0; $col = 0; while ($categories = tep_db_fetch_array($categories_query)) { if ($categories['parent_id'] == 0) { $cPath_new = tep_get_path($categories['categories_id']); /*"OMITED SO IT DOESNT DISPLAY SUBCATEGORIES" $text_subcategories = ''; $subcategories_query = tep_db_query($query); while ($subcategories = tep_db_fetch_array($subcategories_query))*/ { if ($subcategories['parent_id'] == $categories['categories_id']) { $cPath_new_sub = "cPath=" . $categories['categories_id']/*"OMITED SO IT DOESNT DISPLAY SUBCATEGORIES" . "_" . $subcategories['categories_id']*/; $text_subcategories .= ' '; $text_subcategories .= $subcategories['categories_name'] . '' . " "; } // if ($subcategories['parent_id'] == $categories['categories_id']) } // while ($subcategories = tep_db_fetch_array($subcategories_query)) if ($hover == 'on') { // ([3])-->[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::BEGIN if (!file_exists(DIR_WS_IMAGES . $categories['categories_image'])) { $categories['categories_image'] = DIR_WS_DESIGN . 'SI_DesignV2/placeholder__categories.jpg'; } // ([3])-->[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::END // ([4])-->[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::BEGIN $info_box_contents[$row][$col] = array('align' => 'left', 'params' => 'class="smallText" style="border:' . $borderwidth . 'px solid ' . $regborder . '" onMouseOver="window.status=\'' . tep_href_link(FILENAME_DEFAULT, $cPath_new, 'NONSSL') . '\'; this.style.backgroundColor=\'' . $hovercolor . '\'; this.style.cursor=\'hand\'; this.style.border=\'' . $borderwidth . 'px solid ' . $hoverborder . '\';" onMouseOut="window.status=\'\'; this.style.backgroundColor=\'' . $regcolor . '\'; this.style.border=\'' . $borderwidth . 'px solid ' . $regborder . '\';" onclick="location.href=\'' . tep_href_link(FILENAME_DEFAULT, $cPath_new, 'NONSSL') . '\'" width="'.intval(100/$item_column_number).'%" valign="' . $valign . '"', 'text' => '
' . tep_image($categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT, 'class="--categoryImage"') . '' . $item_separator . '' . $categories['categories_name'] . '
' . $text_subcategories . $spacing . '
'); // ([4])-->[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::END } else { // ([3])-->[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::BEGIN if (!file_exists(DIR_WS_IMAGES . $categories['categories_image'])) { $categories['categories_image'] = DIR_WS_DESIGN . 'SI_DesignV2/placeholder__categories.jpg'; } else { $categories['categories_image'] = DIR_WS_IMAGES . $categories['categories_image']; } // ([3])-->[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::END // ([4])-->[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::BEGIN $info_box_contents[$row][$col] = array('align' => 'left', 'params' => 'class="smallText" width="'.intval(100/$item_column_number).'%" valign="' . $valign . '"', 'text' => '
' . tep_image($categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT, 'class="--categoryImage"') . '' . $item_separator . '' . $categories['categories_name'] . '
' . $text_subcategories . '
'); // ([4])-->[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::END } // determine the column position to see if we need to go to a new row $col ++; if ($col > ($item_column_number - 1)) { $col = 0; $row ++; } //if ($col > ($number_of_columns - 1)) } //if ($categories['parent_id'] == 0) } // while ($categories = tep_db_fetch_array($categories_query)) //output the contents new contentBox($info_box_contents); ?> [SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::BEGIN /* pas de variables PHP à libérer, aucunes nouvelles initialisées */ // ([5])-->[SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::END ?> [SI-LINDER-PARTNER-2][OSC][SubTaskDescription]::END ?> [SI-LINDER-PARTNER-2][OSC][MultiTaskDescriptions] ************************************************************************/ ?>