Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Remove product image if price is


koollayed

Recommended Posts

Posted

I had a quick question I was wondering if the oscommerce community could help. I want to remove the product image from the product_info page if the price is 0. I already have to remove the buy box if the product is 0. I was not sure if I added the code in that same line. I tried with 0 results. I searched the forum and online. The code I have to remove the price is

 

<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>

<td class="main" align="right"><?php

 

if ($product_info['products_price'] < 0.01){

 

echo '';

 

} else {

 

 

 

echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);

 

}

 

 

 

?>

 

Thanks for the help.

Posted

Unless the price right next to the image you need to put the if statement round the code the displays the price.

 

It would be cleaner to do this

 

 

if ($product_info['products_price'] > 0){
   display price ..............
}

 

HTH

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Posted

Unless the price right next to the image you need to put the if statement round the code the displays the price.

 

It would be cleaner to do this

 

 

if ($product_info['products_price'] > 0){
   display price ..............
}

 

HTH

 

G

 

 

Thanks got the gears moving.

 

Made the changes you stated above and changed my image echo to below

 

<?php

if ($product_info['products_price'] > 0){

echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image_med']) . '" rel="lightbox">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], ULT_THUMB_IMAGE_WIDTH, ULT_THUMB_IMAGE_HEIGHT, 'hspace="1" vspace="1"') . '<br>' . tep_image_button(TEXT_CLICK_TO_ENLARGE) . '</a>';}

 

else {

 

 

 

}

?>

 

I have light box, but worked like a charm.

 

Thanks again.

Posted

Pleasure but I think you have lose the brackets and have some extra code

 

else {



}
?>

 

G

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...