Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Zero Quantity Peculiarity


HLT

Recommended Posts

Why is it that when a product is at zero quantity, it still shows on the product list and customers can still add it to cart? Admittedly they get a warning that Qty 1 is too much, and there isn't sufficient stock on hand, but they're able to check out no problem.

 

However if you immediately go back and try to reorder, the quantity is of course at -1, and the store has removed it from view, turned it off, little red dot.

 

Why isn't it off when it hits zero? Little red dot then?

 

HLT

.

www.hairlosstalk.com

Consumer Hair Loss Information & Support

Link to comment
Share on other sites

Did you manually change the quantity to 0? Or did the purchase change the quantity to 0?

 

Have you commented out on the checkout_process.php the section of code that sets the products_status to 0?

 

If you manually set the quantity to 0, the code never processes the switch from a positive quantity to <= 0 so the switch is never thrown to set the products_status to 0, the little red dot.

 

If you commented out the code in checkout_process.php or added an add-on that might of commented out the code, then again, the switch is never thrown to set the products_status to 0, the little red dot.

Link to comment
Share on other sites

I see. So going from quantity of 1 to quantity of zero via a *PURCHASE* will turn it to Red and hide it from view?

 

HLT

.

www.hairlosstalk.com

Consumer Hair Loss Information & Support

Link to comment
Share on other sites

Correct.

 

Manually setting products_quantity to 0 does not process it via any code to make the switch from products_status=1 to products_status=0 (little red light)

 

To do it *Manually* you edit the product in the Admin and set the the In Stock or Out of Stock radio button and you can set the products_quantity to 0. Setting the In Stock/Out of Stock is the same as switching the green/red light.

 

So you could have a products_quantity of 100 but set the product out of stock (little red light) and it will not show.

Link to comment
Share on other sites

I want all of my products to be shown all the time, even if they have a red light status :)

 

I would like the insufficient stock mark to appear after the product name where ever it appears if it is out of stock.

 

Is this possible?

 

Thank you :D

Mary

Link to comment
Share on other sites

What you need to do is not have it switched to products_status=0 and have a code change for when products_quantity <=0 the buy now and in cart links read Out of Stock

Link to comment
Share on other sites

In the checkout_process.php is where the stock is checked and then dropped by the quantity purchased. If this quantity hits <= 0 then the products_status switches to 0 and the product will not display.

 

What you want to happen is allow the adjustment to the stock, but not set the product_status to 0 so the product still shows.

 

You need to edit the product_info.php and product_listing.php and anywhere else with a buy now or in cart button exists to show the product as out of stock and not allow the purchase.

 

This can be done by testing the products_quantity for being <= 0

Link to comment
Share on other sites

To keep the status green, I only had to change a 0 to a 1. Thanks for your help!

 

if ($stock_left < 1) {

         tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '1' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

       }

Mary

Link to comment
Share on other sites

Hello,

 

I'm having trouble again :cry:

 

I got the STOCK_MARK_PRODUCT_OUT_OF_STOCK(***) to show up on the product_info page, but I've tried so many different ways on the product_listing page and I'm not having any luck.

 

I'm not getting any errors, but the *** also doesn't show up.

 

catalog/includes/modules/product_listing.php 



        case 'PRODUCT_LIST_NAME':

           $lc_align = '';

           if (isset($HTTP_GET_VARS['manufacturers_id'])) {

             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';

 if ($stock_left < 1) {

         STOCK_MARK_PRODUCT_OUT_OF_STOCK;

      	 }

           } else {

           $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';

           }

 

Anyone know what I'm doing wrong?

 

Thank you

Mary

Link to comment
Share on other sites

Where are you defining $stock_left

 

And what is the statement STOCK_MARK_PRODUCT_OUT_OF_STOCK in the IF statement suppose to be doing? It kind of looks like it is just sitting out there in space with no purpose ... :shock:

Link to comment
Share on other sites

I'm finally making progress. The code below displays a nice *** in the product listing after the quantity if the product is out of stock.

 

modules/product_listing.php



if (($listing['products_quantity']) <=1) { 

 $lc_text = ' ' . $listing['products_quantity'] . ' <span class="stock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . ' </span>';

} else { 

 // Instock 

}

 

I really wanted the *** to be displayed after the product name and I can't figure out how to do that. The $lc_text thingies are giving me trouble. The code below is what I currently have on my page and it is displaying the *** if a product is out of stock, but it shows up at the top of the page :cry: How should I modify my code so *** shows up after the product name?

 

case 'PRODUCT_LIST_NAME':

           $lc_align = '';

           if (isset($HTTP_GET_VARS['manufacturers_id'])) {

             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . TEXT_IMAGE_CNC_PORTED . $listing['products_name'] . '</a>';

           } else {

           $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . TEXT_IMAGE_CNC_PORTED . $listing['products_name'] . '</a>';

           }     

           if (($listing['products_quantity']) <=1) { 

              echo 'howdy <span class="stock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . ' </span>';

           }

           break;

 

Thank you!

Mary

Link to comment
Share on other sites

The reason that it is at the top of the page is the section you are in is building a statement to be displayed further down.

 

Your addition is echoing it right there so it has no where to go and ends up showing at the top.

 

If you were to add it to the content of $lc_text ... then later down the code when $lc_text is displayed, it would show up where you put it in that line of text.

 

Something like would add it to the end of the link:

$lc_text .= 'howdy <span class="stock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . ' </span>';

 

If you move your IF statement above the other $lc_text in this case statement, then do the $lc_text .= on them they will be added after the ****

 

You will have to play with it a bit to get the layout the way you want it.

 

But, the main problem is you are echoing the info at the wrong time and should be adding the additional text or **** to the $lc_text in this case statement.

 

Got all that? :shock:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...