首先在shop admin下的shop_conadd.php里面添加如下代码:
<tr> \r\n <td height=\"30\" width=\"100\" align=\"right\" >";
echo "产品分类2";
echo "</td>\r\n <td width=\"5\" > </td>\r\n <td height=\"30\" > \r\n ";
echo "<s";
echo "elect id=\"selcatid2\" name=\"catid2\" >\r\n ";
$fsql->query( "select * from {P}_shop_cat order by catpath" );
while ( $fsql->next_record( ) )
{
$lpid = $fsql->f( "pid" );
$lcatid = $fsql->f( "catid" );
$cat = $fsql->f( "cat" );
$catpath = $fsql->f( "catpath" );
$lcatpath = explode( ":", $catpath );
$i = 0;
for ( ; $i < sizeof( $lcatpath ) - 2; $i++ )
{
$tsql->query( "select catid,cat from {P}_shop_cat where catid='{$lcatpath[$i]}'" );
if ( $tsql->next_record( ) )
{
$ncatid = $tsql->f( "cat" );
$ncat = $tsql->f( "cat" );
$ppcat .= $ncat."/";
}
}
if ( $pid == $lcatid )
{
echo "<option value='".$lcatid."' selected>".$ppcat.$cat."</option>";
}
else
{
echo "<option value='".$lcatid."'>".$ppcat.$cat."</option>";
}
$ppcat = "";
}
echo " \r\n\t\t</select>\r\n\t\t</td>\r\n </tr>\r\n\t
其次,保存的时候进行处理:
$catid2 = $_POST['catid2'];
$msql->query( "select catpath from {P}_shop_cat where catid='{$catid2}'" );
if ( $msql->next_record( ) )
{
$catpath2 = $msql->f( "catpath" );
}
吧catid2 与catpath2 放到prop17 prop18列
shop_conmod.php的时候,在进行相应的处理
在 model下的 list query 进行如下处理
//显示分类规则:如果后台不指定分类,则显示当前所在分类,否则不限分类
if($catid!=0 && $catid!=""){
$catid=fmpath($catid);
$scl.=" and (catpath regexp '$catid' or prop18 regexp '$catid' ) ";
}elseif($nowcatid!=0 && $nowcatid!=""){
$catid=fmpath($nowcatid);
$scl.=" and (catpath regexp '$catid' or prop18 regexp '$catid' ) ";
}