Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Hide Buy Now/add To Cart Button


Silverado05

Recommended Posts

Hello, I am working with this one contribution to hide the buy now/ add to cart button if sold out but still show the product. I have successfully installed this to my product info but I am having problems with this on my product_listing page. It is section of code to copy and paste but for some reason when I add it it shows all items as sold out even if it isn't.

 

 

Here is the contribution:

Show Sold Out Items

 

 

Here is a screen shot of what it is doing.

 

productlistingcb9.png

 

 

 

I have even tried this on a clean shop and still doesn't work. Anyone know of a code that works to remove the buy now button from the product_listing page successfully? I use to have one installed that worked but can't find it now. So if anyone can help me out that would be great.

 

-Thanks

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

I have tried a couple of other ones with no luck. Anyone offer any insight or help.

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

  • 2 weeks later...

I am still having no luck with this. Here is the code from the install file.

 

Find this:

 

$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> ';

 

And replace with this:

 

/** original **/ //$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> ';

/** show-soldout-v1.0 **/
if($listing['products_quantity'] <= 0 || $listing['products_status']==0)
$lc_text = tep_image_button('button_sold_out.gif', IMAGE_BUTTON_SOLD_OUT) . ' ';
else
$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> ';
/** end show-soldout-v1.0 **/

 

 

Pretty simple cut and dry straight forward installation and has you can see from the pic in the first post that is what it does. Not matter if it is sold out or not it is removing the buy now button with the code above.

 

So does anyone have an idea of how to remove the buy now buttons if sold out successfully on the product listing page.

 

I have achieved this on the product info but the listing page is giving me some troubles.

 

-Thanks

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

Solved

Search the forum and contributions before posting. If that doesn't work, keep looking, then post. The forum is for seeking help and advice NOT for someone to do your work for you. Try to do something on your on, if you are going to run a shop then learn how it works.

Link to comment
Share on other sites

  • 3 months later...

i've used this code to solve the same problem.. i would also like to hide the price if the item is out of stock.. how would i go about that?

Link to comment
Share on other sites

  • 1 month later...
Solved

Hi

Can you please share how you solved this problem?

I used the same contrib.

In ny product listing page, it still displays the BUY NOW button even if the product is out of stock.

It only shows the SOLD OUT button when I click on the product picture for more info and the add to cart button is replaced with the SOLD OUT button...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...