Zdravim vedl by mi niekto pomoct ? robim si webku a mam tam shop no mam tam iba kategorie a potreboval by som aby tie kategorie boli ako podlategorie a dan nimi hlavne kategorie ...
Kód:
CREATE TABLE IF NOT EXISTS `ws_e25_shop_categories` (
`catID` int(11) NOT NULL auto_increment,
`subcatID` varchar(255) NOT NULL default '',
`name` varchar(255) NOT NULL default '',
`pic` varchar(255) NOT NULL default '',
PRIMARY KEY (`catID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
INSERT INTO `ws_e25_shop_categories` (`catID`, `subcatID`, `name`, `pic`) VALUES
(1, '1', 'Assistent', ''),
(2, '2', 'Assistent plus', ''),
(3, '1', 'Winx', ''),
(4, '3', 'Partner', '');
TABLE IF NOT EXISTS `ws_e25_shop_subcategories` (
`subcatID` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`pic` varchar(255) NOT NULL default '',
PRIMARY KEY (`subcatID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
INSERT INTO `ws_e25_shop_subcategories` (`subcatID`, `name`, `pic`) VALUES
(1, 'KANCELARSKY NABYTOK', ''),
(2, 'SPALNOVE ZOSTAVY', ''),
(3, 'POSTELE', '');
cast php kodu vyzrea takto :
Kód:
else{
eval('$title_shop = "' . gettemplate('title_shop') . '";');
echo $title_shop.'<br />» <b><u>'.$_language->module['shop'].'</u></b><br /><br />';
if (isshopadmin($userID)){
$action = '<input type="button" class="button" onclick="MM_goToURL(\'parent\', \'index.php?site=shop&action=new\'); return document.MM_returnValue;" value="'.$_language->module['newp'].'" /> ';
}
$korb = '<input type="button" class="button" onclick="MM_goToURL(\'parent\', \'index.php?site=shop&action=korb\'); return document.MM_returnValue;" value="'.$_language->module['cart'].'" /><br /><br />';
$gesamt = total();
eval('$shop_head = "'.gettemplate('shop_head').'";');
echo $shop_head;
$cats = safe_query("SELECT * FROM " . PREFIX . "shop_categories ORDER BY name");
if(mysql_num_rows($cats)){
eval('$shop_category = "' . gettemplate('shop_category') . '";');
echo $shop_category;
while ($dc = mysql_fetch_array($cats)){
$catID = $dc['catID'];
$result = mysql_fetch_array(safe_query("SELECT count(*) as anz FROM ".PREFIX."shop_products WHERE cat='".$catID."'"));
$cat = '<a href="index.php?site=shop&action=cat&catID='.$catID.'"><img src="images/shopcats/'.$dc['pic'].'" alt="'.$dc['name'].'" border="0"/></a>';
$name = $dc['name'];
if($result['anz']>0){
echo '<tr>
<td bgcolor="'.$bg1.'" class="ordertd" style="border-bottom:1px solid #CCCCCC;">'.$cat.'</td>
<td bgcolor="'.$bg1.'" class="ordertd" style="border-bottom:1px solid #CCCCCC;"><a href="index.php?site=shop&action=cat&catID='.$catID.'">'.$name.'</a></td>
<td bgcolor="'.$bg1.'" class="ordertd" style="border-bottom:1px solid #CCCCCC;">'.$result['anz'].'</td>
</tr>';
}
}
eval('$shop_foot = "' . gettemplate('shop_foot') . '";');
echo $shop_foot;
}else{
echo $_language->module['nocategories'];
}
}
}
?>
chcem aby to zobrazovalo nejak takto:
Kód:
KANCELARSKY NABYTOK (kat)
--- Assistent (pod kat.)
--- Winx (pod kat.)
SPALNOVE ZOSTAVY (kat)
--- Assistent plus (pod kat.)
POSTELE (kat)
--- Partner (pod kat.)