
Originally Posted by
Feznizzle
I used your in two places like this:
FIRST (this one is in product details list)
<?php if ($products_quantity > 0) {echo (($flag_show_product_info_quantity == 1) ? '<li>' . TEXT_PRODUCT_QUANTITY . '</li>' : '') . "\n"; } ?>
SECOND (below my add to cart)
<!--bof disclaimer -->
<?php if ($products_quantity > 0) {echo
'<div id="disclaimer1">*<em>Order must be received by 2pm EST.</em></div>'
;} ?>
<!--eof disclaimer -->
Worked perfect, thanks MC!
Those are a little different than what you suggested. Had to add "echo", some apostrophes, and semicolon before close.
Did I do anything wrong?
Not "wrong". It is in a style that where files are edited, they could possibly be edited to be entered differently. As code editing software (IDEs for example) has gotten better, it can identify unmatched html for example in the midst of php code when the html is presented as html instead of echoed php. The second example would be cleaner than the first in this format:
Code:
<?php if ($products_quantity > 0) {
if ($flag_show_product_info_quantity == 1) {
?><li><?php echo TEXT_PRODUCT_QUANTITY; ?></li><?php
}
echo "\n";
}
?>
SECOND (below my add to cart)
Code:
<!--bof disclaimer -->
<?php
if ($products_quantity > 0) {
?><div id="disclaimer1">*<em>Order must be received by 2pm EST.</em></div><?php
} ?>
<!--eof disclaimer -->
Then of course there is the hardcoding of the "sentence" instead of using a define and the use of \n instead of say <br /> or something similar to make it easier to apply css if needed or desired. Also your page display for a product without sufficient quantity will be slightly different from one that does wherher quantity is permitted to be displayed or not because of the additional end of line that is used only for when there is sufficient quantity. But nothing is wrong about what was done from a gives the desired results as so far expressed.