json 배열을 추출해서 가공해서 넣을려고 하는데요
본문
답변 2
내용을 [ code]소스코드[/code] 로 감싸시면 SyntaxHighlight 가 적용됩니다.
적용해보세요.
$option_cnt = 0;
if(is_array($option_dom)) foreach($option_dom as $option_data) {
//echo "<xmp>".$option_data."</xmp>";
if($option_cnt == -1 ){ //상품옵션 0 index 값이 없고 옵션만 나올때
$option_title_value = trim($option_data -> plaintext);
$option_title[] = $option_title_value;
}
else {
$option_title_value = trim($option_data -> plaintext);
$option_title[] = $option_title_value;
$option_name = trim($option_data -> value);
// $option_stx = explode(" ", $option_stx);
//print_m($option_stx[0]);
$option_list[$option_title_value][] = $option_name;
$option_info_key = $option_name;
//$option_onlick = trim($option_data -> getAttribute('onclick'));
//preg_match("/\((.*?)\)/i",$option_onlick,$onclick_out);
//$onclick_out2 = explode(",",$onclick_out[1]);
//print_m($onclick_out2,"AAAA");
//$option_stock=str_replace("'","",$onclick_out2[1]);
//echo "<xmp>".$option_data."</xmp>";
//$option_stock=trim($option_name -> getAttribute('data-stock'));
$option_sku = $_SKU."_".str_replace(" ","_",$option_name);
$option_info[$option_info_key]['SKU'] = $option_sku;
$option_info[$option_info_key]['Stock'] = $option_stock;
$option_info[$option_info_key]['Price'] = $_Price;
$option_info[$option_info_key]['Currency'] = $_Currency;
$option_info[$option_info_key]['Image'] = $_Image;
$option_info[$option_info_key]['ImageSet'] = $_ImageSet;
}
$option_cnt++;
}