Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Archived

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

graysonhobby

A simple way to remove the "add to cart" and "buy now" buttons from cart if quantity is 0.

Recommended Posts

So far all the contibutions and help I have seen seem to make this too complicated. I just want to disable the buy now and add to cart buttons when stock is 0 or less

 

Im able to get the Detail product button LINK working, however, The Buy Now Button still shows. LINK Im thinking the change needs to be made in

 

catalog/includes/modules/product_listing.php but right now I know enough to be dangerous.

 

I made the 1st change under

 

catalog/product_info.php

 

<((>--Find--<))>

			<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>


<((>--Replace with--<))>

	<?php if ($product_info['products_quantity'] > 0 ) { ?>
			<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
	<?php } else { ?>
		<td class="main" align="right"><?php echo NON_ONLINE_ITEM; ?></td>
	<?php } ?>

 

Then

 

catalog/includes/languages/english.php

<((>--ADD THIS TO THE BOTTOM OF THE FILE (before '?>')--<))>

// No Buy Button If Quantity = 0
define('NON_ONLINE_ITEM','Product Not Available');

 

So I suppose I just need the Buy Now to work.

 

Thanks

Share this post


Link to post
Share on other sites
So far all the contibutions and help I have seen seem to make this too complicated. I just want to disable the buy now and add to cart buttons when stock is 0 or less

 

Im able to get the Detail product button LINK working, however, The Buy Now Button still shows. LINK Im thinking the change needs to be made in

 

catalog/includes/modules/product_listing.php but right now I know enough to be dangerous.

 

I made the 1st change under

 

catalog/product_info.php

 

<((>--Find--<))>

			<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
<((>--Replace with--<))>

	<?php if ($product_info['products_quantity'] > 0 ) { ?>
			<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
	<?php } else { ?>
		<td class="main" align="right"><?php echo NON_ONLINE_ITEM; ?></td>
	<?php } ?>

 

Then

 

catalog/includes/languages/english.php

<((>--ADD THIS TO THE BOTTOM OF THE FILE (before '?>')--<))>

// No Buy Button If Quantity = 0
define('NON_ONLINE_ITEM','Product Not Available');

 

So I suppose I just need the Buy Now to work.

 

Thanks

 

I added this with the above and it works fine.

 

http://www.oscommerce.com/community/contributions,3703

Share this post


Link to post
Share on other sites

×