/** * Implements hook_preprocess_commerce_checkout_form(). */ function bootstrap_barrio_subtheme_preprocess_commerce_checkout_form(&$variables) { $form = &$variables['form']; $custom_fields = []; // 주문 엔터티 추출 시도 $order = NULL; $possible_keys = ['#order', 'order', '#entity', 'checkout']; foreach ($possible_keys as $key) { if (!empty($form[$key]) && $form[$key] instanceof \Drupal\commerce_order\Entity\OrderInterface) { $order = $form[$key]; \Drupal::logger('mytheme')->debug('Order found with key: @key', ['@key' => $key]); break; } } // 대체 방법: 현재 체크아웃 단계에서 주문 엔터티 로드 if (!$order) { $checkout_flow = \Drupal::routeMatch()->getParameter('commerce_checkout_flow'); if ($checkout_flow) { $order = \Drupal::routeMatch()->getParameter('commerce_order'); \Drupal::logger('mytheme')->debug('Order loaded from route: @order_id', ['@order_id' => $order ? $order->id() : 'none']); } } if ($order && $order instanceof \Drupal\commerce_order\Entity\OrderInterface) { foreach ($order->getItems() as $order_item) { $variation = $order_item->getPurchasedEntity(); $product = $variation ? $variation->getProduct() : NULL; if ($product) { $footer_block_value = $product->hasField('field_footer_block') && !$product->field_footer_block->isEmpty() ? $product->field_footer_block->value : 'N/A'; $custom_fields[] = [ 'footer_block' => $footer_block_value, ]; \Drupal::logger('mytheme')->debug('Field footer_block value: @value for product: @product_id', [ '@value' => $footer_block_value, '@product_id' => $product->id(), ]); } else { \Drupal::logger('mytheme')->debug('No product found for order item: @id', ['@id' => $order_item->id()]); } } } else { $custom_fields[] = ['footer_block' => '주문 엔터티를 찾을 수 없습니다.']; \Drupal::logger('mytheme')->debug('No order entity found. Form keys: @keys', ['@keys' => implode(', ', array_keys($form))]); } $variables['custom_fields'] = $custom_fields; $variables['form_keys'] = array_keys($form); } function bootstrap_barrio_subtheme_preprocess_commerce_checkout_order_summary(&$variables) { /** @var \Drupal\commerce_order\Entity\OrderInterface $order */ $order = $variables['order_entity']; $result = []; foreach ($order->getItems() as $item) { $variation = $item->getPurchasedEntity(); // 커스텀 필드값 가져오기 (배열 형태). $values = $variation->get('body')->getValue(); // 예: 각 라인아이템 별로 값 저장. $result[$item->id()] = $values; } $variables['body'] = $result; } 학원원장 | 시민정치마당 주요 콘텐츠로 건너뛰기
사이드바

학원원장 태그글 모음

결과값: 1 - 5 of 5

김정열(金貞烈)

국가혁명배당금당

(전)경기미술초대작가(현)서울미협초대작가 겸 심사위원

댓글: 0  조회수: 9

김정열(金貞烈)

국가혁명배당금당

(현)대한민국미술대전 초대작가(현)계룡 여류작가 회장

댓글: 0  조회수: 5

최진규(崔振圭)

(전)제6대 부산진구의회의원(현)21세기 연세학원 원장
구·시·군의회의원선거

댓글: 0  조회수: 98

박성용(朴成容)

새누리당

(전)2014년 지방선거 경남도의원 후보(의령군)(현)의령군 로타리클럽 청소년위원장

댓글: 0  조회수: 922

성광철(成光哲)

(전)충청북도 교육청 도서관 사서(전)충청북도 청주시 도서관 사서
구·시·군의회의원선거

댓글: 0  조회수: 37