Rechercher :
Accueil » Catalogue » Produit Connexion

Question Comment supprimer le bouton ajouter et le prix si celui-ci est 0 ?
Réponse Attention, tout dépend de votre version :
Pour une MS2, la variable est $product_info ; pour une MS1, c'est $product_info_values.

solution pour les prix du haut
Dans catalog/product_info.php, trouver la ligne
echo $products_price;
Remplacer par
<!-- ######### Suppression du prix si =0 ############## -->         
            <?php
        if ($product_info['products_price']>0){           
               echo $products_price;
          }             
            ?>
<!-- ######### End added ############## -->


solution pour le bouton
trouver la ligne
echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
Remplacer par
<!-- ############ Suppression du bouton si prix=0 ################# -->               
                <?php
        if ($product_info['products_price']>0){
                   echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
          }                  
           ?>
           </td>
<!-- ############ End added ################# --> 

ajout de JeanLuc Pour enlever la possibilité d'achat dans les produits nouveaux
Dans catalog/includes/modules/new_product.php,
Trouver
$info_box_contents[$row][$col] = array('align' => 'center',
                                           'params' => 'class="smallText" width="33%" valign="top"',
                                           'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));
Remplacer par:
if ($new_products['products_price'] > 0) {
    $info_box_contents[$row][$col] = array('align' => 'center',
                                           'params' => 'class="smallText" width="33%" valign="top"',
                                           'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));
} else {
    $info_box_contents[$row][$col] = array('align' => 'center',
                                           'params' => 'class="smallText" width="33%" valign="top"',
                                           'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a>');      
}


Dans products_new.php
Trouver:
<td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>
<td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>

Remplacer par:
<?php if ($products_new['products_price'] > 0) { ?>
    <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>
    <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
<?php } else { ?>
    <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name']; ?></td>
    <td align="right" valign="middle" class="main"><?php echo '&nbsp;'; ?></td>
<?php } ?>


Ajout de JeanLuc pour la liste des produits dans l'index:
Dans catalog/includes/modules/product_listing.php trouver (vers ligne 109):
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;
Remplacer par:
case 'PRODUCT_LIST_PRICE':
  $lc_align = 'right';
  if ($listing['products_price'] > 0) {
    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;';
    }
  } else {
    $lc_text = '&nbsp;';
  }
break;

et trouver (vers ligne 130):
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;
Remplacer par:
case 'PRODUCT_LIST_BUY_NOW':
  if ($listing['products_price'] > 0) {
    $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;';
  } else {
    $lc_text = '&nbsp;';
  }
break;


ajout de xawaks pour les critiques
Dans le fichier "products_reviews.php"
Alors il faut modifier la ligne 71 (remplacer le echo $products_price par)
<!-- ######### Suppression du prix si =0 ############## -->        
           <?php
        if ($product_info['products_price']>0){          
              echo $products_price;
          }            
           ?>
  <!-- ######### End added ############## -->

Puis ligne 196, cela doit ressembler à cela
<?php
 }
if ($product_info['products_price'] > 0) {
 echo '<p><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now') . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a></p>';
}
?>
faire de même sur la page products_reviews_write.php
Auteur : Gyakutsuki / JeanLuc / xawaks Mise à jour le 21/03/2005

Retour