Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Check out with out of stock items


John W

Recommended Posts

Posted

Hi All,

 

I tried searching for a thread on this but found none.

 

About a 1.5 weeks ago my site started letting people check out with out of stock items. This is starting to be a pain.

 

Does anyone know why this would have broken?

 

Any suggestions of what I can look to fix this?

I'm not really a dog.

Posted

Hi,

 

If you go into your admin panel and click on Configuration>Stock you should make sure the option 'Allow Checkout' is set to false.

Reddy to Rumble

 

Thank you osCommerce and all who Contribute to her!

Posted

Hey Rumble,

 

Thanks for your reply, but I don't think I was clear about this. I have had it working for 6 mos and it just stopped.

 

Any ideas on code to look at?

I'm not really a dog.

Posted

In checkout_confirmation.php around line 70 i have this stock check failsafe;

 

// Stock Check

 $any_out_of_stock = false;

 if (STOCK_CHECK == 'true') {

   for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

     if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {

       $any_out_of_stock = true;

     }

   }

   // Out of Stock

   if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {

     tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

   }

 }

 

 

And in checkout_payment.php around line 38

 

// Stock Check

 if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {

   $products = $cart->get_products();

   $any_out_of_stock = 0;

   for ($i=0, $n=sizeof($products); $i<$n; $i++) {

     if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {

       $any_out_of_stock = 1;

     }

   }

   if ($any_out_of_stock == 1) {

     tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

   }

 }

 

 

And finally around line 99 of shopping_cart.php this code

 

<?php

   if ($any_out_of_stock == 1) {

     if (STOCK_ALLOW_CHECKOUT == 'true') {

?>

     <tr>

       <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td>

     </tr>

<?php

     } else {

?>

     <tr>

       <td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td>

     </tr>

<?php

     }

   }

?>

 

Check if your files have these lines, the files are all in the catalog folder.

Reddy to Rumble

 

Thank you osCommerce and all who Contribute to her!

Posted

Hey, thanks.

 

That is stock code, correct?

 

What snapshot do you have?

 

I have looked at my shopping_cart and compared it to my original install and it was okay but I haven't looked at checkout_confirmation or checkout_payment.

 

I did look at my database and it seems okay.

 

At first this didn't seem like a big deal but people are coming over from Google with a product link and buying it even thought I have it labeled out of stock.

I'm not really a dog.

Archived

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

×
×
  • Create New...