osCommerce France : Accueil Forum Portail osCommerce France Réponses aux questions Foire aux contributions

Bienvenue invité ( Connexion | Inscription )

 
Reply to this topicStart new topic
> Pas de mise en page de Prévisualisation de la description
roiphoto
posté 14 Apr 2017, 12:01
Message #1


Ceinture jaune OSC
Icône de groupe

Groupe : Membres
Messages : 73
Inscrit : 6-August 07
Lieu : 93200
Membre no 18622



Bonjour,

Pas de mise en page de Prévisualisation de la description

Oscommerce2.2RC1
Easyphp1.8 (php 4.3.10)
+ addon CAP1.4.3 (Customer Add Products)
LOCAL

Après que le client ait introduit la description et toutes les autres informations de son produit dans les diverses langues, la prévisualisation apparaît en ligne kilométrique (sans retour à la ligne et sans mise en page), c’est pareil à l’insertion du produit.

Que dois-faire ? Le forum anglophone de la contribution ne donne rien !

Merci
Go to the top of the page
 
badcape
posté 14 Apr 2017, 18:32
Message #2


Ceinture bleue OSC
Icône de groupe

Groupe : Membres
Messages : 1054
Inscrit : 28-September 07
Lieu : Saint paul - REUNION
Membre no 19202



... 'soir Roiphoto happy.gif ,
je ne connais pas cette contrib mais c'est du "Leirisset" (il est en tout cas intervenu) donc ça doit tenir la route.
Il est écrit quelque part que le champ de description accepte le html? Tu as essayé?
cool.gif


--------------------
Thierry
En prod Server: Percona Server via UNIX socket Percona Server version: 5.5.40-36.1-log - Percona Server (GPL), Release 36.1, Revision 707
phpMyAdmin 3.5.8.2 Database version: libmysql - 5.0.96 PHP extension: mysqli
version Oscommerce-2.3.4 bootstrap avec un tas comme ça de contributions ...... et bien d'autres dont je me suis inspiré à grand renfort de café !
Un grand merci à tous !(pour votre aide et votre patience....)
En local: EasyPHP DevServer 14.1 VC9 "Minakami" avec oscom 2.3.4 Bootstrap Gold + KissIT_image thumbnailer, Product fields group, Products Extra Fields, margin report, account_create_in_admin, easy populate, FAQ desk, MATC, SPPC, quick updates for SPPC, slick reCaptcha, modular front page module, Select Product Image Directory... modifiées et d'autre contrib que je teste avant de mettre en prod.
Go to the top of the page
 
Bonbec
posté 14 Apr 2017, 21:11
Message #3


Ceinture bleue OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1252
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Bonsoir,
Citation (roiphoto @ 14 Apr 2017, 12:01) *
... Après que le client ait introduit la description et toutes les autres informations de son produit dans les diverses langues, la prévisualisation apparaît en ligne kilométrique (sans retour à la ligne et sans mise en page), c’est pareil à l’insertion du produit.
Que dois-faire ? Le forum anglophone de la contribution ne donne rien !

Sans voir ce que çà donne, ce n'est pas facile à deviner.
Voilà quelques pistes :
1) comparer le fichiers en local avec les fichiers du zip d'origine pour voir ce qui a pu être modifié involontairement dans les affichages des <table><tr><td></td></tr></table>
2) la ligne kilométrique : tous les mots se touchent ou ils sont séparés par des espaces et les ponctuations ?
3) regarder le contenu de products_description dans la BDD pour voir si c'est aussi au kilomètre, auquel cas çà clocherait dès l'envoi du formulaire.
4) peut-être une syntaxe pas compatible avec la version de php


--------------------
Config 1 en live : Osc 2.2 très fortement modifié ... UTF-8 et Php 5.4.
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + trop de bidouilles persos pas très OsCommerce (erreurs de jeunesse)
Config 2 en local avec UwAmp : Osc 2.3.4 BS
Go to the top of the page
 
roiphoto
posté 16 Apr 2017, 18:11
Message #4


Ceinture jaune OSC
Icône de groupe

Groupe : Membres
Messages : 73
Inscrit : 6-August 07
Lieu : 93200
Membre no 18622



Merci Badcape et Bonbec pour les réponses.

J’ai essayé easyphp1.7 (php 4.3.3) , cela n’a pas résolu le problème

Pour répondre à Badcape, j’ai téléchargé la dernière version de Leirisset du 24/03/2008. Beaucoup de bugs sont fixés, mais il reste celui-là
Il n’est écrit nulle part html pour la description du produit (pas en ma connaissance !)

Voici en exemple, une description tirée de l’un des produits fictifs oscommerce

Avant la pévisualisation


Après la prévisualisation, voici :


Dans la BDD, la description est correcte et respecte la mise en page du client (pas de ligne kilométrique, les retours à la ligne, l’espacement entre les paragraphes, entre les mots : tout est conforme à la description avant prévisualisation).

En voici une capture d’écran


Pour toutes fins utiles, je me permets de vous envoyer une copie intégrale du fichier catalog/account_add.php de la contribution. Peut-être que vous y verrez plus clair que moi.

