db->query("select products.*, product_seo.page_title, product_seo.meta_keywords, product_seo.meta_description from products left join product_seo on product_seo.product_uid = products.uid where products.uid='".$formarray["uid"]."' limit 1");
if (count($products) != 1) {
header("Location: ".SITE_URL."products.html");
exit();
}
$product = General::prepare_formarray_for_display($products[0]);
$page_title = ($product["page_title"] == ""?strip_tags(General::fixtext($product["name_raw"],"tinymce_inline")):$product["page_title"]);
$meta_description = ($product["meta_description"] == ""?strip_tags(General::fixtext($product["name_raw"],"tinymce_inline")):$product["meta_description"]);
$meta_keywords = ($product["meta_keywords"] == ""?strip_tags(General::fixtext($product["name_raw"],"tinymce_inline")):$product["meta_keywords"]);
echo $page->build_start($page_title, $meta_description, $meta_keywords);
$_SESSION["sess_product_selected"] = $product["uid"];
?>
build_body("");
echo $page->build_head();
?>
".General::fixtext($product["name_raw"],"tinymce_inline")."
\n";
echo General::fixtext($product["description_raw"],"tinymce");
echo "
\n";
// check for pricing table
$pricing = $page->db->query("select * from product_pricing where product_uid = '".$product["uid"]."' order by line ASC");
if (count($pricing) > 0) {
echo "
Quantity | \n";
for($x=0; $x<$product["colors"]; $x++) echo "".($x+1)." COLOR | \n";
echo "
";
foreach($pricing as $p) {
$pricing = $p["quantity_low"]."-".$p["quantity_high"];
if ($p["quantity_high"]=="") $pricing = ">".$p["quantity_low"];
echo "".$pricing." | ";
for($x=0; $x<$product["colors"]; $x++) echo "\$".General::cash($p["price".($x+1)])." | \n";
}
echo "
";
echo "
";
}
// check for bulleted notes
$notes = $page->db->query("select * from product_notes where product_uid = '".$product["uid"]."' order by line ASC");
if (count($notes) > 0) {
echo "
\n";
foreach ($notes as $n) echo "- ".General::fixtext($n["note"],"tinymce_inline")."
\n";
echo "
\n";
}
// check for colors (will use later)
$colors = $page->db->query("select * from product_colors where product_uid = '".$product["uid"]."' order by line ASC");
if (count($colors) > 0) {
echo "
Available in ".(count($colors)>1?"these colors":"one color").":
Click on a color to start designing with that color.";
echo "
";
$num_columns = 10;
$col = 1;
foreach($colors as $c) {
$image = "";
// see if there is a specific image for this color (detail image)
$details = $page->db->query("select product_uid, line from product_colors where uid='".$c["uid"]."' limit 1");
$detail = $details[0];
if (file_exists(SITE_PATH."images_product_detail/".$detail["product_uid"]."_".$detail["line"].".jpg")) {
list($width, $height) = getimagesize(SITE_PATH."images_product_detail/".$detail["product_uid"]."_".$detail["line"].".jpg");
$image = SITE_URL."images_product_detail/".$detail["product_uid"]."_".$detail["line"].".jpg";
}
if ($image == "") {
// no image, grab the default image
$product = $products[0];
if (file_exists(SITE_PATH."images_product/".$product["uid"].".jpg")) {
$image = SITE_URL."images_product/".$product["uid"].".jpg";
list($width, $height) = getimagesize(SITE_PATH."images_product/".$product["uid"].".jpg");
} else {
$image = SITE_URL."images_product/image_missing.jpg";
$height = 245;
$width = 200;
}
}
$onmouseover_js = "onmouseover = \"document.images.prod_image.src='$image'; document.getElementById('prod_image').style.width='".$width."px'; document.getElementById('prod_image').style.height='".$height."px';\"";
if ($col==($num_columns+1)) {
$col = 1;
echo "\n";
}
if($col==1) echo "\n";
echo "".General::fixtext($c["name"])." | \n";
$col++;
}
// finish up the table - the TR is always open
for($x=0; $x<($num_columns - ($col-1)); $x++) echo " | ";
echo "
";
}
if (General::fixtext($product["description_bottom_raw"],"tinymce_inline") != "") {
// above, can't cehck for "" natively because it might be
from tinymce
echo "
",General::fixtext($product["description_bottom_raw"],"tinymce");
}
echo "
";
?>
draw_flair();
echo $page->end_body("");
?>