Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Out of stock checkout.


bshack

Recommended Posts

Hi, Is there a way that when a customer views a product, and it is out of, they can add it to their cart? As of now if an item is out of stock you can checkout with an item out of stock? Is it possible to disable teh add to cart on out of stock items? Any help would be appreciated.

Brad Shackleford

Link to comment
Share on other sites

Backup...Backup...Backup

Create an out of stock button name it: button_out_of_stock.gif and add it to

/includes/languages/english/images/buttons/

 

Open your includes/languages/english.php file and add:

 

define('IMAGE_BUTTON_OUT_OF_STOCK', 'Out of Stock');

 

In product_listing.php find this line:

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

<td align="right" class="main"><?php If ($product_info['products_quantity']<>0){
   echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); 
}else{
   echo tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . 'button_out_of_stock_cart.gif', IMAGE_BUTTON_OUT_OF_STOCK); 
   
} ?></td>

Worked for me. Item must be active (set to green) with quantity of 0 to display 'out of stock'.

Link to comment
Share on other sites

if ($product_info['products_quantity'] > 0)

 

or

 

if ($product_info['products_quantity'] < 1)

 

(and reverse the statement)

 

but it can't be as quoted above ;)

 

fl70 wrote:

If ($product_info['products_quantity']<>0)

Link to comment
Share on other sites

This is exactly as coded in my shop.

<td align="right" class="main"><?php If ($product_info['products_quantity']<>0){
  echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
}else{
  echo tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . 'button_out_of_stock_cart.gif', IMAGE_BUTTON_OUT_OF_STOCK);
  
} ?></td>

Link to comment
Share on other sites

This is exactly as coded in my shop.
<td align="right" class="main"><?php If ($product_info['products_quantity']<>0){
? echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);
}else{
? echo tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . 'button_out_of_stock_cart.gif', IMAGE_BUTTON_OUT_OF_STOCK);
? 
} ?></td>

That may be, but it's incorrect. :)

 

It says:

 

if ($product_info['products_quantity'] less than greater than 0)

 

which makes no sense. Probably just someone's typo. ;)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...