Code
<?php
/*
  $Id: account_add.php,v 1.4 2005/05/16 23:03:52 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');
  require(DIR_WS_FUNCTIONS.'/product_manage.php');
  require(DIR_WS_CLASSES.'/product_manage.php');
  require(DIR_WS_CLASSES . 'upload.php');

  if (!tep_session_is_registered('customer_id')) {
    $navigation->set_snapshot();
    tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  }
  $customer_query = tep_db_query("select customers_firstname,customers_lastname,customers_email_address,customers_ap from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
  $customer = tep_db_fetch_array($customer_query);

// if (!$customer['customers_ap']) {
//     echo "<script>alert(\"".TEXT_ALERT."\"); window.history.go(-1);</script>\n";
//     exit();
//       }

  require(DIR_WS_LANGUAGES . $language . '/account_add.php');

  $action = (isset($_REQUEST['action']) ? $_REQUEST['action'] : '');
  $osCsid = (isset($_REQUEST['osCsid']) ? $_REQUEST['osCsid'] : '');
   switch ($action) {
   case 'new_product_preview':
         // copy image only if modified
        //echo DIR_WS_IMAGES;
        //print_r ($customer);
        //die($products_image);
        $products_image = new upload('products_image');
        $products_image->set_destination(DIR_WS_IMAGES);
        if ($products_image->parse() && $products_image->save()) {
          $products_image_name = $products_image->filename;
        } else {
          $products_image_name = (isset($_POST['products_previous_image']) ? $_POST['products_previous_image'] : '');
        }

        if ($products_image_swf){

                            /*  echo $products_image_swf;
                              $products_image_swf = new upload('products_image_swf');
                              $products_image_swf->set_destination(DIR_WS_IMAGES);
                              if ($products_image_swf->parse() && $products_image_swf->save()) {
                                $products_image_name2 = $products_image_swf->filename;
                              } else {
                                $products_image_name2 = (isset($_POST['products_previous_image']) ? $_POST['products_previous_image'] : '');
                              }*/

        }
        //die($products_image_name);
        break;

   case 'insert_product':
   case 'update_product':
        if (isset($_POST['edit_x']) || isset($_POST['edit_y'])) {
          $action = 'new_product';
        } else {
          if (isset($_GET['pID'])) $products_id = tep_db_prepare_input($_GET['pID']);
          $products_date_available = tep_db_prepare_input($_POST['products_date_available']);

          $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

          $sql_data_array = array('products_quantity' => tep_db_prepare_input($_POST['products_quantity']),
                                  'products_model' => tep_db_prepare_input($_POST['products_model']),
                                  'products_price' => tep_db_prepare_input($_POST['products_price']),
                                  'products_date_available' => $products_date_available,
                                  'products_weight' => tep_db_prepare_input($_POST['products_weight']),
                                  'products_status' => '0',//tep_db_prepare_input($_POST['products_status']),
                                  'products_tax_class_id' => tep_db_prepare_input($_POST['products_tax_class_id']),
                                  'customer_id' => $customer_id,
                                  'manufacturers_id' => tep_db_prepare_input($_POST['manufacturers_id']));

          if (isset($_POST['products_image']) && tep_not_null($_POST['products_image']) && ($_POST['products_image'] != 'none')) {
            $sql_data_array['products_image'] = tep_db_prepare_input($_POST['products_image']);
          }

          if ($action == 'insert_product') {
            $insert_sql_data = array('products_date_added' => 'now()');

            $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

            tep_db_perform(TABLE_PRODUCTS, $sql_data_array);
            $products_id = tep_db_insert_id();

            $chosencategory = $_POST['category_id'];

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . $chosencategory . "')");
          } elseif ($action == 'update_product') {
            $update_sql_data = array('products_last_modified' => 'now()');

            $sql_data_array = array_merge($sql_data_array, $update_sql_data);

            tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
          }

          $languages = tep_get_languages();
          for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
            $language_id = $languages[$i]['id'];

            $sql_data_array = array('products_name' => tep_db_prepare_input($_POST['products_name'][$language_id]),
                                    'products_description' => tep_db_prepare_input($_POST['products_description'][$language_id]),
                                    'products_url' => tep_db_prepare_input($_POST['products_url'][$language_id]));

            if ($action == 'insert_product') {
              $insert_sql_data = array('products_id' => $products_id,
                                       'language_id' => $language_id);

              $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

              tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
            } elseif ($action == 'update_product') {
              tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
            }
          }

          if (USE_CACHE == 'true') {
            tep_reset_cache_block('categories');
            tep_reset_cache_block('also_purchased');
          }
          define(EMAIL_TEXT_SUBJECT,'Un nouveau produit a été ajouté');
          $category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$category_id . "' and language_id = '" . (int)$language_id ."'");
          $category = tep_db_fetch_array($category_query);

          $email =  "Cher administrateur\n\n";
          $email .= "Un nouveau produit a été ajouté dans la catégorie : ".$category['categories_name']."\n\n";
          $email .= "Cet ajout a été fait par : ". $customer['customers_firstname'].' '.$customer['customers_lastname'] ."\n\n";
          $email .= "Pour approuver ce nouveau produit, veuillez vous rendre dans votre panneau d\'administration \n\n";
          tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_TEXT_SUBJECT, $email,$customer['customers_firstname'].' '.$customer['customers_lastname'],$customer['customers_email_address']);
          tep_redirect(tep_href_link(FILENAME_DEFAULT, 'osCsid=' . $osCsid . '&pID=' . $products_id));
        }
        break;
   }
  $breadcrumb->add('My Account', tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
  $breadcrumb->add('Add new product', tep_href_link('account_add.php', '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript" src="includes/admin_general.js"></script>
<link id="luna-tab-style-sheet" type="text/css" rel="stylesheet" href="includes/javascript/tabs/tabpane.css" />
<script type="text/javascript" src="includes/javascript/tabs/tabpane.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<div id="spiffycalendar" class="text" style="z-index:3"></div>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td>

<?php
  if ($action != 'new_product_preview') {
    $parameters = array('products_name' => '',
                       'products_description' => '',
                       'products_url' => '',
                       'products_id' => '',
                       'products_quantity' => '',
                       'products_model' => '',
                       'products_image' => '',
                       'products_price' => '',
                       'products_weight' => '',
                       'products_date_added' => '',
                       'products_last_modified' => '',
                       'products_date_available' => '',
                       'products_status' => '',
                       'products_tax_class_id' => '',
                       'category_id' => '',
                       'manufacturers_id' => '');

    $pInfo = new objectInfo($parameters);

    if (isset($_GET['pID']) && empty($_POST)) {
      $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$_GET['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
      $product = tep_db_fetch_array($product_query);

      $pInfo->objectInfo($product);
    } elseif (tep_not_null($_POST)) {
      $pInfo->objectInfo($_POST);
      $products_name = $_POST['products_name'];
      $products_description = $_POST['products_description'];
      $products_url = $_POST['products_url'];
    }

    $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));
    $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
    while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
      $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
                                     'text' => $manufacturers['manufacturers_name']);
    }
    $languages = tep_get_languages();
    //print_r( $languages);
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
    //echo $languages[$i]['directory'];
    if ($languages[$i]['directory']==$language) $language_id=$languages[$i]['id'];
    }
    $categories_array = array(array('id' => '', 'text' => TEXT_NONE));
    $categories_query = tep_db_query("select a.categories_id,parent_id, b.categories_name from " . TABLE_CATEGORIES . " as a," . TABLE_CATEGORIES_DESCRIPTION . " as b where a.categories_id = b.categories_id and b.language_id = " . (int)$language_id . " order by categories_id");
    while ($categories = tep_db_fetch_array($categories_query)) {
      //echo  $categories['parent_id'];
      $parent_id = $categories['parent_id'];
      if ($parent_id==0)
      {
              $categories_array[] = array('id' => $categories['categories_id'],
                                     'text' => $categories['categories_name']);
                                     } else {
                                            $txt=NULL;
                                            while ($parent_id!=0) {
                                             //echo $parent_id;
                                             $category_query = tep_db_query("select a.categories_id,parent_id, b.categories_name from " . TABLE_CATEGORIES . " as a," . TABLE_CATEGORIES_DESCRIPTION . " as b where a.categories_id = b.categories_id and a.categories_id = " . $parent_id . " and b.language_id = " . (int)$language_id . " order by categories_id");
                                             $category  =  tep_db_fetch_array($category_query);
                                              $txt .=$category['categories_name']."->";
                                              $parent_id = $category['parent_id'];
                                              //die($txt.$parent_id.$category['categories_id']);
                                              }
                                             $categories_array[] = array('id' => $categories['categories_id'],
                                                                   'text' => $txt.$categories['categories_name']);
                                             }
    }

    $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
    $tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title");
    while ($tax_class = tep_db_fetch_array($tax_class_query)) {
      $tax_class_array[] = array('id' => $tax_class['tax_class_id'],
                                 'text' => $tax_class['tax_class_title']);
    }


    if (!isset($pInfo->products_status)) $pInfo->products_status = '1';
    switch ($pInfo->products_status) {
      case '0': $in_status = false; $out_status = true; break;
      case '1':
      default: $in_status = true; $out_status = false;
    }
