Exemple #1
0
function showProClass($result, $pid = 0)
{
    $arrClass = array();
    foreach ($result as $key => $v) {
        if (isset($v['parentid']) && $pid == $v['parentid']) {
            $arrClass[] = $v;
            $arrClass = array_merge($arrClass, showProClass($result, $v['cid']));
            //合并数组
        }
    }
    return $arrClass;
}
Exemple #2
0
    }
} elseif ($_GET['action'] == 'new') {
    //=========================================================新产品
    $id = $_GET['id'];
    $new = $_GET['new'] == '1' ? '0' : '1';
    if (!empty($id)) {
        $db->Execute("UPDATE mycms_products_list SET new={$new} WHERE id={$id}");
        echo '<script language="javascript">window.location.href="' . $_SERVER['HTTP_REFERER'] . '";</script>';
        exit;
    } else {
        admin_msg($_SERVER['HTTP_REFERER'], '参数不正确,不能设置产品属性!');
    }
} elseif ($_GET['action'] == 'class') {
    //=======================================================显示产品分类
    $result = $db->GetAll('SELECT * FROM mycms_products_class ORDER BY csort');
    $arrClass = showProClass($result);
    $smarty->assign('class', $arrClass);
    $smarty->display('admin/pages/ProductList-class.html');
} elseif ($_GET['action'] == 'classadd') {
    //====================================================添加分类
    $cid = $_GET['cid'];
    $result = $db->GetRow('SELECT cid,parentid,depth,cname FROM mycms_products_class where cid=' . $cid);
    //$result=dropProClass($result);
    $smarty->assign('class_parent', $result);
    $smarty->assign('pid', $cid);
    /*
    $fck = new FCKeditor('cdescription') ;//建立对像,name和id
    $fck->Width        = '600' ;//长度
    $fck->Height        = '350' ;//高度
    $fck_content = $fck->CreateHtml();//创建Fckeditor脚本文件
    $smarty->assign('content',$fck_content);