Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Hide "Add to Cart" and disable "Buy Now" for manufacturer


Recommended Posts

Hi all,


Figured out the solution to a problem I've been having for a while, so thought I'd share :)


Hope someone else finds it useful!





Hide Add to Cart and disable Buy Now for manufacturer v1.0 by Raj Siva-Rajah (Menathor)

***Based on Tim Elam (aka Bigredman74)'s Easy Call for Price***





DESCRIPTION: For a standard osCommerce 2.2 install. Allows you to hide "add to cart" and prevent "buy now" from adding to cart for products

under a chosen manufacturer.


REASON: There were products I wanted to display in my shop which aren't being sold in my shop - i.e. I wanted them in my catalogue as "ads" with links

in the product description to external purchase sites. Obviously, I needed to prevent the item from being added to the cart. I used Tim Elam's Easy

Call for Price (http://www.oscommerce.com/community/contributions,3211) as a starting point and modified the code to use a chosen "manufacturers_id"

rather than price. I also changed the code so the "Buy Now" buttons weren't hidden, but rather took the user to the product description instead of

adding it to the basket.


CREDITS: Tim Elam (aka Bigredman74) and everyone who contributed to the "Easy Call for Price" and “Call for Pricing / Negotiable Pricing” contributions.


LICENSE: All work is freely available under the GNU General Public License as per http://www.oscommerce.com/forums/index.php?act=boardrules. A copy of the GNU General Public License Version 2, June 1991 is included with this package as LICENSE.TXT.

Link to comment
Share on other sites

  • 6 months later...

Menathor thank you for your contribution.

I am looking for a variation on this.

I would like to hide the "Add to Cart" for non-logged in users.

I've looked at your code but I am not proficient in PHP.

I guess there is a variable to indicated where the user is logged in and I should test for that and hide the icon if not logged in.

Any help would be appreciated.

Link to comment
Share on other sites

The test would be:


  if (tep_session_is_registered('customer_id')) {
  //show cart



Remember, What you think I ment may not be what I thought I ment when I said it.




Auto Backup your Database, Easy way


Multi Images with Fancy Pop-ups, Easy way


Products in columns with multi buy etc etc


Disable any Category or Product, Easy way


Secure & Improve your account pages et al.

Link to comment
Share on other sites

Thanks Sam.

I added your suggestion around the line that displays the "Add to Cart" button in product_info.php but now it doesn't show at all. Logged in or not.


Here is what I did;


<!-- BEGIN Hide Add to Cart until logged in -->


if (tep_session_is_registered(customer.id)) {


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




<!-- END Hide Add to Cart until logged in -->

Link to comment
Share on other sites

  • 6 months later...

Hi all,


Looking to use Menathor's contrib but hide the buttons based on catagory instead of manufacturer.


I think I need to change the line:

	      if ($product_info['manufacturers_id'] == 1){ 



        if ($category[categories_name] == 'xxx') {  

where xxx would be the catagory name of the products people can't buy online.


Your feedback would be helpful.


Thanks, JR

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...