/** * 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; } [2019 NPO 파트너 페어] 모금 성과 분석이 쉬워지는 온오프라인 후원자 데이터 관리 방법 | 시민정치마당 주요 콘텐츠로 건너뛰기
사이드바

[2019 NPO 파트너 페어] 모금 성과 분석이 쉬워지는 온오프라인 후원자 데이터 관리 방법

화, 2020/02/11- 17:52admin 에 의해 제출됨
관련 개인/그룹
카테고리

오늘은 온오프라인 후원자 데이터 관리 방법에 대해 이규철 휴먼소프트웨어 대표와 김자유 누구나데이터 대표가 공동으로 준비한 워크숍 내용을 들고 왔습니다 :)어떤 데이터를 모아야 하는지, 어떻게 데이터를 모을 수 있는지에 대해 함께 알아볼까요?휴먼소프트웨어는 1997년도부터 비영리단체에 필요한 업무용 소프트웨어를 만들어 왔고, 그동안 정말 많은 솔루션을 만들어 왔습니다. 지금은 후원자 회원관리, 회계, 국내 해외 아동 결연 관리에 집중하고 있고요. 1250여 개의 단체가 MRM이라는 솔루션을 사용하고 계십니다. 먼저 후원자의 어떤 데이터를 관리해야 하는지에 대해 말해보고자 합니다. 단체에 있어 후원자는 파트너라고 생각.......

댓글 달기

CAPTCHA
스펨 사용자 차단 질문