[RESOLU] header_tag non multiligues

Archive

Messagepar johnhummer » Ven 15 Jan 2010, 07:06

Bonjour,

Les header_tag des Categories/Produits ne sont pas multilingues. Pour ceux qui le désirent, voici un correctif (attention: les header_tags se trouveront déplacés de la table categories à la table categories_description):

-----------------------------------------------------------------------

1. Exécuter les commandes SQL suivantes (via phpMyAdmin ou en ligne de commande):

Code: Tout sélectionner
ALTER TABLE osc_categories DROP category_head_title_tag;
ALTER TABLE osc_categories DROP category_head_desc_tag;
ALTER TABLE osc_categories DROP category_head_keywords_tag;

ALTER TABLE osc_categories_description ADD category_head_title_tag varchar(80) AFTER categories_description;
ALTER TABLE osc_categories_description ADD category_head_desc_tag longtext AFTER categories_description;
ALTER TABLE osc_categories_description ADD category_head_keywords_tag longtext AFTER categories_description;

-----------------------------------------------------------------------

2. Fichier admin/categories.php

Ligne 51, remplacer

Code: Tout sélectionner
 $sql_data_array = array('sort_order' => $sort_order);

        //begin Header Tags Controller
        $htc_title = tep_db_prepare_input($HTTP_POST_VARS['htc_title']);
        $htc_title_data = array('category_head_title_tag' => $htc_title);
        $htc_desc = tep_db_prepare_input($HTTP_POST_VARS['htc_desc']);
        $htc_desc_data = array('category_head_desc_tag' => $htc_desc);
        $htc_keywords = tep_db_prepare_input($HTTP_POST_VARS['htc_keywords']);
        $htc_keywords_data = array('category_head_keywords_tag' => $htc_keywords);
        //end Header Tags Controller

        if ($action == 'insert_category') {

Par:

Code: Tout sélectionner
 $sql_data_array = array('sort_order' => $sort_order);

        if ($action == 'insert_category') {

Ligne 66, remplacer

Code: Tout sélectionner
          $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

          //begin Header Tags Controller
          $sql_data_array = array_merge($sql_data_array, $htc_title_data);
          $sql_data_array = array_merge($sql_data_array, $htc_desc_data);
          $sql_data_array = array_merge($sql_data_array, $htc_keywords_data);
         //end Header Tags Controller

          tep_db_perform(TABLE_CATEGORIES, $sql_data_array);

Par:

Code: Tout sélectionner
          $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

          tep_db_perform(TABLE_CATEGORIES, $sql_data_array);

Ligne 91, remplacer

Code: Tout sélectionner
$sql_data_array = array('categories_name' => tep_db_prepare_input($categories_name_array[$language_id]));

          if ($action == 'insert_category') {

Par:

Code: Tout sélectionner
$sql_data_array = array('categories_name' => tep_db_prepare_input($categories_name_array[$language_id]));
     
      //begin Header Tags Controller
          $htc_title_array = $HTTP_POST_VARS['htc_title'];     
      $htc_desc = $HTTP_POST_VARS['htc_desc'];
      $htc_keywords_array = $HTTP_POST_VARS['htc_keywords'];
   
      $sql_data_array['category_head_title_tag'] =  tep_db_prepare_input($htc_title_array[$language_id]);     
      $sql_data_array['category_head_desc_tag'] =  tep_db_prepare_input($htc_desc[$language_id]);
     $sql_data_array['category_head_keywords_tag'] =  tep_db_prepare_input($htc_keywords_array[$language_id]);
          //end Header Tags Controller
 
          if ($action == 'insert_category') {

Ligne 105, remplacer

Code: Tout sélectionner
        if ( !empty($_FILES['categories_image']['tmp_name']) ) {
          $categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES);
          tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");
        }

        //begin Header Tags Controller
        tep_db_query("update " . TABLE_CATEGORIES . " set category_head_title_tag = '" . $htc_title . "' where categories_id = '" . (int)$categories_id . "'");
        tep_db_query("update " . TABLE_CATEGORIES . " set category_head_desc_tag = '" . $htc_desc . "' where categories_id = '" . (int)$categories_id . "'");
        tep_db_query("update " . TABLE_CATEGORIES . " set category_head_keywords_tag = '" . $htc_keywords . "' where categories_id = '" . (int)$categories_id . "'");
        //end Header Tags Controller

        osCSS_Cache::clear('categoriesBox');

Par:

Code: Tout sélectionner
        if ( !empty($_FILES['categories_image']['tmp_name']) )
          $categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES);
          tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");
        }

        osCSS_Cache::clear('categoriesBox');

Ligne 987, remplacer

Code: Tout sélectionner
      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.category_head_title_tag, c.category_head_desc_tag, c.category_head_keywords_tag from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
    } else {
      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.category_head_title_tag, c.category_head_desc_tag, c.category_head_keywords_tag from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");

Par:

Code: Tout sélectionner
      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, cd.category_head_title_tag, cd.category_head_desc_tag, cd.category_head_keywords_tag from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
    } else {
      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, cd.category_head_title_tag, cd.category_head_desc_tag, cd.category_head_keywords_tag from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");

Ligne 1104, remplacer

Code: Tout sélectionner
        $contents[] = array('text' => '<br>' . TEXT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', '', 'size="2"'));
        $contents[] = array('text' => '<br>' . 'Header Tags Category Title' . '<br>' . tep_draw_input_field('htc_title', '', 'size="30"'));
        $contents[] = array('text' => '<br>' . 'Header Tags Category Description' . '<br>' . tep_draw_input_field('htc_desc', '', 'size="30"'));
        $contents[] = array('text' => '<br>' . 'Header Tags Category Keywords' . '<br>' . tep_draw_input_field('htc_keywords', '', 'size="30"'));
        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
        break;

Par:

Code: Tout sélectionner
        $contents[] = array('text' => '<br>' . TEXT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', '', 'size="2"'));
     
      for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
          $category_imput_string_header_tag_title .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('htc_title[' . $languages[$i]['id'] . ']', '', 'size="30"');
          $category_imput_string_header_tag_desc  .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('htc_desc[' . $languages[$i]['id'] . ']', '', 'size="30"');
          $category_imput_string_header_tag_key   .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('htc_keywords[' . $languages[$i]['id'] . ']', '', 'size="30"');
   }
   
    $contents[] = array('text' => '<br>' . "Header Tags Category Title" . $category_imput_string_header_tag_title);
   $contents[] = array('text' => '<br>' . "Header Tags Category Description" . $category_imput_string_header_tag_desc);
    $contents[] = array('text' => '<br>' . "Header Tags Category Keywords" . $category_imput_string_header_tag_key);
    $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
        break;

Ligne 1125, remplacer

Code: Tout sélectionner
        $contents[] = array('text' => '<br>' . TEXT_EDIT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', $cInfo->sort_order, 'size="2"'));
        $contents[] = array('text' => '<br>' . 'Header Tags Category Title' . '<br>' . tep_draw_input_field('htc_title', $cInfo->category_head_title_tag, 'size="30"'));
        $contents[] = array('text' => '<br>' . 'Header Tags Category Description' . '<br>' . tep_draw_input_field('htc_desc', $cInfo->category_head_desc_tag, 'size="30"'));
        $contents[] = array('text' => '<br>' . 'Header Tags Category Keywords' . '<br>' . tep_draw_input_field('htc_keywords', $cInfo->category_head_keywords_tag, 'size="30"'));
        $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
        break;

Par:

Code: Tout sélectionner
        $contents[] = array('text' => '<br>' . TEXT_EDIT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', $cInfo->sort_order, 'size="2"'));
         
      for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
          $category_imput_string_header_tag_title .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('htc_title[' . $languages[$i]['id'] . ']', tep_get_category_head_title_tag($cInfo->categories_id, $languages[$i]['id']), 'size="30"');
          $category_imput_string_header_tag_desc  .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('htc_desc[' . $languages[$i]['id'] . ']', tep_get_category_head_desc_tag($cInfo->categories_id, $languages[$i]['id']), 'size="30"');
          $category_imput_string_header_tag_key  .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('htc_keywords[' . $languages[$i]['id'] . ']', tep_get_category_head_keywords_tag($cInfo->categories_id, $languages[$i]['id']), 'size="30"');
    }
   
    $contents[] = array('text' => '<br>' . 'Header Tags Category Title' . $category_imput_string_header_tag_title);
   $contents[] = array('text' => '<br>' . 'Header Tags Category Description' . $category_imput_string_header_tag_desc);
    $contents[] = array('text' => '<br>' . 'Header Tags Category Keywords' . $category_imput_string_header_tag_key);
    $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
       break;

-----------------------------------------------------------------------

3. Fichier admin/includes/functions/general.php,

Ligne 1397, ajouter les fonctions

Code: Tout sélectionner
function tep_get_category_head_title_tag($categories_id, $language_id) {
    $category_query = tep_db_query("select category_head_title_tag from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$language_id . "'");
    $category = tep_db_fetch_array($category_query);

    return $category['category_head_title_tag'];
  }

function tep_get_category_head_desc_tag($categories_id, $language_id) {
    $category_query = tep_db_query("select category_head_desc_tag from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$language_id . "'");
    $category = tep_db_fetch_array($category_query);

    return $category['category_head_desc_tag'];
  }

function tep_get_category_head_keywords_tag($categories_id, $language_id) {
    $category_query = tep_db_query("select category_head_keywords_tag from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$language_id . "'");
    $category = tep_db_fetch_array($category_query);

    return $category['category_head_keywords_tag'];
  }

-----------------------------------------------------------------------

4. Fichier includes/header_tags.php,

Ligne 42, remplacer

Code: Tout sélectionner
  $the_categorie_info_query = tep_db_query("select category_head_title_tag, category_head_keywords_tag, category_head_desc_tag from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

par:

Code: Tout sélectionner
  $the_categorie_info_query = tep_db_query("select category_head_title_tag, category_head_keywords_tag, category_head_desc_tag from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "'and language_id = '" . (int)$languages_id . "'");
johnhummer
Membre actif
 
Messages: 34
Inscription: Mer 30 Déc 2009, 11:56

Messagepar cynic- » Ven 15 Jan 2010, 13:41

Alors là !

Image
cynic-
Site Admin
 
Messages: 694
Inscription: Mar 04 Déc 2007, 13:04

Messagepar j4k » Ven 15 Jan 2010, 13:57

Oh Oh ! super contrib ! il va falloir inclure ça dans le noyau ! j'ajoute à la roadmap : http://dev.oscss.org/index.php?do=details&task_id=221

ça va relancer le débat, header_tag / categorie description ou osCMS ! ;)
~ osCSS 1.2.1 ~
Avatar de l’utilisateur
j4k
Site Admin
 
Messages: 1259
Inscription: Mer 27 Avr 2005, 09:13
Localisation: France

Messagepar oscim » Ven 15 Jan 2010, 17:13

Pour relancer ce debat, justement,

JE me demande si il ne serait pas plus judicuex de placer une db hedare_tag, a part, en incluant un type product/categorie

L'interet d'une telle approche serait juste de pourvoir intégrer d'autre page, comme les cms.

D'autre part avez vous vu cette contrib http://addons.oscommerce.com/info/5851

Qui semble être un peu plus abouti, dansla gestion des tags...
Pour un web au normes du W3C, pour un web plus propre !

- Download osCSS Toutes versions
- stable osCSS 2.1.0 (help|info|new dev) Official help|wiki|Tuto for osCSS 2 | doc doxygen
- Utiliser le tracker pour suivre les évolutions et développements
- Inscrivez vos sites sur oscss pour présenter vos réalisations
Avatar de l’utilisateur
oscim
Site Admin
 
Messages: 1643
Inscription: Mar 25 Sep 2007, 11:33


Retourner vers osCSS 1.2.1

 


  • Articles en relation
    Réponses
    Vus
    Dernier message

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 2 invités

cron