/** * 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; } 사람이 보이면 일단 멈추어 주세요 | 시민정치마당 주요 콘텐츠로 건너뛰기
사이드바

사람이 보이면 일단 멈추어 주세요

월, 2020/11/16- 16:50admin 에 의해 제출됨
관련 개인/그룹
지역
카테고리

부산권역, 보행자의 안전을 생각하는 교통 캠페인사람이 보이면 일, 단, 멈, 춤지난 11월 11일은 농민들의 긍지와 자부심을 고취시키고 농업(農業)의 중요성을 되새기는 법정기념일인 농민의 날이었는데요.더불어 보행 교통 개선의 중요성에 대한 범국민적 의식을 고취하기 위해 사람의 두 다리를 연상시키는 ‘보행자의 날’이기도 했습니다. 매년 3200여 명이 교통 사로고 사망하고, 그중 40%가 보행자라고 하는데, 이 정도면 재난 수준인데요.타이어 마모로 배출되는 미세 플라스틱이 도시의 대기오염 주범으로 환경과 밀접한 관련을 맺고 있습니다. 안전한 먹거리뿐만 아니라 일상의 안전을 위해 부산경찰청과 아이쿱생협 부산권.......

댓글 달기

CAPTCHA
스펨 사용자 차단 질문