?>
<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
<script language="javascript"><!--
  var dateAvailable = new ctlSpiffyCalendarBox("dateAvailable", "new_product", "products_date_available","btnDate1","<?php echo $pInfo->products_date_available; ?>",scBTNMODE_CUSTOMBLUE);
//--></script>
<script language="javascript"><!--
var tax_rates = new Array();
<?php
    for ($i=0, $n=sizeof($tax_class_array); $i<$n; $i++) {
      if ($tax_class_array[$i]['id'] > 0) {
        echo 'tax_rates["' . $tax_class_array[$i]['id'] . '"] = ' . tep_get_tax_rate_value($tax_class_array[$i]['id']) . ';' . "\n";
      }
    }
?>

function doRound(x, places) {
  return Math.round(x * Math.pow(10, places)) / Math.pow(10, places);
}

function getTaxRate() {
  var selected_value = document.forms["new_product"].products_tax_class_id.selectedIndex;
  var parameterVal = document.forms["new_product"].products_tax_class_id[selected_value].value;

  if ( (parameterVal > 0) && (tax_rates[parameterVal] > 0) ) {
    return tax_rates[parameterVal];
  } else {
    return 0;
  }
}

function updateGross() {
  var taxRate = getTaxRate();
  var grossValue = document.forms["new_product"].products_price.value;

  if (taxRate > 0) {
    grossValue = grossValue * ((taxRate / 100) + 1);
  }

  document.forms["new_product"].products_price_gross.value = doRound(grossValue, 4);
}

function updateNet() {
  var taxRate = getTaxRate();
  var netValue = document.forms["new_product"].products_price_gross.value;

  if (taxRate > 0) {
    netValue = netValue / ((taxRate / 100) + 1);
  }

  document.forms["new_product"].products_price.value = doRound(netValue, 4);
}
//--></script>
<?php echo tep_draw_form('new_product', 'account_add.php?osCsid=' . $osCsid . (isset($_REQUEST['pID']) ? '&pID=' . $_GET['pID'] : '') . '&action=new_product_preview', 'post', 'enctype="multipart/form-data"'); ?>
    <table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo TEXT_NEW_PRODUCT; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
<table width="100%" border="0">
  <tr>
    <td valign="middle" align="left">

  <div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>

<div class="tab-page" id="configPane"><script type="text/javascript">
   var tabPane1 = new WebFXTabPane( document.getElementById( "configPane" ), 0 )
</script>
<div class="tab-page" id="site-page"><h2 class="tab"><? echo TEXT_HEADING_TAB1; ?></h2><script type="text/javascript">
  tabPane1.addTabPage( document.getElementById( "site-page" ) );</script> <table class="adminform">
<td><table>
            <tr bgcolor="#ebebff">
            <td class="main"><?php echo TEXT_PRODUCTS_STATUS; ?></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_radio_field('products_status', '1', $in_status) . '&nbsp;' . TEXT_PRODUCT_AVAILABLE . '&nbsp;' . tep_draw_radio_field('products_status', '0', $out_status) . '&nbsp;' . TEXT_PRODUCT_NOT_AVAILABLE; ?></td>
            </tr>
            <tr>
            <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
            </tr>
            <tr bgcolor="#ebebff">
            <td class="main"><?php echo TEXT_PRODUCTS_DATE_AVAILABLE; ?><br><small>(JJ-MM-AAAA)</small></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;'; ?><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="dd-MM-yyyy";</script></td>
            </tr>
            <tr>
            <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
            </tr>
            <tr bgcolor="#ebebff">
            <td class="main"><?php echo TEXT_PRODUCTS_CATEGORY; ?></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_pull_down_menu('category_id', $categories_array, $pInfo->categories_id); ?></td>
            </tr>
            <tr bgcolor="#ebebff">
            <td class="main"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, $pInfo->manufacturers_id); ?></td>
            </tr>
            <tr>
            <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
            </tr>
<?php
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
            <tr bgcolor="#ebebff">
            <td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_NAME; ?></td>
            <td class="main"><?php echo tep_image(DIR_WS_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? $products_name[$languages[$i]['id']] : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td>
            </tr>
<?php
    }
?>
            <tr>
            <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
            </tr>
            <tr bgcolor="#ebebff">
            <td class="main"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id, 'onchange="updateGross()"'); ?></td>
            </tr>
            <tr bgcolor="#ebebff">
            <td class="main"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>
            </tr>
            <tr bgcolor="#ebebff">
            <td class="main"><?php echo TEXT_PRODUCTS_PRICE_GROSS; ?></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_price_gross', $pInfo->products_price, 'OnKeyUp="updateNet()"'); ?></td>
            </tr>
            <tr>
            <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
            </tr>
<script language="javascript">
<!--
updateGross();
//-->
</script>
            <tr bgcolor="#ebebff">
            <td class="main"><?php echo TEXT_PRODUCTS_QUANTITY; ?></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_quantity', $pInfo->products_quantity); ?></td>
            </tr>
            <tr>
            <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
            </tr>
            <tr bgcolor="#ebebff">
            <td class="main"><?php echo TEXT_PRODUCTS_MODEL; ?></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_model', $pInfo->products_model); ?></td>
            </tr>
            <tr>
            <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
            </tr>
            <tr bgcolor="#ebebff">
            <td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?> <?php echo "(Attention !<br>1 Megapixel maximum)"; ?></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_file_field('products_image','') . tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . $pInfo->products_image . tep_draw_hidden_field('products_previous_image', $pInfo->products_image); ?></td>
            <tr>
            <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
            </tr>
            <tr bgcolor="#ebebff">
            <td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?> <?php echo "(kg)"; ?></td>
            <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td>
            </tr>
   </table></td></table>
        </div>

<div class="tab-page" id="Locale-page"><h2 class="tab"><? echo TEXT_HEADING_TAB2; ?></h2>
<script type="text/javascript"> tabPane1.addTabPage( document.getElementById( "Locale-page" ) );</script>
   <table class="adminform">
    <?php
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
            <tr bgcolor="#ebebff">
            <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td>
            <td width="100%"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td class="main" valign="top"><?php echo tep_image(DIR_WS_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?>&nbsp;</td>
                <td class="main" width="100%"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '20', '10', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>
              </tr>
            </table></td>
          </tr>
<?php
    }
?>
    </table>
        </div>


