Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

display show product quantity/ stock level text


mc8000

Recommended Posts

To display stock quantity with some text edit the file includes/modules/product_listing_col.php

 

Change the following line as seen here. I have used the words 'in stock' around line 151

 

$lc_text = ' ' . $listing[$x]['products_quantity'] . ' in stock';

Link to comment
Share on other sites

To display stock quantity with some text edit the file includes/modules/product_listing_col.php

 

Change the following line as seen here. I have used the words 'in stock' around line 151

 

$lc_text = ' ' . $listing[$x]['products_quantity'] . ' in stock';

 

Could you help me some more. I have modified the fill, product_listing.php, since I do not have a product_listing_col.php?.

 

But what do I need to do to have the stock displayed together with the name and price?

Link to comment
Share on other sites

  • 4 years later...

Here is what I did that worked well. I am sure there is a better coding way to do this, but this seems to work fine.

 

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

if (tep_not_null($listing[$x]['specials_new_products_price'])) {

$lc_text = ' <s>' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span> ';

} else {

if (tep_get_products_stock($listing[$x]['products_id']) < 100 )

$lc_text = 'Inventory: ' . tep_get_products_stock($listing[$x]['products_id']) .'</br>' . ' <font color="black" size="2"><b>' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' </font></b>';

if (tep_get_products_stock($listing[$x]['products_id']) > 99 )

$lc_text = 'Inventory: ' . 'Over 100' .'</br>' . ' <font color="black" size="2"><b>' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' </font></b>';

if (tep_get_products_stock($listing[$x]['products_id']) < 1 )

$lc_text = 'Inventory: ' . '<font color=red><b>Out Of Stock</b></font>' .'</br>' . ' <font color="black" size="2"><b>' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' </font></b>';

}

break;

Link to comment
Share on other sites

Chris,

 

You replied to a 5 year old post, that was referring to an out-dated version of osCommerce. Your code refers to v2.3.1

 

 

 

 

Chris

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...