Hello, I need to show the

block only if there is some items (images) in it, and hide it if there is any, I'm just starting to learn php, so I need some help or advice please.

It's in the following code of uc_product.module:

function theme_uc_product_image($variables) {
  static $rel_count = 0;
  $images = $variables['images'];

  // Get the current product image widget.
  $image_widget = uc_product_get_image_widget();

  $first = array_shift($images);

  $output = '<div class="product-image"><div class="main-product-image">';
  $output .= '<a href="' . image_style_url('uc_product_full', $first['uri']) . '" title="' . $first['title'] . '"';
  if ($image_widget) {
    $image_widget_func = $image_widget['callback'];
    $output .= $image_widget_func($rel_count);
  }
  $output .= '>';
  $output .= theme('image_style', array(
    'style_name' => 'uc_product',
    'path' => $first['uri'],
    'alt' => $first['alt'],
    'title' => $first['title'],
  ));
  $output .= '</a></div><div class="more-product-images">';
  foreach ($images as $thumbnail) {
    // Node preview adds extra values to $images that aren't files.
    if (!is_array($thumbnail) || empty($thumbnail['uri'])) {
      continue;
    }
    $output .= '<a href="' . image_style_url('uc_product_full', $thumbnail['uri']) . '" title="' . $thumbnail['title'] . '"';
    if ($image_widget) {
      $output .= $image_widget_func($rel_count);
    }
    $output .= '>';
    $output .= theme('image_style', array(
      'style_name' => 'uc_thumbnail',
      'path' => $thumbnail['uri'],
      'alt' => $thumbnail['alt'],
      'title' => $thumbnail['title'],
    ));
    $output .= '</a>';
  }
  $output .= '</div><div class="clearfix"></div></div>';
  $rel_count++;

  return $output;
}

Comments

longwave’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.