<div class="tab-page" id="Locale2-page"><h2 class="tab"><? echo TEXT_HEADING_TAB3; ?></h2>
<script type="text/javascript"> tabPane1.addTabPage( document.getElementById( "Locale2-page" ) );</script>
<table class="adminform">
<td><table>
   <?php
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
            <tr bgcolor="#ebebff">
            <td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_URL . '<br><small>' . TEXT_PRODUCTS_URL_WITHOUT_HTTP . '</small>'; ?></td>
            <td class="main"><?php echo tep_image(DIR_WS_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (isset($products_url[$languages[$i]['id']]) ? $products_url[$languages[$i]['id']] : tep_get_products_url($pInfo->products_id, $languages[$i]['id']))); ?></td>
            </tr>
<?php
    }
?>

     </td></table>
    </table>
        </div>
        
<div align="center" class="tab-page" id="about-page"><h2 class="tab"><? echo TEXT_HEADING_TAB4; ?></h2>
<script type="text/javascript">  tabPane1.addTabPage( document.getElementById( "about-page" ) );</script>
  <table class="adminform">
    <td width="100%" valign="top" align="center"><table border="0" width="100%" cellspacing="0" cellpadding="2" align="center">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0" align="center">
          <tr>
            <td class="pageHeading" align="center"><? echo TEXT_TITLE_TAB4; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
           </tr>
          <tr>
           <td class="main" align="center" valign="top"><? echo TEXT_TAB4; ?><br></td>
           </tr>
           <tr>
           <td class="main" align="center" valign="top"><br></td>
           </tr>
                <tr>
                    <td align=center valign=top><img src="images/logo.png">
                    </td>
           <tr><td align=center valign=top><font class=small color=#FFA500><a href='http://www.procreator.info' color=#FFA500 target=_blank><font color=#FFA500>www.procreator.info</a></font></td>
            </tr>
            </table></td>
                </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
    </div>
</div>
<?php
}
if ($action == 'new_product_preview') {
    if (tep_not_null($_POST)) {
      $pInfo = new objectInfo($_POST);
      $products_name = $_POST['products_name'];
      $products_description = $_POST['products_description'];
      $products_url = $_POST['products_url'];
    } else {
      $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id  from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$_GET['pID'] . "'");
      $product = tep_db_fetch_array($product_query);

      $pInfo = new objectInfo($product);
      $products_image_name = $pInfo->products_image;
    }

    $form_action = (isset($_GET['pID'])) ? 'update_product' : 'insert_product';

    echo tep_draw_form($form_action, 'account_add.php?osCsid=' . $osCsid . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '') . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');

    $languages = tep_get_languages();
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
      if (isset($_GET['read']) && ($_GET['read'] == 'only')) {
        $pInfo->products_name = tep_get_products_name($pInfo->products_id, $languages[$i]['id']);
        $pInfo->products_description = tep_get_products_description($pInfo->products_id, $languages[$i]['id']);
        $pInfo->products_url = tep_get_products_url($pInfo->products_id, $languages[$i]['id']);
      } else {
        $pInfo->products_name = tep_db_prepare_input($products_name[$languages[$i]['id']]);
        $pInfo->products_description = tep_db_prepare_input($products_description[$languages[$i]['id']]);
        $pInfo->products_url = tep_db_prepare_input($products_url[$languages[$i]['id']]);
      }
