i work in a new Company and they have a complicated cms and i dont know what to do.
The issue:
There are Products, they have a Option and some have no Options. This Code under this is in the first page of the shopping card:
<div class="warenkorb_tarifoptionen" id="warenkorb_zusatz_label">Choose Option: </div>
<?php
foreach($warenkorb_tarif['tarifoptionen'] as $option_id => $tarifoption) {
echo '
<div class="warenkorb_tarifoptionen_name">'.$tarifoption['optionsname'].':</div>
<div class="warenkorb_selectbox" id="warenkorb_aktion_verfugbar">'.$tarifoption['optionsanzeige'].'</div>
<div class="warenkorb_optionsinfo">'.$tarifoption['optionsmouseover'].'</div>
<div class="clear"></div>
';
}
}
?>
Some Products have Options. Then it makes sense to choose a Option. But the Text: Choose Option: is also shown by products without a option.
The Question: can i disable this text by products without a Option? Because the text is always online - even there is nothing to select.
Thank you guys, its my first time here in this platform. I hope you unstand my issue.
Wrap the whole block in a check to see if any options exist, before outputting anything.
<?php if (!empty($warenkorb_tarif['tarifoptionen'])): ?>
<div class="warenkorb_tarifoptionen" id="warenkorb_zusatz_label">Choose Option: </div>
<?php
foreach($warenkorb_tarif['tarifoptionen'] as $option_id => $tarifoption) {
echo '
<div class="warenkorb_tarifoptionen_name">'.$tarifoption['optionsname'].':</div>
<div class="warenkorb_selectbox" id="warenkorb_aktion_verfugbar">'.$tarifoption['optionsanzeige'].'</div>
<div class="warenkorb_optionsinfo">'.$tarifoption['optionsmouseover'].'</div>
<div class="clear"></div>
';
}
}
?>
<?php endif; ?>
@Karsten Koop - you was right!
if (!empty($warenkorb_tarif['tarifoptionen']))
made it!