0) ? $_GET['t'] : ''; if ($_GET['i']) { $item = $_GET['i']; if ($_GET['c']) { $cat = $_GET['c']; } else { $query = 'select `group_fk` from `zsf_products` where `id` = \'' . $item . '\''; $res = mysql_query($query, $conn); list ($cat) = mysql_fetch_row($res); header('Location: detail.html?i=' . $item . '&c=' . $cat . '&t=' . $flytype); } if ($flytype > 0) { $query = 'select `id`, `pname`, `pimage` from `zsf_products` where `id` in (select `prodid_FK` from `zsf_flytypes` where `typeid_FK` = ' . $flytype . ') order by `pname`'; $res = mysql_query('select `id`, `name` from `zsf_categories`'); while ($row = mysql_fetch_assoc($res)) { extract($row); $flytypes[$id] = $name; } } elseif ($navids['s'][$cat][1] <> '') $query = 'select `id`, `pname`, `pimage` from `zsf_products` where `group_fk` = ' . $cat . ' order by `pname`'; else $query = 'select `id`, `pname`, `pimage` from `zsf_products` where `id` in (select `prodid_fk` from `zsf_specials` where `group_fk` = ' . $cat . ') order by `pname`'; $res = mysql_query($query, $conn); while ($row = mysql_fetch_array($res)) { $itemids[] = $row[0]; $products[$row[0]] = $row[1]; $imgs[$row[0]] = $row[2]; } $prodmenu = ''; $key = array_search($item, $itemids); $previd = $itemids[($key - 1)]; $nextid = $itemids[($key + 1)]; $prev = ($previd) ? '<< prev' : '<< prev'; $next = ($nextid) ? 'next >>' : 'next >>'; $query = 'select `pname`, `pimage`, `description`, `price`, `size`, `gname`, `gdir`, g.`id` from `zsf_products` p, `zsf_groups` g where p.`id` = ' . $item . ' and p.`group_fk` = g.`id`'; $res = mysql_query($query, $conn); list ($pname, $pimage, $description, $price, $size, $gname, $gdir, $gid) = mysql_fetch_row($res); if ($cat > 6) { $query = 'select `gname` from `zsf_groups` where `id` = ' . $cat; $res = mysql_query($query, $conn); list ($gname) = mysql_fetch_row($res); } if ($price == 0) { $query = 'select m.qty, m.price from zsf_products p, zsf_prices m where p.id = ' . $item . ' and p.price_fk = m.keyf'; $res = mysql_query($query, $conn); while ($row = mysql_fetch_assoc($res)) { extract($row); $prices[$qty] = $price; } } $query = 'select `sort`, `iname` from `zsf_images` where `prodid_fk` = ' . $item . ' order by sort'; $res = mysql_query($query, $conn); while ($row = mysql_fetch_assoc($res)) { extract($row); $images[$sort] = $iname; } $query = 'select `size` is_size, `qty` is_avail from `zsf_inventory` where `prodid_fk` = ' . $item; $res = mysql_query($query, $conn); while ($row = mysql_fetch_assoc($res)) { extract($row); $is_size = ($is_size) ? $is_size : 0; $instock[$is_size] = $is_avail; } $query = 'SELECT `phpsessid` pndg_sessid, `size` pndg_size, `qty` pndg_qty FROM `zsf_pending` where `prodid_fk` = ' . $item; $res = mysql_query($query, $conn); while ($row = mysql_fetch_assoc($res)) { extract($row); $pndg_size = ($pndg_size) ? $pndg_size : 0; $pending[$pndg_size] += $pndg_qty; if ($pndg_sessid == $_COOKIE['PHPSESSID']) { if ($pndg_size) { $basket[$pndg_size] = $pndg_qty; } else { $basket = $pndg_qty; } } } $query = 'select `size` csize, `price` cprice from `zsf_clearance` where `prodid_fk` = ' . $item . ' order by `size`'; $res = mysql_query($query, $conn); while ($row = mysql_fetch_assoc($res)) { extract($row); $clearprods[$csize] = $cprice; } } else { header('Location: ../index.html'); } //print_arr($pending); $enlarge = ($gdir == 'books') ? false : true; if (is_array($basket)) { $sizevals = array(); for ($i = 4; $i <= 24; $i += 2) { $sizevals[$i] = 0; } foreach($basket as $svsize => $svqty) { $svsize = ($svsize) ? $svsize : 0; $sizevals[$svsize] = $svqty; } } else { $sqty = ($basket) ? $basket : 0; } ?> <?php if ($pname) { echo $pname . ' / '; } ?>StreamFlies.com / 541-218-1994
Home: '; if ($flytype > 0) { echo '' . $flytypes[$flytype] . ': '; } else { echo '' . $gname . ': '; } echo $pname . '[back]