?>
    <table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo tep_image(DIR_WS_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . $pInfo->products_name; ?></td>
            <td class="pageHeading" align="right"><?php echo $currencies->format($pInfo->products_price); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
      <tr>
        <td class="main"><?php echo tep_image(DIR_WS_IMAGES . $products_image_name, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . $pInfo->products_description; ?></td>
      </tr>

<?php


      if ($pInfo->products_url) {
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
      <tr>
        <td class="main"><?php echo sprintf(TEXT_PRODUCT_MORE_INFORMATION, $pInfo->products_url); ?></td>
      </tr>
<?php
      }
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
<?php
      if ($pInfo->products_date_available > date('Y-m-d')) {
?>
      <tr>
        <td align="center" class="smallText"><?php echo sprintf(TEXT_PRODUCT_DATE_AVAILABLE, tep_date_long($pInfo->products_date_available)); ?></td>
      </tr>
<?php
      } else {
?>
      <tr>
        <td align="center" class="smallText"><?php echo sprintf(TEXT_PRODUCT_DATE_ADDED, tep_date_long($pInfo->products_date_added)); ?></td>
      </tr>
<?php
      }
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
<?php
    }

    if (isset($_GET['read']) && ($_GET['read'] == 'only')) {
      if (isset($_GET['origin'])) {
        $pos_params = strpos($_GET['origin'], '?', 0);
        if ($pos_params != false) {
          $back_url = substr($_GET['origin'], 0, $pos_params);
          $back_url_params = substr($_GET['origin'], $pos_params + 1);
        } else {
          $back_url = $_GET['origin'];
          $back_url_params = '';
        }
      } else {
        $back_url = FILENAME_MANAGE;
        $back_url_params = 'osCsid=' . $osCsid . '&pID=' . $pInfo->products_id;
      }
?>
      <tr>
        <td align="right"><?php echo '<a href="' . tep_href_link($back_url, $back_url_params, 'NONSSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
      </tr>
<?php
    } else {
?>
      <tr>
        <td align="right" class="smallText">
<?php
/* Re-Post all POST'ed variables */
      reset($_POST);
      while (list($key, $value) = each($_POST)) {
        if (!is_array($_POST[$key])) {
          echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
        }
      }
      $languages = tep_get_languages();
      for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
        echo tep_draw_hidden_field('products_name[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_name[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_description[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_url[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_url[$languages[$i]['id']])));
      }
      echo tep_draw_hidden_field('products_image', stripslashes($products_image_name));

      echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="edit"') . '&nbsp;&nbsp;';

      if (isset($_GET['pID'])) {
        echo tep_image_submit('button_update.gif', IMAGE_UPDATE);
      } else {
        echo tep_image_submit('button_insert.gif', IMAGE_INSERT);
      }
      echo '&nbsp;&nbsp;<a href="' . tep_href_link('account.php', 'osCsid=' . $osCsid . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';
?></td>
      </tr>
    </table></form>
<?php
    }
  }
  ?>

<?if ($action != 'new_product_preview') {
    ?>  <tr>
        <td class="main" align="right"><?php echo tep_draw_hidden_field('products_date_added', (tep_not_null($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d'))) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '&nbsp;&nbsp;<a href="' . tep_href_link('account_add.php', 'osCsid=' . $osCsid . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
      </tr>
    </table></form>
      <? }?>
<!-- body_text_eof //-->
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
    </table></td>
  </tr>
</table>
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Merci


Go to the top of the page
 
Bonbec
posté 16 Apr 2017, 22:26
Message #5


Ceinture bleue OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1252
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Bonsoir,

A première vue, dans le fichier, à par quelques modifs de texte, il n'y a rien qui cloche.
Seule une modif mérite une remarque :
Code
$chosencategory = $_POST['category_id'];

n'est pas sécurisé vu que cette récupération d'une donnée de formulaire va être injectée dans la BDD sans aucune vérification du contenu.
Je suggère d'utiliser la fonction d'OsCommerce prévue pour ce cas de figure :
Code
$chosencategory = tep_db_prepare_input($_POST['category_id']);


Merci pour les captures d'écran, çà répond à mes questions. Pour l'affichage de products_description, est ce que sur la page product_info.php (page de produit) l'affichage de la description se fait correctement ou c'est aussi au kilomètre ?
Si c'est au kilomètre, c'est que la function tep_get_products_description dans includes/functions/general.php a été modifiée.
Si non, alors faudra modifier un peu la page account_add.php, la ligne 519 :
Code
        $pInfo->products_description = tep_get_products_description($pInfo->products_id, $languages[$i]['id']);

à modifier en :
Code
        $pInfo->products_description = nl2br(tep_get_products_description($pInfo->products_id, $languages[$i]['id']));



--------------------
Config 1 en live : Osc 2.2 très fortement modifié ... UTF-8 et Php 5.4.
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + trop de bidouilles persos pas très OsCommerce (erreurs de jeunesse)
Config 2 en local avec UwAmp : Osc 2.3.4 BS
Go to the top of the page
 
roiphoto
posté 21 Apr 2017, 12:00
Message #6


Ceinture jaune OSC
Icône de groupe

Groupe : Membres
Messages : 73
Inscrit : 6-August 07
Lieu : 93200
Membre no 18622



Bonjour
Merci Bonbec pour les deux conseils que vous venez de me donner.

Le premier $chosencategory = $_POST['category_id']; à changer par $chosencategory = tep_db_prepare_input($_POST['category_id']); était une correction apportée par un membre (moins expérimenté que vous) sur le forum anglophone parce que les produits n’allaient pas dans les catégories choisies par le customer. De ce côté, votre re-correction arrange formidablement les choses, cela fonctionne bien. Une fois de plus MERCI

Quant à la 2è modif à savoir $pInfo->products_description = nl2br(tep_get_products_description($pInfo->products_id, $languages[$i]['id']));
Je l’ai effectuée à la ligne 518.

OUF ENFIN ! OUF ENFIN ! OUF ENFIN !

Cette modif a permis que non seulement, du côté admin la description du produit accepte les codes <br> strong></strong> etcmais aussi la restitution d’une mise en page conforme et belle. UN GRAND PAS EST FAIT. FELICITATIONS !

Par contre, du côté customer (dans son espace-abonné), la ligne demeure kilométrique à la prévisualisation et à l’insertion malgré les modifs.

Vu le nombre de customers à ajouter leurs produits, ce serait fastidieux defaire manuellement la mise en page par l’administrateur. Ne serait-il pas possible que la description du produit (du côté customer) respecte en même temps les normes html de sorte qu’au final, l’administrateur n’a qu’à lire et valider son annonce ? ? ?

Je vous remercie
Go to the top of the page
 
Bonbec
posté 21 Apr 2017, 12:13
Message #7


Ceinture bleue OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1252
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Bonjour,

Heureux que cela avance dans le bon sens smile.gif

Citation (roiphoto @ 21 Apr 2017, 12:00) *
... Par contre, du côté customer (dans son espace-abonné), la ligne demeure kilométrique à la prévisualisation et à l’insertion malgré les modifs. ...

Comme je n'ai pas cette addon sur mon site, je suis un peu dans le brouillard pour savoir quel fichier serait à modifier.
Quel fichier apparait dans l'url du côté customer (dans son espace-abonné) ?


--------------------
Config 1 en live : Osc 2.2 très fortement modifié ... UTF-8 et Php 5.4.
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + trop de bidouilles persos pas très OsCommerce (erreurs de jeunesse)
Config 2 en local avec UwAmp : Osc 2.3.4 BS
Go to the top of the page
 
roiphoto
posté 22 Apr 2017, 10:08
Message #8


Ceinture jaune OSC
Icône de groupe

Groupe : Membres
Messages : 73
Inscrit : 6-August 07
Lieu : 93200
Membre no 18622



Bonjour,

Pour ajouter, l’URL affiché est 127.0.0.1/mon_projet /account_add.php que je vous ai précédemment envoyé. (voir mon message du 16 apr 2017 18:11)

Puis-je vous suggérer qu’on trouve un endroit où inserer comme dans les formulaires classiques html un input text_area qui respecte les retours à la ligne, ce qui permet à l’internaute "analphabète en html" de proposer sa propre mise en page ?

Je profite aussi pour vous envoyer les autres require dont /account_add.php a besoin pour tourner

le premier /includes/application_top.php qui n’est pas modifié

le 2è c’est /includes/functions/product_manage.php
Code
<?
//BOF:Useful functions
if (!function_exists('tep_draw_file_field')){
function tep_draw_file_field($name, $required = false) {
    $field = tep_draw_input_field($name, '', '',  'file',$required);

    return $field;
  }
}

if (!function_exists('tep_get_languages')){
function tep_get_languages() {
    $languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order");
    while ($languages = tep_db_fetch_array($languages_query)) {
      $languages_array[] = array('id' => $languages['languages_id'],
                                 'name' => $languages['name'],
                                 'code' => $languages['code'],
                                 'image' => $languages['image'],
                                 'directory' => $languages['directory']);
    }

    return $languages_array;
  }
}

if (!function_exists('tep_output_generated_category_path')){
  function tep_output_generated_category_path($id, $from = 'category') {
    $calculated_category_path_string = '';
    $calculated_category_path = tep_generate_category_path($id, $from);
    for ($i=0, $n=sizeof($calculated_category_path); $i<$n; $i++) {
      for ($j=0, $k=sizeof($calculated_category_path[$i]); $j<$k; $j++) {
        $calculated_category_path_string .= $calculated_category_path[$i][$j]['text'] . '&nbsp;&gt;&nbsp;';
      }
      $calculated_category_path_string = substr($calculated_category_path_string, 0, -16) . '<br>';
    }
    $calculated_category_path_string = substr($calculated_category_path_string, 0, -4);

    if (strlen($calculated_category_path_string) < 1) $calculated_category_path_string = TEXT_TOP;

    return $calculated_category_path_string;
  }
}

if (!function_exists('tep_generate_category_path')){

    function tep_generate_category_path($id, $from = 'category', $categories_array = '', $index = 0) {
    global $languages_id;

    if (!is_array($categories_array)) $categories_array = array();

    if ($from == 'product') {
      $categories_query = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$id . "'");
      while ($categories = tep_db_fetch_array($categories_query)) {
        if ($categories['categories_id'] == '0') {
          $categories_array[$index][] = array('id' => '0', 'text' => TEXT_TOP);
        } else {
          $category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$categories['categories_id'] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");
          $category = tep_db_fetch_array($category_query);
          $categories_array[$index][] = array('id' => $categories['categories_id'], 'text' => $category['categories_name']);
          if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index);
          $categories_array[$index] = array_reverse($categories_array[$index]);
        }
        $index++;
      }
    } elseif ($from == 'category') {
      $category_query = tep_db_query("select cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");
      $category = tep_db_fetch_array($category_query);
      $categories_array[$index][] = array('id' => $id, 'text' => $category['categories_name']);
      if ( (tep_not_null($category['parent_id'])) && ($category['parent_id'] != '0') ) $categories_array = tep_generate_category_path($category['parent_id'], 'category', $categories_array, $index);
    }

    return $categories_array;
  }
}

if (!function_exists('tep_get_products_description')){
  function tep_get_products_description($product_id, $language_id) {
    $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
    $product = tep_db_fetch_array($product_query);

    return $product['products_description'];
  }
}

if (!function_exists('tep_get_products_url')){
  function tep_get_products_url($product_id, $language_id) {
    $product_query = tep_db_query("select products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
    $product = tep_db_fetch_array($product_query);

    return $product['products_url'];
    }
}

if (!function_exists('tep_get_category_tree')){

function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) {
    global $languages_id;

    if (!is_array($category_tree_array)) $category_tree_array = array();
    if ( (sizeof($category_tree_array) < 1) && ($exclude != '0') ) $category_tree_array[] = array('id' => '0', 'text' => TEXT_TOP);

    if ($include_itself) {
      $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int)$languages_id . "' and cd.categories_id = '" . (int)$parent_id . "'");
      $category = tep_db_fetch_array($category_query);
      $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']);
    }

    $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and c.parent_id = '" . (int)$parent_id . "' order by c.sort_order, cd.categories_name");
    while ($categories = tep_db_fetch_array($categories_query)) {
      if ($exclude != $categories['categories_id']) $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']);
      $category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . '&nbsp;&nbsp;&nbsp;', $exclude, $category_tree_array);
    }

    return $category_tree_array;
  }
}

