Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

URGENT: Want to show OUT OF STOCK items.


211655

Recommended Posts

Hi,

i need some help in getting a out of stock module.

 

in osc, if a product is out of stock, it totally takes it out from the store. i think thats not helpful, if something is out of stock, it should be in store but ppl shouldnt be allowed to add them to cart.

 

is there any way i can od that. if somethingis out of stock, it shows a text or an image and wouldnt show add to cart button.

 

now 2 things.(v imp)

- i am not using stock levels and have set all of that options to be false in admin.

- i have written a code that of a product's orice is 0$ then shoulnt show the add to cart button.

code is:

e.g,

 if (PRODUCT_LIST_BUY_NOW) {
 
         $lc_text .= (($listing['products_price'] > 0) ?  '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing['products_name'] . TEXT_NOW) . '</a><br>' : ' <br>');      
       }

 

 

should i do the same thng with product quantity. but problem, currently all products have 0 quantity, it means i have to go manually and change that(dont like that idea...more..), second i fwere to do that, how will i write the code with 2 if statements and what will b the code for out of stock. i can have an image instead of '' for out of stock.

 

Plz share any thoughts u have. its a serious problem as if something is out of stocka and i put out of stock, it takes out the product compeletely. cant be done this way.

 

thanks in advance,

Link to comment
Share on other sites

I don't understand how you can check stock without products_quantity being set..?

 

You could set a default quantity by dropping the column in the products table and recreating it with quantity :)

 

You should have 'check stock' set to true.

 

You can do it like this:

 

Buy now button:

 

          case 'PRODUCT_LIST_BUY_NOW':
           $lc_align = 'center';
           if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) { 
           $lc_text = '';
         }  else  {            
           $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
         }  
           break;
       }

 

Quantity:

 

          case 'PRODUCT_LIST_QUANTITY':
           $lc_align = 'right';
           if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) { 
           $lc_text = TEXT_STOCK;
         }  else  {             
           $lc_text = ' ' . $listing['products_quantity'] . ' ';
         }  
           break;

 

Matti

Link to comment
Share on other sites

Thanks Matti V V Much.

 

we are not using to monitor the stock. we already use some other software and just wanna monitor through that. now when we are out of some product, i want it to be still in the catalog with a text or an image saying " out of stock". i also dont want customers to add that product to the cart as i did it in products with 0 price.

 

My settings in admin section in stock area are:

Check stock level: false

Subtract stock: false

Allow Checkout : false

Mark product out of stock "Out of Stock"

Stock Re-order level: 2

 

 

Now if i dont use stock, how and what hsould be the settings then,

thanks

 

i m new to php and how i am going to call those cases? or just paste those two codes and replace with current?

 

dan

Link to comment
Share on other sites

You must use:

 

Check stock level: true

 

The others are your choice - you could set:

 

Subtract stock: false

 

.... then manually set out of stock items with zero quantity, but, I think it far better to set true stock levels and set Subtract stock: true.

 

You can use the code I posted to replace the relevant code in product_listing.php (I have not tested it) :D

 

You can use tep_get_products_stock wherever you wish, eg. product_info.php

 

Matti

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...