Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need Help Hiding Price when quanitity is set to zero


Guest

Recommended Posts

so i found a contribution to remove the add to cart button if the quantity is set to zero.. what i would like to do is in that code also make it so the price is hidden when the quantity is set to zero.

 

 

here is the code for the hiding the add to cart button

 

catalog/products_info.php:

 

 

Below this:

 

 

<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>

 

 

 

put this:

 

 

 

<?php if ($product_info['products_quantity'] > 0) { ?>

<b>

<td class="main"><center> <b><?php echo TEXT_PRODUCT_IN_STOCK; ?> <?php echo $product_info['products_quantity']; ?> <?php echo TEXT_PRODUCT_IN_STOCK2; ?></b></center> </td>

 

<?php } else { ?>

 

<td class="main"> <b><?php echo TEXT_PRODCUT_OUT_OF_STOCK; ?></b> </td>

</b>

<?php } ?>

 

 

<!--bof remove add to cart button-->

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

if (((STOCK_CHECK == "true")&&($product_info['products_quantity'] > 0)) or (STOCK_CHECK == "false")) {

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

} else {

echo tep_draw_separator('pixel_trans.gif', '1', '22');

}

?></td>

<!--eof remove add to cart button-->

 

 

to show the stock quantity of products in the middle of your info box (between the buttons of "reviews" and "add to cart") and to hide the "add to cart"-Button if the product is out of stock!

 

 

 

 

 

After this you have to define your languages, examples given are for german and english language:

 

 

catalog/languages/german/product_info.php:

 

 

add simply:

 

// DSQ EOF

define('TEXT_PRODUCT_IN_STOCK', 'Es sind noch');

define('TEXT_PRODUCT_IN_STOCK2', 'Artikel verfügbar.');

define('TEXT_PRODCUT_OUT_OF_STOCK', 'Dieser Artikel ist vorübergehend ausverkauft.');

// DSQ BOF

 

 

catalog/languages/english/product_info.php:

 

add simply:

 

// DSQ EOF

define('TEXT_PRODUCT_IN_STOCK', 'There are');

define('TEXT_PRODUCT_IN_STOCK2', 'products in stock.');

define('TEXT_PRODCUT_OUT_OF_STOCK', 'This product is temporary out of stock.');

// DSQ BOF

 

 

 

 

 

 

 

 

 

--------------------

 

03/08/2007 by donots

Link to comment
Share on other sites

someone?

 

Hi

 

I tried installing that mod today, but when I added it my columns all went haywire, the shopping cart dropped down and I got 2 add to cart buttons for teh lines where I do have stock.

 

Any help would be appreciated.

Link to comment
Share on other sites

Hi

 

I tried installing that mod today, but when I added it my columns all went haywire, the shopping cart dropped down and I got 2 add to cart buttons for teh lines where I do have stock.

 

Any help would be appreciated.

 

 

if you got two add to cart butons you probably didnt replace the old button maybe you took out one of the table codes to... my purchase button went to the bottom too

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...