Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

is there a way to remove add to cart on some items?


birdmantx

Recommended Posts

I have a website where some items can not be shipped. Is there a way I can remove the add to cart but only for the items that cant be shipped?

 

Thank you,

Sam

Flying away to get back to work.

Link to comment
Share on other sites

if u want what i think u want http://addons.oscommerce.com/info/3076

Sam

 

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

 

Contributions:

 

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

if u want what i think u want http://addons.oscommerce.com/info/3076

 

Let me explain my situation better. I have a online store thats sells pet products and pets. of course the pets cant be shipped by mail so I would like to remove the add to cart buttons on them. Would it be better just to add a page and keep them seperate? If so what do I need to do to add a page where I can also have images and descriptions of each. Thank you!!

Sam in TX

Flying away to get back to work.

Link to comment
Share on other sites

this sort of thing may have that, otherwise u may have to look at adding a field to the table & working on that

Sam

 

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

 

Contributions:

 

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

Make the products that you do not want to ship have a shipping weight of 0, then find this code on the product_info.php page:

 

<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 it with:

 

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

<?php

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

echo ' ';

} else {

 

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

}

?></td>

 

This will check the weight of the product and if it is less than 1 pound the button will not show.

Link to comment
Share on other sites

Make the products that you do not want to ship have a shipping weight of 0, then find this code on the product_info.php page:

 

<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 it with:

 

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

<?php

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

echo ' ';

} else {

 

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

}

?></td>

 

This will check the weight of the product and if it is less than 1 pound the button will not show.

Link to comment
Share on other sites

I just realized that my solution was for products displaying no price, so you will need to edit my solution to change

 

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

 

to look at weight instead of price.

Link to comment
Share on other sites

  • 6 months later...

I just realized that my solution was for products displaying no price, so you will need to edit my solution to change

 

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

 

to look at weight instead of price.

 

 

I know that this thread is a little old now, but have just been using this code to remove the "add to cart" option if the weight is zero.

 

In fact, could not get it to work with zero, so set it to 999.

 

Anyway, thought that I would just add, that in order to get this to work, you need to modify the query string on line 72 that looks like

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_weight, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

to include p.products_weight otherwise it will not work!

 

I have also noticed, that if you select category (in the category box) to display the items as a list, you still get the "buy now" button available. If someone can tell me which file is used to generate that list, I will work out the code so the "buy now" button is not displayed here as well.

Link to comment
Share on other sites

  • 1 year later...

Hi! I hope someone's still around, even though this is pretty old. I loved this solution for the two "0" price products I have on my catalog. I only have one little problem: I not only can't apply the same code to the "buy now" button, but it is the only case in which "buy now" adds directly to cart. hmmmm

 

Thoughts?

Thanks!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...