.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
I apologize, I should have elaborated more. Using the code found in this thread I now have a section in the product page that changes from "In Stock"
to "Low Stock"
But when sold out it reads "In Stock"
In includes/templates/mytemplate/templates/tpl_product_music_info_display I have
In includes/languages/english/mytemplate/product_info.php I havePHP Code:
<?php
if ($products_quantity == 1) {
echo '<li>' . TEXT_ONE_LEFT . '</li>';
} else {
if ($products_quantity == 2) {
echo '<li>' . TEXT_TWO_LEFT . '</li>';
} else { echo '<li>' . TEXT_IN_STOCK . '</li>';}}
?>
PHP Code:
<?php
define('TEXT_ONE_LEFT', '<b>Last One!</b>');
define('TEXT_TWO_LEFT', 'Low Stock');
define('TEXT_IN_STOCK', 'In stock');
?>
I would like to have it read "Out of stock" when the quantity reaches zero but am at a loss as how to make that happen.
Thanks!
I tried
PHP Code:
<?php
if ($products_quantity == 0) {
echo '<li>' . TEXT_SOLD_OUT . '</li>';
} else {
if ($products_quantity == 1) {
echo '<li>' . TEXT_ONE_LEFT . '</li>';
} else {
if ($products_quantity == 2) {
echo '<li>' . TEXT_TWO_LEFT . '</li>';
} else { echo '<li>' . TEXT_IN_STOCK . '</li>';}}
?>But it produced a blank page.PHP Code:
<?php
define('TEXT_SOLD_OUT', 'Out of Stock');
define('TEXT_ONE_LEFT', 'Last One!');
define('TEXT_TWO_LEFT', 'Low Stock');
define('TEXT_IN_STOCK', 'In stock');
?>
Because you used else instead of elseif, you don't have enough closed parenthesis. Try this (I didn't test it):
PHP Code:
<?php
if ($products_quantity == 0) {
echo '<li>' . TEXT_SOLD_OUT . '</li>';
} else {
if ($products_quantity == 1) {
echo '<li>' . TEXT_ONE_LEFT . '</li>';
} else {
if ($products_quantity == 2) {
echo '<li>' . TEXT_TWO_LEFT . '</li>';
} else { echo '<li>' . TEXT_IN_STOCK . '</li>';
}
}
}
?>
Bookmarks