' . "\n"; echo ''; echo '' . "\n"; echo '' . "\n"; echo '
' . $prev . '     ' . $prodmenu . '     ' . $next . '
' . "\n"; if ($enlarge) { echo '

Click the image to enlarge
' . $pname . '.jpg

' . "\n"; } else { echo '

' . $pname . '.jpg

' . "\n"; } if ($images) { echo '' . $pimage . '.jpg'; $imgno = 1; foreach($images as $img) { echo '' . $img . '.jpg'; } } echo '
'; echo 'Name: ' . $pname; if ($price > 0) { echo '
Price:'; } if (!($prices)) { if ($price > 0) { echo ' $' . $price; $iprice = $price; } } else { if ($prices[1] > 0) { echo ' $' . $prices[1]; $iprice = $prices[1]; } } if ($description) { echo '

Description:
' . $description . '

' . "\n"; } echo '
Order:'; if ($size) { $size_arr = array(); $salmon = false; $trout = true; $sizes = explode(',', $size); # foreach($sizes as $s) # { # if ($s < 9) { $salmon = true; } # if ($s > 9) { $trout = true; } # } # if ($gdir == 'flies') # { # if ($salmon) { echo '     Salmon & Steelhead'; } # if ($trout) { echo '     Trout'; } # } if (count($sizes) > 6) { $countsize = ceil((count($sizes) / 2)); $size_arr = array_chunk($sizes, 6); //$countsize); } else { $size_arr[0] = $sizes; } foreach ($size_arr as $sizes) { $str = '' . "\n" . '' . "\n" . ''; for ($i = 0; $i < count($sizes); $i++) { $bg = 'trout'; //($gdir == 'flies' && $sizes[$i] < 9) ? 'salmon' : 'trout'; $str .= '' . "\n"; } $str .= '' . "\n" . ''; for ($i = 0; $i < count($sizes); $i++) { $bg = 'trout'; //($gdir == 'flies' && $sizes[$i] < 9) ? 'salmon' : 'trout'; $thisstock = $instock[$sizes[$i]] - $pending[$sizes[$i]] + $sizevals[$sizes[$i]]; $thisstock = ($thisstock <= 0) ? 0 : $thisstock; $disable = ($thisstock <= 0) ? ' onmouseup="alert(\'This item is currently out of stock.\');" readonly="readonly"' : ''; $orderqty = ($sizevals[$sizes[$i]] > 0) ? $sizevals[$sizes[$i]] : ''; $str .= ''; } $str .= '' . "\n" . ''; for ($i = 0; $i < count($sizes); $i++) { $bg = 'trout'; //($gdir == 'flies' && $sizes[$i] < 9) ? 'salmon' : 'trout'; $thisstock = $instock[$sizes[$i]] - $pending[$sizes[$i]] + $sizevals[$sizes[$i]]; $thisstock = ($thisstock <= 0) ? 0 : $thisstock; $str .= ''; } $str .= '' . "\n"; if ($clearprods) { $str .= ''; for ($i = 0; $i < count($sizes); $i++) { if ($clearprods[$sizes[$i]] > 0) { $clearprice = '$' . number_format($clearprods[$sizes[$i]], 2); $tdbg = 'blue'; } else { $clearprice = ''; $tdbg = $bg; } $str .= ''; } $str .= ''; } $str .= '
Size' . $sizes[$i] . '
Qty.
In stock' . $thisstock . '
' . $clearprice . '
' . "\n"; echo $str; } } else { $qtyavail = $instock[0] - $pending[0] + $sqty; $disable = ($qtyavail <= 0) ? ' onmouseup="alert(\'This item is currently out of stock.\');" readonly="readonly"' : ''; echo '

' . $pname . '
' . "\n"; echo 'Quantity:

' . "\n"; echo '

In stock: ' . $qtyavail . '

' . "\n"; } echo '

'; echo '
' . "\n"; echo '

[back]

' . "\n"; $img_no = mt_rand(1, 4); ?>