if (!function_exists('tep_childs_in_category_count')){
function tep_childs_in_category_count($categories_id) {
    $categories_count = 0;

    $categories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$categories_id . "'");
    while ($categories = tep_db_fetch_array($categories_query)) {
      $categories_count++;
      $categories_count += tep_childs_in_category_count($categories['categories_id']);
    }

    return $categories_count;
  }
}

if (!function_exists('tep_products_in_category_count')){
function tep_products_in_category_count($categories_id, $include_deactivated = false) {
    $products_count = 0;

    if ($include_deactivated) {
      $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$categories_id . "'");
    } else {
      $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int)$categories_id . "'");
    }

    $products = tep_db_fetch_array($products_query);

    $products_count += $products['total'];

    $childs_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$categories_id . "'");
    if (tep_db_num_rows($childs_query)) {
      while ($childs = tep_db_fetch_array($childs_query)) {
        $products_count += tep_products_in_category_count($childs['categories_id'], $include_deactivated);
      }
    }

    return $products_count;
  }
}

if (!function_exists('tep_info_image')){
  function tep_info_image($image, $alt, $width = '', $height = '') {
    if (tep_not_null($image) && (file_exists(DIR_WS_IMAGES . $image)) ) {
      $image = tep_image(DIR_WS_IMAGES . $image, $alt, $width, $height);
    } else {
      $image = TEXT_IMAGE_NONEXISTENT;
    }

    return $image;
  }
}

if (!function_exists('tep_get_tax_rate_value')){
  function tep_get_tax_rate_value($class_id) {
    $tax_query = tep_db_query("select SUM(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " where tax_class_id = '" . (int)$class_id . "' group by tax_priority");
    if (tep_db_num_rows($tax_query)) {
      $tax_multiplier = 0;
      while ($tax = tep_db_fetch_array($tax_query)) {
        $tax_multiplier += $tax['tax_rate'];
      }
      return $tax_multiplier;
    } else {
      return 0;
    }
  }
}

if (!function_exists('tep_remove_product')){

function tep_remove_product($product_id) {
    $product_image_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
    $product_image = tep_db_fetch_array($product_image_query);

    $duplicate_image_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image = '" . tep_db_input($product_image['products_image']) . "'");
    $duplicate_image = tep_db_fetch_array($duplicate_image_query);

    if ($duplicate_image['total'] < 2) {
      if (file_exists(DIR_FS_CATALOG_IMAGES . $product_image['products_image'])) {
        @unlink(DIR_FS_CATALOG_IMAGES . $product_image['products_image']);
      }
    }

    tep_db_query("delete from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "'");
    tep_db_query("delete from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
    tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "'");
    tep_db_query("delete from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "'");
    tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$product_id . "'");
    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where products_id = '" . (int)$product_id . "'");
    tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where products_id = '" . (int)$product_id . "'");

    $product_reviews_query = tep_db_query("select reviews_id from " . TABLE_REVIEWS . " where products_id = '" . (int)$product_id . "'");
    while ($product_reviews = tep_db_fetch_array($product_reviews_query)) {
      tep_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int)$product_reviews['reviews_id'] . "'");
    }
    tep_db_query("delete from " . TABLE_REVIEWS . " where products_id = '" . (int)$product_id . "'");

    if (USE_CACHE == 'true') {
      tep_reset_cache_block('categories');
      tep_reset_cache_block('also_purchased');
    }
  }
}
//EOF:Useful functions

?>


Le 3è c’est /includes/classes/product_manage.php

