Skip to main content

Hide inactive button associated with custom field

More
9 years 6 months ago - 9 years 6 months ago #266300 by neo191987
-- HikaShop version -- : 3.0.1

Hi I want to ask how can hide inactive button associated with custom field has no content. The goal is: made button associated with text custom field that will take the user to the official website of the product, but if for example there is no content in the field, the button to hide.

This is the button code
Code:
<div class="info-buttons"> <span class="website"> <?php $url = $this->element->website; $css_button = $this->config->get('css_button', 'hikabtn'); ?> <a href="<?php echo $url; ?>" class="<?php echo $css_button; ?>" target="_blank" data-toggle="tooltip" data-placement="top" title="Website"> <?php echo JText::_('<i class="fa fa-globe" aria-hidden="true"></i>'); ?></a> </span> </div>
Last edit: 9 years 6 months ago by neo191987.

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #266315 by nicolas
Like that:
Code:
<?php if(!empty($this->element->website)){ ?> <div class="info-buttons"> <span class="website"> <?php $url = $this->element->website; $css_button = $this->config->get('css_button', 'hikabtn'); ?> <a href="<?php echo $url; ?>" class="<?php echo $css_button; ?>" target="_blank" data-toggle="tooltip" data-placement="top" title="Website"> <?php echo JText::_('<i class="fa fa-globe" aria-hidden="true"></i>'); ?></a> </span> </div> <?php } ?>
The following user(s) said Thank You: neo191987

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #266326 by neo191987
It works perfectly. Thank you. :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.135 seconds
Powered by Kunena Forum