clare485
11/19/2014 - 10:08 AM

only echo attribute if it's filled in

only echo attribute if it's filled in

// for a dropdown
                                  $manufacturer = trim($_product->getAttributeText('manufacturer')); 
                                    if ($manufacturer) {
                                      echo "<tr>
                                              <td class='manufacturer'>
                                              <span class='label'>Manufacturer:</span>
                                          </td>
                                          <td class='manufacturer'>
                                            <span class='value'>".$manufacturer."</span>
                                           </td>
                                      </tr>";
                                  }
                              
// for a textfield

                                $getbike_colour = trim($_product->getbike_colour());
                                if ($getbike_colour) {
                                  echo "<tr>
                                              <td>
                                              <span class='label'>Colour:</span>
                                              </td>
                                              <td>
                                                <span class='value'>" . $getbike_colour . "</span>
                                            </td>
                                          </tr>";
                                    }