You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
For anyone who needs anything like this, this script produces a simple tree of the categories in your webstore upto 2 levels deep (can be expanded if need be). The layout sucks, the coding is terrible, and I don't like to think what it is likely to do to your store, but our store, at least, is still working...
<?php $ref = $this->globals('khxc.ref'); $ns = $this->globals('khxc.namespace'); $prodidx = $this->globals('ecom.prod_prodidx'); $dispapp = $this->globals('khxc_display.app'); $app = $this->globals('khxc.app'); $eol = $this->globals('khxc.eol'); $proddisp = $this->globals('ecom.prod_proddetail'); $prodnum = $proddisp['prodnum']; $catshow = $this->globals('ecom.cat_catshow'); $catname = $this->xhtml_encode($catshow['name']); $catid = $catshow['id']; $catsplash = $catshow['splashdisp']; $catxcat = $catshow['xcat']; include '/var/wetsocks.php'; print '<div class="skin_fenavh"> Product Categories </div>'; print '<div id="skin_fenav1">' . $eol . $eol; print '<table>'; mysql_connect("$s", "$u", "$p") or die(mysql_error()); mysql_select_db("$d") or die(mysql_error()); $result1 = mysql_query("SELECT id,name,splashdisp,xcat FROM gbu0_cat WHERE splashdisp != 'BOOLEAN(1)' ORDER BY id" ) or die(mysql_error()); while ($row = mysql_fetch_array($result1)) { print '<tr><td><a class="mobile" href="/gbu0-catshow/' . $row['id'] . '.html" alt="' . $row['name'] . '" />' . $row['name'] . '</a><br /></td></tr>'; if (!(empty($row['xcat']))) { $catbits1 = explode(', ',$row['xcat']); $counter = 0; foreach ($catbits1 as $num => $catiden1) { $subcat1 = trim($catiden1); $result2 = mysql_query("SELECT id,name,xcat FROM gbu0_cat where id like '$subcat1' order by name") or die(mysql_error()); $counter++; while ($row = mysql_fetch_array($result2)) { print '<tr><td><a class="sub" href="/gbu0-catshow/' . $subcat1 . '.html" alt="' . $row['name'] . '" />' . $row['name'] . '</a></td>'; if (!(empty($row['xcat']))) { $catbits2 = explode(', ',$row['xcat']); $counter = 0; foreach ($catbits2 as $num => $catiden2) { $subcat2 = trim($catiden2); $result3 = mysql_query("SELECT id,name,xcat FROM gbu0_cat where id like '$subcat2' order by name") or die(mysql_error()); $counter++; while ($row = mysql_fetch_array($result3)) { print '</tr><tr><td><a class="sub" href="/gbu0-catshow/' . $subcat2 . '.html" alt="' . $row['name'] . '" />' . $row['name'] . '</a></td>'; print '</tr>'; } // End of while loop. } // End of foreach statement. } // End of if statement. } // End of while loop. } // End of foreach statement. } // End of if statement. } // End of while loop. mysql_free_result($result); mysql_close($result); print '</table>'; print '</div>' . $eol . $eol; ?>
Offline