• User Attivo

    [Oscommerce] Cambiare il testo linkato delle immagini extra

    Salve a tutti,
    dovrei effettuare una modifica al file includes/products_extra_images.php per cambiare il testo linkato "Clicca qui per allargare la finestra" che appare nella scheda prodotto vicino alle anteprime delle immagini extra.
    Quello che vorrei è che alla seconda immagine extra che venga aggiunta, il testo linkato sia diverso dal testo linkato della prima immagine.
    Questo è il codice da modificare

    
    <?php
    
    $products_extra_images_query = tep_db_query("SELECT products_extra_image, products_extra_images_id FROM " . TABLE_PRODUCTS_EXTRA_IMAGES . " WHERE products_id='" . $product_info['products_id'] . "'");
    if (tep_db_num_rows($products_extra_images_query) >= 1){
     $rowcount_value=4;  //number of extra images per row 
     $rowcount=1;
    ?>
                  
         <table border="0" width="100%" cellspacing="1" cellpadding="2">
           <TR>
    <?php 
         
     //$products_extra_images_query = tep_db_query("SELECT products_extra_image, products_extra_images_id FROM " . TABLE_PRODUCTS_EXTRA_IMAGES . " WHERE products_id='" . $product_info['products_id'] . "'");
     while ($extra_images = tep_db_fetch_array($products_extra_images_query)) {
    ?>
      <TD CLASS="smalltext" align ="center">
      <SCRIPT language="javascript"><!--
      document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_EXTRA_IMAGES, 'peiID=' . $extra_images['products_extra_images_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $extra_images['products_extra_image'], addslashes($product_info['products_name']),SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
      //--></SCRIPT>
      <NOSCRIPT>
      <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $extra_images['products_extra_image']) . '">' . tep_image(DIR_WS_IMAGES . $extra_images['products_extra_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
      </NOSCRIPT>
      </td>
    <?php
     if ($rowcount == $rowcount_value){echo '</tr><tr>'; $rowcount=1;}
     else {$rowcount=$rowcount+1;}
     }
    ?> 
        </tr>
     </TABLE>
    <?php
    }
    ?>   
    
    

    La variabile che richiama il testo che appare è: TEXT_CLICK_TO_ENLARGE penso che basti un if che faccia il controllo se l'immagine extra è la seconda allora richiama l'altra variabile che creerò tipo TEXT_CLICK_TO_ENLARGE_2 altrimenti chiama TEXT_CLICK_TO_ENLARGE.
    Non so se mi sono spiegato.
    Spero mi possiate aiutare.
    Grazie mille
    ciao


  • Bannato User Attivo

    io non ho capito bene.. ti faccio una domanda... a cosa serve dare un nome ad un altra immagine? ti spieghi meglio? grazie


  • User Attivo

    OK ti spiego meglio, le immagini extra che inserisco per i libri dovranno avere:
    il primo testo linkato la scritta: clicca qui per visualizzare il sommario
    il secondo testo linkato la scritta: clicca qui per visualizzare la striscetta.
    Quindi per la prima immagine che viene inserita va richiamata la variabile con il primo testo, per la seconda immagine che viene inserita va richiamata la variabile con il secondo testo. Con un controllo tipo if penso che la cosa non debba essere difficile da fare...grazie 🙂


  • User Attivo

    up


  • User Attivo

    Ho provato a fare in questo modo:

    $products_extra_images_query = tep_db_query("SELECT products_extra_image, products_extra_images_id FROM " . TABLE_PRODUCTS_EXTRA_IMAGES . " WHERE products_id='" . $product_info['products_id'] . "'");
    if (tep_db_num_rows($products_extra_images_query) >= 1){
     $rowcount_value=4;  //number of extra images per row 
     $rowcount=1;
    ?>
                  
         <table border="0" width="100%" cellspacing="1" cellpadding="2">
           <TR>
    <?php 
         
     //$products_extra_images_query = tep_db_query("SELECT products_extra_image, products_extra_images_id FROM " . TABLE_PRODUCTS_EXTRA_IMAGES . " WHERE products_id='" . $product_info['products_id'] . "'");
     while ($extra_images = tep_db_fetch_array($products_extra_images_query)) {
    ?>
      <TD CLASS="smalltext" align ="center">
      <SCRIPT language="javascript"><!--
      document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_EXTRA_IMAGES, 'peiID=' . $extra_images['products_extra_images_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $extra_images['products_extra_image'], addslashes($product_info['products_name']),SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
      //--></SCRIPT>
      <NOSCRIPT>
      <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $extra_images['products_extra_image']) . '">' . tep_image(DIR_WS_IMAGES . $extra_images['products_extra_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>'; 
      if ($rowcount=2){
      echo'clicca per visualizzare la striscetta</a>';}
      else {''. TEXT_CLICK_TO_ENLARGE . '</a>';} ?>
      </NOSCRIPT>
      </td>
    <?php
     if ($rowcount == $rowcount_value){echo '</tr><tr>'; $rowcount=1;}
     else {$rowcount=$rowcount+1;}
     }
    ?> 
        </tr>
     </TABLE>
    <?php
    }
    ?>    
    

    ma il risultato resta invariato... forse la variabile che uso per il controllo non è quella giusta??
    grazie


  • User Attivo

    ok l'errore stava nel fatto che non ho messo l'if nel javascritp.
    Ad ogni modo così facendo:

    $products_extra_images_query = tep_db_query("SELECT products_extra_image, products_extra_images_id FROM " . TABLE_PRODUCTS_EXTRA_IMAGES . " WHERE products_id='" . $product_info['products_id'] . "'");
    if (tep_db_num_rows($products_extra_images_query) >= 1){
     $rowcount_value=4;  //number of extra images per row 
     $rowcount=1;
    ?>
                  
         <table border="0" width="100%" cellspacing="1" cellpadding="2">
           <TR>
    <?php 
         
     //$products_extra_images_query = tep_db_query("SELECT products_extra_image, products_extra_images_id FROM " . TABLE_PRODUCTS_EXTRA_IMAGES . " WHERE products_id='" . $product_info['products_id'] . "'");
     while ($extra_images = tep_db_fetch_array($products_extra_images_query)) {
    ?>
      <TD CLASS="smalltext" align ="center">
      <SCRIPT language="javascript"><!--
      document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_EXTRA_IMAGES, 'peiID=' . $extra_images['products_extra_images_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $extra_images['products_extra_image'], addslashes($product_info['products_name']),SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>';
      if ($rowcount=2){
      echo'clicca per visualizzare la striscetta</a>';}
      else {''. TEXT_CLICK_TO_ENLARGE . '</a>';} ?>');
      //--></SCRIPT>
      <NOSCRIPT>
      <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $extra_images['products_extra_image']) . '">' . tep_image(DIR_WS_IMAGES . $extra_images['products_extra_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>'; 
      if ($rowcount=2){
      echo'clicca per visualizzare la striscetta</a>';}
      else {''. TEXT_CLICK_TO_ENLARGE . '</a>';} ?>
      </NOSCRIPT>
      </td>
    <?php
     if ($rowcount == $rowcount_value){echo '</tr><tr>'; $rowcount=1;}
     else {$rowcount=$rowcount+1;}
     }
    ?> 
        </tr>
     </TABLE>
    <?php
    }
    ?>    
    

    Mi appare per tutte e due le immagini "clicca qui per visualizzare la striscetta".
    Come mai?? l'if non va bene? il link della prima immagine deve richiamare il testo nella variabile TEXT_CLICK_TO_ENLARGE, mentre il link della seconda immagine deve richiamare il testo "clicca qui per visualizzare la striscetta.
    che sbaglio??


  • User Attivo

    <ok risolto grazie a tutti! lo stesso..