Показать изображение Fancy Product Design URL-адреса элементов в корзине woocommerce

Я пытаюсь получить изображения (или URL-адреса изображений) элементов, которые добавляются в дизайнер модных продуктов. Я нашел следующий код, но этот написан для текущего цвета вместо текущего изображения. Название элементов показано, но я не могу найти решение, чтобы найти изображения (или URL-адреса изображений).

Заранее спасибо!

add_filter( 'woocommerce_get_item_data', 'wc_checkout_description_tp', 10, 2     );
 function wc_checkout_description_tp( $other_data, $cart_item ){
 //re-convert the fpd dtails from the json sting to an array
 $fpd_detail_arr = json_decode( html_entity_decode( stripslashes(   $cart_item['fpd_data']['fpd_product'] ) ), true );
 //remove the first element as we are not dealing with shadows
 $fpd_elems_arr = array_slice($fpd_detail_arr[0]['elements'], 1);

 //loop each element and set the details to a var
 foreach($fpd_elems_arr as $elem_key => $element_arr){
     foreach($element_arr as $key => $value){
         //the currentColor value is set inside yet another array
         if(is_array($value)){
             foreach($value as $val_key => $val_val){
                 if( $val_key == 'currentColor' && !empty($val_val) ){
                     $fpd_detail_value = $val_val;
                 }
             }

         }
         //set the title value
         else{
             if( $key == 'title' && !empty($value) ){
                 $fpd_detail_name = trim($value);
             }
         }
     }
    //add the name and value pair to the detail array
     $other_data[] = array(
         'name' => $fpd_detail_name,
         'value' => $fpd_detail_value
     );

 }
 //return the final detail array
 return $other_data;
}

0 ответов

Другие вопросы по тегам