Product show view - displaying height/width etc

  • Posts: 78
  • Thank you received: 0
13 years 9 months ago #8606

I have the following code

<table>
<tr><td>

<span id="hikashop_product_height_main" class="hikashop_product_height_main">
                             <?php echo '<strong>Height:&nbsp</strong></td><td> '.($this->element->product_height).' '.$this->element->product_dimension_unit; ?>
                      </span></td></tr>
<tr><td>
<span id="hikashop_product_width_main" class="hikashop_product_width_main">
                              <?php echo '<strong>Width:&nbsp</strong></td><td> '.($this->element->product_width).' '.$this->element->product_dimension_unit; ?>
                      </span></td></tr>
<tr><td>
<span id="hikashop_product_length_main" class="hikashop_product_length_main">
                              <?php echo '<strong>Depth:&nbsp</strong></td><td> '.($this->element->product_length).' '.$this->element->product_dimension_unit; ?>
                      </span></td></tr>
<tr><td>&nbsp</td></tr>
<tr><td>

<span id="hikashop_product_length_main" class="hikashop_product_length_main">
                              <?php echo '<strong>Weight:&nbsp</strong></td><td> '.($this->element->product_weight).' '.$this->element->product_weight_unit; ?>
                      </span></td></tr>

</table>

displaying the dimension on the product_show view like this


What changes would I need to make to stop displaying these properties when their value is zero?

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #8619

For example, instead of :

echo '<strong>Height: </strong></td><td> '.($this->element->product_height).' '.$this->element->product_dimension_unit;

you should write:
if(bccomp($this->element->product_height,0,3)>0){
echo '<strong>Height: </strong></td><td> '.($this->element->product_height).' '.$this->element->product_dimension_unit;
}

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

  • Posts: 78
  • Thank you received: 0
13 years 9 months ago #8628

Perfect

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

Time to create page: 0.061 seconds
Powered by Kunena Forum