4 replies [Last post]
SeaJay Designs's picture
Offline
Joined: 09/09/2011
Juice: 10
Was this information Helpful?

Hi, (I hope this is the right place to post this) but...
I'm currently working on a website using Drupal 7 + Ubercart 3 and I have so far been unable to find a module to set products to be out of stock automatically once they have been sold.

But I did come across this thread http://drupal.org/node/384996 and in it someone suggests putting this in the theme...

function site_uc_product_add_to_cart( $node ) {
  $stocklevel = uc_stock_level($node->model);
  if (is_numeric($stocklevel)) {
    // Stock tracking is active
    if ($stocklevel <= 0) {
      return '<div class="add-to-cart out-of-stock">' . t('Out of stock') . '</div>';
    }
    else {
      return theme_uc_product_add_to_cart($node);
    }
  }
  else {
    // Stock tracking is not being used for this product, just show the add to cart button as normal
    return theme_uc_product_add_to_cart($node);
  }
}

I think it was written for D6/UC2 and it doesn't work on my theme. So dose anyone know how to update it for D7/UC3?

Any help would be great.

Thanks in advance

2faroffroad's picture
Offline
Joined: 11/04/2011
Juice: 18
How to remove UC "add to cart button" in theme

Did you add it to your theme?
Did it work?

I need a out of stock solution also.

SeaJay Designs's picture
Offline
Joined: 09/09/2011
Juice: 10
Re: How to remove UC "add to cart button" in theme

I can't add it to my theme because it was written for D6 and I'm using D7 Sad

Still looking for a solution.

Geva's picture
Offline
Joined: 02/18/2011
Juice: 112
Re: How to remove UC "add to cart buttom" in theme

Hi,
Simply to switch off the "add to cart" field -

Structure / Content types and in the line of the product - manage display
Add to cart form Format -> Hidden --- it's the default, you can set in teaser and full page view too

is it ok?

2faroffroad's picture
Offline
Joined: 11/04/2011
Juice: 18
slow D7 + uber3

Ya.
I was gong to start a new site on D7+uber3... But after I was unable to find a solution to several issues... I decided D7 + uber3 is still too new and deleted it all and started back with a D6 site.
So far D6 with uber2 has met my demands.. I may try D7 again sometime and I did love the new interface and other features..
Thanks.