- :
−
0 && $test_c<9999) { //Lookup test_c to see if it's a real category $test_name=get_category_name($test_c); if ($test_name) { $prod_cat_id = $test_c; $prod_cat_name = $test_name; } } if (!$prod_cat_id) { //default to Eurorack modules $prod_cat_id = 5; $prod_cat_name = get_category_name($prod_cat_id); } $q="SELECT parent_id, link_url FROM product_categories WHERE id='$prod_cat_id'"; $r=db_query($q); $s=db_fetch_array($r); if (!$s['parent_id']) { header("Location: ".$s['link_url']); } $page="4ms: $prod_cat_name"; include("header.inc"); $q="SELECT overview_text FROM product_categories WHERE id='$prod_cat_id'"; $s = db_fetch_array(db_query($q)); $overview_text = $s['overview_text']; //Extract product info and put it in $products array $products = []; $q="SELECT pp.job_t_id, pp.tags, pd.product_long, pd.product_abbr, ppics.pic_link, job_template.hi_price FROM product_placements pp JOIN product_descriptions pd ON pd.job_t_id=pp.job_t_id JOIN product_pics ppics ON ppics.job_t_id=pp.job_t_id AND display=1 AND img_order=1 JOIN job_template ON job_template.id = pp.job_t_id WHERE pp.prod_cat_id='$prod_cat_id' ORDER BY pp.priority>0 DESC, pp.priority"; $r=db_query($q); $all_unique_tags=array(); while ($s=db_fetch_array($r)){ if ($s['job_t_id']>0){ $name=$s['product_long']; $abbr=$s['product_abbr']; $products[$s['job_t_id']] = []; $products[$s['job_t_id']]['name'] = $name; //Pre-pend $PROD_TAG_PP to every tag $prod_tags = explode(" ", trim($s['tags'])); $this_product_tags = ""; foreach ($prod_tags as $t) { $tag = $PROD_TAG_PP.$t; $this_product_tags.=$tag." "; //Add unique tags to $tags array if (!in_array($tag, $all_unique_tags, TRUE)) array_push($all_unique_tags, $tag); } $products[$s['job_t_id']]['product_abbr'] = "[ $abbr ]"; $products[$s['job_t_id']]['tags'] = $this_product_tags; $products[$s['job_t_id']]['pic_link'] = $s['pic_link']."-420.jpg"; if ($s['hi_price'] != round($s['hi_price'],0)) $products[$s['job_t_id']]['price'] = pretty_number(round($s['hi_price'],2)); else $products[$s['job_t_id']]['price'] = round($s['hi_price'],0); } } //Separate unique tags into numbered tags, and unnumbered tags. //Order the former by number (alphabetical) //Then combine them back into one array $numbered_tags=array(); $unnumbered_tags=array(); foreach ($all_unique_tags as $prod_tag){ $tag = substr($prod_tag,strlen($PROD_TAG_PP)); if ((strpos($tag,"_")!==FALSE) && is_numeric(substr($tag,0,strpos($tag,"_")))) array_push($numbered_tags, $prod_tag); else array_push($unnumbered_tags, $prod_tag); } sort($numbered_tags); $all_unique_tags = array_merge($numbered_tags, $unnumbered_tags); ?>