2012-07-21 2 views
-1

데이터베이스에 결과가있는 경우에만 표시하려는 색상 견본 (및 AVAIALBLE COLORS 타일) 영역이 내 페이지에 있습니다. SO IST결과가 없으면 Div를 표시하지 않음 -

private function getWTVariationHighlights($productId, $variationId) 
{ 
    $output_str = ""; 
    $output_str .="<div class=\"mainProductSwatchesTitle\"><b>AVAILABLE COLOURS</b>\n"; 
    $output_str .= "<div class=\"mainProductSwatches\">\n"; 
    $sql = "select voptionid, vovalue from [|PREFIX|]product_variation_options where vovariationid=$variationId and (voname='Colour' or voname='Color')"; 
    $result = $this->db->Query($sql); 
    while ($row = $this->db->fetch($result)) { 
     $sql = "select * from [|PREFIX|]variation_option_highlight where variation_option_id=" . $row['voptionid'] . " and product_id=" . $productId; 
     $result2 = $this->db->Query($sql); 
     if($row2 = $this->db->fetch($result2)){ 
      if($row2['thumb_location']){ 
       $output_str .= "<a href=\"#\" onmouseover=\"changeMain('" . $row2['location'] . "')\"><img src=\"" 
        . $GLOBALS['ShopPath'] . "/product_images/hfh_highlight_images/" . $row2['thumb_location'] . "\" /></a>\n"; 
      } 
     } 
    } 
    $output_str .= "</div>\n"; 
    $output_str .= "<script type=\"text/javascript\">\n"; 
    $output_str .= "function changeMain(src)\n"; 
    $output_str .= "{\n"; 
     $output_str .= "document.getElementById('phthumb').src = '" . $GLOBALS['ShopPath'] . "/product_images/hfh_highlight_images/' + src;\n"; 
    $output_str .= "}\n"; 
    $output_str .= "</script>\n"; 

    return $output_str; 
} 
+2

구체적인 기술적 인 질문에 대한 주로 웹 사이트 :

여기 내 코드입니다. 너는 하나도 묻지 않는다. 정확히 무엇이 문제인지 더 많은 정보를 제공 할 수 있다면 참조하십시오. 너 뭐 벌써 해봤 니? 기타 –

답변

1

간단한 CSS를 사용

div:empty 
{display:none;} 
관련 문제