foreach ($order->line_items as $chinak){
$promotion_value=array();
$commission_value=array();
$addition_value=array();
foreach($chinak->commission_one as $key_pro_com_addition=>$pro_com_value){
$promotion=data_retrieve('promotion_setup', 'promotion_code', $key_pro_com_addition);
$addition=data_retrieve('value_addition_setup', 'value_code', $key_pro_com_addition);
$commission=data_retrieve('commission_setup', 'commission_code', $key_pro_com_addition);
if($promotion['promotion_code']!=NULL){
$promotion_value[]= $promotion['promotion_code'].'-'.$pro_com_value;
} elseif($addition['value_code']!=NULL){
$addition_value[]= $addition['value_code'].'-'.$pro_com_value;
}elseif($commission['commission_code']!=NULL){
$commission_value[]= $commission['commission_code'].'-'.$pro_com_value;
}
}
$promotion_comma=implode(',',$promotion_value);
$addition_comma=implode(',',$addition_value);
$commission_comma=implode(',',$commission_value);
$sql_com_prom="INSERT INTO ".TB_PREF."pro_com_value_addition(order_no,stock_id,value_addition,promotion,commission) VALUES(";$sql_com_prom.=$order_no.",".db_escape($chinak->stock_id).",".db_escape($addition_comma).",".db_escape($promotion_comma).",".db_escape($commission_comma).")";
db_query($sql_com_prom);
}
這正是我一直在感謝之後.... – DCHP
感謝GRT答案 –