Code
<?
/*
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License

*/
  class tableBlock {
    var $table_border = '0';
    var $table_width = '100%';
    var $table_cellspacing = '0';
    var $table_cellpadding = '2';
    var $table_parameters = '';
    var $table_row_parameters = '';
    var $table_data_parameters = '';

    function tableBlock($contents) {
      $tableBox_string = '';

      $form_set = false;
      if (isset($contents['form'])) {
        $tableBox_string .= $contents['form'] . "\n";
        $form_set = true;
        array_shift($contents);
      }

      $tableBox_string .= '<table border="' . $this->table_border . '" width="' . $this->table_width . '" cellspacing="' . $this->table_cellspacing . '" cellpadding="' . $this->table_cellpadding . '"';
      if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters;
      $tableBox_string .= '>' . "\n";

      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        $tableBox_string .= '  <tr';
        if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
        if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
        $tableBox_string .= '>' . "\n";

        if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
          for ($x=0, $y=sizeof($contents[$i]); $x<$y; $x++) {
            if (isset($contents[$i][$x]['text']) && tep_not_null(isset($contents[$i][$x]['text']))) {
              $tableBox_string .= '    <td';
              if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . $contents[$i][$x]['align'] . '"';
              if (isset($contents[$i][$x]['params']) && tep_not_null(isset($contents[$i][$x]['params']))) {
                $tableBox_string .= ' ' . $contents[$i][$x]['params'];
              } elseif (tep_not_null($this->table_data_parameters)) {
                $tableBox_string .= ' ' . $this->table_data_parameters;
              }
              $tableBox_string .= '>';
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
              $tableBox_string .= $contents[$i][$x]['text'];
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
              $tableBox_string .= '</td>' . "\n";
            }
          }
        } else {
          $tableBox_string .= '    <td';
          if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . $contents[$i]['align'] . '"';
          if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
            $tableBox_string .= ' ' . $contents[$i]['params'];
          } elseif (tep_not_null($this->table_data_parameters)) {
            $tableBox_string .= ' ' . $this->table_data_parameters;
          }
          $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";
        }

        $tableBox_string .= '  </tr>' . "\n";
      }

      $tableBox_string .= '</table>' . "\n";

      if ($form_set == true) $tableBox_string .= '</form>' . "\n";

      return $tableBox_string;
    }
  }
  
  class box extends tableBlock {
    function box() {
      $this->heading = array();
      $this->contents = array();
    }

    function infoBox($heading, $contents) {
      $this->table_row_parameters = 'class="infoBoxHeading"';
      $this->table_data_parameters = 'class="infoBoxHeading"';
      $this->heading = $this->tableBlock($heading);

      $this->table_row_parameters = '';
      $this->table_data_parameters = 'class="infoBoxContent"';
      $this->contents = $this->tableBlock($contents);

      return $this->heading . $this->contents;
    }

    function menuBox($heading, $contents) {
      $this->table_data_parameters = 'class="menuBoxHeading"';
      if (isset($heading[0]['link'])) {
        $this->table_data_parameters .= ' onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . $heading[0]['link'] . '\'"';
        $heading[0]['text'] = '&nbsp;<a href="' . $heading[0]['link'] . '" class="menuBoxHeadingLink">' . $heading[0]['text'] . '</a>&nbsp;';
      } else {
        $heading[0]['text'] = '&nbsp;' . $heading[0]['text'] . '&nbsp;';
      }
      $this->heading = $this->tableBlock($heading);

      $this->table_data_parameters = 'class="menuBoxContent"';
      $this->contents = $this->tableBlock($contents);

      return $this->heading . $this->contents;
    }
  }
  class objectInfo {

// class constructor
    function objectInfo($object_array) {
      reset($object_array);
      while (list($key, $value) = each($object_array)) {
        $this->$key = tep_db_prepare_input($value);
      }
    }
  }

  ?>


Et le dernier /includes/classes/upload.php

