//jimpei's code 排列组合
function get_goods_specifications_combine($goods_id)
{
if (empty($goods_id))
{
return array(); //$goods_id不能为空
}
$sql = "SELECT g.goods_attr_id, g.attr_value, g.attr_id, a.attr_name
FROM " . $GLOBALS['ecs']->table('goods_attr') . " AS g
LEFT JOIN " . $GLOBALS['ecs']->table('attribute') . " AS a
ON a.attr_id = g.attr_id
WHERE goods_id = '$goods_id'
AND a.attr_type = 1
ORDER BY g.attr_id ASC";
$results = $GLOBALS['db']->getAll($sql);
$pre_attr_id=$results[0]['attr_id'];
$property_list=array();
for($j=0;$j $Value){
$CombineCount *= count($Value);
}
$RepeatTime = $CombineCount;
foreach($CombinList as $ClassNo => $StudentList){
$RepeatTime = $RepeatTime/count($StudentList);
$StartPosition = 1;
foreach($StudentList as $Student){
$TempStartPosition = $StartPosition;
$SpaceCount = $CombineCount/count($StudentList)/$RepeatTime;
for($J = 1; $J <= $SpaceCount; $J ++){
for($I = 0; $I < $RepeatTime; $I ++){
$Result[$TempStartPosition + $I][$ClassNo] = $Student;
}
$TempStartPosition += $RepeatTime * count($StudentList);
}
$StartPosition += $RepeatTime;
}
}
return $Result;
}
正文完