/** * 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('field_my_field')->getValue(); // 예: 각 라인아이템 별로 값 저장. $result[$item->id()] = $values; } $variables['my_custom_fields'] = $result; } 그리스도.맑스.민족과의 만남 "노동자, 농민일체 인민대중을 위한 국가"의 꿈 그리스도. 맑스. 민족과의 만남, ​ "사람이 이 세상에 태어나서 꼭 알아야 할 것은 그렇게 많지가 않아. 삶의 본질은 복잡한 게 아니거든. 본질... | 시민정치마당 주요 콘텐츠로 건너뛰기
사이드바

그리스도.맑스.민족과의 만남

"노동자, 농민일체 인민대중을 위한 국가"의 꿈

그리스도. 맑스. 민족과의 만남,



"사람이 이 세상에 태어나서 꼭 알아야 할 것은 그렇게 많지가 않아. 삶의 본질은 복잡한 게 아니거든. 본질...

토, 2021/01/30- 08:37admin 에 의해 제출됨
카테고리

그리스도.맑스.민족과의 만남



"노동자, 농민일체 인민대중을 위한 국가"의 꿈



그리스도. 맑스. 민족과의 만남,







"사람이 이 세상에 태어나서 꼭 알아야 할 것은 그렇게 많지가 않아. 삶의 본질은 복잡한 게 아니거든. 본질 하나만 잘 붙들고 살면 세상이 아무리 흔들려도 ‘나’까지 흔들릴 일은 없는 거야.



그렇지만, 조금 외롭긴 하겠지. 예수가 그러셨듯이, 본질을 본 사람은 원래 외로운 법이니까."

.

.

.

몽양 여운형

.

.

.



댓글 달기

CAPTCHA
스펨 사용자 차단 질문