Code
<?php
/*
  $Id: upload.php,v 1.2 2003/06/20 00:18:30 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  class upload {
    var $file, $filename, $destination, $permissions, $extensions, $tmp_filename, $message_location;

    function upload($file = '', $destination = '', $permissions = '777', $extensions = '') {

      $this->set_file($file);
      $this->set_destination($destination);
      $this->set_permissions($permissions);
      $this->set_extensions($extensions);

      $this->set_output_messages('direct');

      if (tep_not_null($this->file) && tep_not_null($this->destination)) {
        $this->set_output_messages('session');

        if ( ($this->parse() == true) && ($this->save() == true) ) {
          return true;
        } else {
// self destruct
          unset($this);//$this = null;

          return false;
        }
      }
    }

    function parse() {
      global $messageStack;

      if ((strcasecmp(substr($_FILES[$this->file]['name'],-4),".gif")) && (strcasecmp(substr($_FILES[$this->file]['name'],-4),".jpg")) && (strcasecmp(substr($_FILES[$this->file]['name'],-4),".png")) && (strcasecmp(substr($_FILES[$this->file]['name'],-4),".bmp")) && (strcasecmp(substr($_FILES[$this->file]['name'],-4),".swf"))&& (strcasecmp(substr($_FILES[$this->file]['name'],-4),""))) {
                echo "<script>alert('The file must be gif, png, jpg, bmp'); window.history.go(-1);</script>\n";
                exit();
        }
      if (isset($_FILES[$this->file])) {
        $file = array('name' => $_FILES[$this->file]['name'],
                      'type' => $_FILES[$this->file]['type'],
                      'size' => $_FILES[$this->file]['size'],
                      'tmp_name' => $_FILES[$this->file]['tmp_name']);
      } elseif (isset($GLOBALS['HTTP_POST_FILES'][$this->file])) {
        global $HTTP_POST_FILES;

        $file = array('name' => $HTTP_POST_FILES[$this->file]['name'],
                      'type' => $HTTP_POST_FILES[$this->file]['type'],
                      'size' => $HTTP_POST_FILES[$this->file]['size'],
                      'tmp_name' => $HTTP_POST_FILES[$this->file]['tmp_name']);
      } else {
        $file = array('name' => (isset($GLOBALS[$this->file . '_name']) ? $GLOBALS[$this->file . '_name'] : ''),
                      'type' => (isset($GLOBALS[$this->file . '_type']) ? $GLOBALS[$this->file . '_type'] : ''),
                      'size' => (isset($GLOBALS[$this->file . '_size']) ? $GLOBALS[$this->file . '_size'] : ''),
                      'tmp_name' => (isset($GLOBALS[$this->file]) ? $GLOBALS[$this->file] : ''));
      }

      if ( tep_not_null($file['tmp_name']) && ($file['tmp_name'] != 'none') && is_uploaded_file($file['tmp_name']) ) {
        if (sizeof($this->extensions) > 0) {
          if (!in_array(strtolower(substr($file['name'], strrpos($file['name'], '.')+1)), $this->extensions)) {
            if ($this->message_location == 'direct') {
              $messageStack->add(ERROR_FILETYPE_NOT_ALLOWED, 'error');
            } else {
              $messageStack->add_session(ERROR_FILETYPE_NOT_ALLOWED, 'error');
            }

            return false;
          }
        }

        $this->set_file($file);
        $this->set_filename($file['name']);
        $this->set_tmp_filename($file['tmp_name']);

        return $this->check_destination();
      } else {
        if ($this->message_location == 'direct') {
          $messageStack->add(WARNING_NO_FILE_UPLOADED, 'warning');
        } else {
          $messageStack->add_session(WARNING_NO_FILE_UPLOADED, 'warning');
        }

        return false;
      }
    }

    function save() {
      global $messageStack;
      list($width, $height, $type, $attr) = getimagesize($this->file['tmp_name']);
       //echo  $width.' '.$height.' '. $type.' '. $attr;
      // die($this->file['type']);


      if (substr($this->destination, -1) != '/') $this->destination .= '/';
      if (!is_dir($this->destination.'thumb/')) mkdir ($this->destination.'thumb/');
      if (move_uploaded_file($this->file['tmp_name'], $this->destination . $this->filename)) {
        copy($this->destination . $this->filename, $this->destination.'thumb/'. $this->filename);
        chmod($this->destination . $this->filename, $this->permissions);

       $picture = $this->destination . $this->filename; # picture fileNAME here. not address
       if (eregi('jpeg',$this->file['type']) || eregi('jpg',$this->file['type']))
           {
                   $function_image_create = "ImageCreateFromJpeg";
                   $function_image_new = "ImageJpeg";
           }
       if (eregi('png',$this->file['type']))
           {
                   $function_image_create = "ImageCreateFromPng";
                   $function_image_new = "ImagePNG";
           }
        if (eregi('gif',$this->file['type']))
           {
                   $function_image_create = "ImageCreateFromGif";
                   $function_image_new = "ImagePNG";

           }
  //     if (!eregi('flash',$this->file['type']))
  //         {

//      $src_img=@$function_image_create($picture);
  //     $oh = imagesy($src_img);  # original height
//      $ow = imagesx($src_img);  # original width
  //     $r = $oh/$ow;
//      $new_w = 100;
//      $new_h = $new_w * $r;
//      $dst_img = ImageCreateTrueColor($new_w,$new_h);

//      ImageCopyResized($dst_img, $src_img, 0,0,0,0, $new_w, $new_h, ImageSX($src_img), ImageSY($src_img));

//      @$function_image_new($dst_img, "$picture");
//           }




if ($this->message_location == 'direct') {
          $messageStack->add(SUCCESS_FILE_SAVED_SUCCESSFULLY, 'success');
        } else {
          $messageStack->add_session(SUCCESS_FILE_SAVED_SUCCESSFULLY, 'success');
        }

        return true;
      } else {
        if ($this->message_location == 'direct') {
          $messageStack->add(ERROR_FILE_NOT_SAVED, 'error');
        } else {
          $messageStack->add_session(ERROR_FILE_NOT_SAVED, 'error');
        }

        return false;
      }
    }

    function set_file($file) {
      $this->file = $file;
    }

    function set_destination($destination) {
      $this->destination = $destination;
    }

    function set_permissions($permissions) {
      $this->permissions = octdec($permissions);
    }

    function set_filename($filename) {
      $this->filename = $filename;
    }

    function set_tmp_filename($filename) {
      $this->tmp_filename = $filename;
    }

    function set_extensions($extensions) {
      if (tep_not_null($extensions)) {
        if (is_array($extensions)) {
          $this->extensions = $extensions;
        } else {
          $this->extensions = array($extensions);
        }
      } else {
        $this->extensions = array();
      }
    }

    function check_destination() {
      global $messageStack;

      if (!is_writeable($this->destination)) {
        if (is_dir($this->destination)) {
          if ($this->message_location == 'direct') {
            $messageStack->add(sprintf(ERROR_DESTINATION_NOT_WRITEABLE, $this->destination), 'error');
          } else {
            $messageStack->add_session(sprintf(ERROR_DESTINATION_NOT_WRITEABLE, $this->destination), 'error');
          }
        } else {
          if ($this->message_location == 'direct') {
            $messageStack->add(sprintf(ERROR_DESTINATION_DOES_NOT_EXIST, $this->destination), 'error');
          } else {
            $messageStack->add_session(sprintf(ERROR_DESTINATION_DOES_NOT_EXIST, $this->destination), 'error');
          }
        }

        return false;
      } else {
        return true;
      }
    }

    function set_output_messages($location) {
      switch ($location) {
        case 'session':
          $this->message_location = 'session';
          break;
        case 'direct':
        default:
          $this->message_location = 'direct';
          break;
      }
    }
  }
?>


Je vous remercie


Go to the top of the page
 
Bonbec
posté 23 Apr 2017, 22:50
Message #9


Ceinture bleue OSC
Icône de groupe

Groupe : Modérateurs
Messages : 1252
Inscrit : 30-May 06
Lieu : Vichy (03)
Membre no 10583



Bonsoir,

Citation (roiphoto @ 22 Apr 2017, 10:08) *
Pour ajouter, l’URL affiché est 127.0.0.1/mon_projet /account_add.php que je vous ai précédemment envoyé. (voir mon message du 16 apr 2017 18:11)
Puis-je vous suggérer qu’on trouve un endroit où inserer comme dans les formulaires classiques html un input text_area qui respecte les retours à la ligne, ce qui permet à l’internaute "analphabète en html" de proposer sa propre mise en page ?

Le mieux est de "réparer" cet addon afin de le rendre compatible à votre site. Moins on ajoute de code et plus c'est facile à maintenir en cas d'intervention future.

Citation (roiphoto @ 22 Apr 2017, 10:08) *
Je profite aussi pour vous envoyer les autres require dont /account_add.php a besoin pour tourner
le premier /includes/application_top.php qui n’est pas modifié
le 2è c’est /includes/functions/product_manage.php
Code
<?
//BOF:Useful functions

Modifier le <? en <?php pour la cas où le serveur en production n'accepte pas les "short tags".

Je pense avoir trouvé où il faut faire une légère modification de code pour que cela s'affiche correctement partout. Toujours dans /includes/functions/product_manage.php :
Citation (roiphoto @ 22 Apr 2017, 10:08) *
...
if (!function_exists('tep_get_products_description')){
function tep_get_products_description($product_id, $language_id) {
$product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
$product = tep_db_fetch_array($product_query);

return $product['products_description'];
}
}

Modifier la ligne :
Code
    return $product['products_description'];

en :
Code
    return nl2br($product['products_description']);

Je pense que cette modif rendra inutile la modif de la ligne 518 faite l'autre jour.


--------------------
Config 1 en live : Osc 2.2 très fortement modifié ... UTF-8 et Php 5.4.
Contribs installées : down_for_maintenance_v 2.3 | Estimated Shipping v1.5 | imprint_1_3_5 | low_stock_report_v2.04 | visible_countries_1.2b | Products Tabs | shoppingCart_cleanup_v1.01.0 | + trop de bidouilles persos pas très OsCommerce (erreurs de jeunesse)
Config 2 en local avec UwAmp : Osc 2.3.4 BS
Go to the top of the page
 
roiphoto
posté Hier, 18:50
Message #10


Ceinture jaune OSC
Icône de groupe

Groupe : Membres
Messages : 73
Inscrit : 6-August 07
Lieu : 93200
Membre no 18622



Bonjour et merci pour la réponse

J’ai appliqué les conseils que vous m’avez donnés et les résultats sont les mêmes, Pas de changements et pas d’évolution.
La ligne est toujours au kilomètre

Sur le forum anglophone, un Membre suggérait d’intégrer fck editor, mais lui-même ne s’y connaissait pas trop. (ce n’est qu’une piste de recherche de solution à la situation)

Selon vous, est-ce faisable ?
Merci
Go to the top of the page
 

Reply to this topicStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :

 



RSS Version bas débit Nous sommes le : 26th April 2017 - 05:05
Ce site est déclaré auprès de la commision Nationale
de l'Informatique et des Libertés (déclaration n°: 1043896)