IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Script à intégrer, comment faire?


Sujet :

JavaScript

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    227
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 227
    Par défaut Script à intégrer, comment faire?
    Bonjour,

    J'ai un javascript que j'ai trouvé et modifié et qui tourne sur la page info produit de ma boutique oscommerce.
    J'aimerais intégrer ce script dans la page liste des produits mais je ne sais pas comment faire.
    Quelqu'un peut il m'aider?

    Le script:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
     
     
     
    <!-- // Modif de popup image //-->
    <script language="javascript" type="text/javascript"><!--
     
    function popupWindow(url) {
     
     window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
    }
     
    function popupXL2(of) {
     
    var xlContStyle = document.getElementById('xlCont').style
    xlContStyle.display='block';
    if (of && document.getElementById('xlImg').height > 400) {
     with (xlContStyle) {
      height='400px';
      width=(parseInt(document.getElementById('xlImg').width) + 20) + 'px';
      overflow='auto'
     }
    }
    }
     
    //--></script>
    <style type="text/css">
    <!--
    #xlCont {
    display:none;
    top:70px;
    left:500px;
    position:absolute;
    background:#B9BAC1;  
    border:8px solid #B9BAC1;
    z-index:200;
    font-size: 10px;
     }
    -->
    </style>
     
    <?php
    echo '<a href="javascript:popupXL2(false);">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
    <div id="xlCont" style="display:none"><a href="javascript:void(0)" onclick="document.getElementById('xlCont').style.display='none'">
    <?php  
    echo '<div style="text-align: right;"><img alt="Fermeture" src="/images/perso/bout_ferm.png"></div>';
    echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], $width, $height, 'class="infoBox_image" id="xlImg"');
    ?>
    </a>
    <?php  echo '<br><div style="text-align: left;">'. $product_info['products_description'].'</div><div style="text-align: right;"><div style="font-size: 14px;">'. $product_info['products_price'].' € </div></div>' ?>
    </div>
    <?php /* <script language="javascript"><!--
    document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
    //--></script> */  ?>
    <!-- // Fin Modif de popup image //-->
    La page liste des produits:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    <?php
    /*
      $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $
    
      osCommerce, Open Source E-Commerce Solutions
      http://www.oscommerce.com
    
      Copyright (c) 2003 osCommerce
    
      Released under the GNU General Public License
    */
     
      $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');
     
      if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
    ?>
    <table border="0" summary="" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
        <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
      </tr>
    </table>
    <?php
      }
     
      $list_box_contents = array();
     
      for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
        switch ($column_list[$col]) {
          case 'PRODUCT_LIST_MODEL':
            $lc_text = TABLE_HEADING_MODEL;
            $lc_align = '';
            break;
          case 'PRODUCT_LIST_NAME':
            $lc_text = TABLE_HEADING_PRODUCTS;
            $lc_align = '';
            break;
          case 'PRODUCT_LIST_MANUFACTURER':
            $lc_text = TABLE_HEADING_MANUFACTURER;
            $lc_align = '';
            break;
          case 'PRODUCT_LIST_PRICE':
            $lc_text = TABLE_HEADING_PRICE;
            $lc_align = 'right';
            break;
          case 'PRODUCT_LIST_QUANTITY':
            $lc_text = TABLE_HEADING_QUANTITY;
            $lc_align = 'right';
            break;
          case 'PRODUCT_LIST_WEIGHT':
            $lc_text = TABLE_HEADING_WEIGHT;
            $lc_align = 'right';
            break;
          case 'PRODUCT_LIST_IMAGE':
            $lc_text = TABLE_HEADING_IMAGE;
            $lc_align = 'center';
            break;
          case 'PRODUCT_LIST_BUY_NOW':
            $lc_text = TABLE_HEADING_BUY_NOW;
            $lc_align = 'center';
            break;
        }
     
        if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
          $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
        }
     
        $list_box_contents[0][] = array('align' => $lc_align,
                                        'params' => 'class="productListing-heading"',
                                        'text' => '&nbsp;' . $lc_text . '&nbsp;');
      }
     
      if ($listing_split->number_of_rows > 0) {
        $rows = 0;
        $listing_query = tep_db_query($listing_split->sql_query);
        while ($listing = tep_db_fetch_array($listing_query)) {
          $rows++;
     
          if (($rows/2) == floor($rows/2)) {
            $list_box_contents[] = array('params' => 'class="productListing-even"');
          } else {
            $list_box_contents[] = array('params' => 'class="productListing-odd"');
          }
     
          $cur_row = sizeof($list_box_contents) - 1;
     
          for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
            $lc_align = '';
     
            switch ($column_list[$col]) {
              case 'PRODUCT_LIST_MODEL':
                $lc_align = '';
                $lc_text = '&nbsp;' . $listing['products_model'] . '&nbsp;';
                break;
              case 'PRODUCT_LIST_NAME':
                $lc_align = '';
                if (isset($HTTP_GET_VARS['manufacturers_id'])) {
                  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
                } else {
                  $lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>&nbsp;';
                }
                break;
              case 'PRODUCT_LIST_MANUFACTURER':
                $lc_align = '';
                $lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a>&nbsp;';
                break;
              case 'PRODUCT_LIST_PRICE':
                $lc_align = 'right';
                if (tep_not_null($listing['specials_new_products_price'])) {
                  $lc_text = '&nbsp;<s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>&nbsp;&nbsp;<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>&nbsp;';
                } else {
                  $lc_text = '&nbsp;' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '&nbsp;';
                }
                break;
              case 'PRODUCT_LIST_QUANTITY':
                $lc_align = 'right';
                $lc_text = '&nbsp;' . $listing['products_quantity'] . '&nbsp;';
                break;
              case 'PRODUCT_LIST_WEIGHT':
                $lc_align = 'right';
                $lc_text = '&nbsp;' . $listing['products_weight'] . '&nbsp;';
                break;
              case 'PRODUCT_LIST_IMAGE':
                $lc_align = 'center';
                if (isset($HTTP_GET_VARS['manufacturers_id'])) {
                  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
                } else {
                  $lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>&nbsp;';
                }
                break;
              case 'PRODUCT_LIST_BUY_NOW':
                $lc_align = 'center';
                $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>&nbsp;';
                break;
            }
     
            $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                                   'params' => 'class="productListing-data"',
                                                   'text'  => $lc_text);
          }
        }
     
        new productListingBox($list_box_contents);
      } else {
        $list_box_contents = array();
     
        $list_box_contents[0] = array('params' => 'class="productListing-odd"');
        $list_box_contents[0][] = array('params' => 'class="productListing-data"',
                                       'text' => TEXT_NO_PRODUCTS);
     
        new productListingBox($list_box_contents);
      }
     
      if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
    ?>
    <table border="0" summary="" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
        <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
      </tr>
    </table>
    <?php
      }
    ?>

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Juin 2004
    Messages
    157
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2004
    Messages : 157
    Par défaut
    Bonjour,

    essaye d'ajouter ton script à la fin du fichier "produits"

    c'est à dire après

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    </table>
    <?php
      }
    ?>
    ....coller le script ici à la place de ce texte ...

    Conseil: fait une sauvegarde avant d'expérimenter ...

    Tous qui est du javascript ( <script language="javascript" type="text/javascript"> ) et ( <style type="text/css"> )
    est normalement placer à l'intérieur des balises <head> </head>

    Et bon je ne travaille pas avec la "boutique oscommerce" donc ne peux pas d'aider plus

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    227
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 227
    Par défaut
    Salut Didier,

    Je crois que ça se passe à ce niveau...
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     case 'PRODUCT_LIST_IMAGE':
                $lc_align = 'center';
                if (isset($HTTP_GET_VARS['manufacturers_id'])) {
                  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
                } else {
                  $lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>&nbsp;';
                }
    Il faut passer les paramètres d'affichage popup à cette variable: $listing['products_image']

    Je n'arrive pas à savoir ce qu'il faut scinder.
    Il y a une partie qui appelle le script et une autre qui attribut les paramètres d'affichage à la variable...
    La où ça se complique encore plus pour moi, c'est que cela semble devoir être intégré dans la variable $lc_text...
    Et entre les erreurs de syntaxe possible et le placement du code, je rame grave...

Discussions similaires

  1. Script erreur, comment faire ?!
    Par bikette63 dans le forum VBScript
    Réponses: 3
    Dernier message: 06/12/2006, 15h22
  2. Réponses: 1
    Dernier message: 13/05/2006, 10h24
  3. Réponses: 12
    Dernier message: 12/04/2006, 14h27
  4. Comment faire un script file pour lftp
    Par dietrich dans le forum Applications et environnements graphiques
    Réponses: 3
    Dernier message: 26/03/2006, 11h33
  5. Script qui s'arrète !! Comment faire autrement ?
    Par Xplosif² dans le forum C++
    Réponses: 5
    Dernier message: 25/02/2006, 22h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo