Contributions
Low Stock, Order Soon
To create a sense of urgency and let customers know a product has only one item left in stock.
<!-- bof limited supply -->
<?php
$limitedSupply_query = "SELECT products_quantity, products_id
FROM " . TABLE_PRODUCTS . "
WHERE products_id = '" . (int)$_GET['products_id'] . "' ";
$limitedSupply = tep_db_query($limitedSupply_query);
if ($product_info['products_quantity'] < 5) {
echo '<font color="#ff0000"><strong><div align="center"><div id="limited">Low Stock, Order Soon !</div></strong></font>';
}
?>
<!-- eof limited supply -->
Paste the code in the file where you would like the alert message to appear, I usually put it just above the Add to Cart button. Upload the edited file to root directory /product_info.php
if you want the low stock alert to show when there are 3 items or less, you would change
if ($limitedSupply->fields['products_quantity'] < 1)
to
if ($limitedSupply->fields['products_quantity'] < 3)
| 24 Oct 2009 |
To create a sense of urgency and let customers know a product has only one item left in stock.
<!-- bof limited supply -->
<?php
$limitedSupply_query = "SELECT products_quantity, products_id
FROM " . TABLE_PRODUCTS . "
WHERE products_id = '" . (int)$_GET['products_id'] . "' ";
$limitedSupply = tep_db_query($limitedSupply_query);
if ($product_info['products_quantity'] < 5) {
echo '<font color="#ff0000"><strong><div align="center"><div id="limited">Low Stock, Order Soon !</div></strong></font>';
}
?>
<!-- eof limited supply -->
Paste the code in the file where you would like the alert message to appear, I usually put it just above the Add to Cart button. Upload the edited file to root directory /product_info.php
if you want the low stock alert to show when there are 3 items or less, you would change
if ($limitedSupply->fields['products_quantity'] < 1)
to
if ($limitedSupply->fields['products_quantity'] < 3)
Note: Contributions are used at own risk.
