Basic PHP if statement echo issue -
i've got issue want check, if product has options attached it, want output different in list.
so want output following:
if product has options attached it, should formatted this:
price from: £1.99
if product has no options attached it, should formatted this:
price: £1.99
the words cost from: , price: localised , beingness pulled separate php file.
i'm not sure going wrong here, code:
<li> <?php if(count($options)>1): ?> <span class="normal"><?php echo $text_price_from; ?></span> <?php else: ?> <span class="normal"><?php echo $text_price; ?></span> <?php endif; ?> <span class="price"><?php echo $price; ?></span> </li>
in html output, shows span empty.
strange is, works if write work statically in first span. example, works:
<li> <?php if(count($options)>1): ?> <span class="normal">from:</span> <?php else: ?> <span class="normal"><?php echo $text_price; ?></span> <?php endif; ?> <span class="price"><?php echo $price; ?></span> </li>
anyone got ideas? platform opencart.
thanks mel
your language file need have a
$_['text_price_from'] = 'from:';
and controller needs have
$this->data['text_price_from'] = $this->language->get('text_price_from');
this issue - missing 1 of pieces of puzzle. if it's not, other explanation variable beingness unset in either language file, controller or perchance template
php if-statement echo opencart
No comments:
Post a Comment