From d0e97b5be649c772d4982d404667ba67e66d8cea Mon Sep 17 00:00:00 2001 From: Rajat Gupta Date: Fri, 3 Nov 2023 05:54:28 -0400 Subject: [PATCH 1/4] JCOREX-145:Foxycart --- .../hwjma_ecommerce/hwjma_ecommerce.module | 67 +++- .../hwjma_ecommerce.routing.yml | 2 + .../hwjma_ecommerce/js/hwjma_ecommerce.js | 40 --- .../src/Plugin/Block/DisplayPrice.php | 317 +++++++----------- .../templates/hwjma-access-panel.html.twig | 2 +- .../hwjma-purchase-offer-item.html.twig | 2 +- .../templates/hwjma-purchase-offer.html.twig | 2 +- .../hwjma_theme/includes/layout.theme.inc | 4 +- .../system/region--header-auth.html.twig | 2 +- .../global/region--header-auth.twig | 7 +- .../default/css/scss/_custom-style.scss | 2 +- 11 files changed, 199 insertions(+), 248 deletions(-) create mode 100644 web/modules/highwire/hwjma_ecommerce/hwjma_ecommerce.routing.yml diff --git a/web/modules/highwire/hwjma_ecommerce/hwjma_ecommerce.module b/web/modules/highwire/hwjma_ecommerce/hwjma_ecommerce.module index 0f5b3e0f8..d19280e27 100644 --- a/web/modules/highwire/hwjma_ecommerce/hwjma_ecommerce.module +++ b/web/modules/highwire/hwjma_ecommerce/hwjma_ecommerce.module @@ -1,6 +1,6 @@ $variables['duration']]) : t('You will have access to this content for the specified period, including any updates during that period.'); + $variables['info'] = t('You will have access to this content for the specified period, including any updates during that period.'); break; } } - if ($variables['logged_in'] == FALSE) { - $current_path = \Drupal::service('path.current')->getPath(); - $target_path = \Drupal::service('path_alias.manager')->getAliasByPath($current_path); - $variables['purchase_link']["#url"] = Url::fromRoute('openid_connect_sams_sigma.wayfless-url', ['target' => $target_path]); - } } /** @@ -93,5 +87,58 @@ function hwjma_ecommerce_js_alter(&$javascript, $assets) { // Set weight of hwjma_ecommerce/hwjma_ecommerce to just higher than highwire_ecommerce/highwire_ecommerce_foxycart if (!empty($javascript[$hw_ecom_foxycart_js]) && !empty($javascript[$hwjma_ecom_js])) { $javascript[$hwjma_ecom_js]['weight'] = $javascript[$hw_ecom_foxycart_js]['weight'] + 0.001; + } -} \ No newline at end of file +} + +/** +* Helper function to get book chunk content types for the MHE site. +* +* @return array +* Array of book chunk node types +*/ +function hwjma_core_get_book_chunk_types() { + return ['item_chapter', 'item_section','item_front_matter', 'item_back_matter']; +} + +/** +* Helper function to get journal chunk content types for the bps site. +* +* @return array +* journal chunk node types +*/ +function hwjma_core_get_journal_chunk_types() { + return ['journal_article', 'journal_issue', 'journal_volume', 'journal_fragment']; +} + +/** +* Implements hook_tokens(). +*/ +function hwjma_core_tokens($type, array $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) { + $replacements = []; + if ($type == 'node' && !empty($data['node']) && $data['node'] instanceof Node) { + $node = $data['node']; + foreach ($tokens as $name => $original) { + if ($name == 'type_display') { + $type = $node->getType(); + if (!in_array($type, hwjma_core_get_hw_content_types())) { + $replacements[$original] = $type; + } + elseif (in_array($type, hwjma_core_get_book_chunk_types())) { + $replacements[$original] = t('chapter'); + } + else { + switch ($type) { + case HW_NODE_TYPE_ARTICLE: + $replacements[$original] = t('article'); + break; + case HW_NODE_TYPE_JOURNAL: + $replacements[$original] = t('journal'); + break; + } + } + } + } + } + return $replacements; +} diff --git a/web/modules/highwire/hwjma_ecommerce/hwjma_ecommerce.routing.yml b/web/modules/highwire/hwjma_ecommerce/hwjma_ecommerce.routing.yml new file mode 100644 index 000000000..139597f9c --- /dev/null +++ b/web/modules/highwire/hwjma_ecommerce/hwjma_ecommerce.routing.yml @@ -0,0 +1,2 @@ + + diff --git a/web/modules/highwire/hwjma_ecommerce/js/hwjma_ecommerce.js b/web/modules/highwire/hwjma_ecommerce/js/hwjma_ecommerce.js index 181e465d6..b16dce62a 100644 --- a/web/modules/highwire/hwjma_ecommerce/js/hwjma_ecommerce.js +++ b/web/modules/highwire/hwjma_ecommerce/js/hwjma_ecommerce.js @@ -12,16 +12,6 @@ var FC = FC || {}; collapseAccessPanel($(params.element).closest('.access-panel')); }); - /* - * Update add to cart link display when item is removed from cart. - */ - FC.client.wrap("highwire-ecommerce-cart-item-removed", function (params) { - // Replace purchase links for items removed from the cart. - if (params.apath && params.interval) { - itemRemovedFromCart(context, params.apath, params.interval); - } - }); - /** * Customize display of list items in message. */ @@ -49,42 +39,12 @@ var FC = FC || {}; * The access panel to collapse. */ function collapseAccessPanel($panel) { - //var $panel = $link.closest('.access-panel'); if ($panel.length > 0 && $panel.hasClass('in')) { var $trigger = $('[data-target="#' + $panel.attr('id') + '"].btn--access-expander', context).first(); $trigger.trigger('click'); } } - /** - * Update add to cart link when item is removed from cart. - * - * @param context - * A jquery object to use as context. - * @param apath - * Apath of removed item - * @param interval - * Interval of removed item - */ - function itemRemovedFromCart(context, apath, interval) { - var $links = $('a.highwire-ecommerce-item-in-cart[data-apath="' + apath + '"][data-interval="' + interval + '"]', context); - if ($links.length <= 0) { - return; - } - $links.each(function () { - var $link = $(this); - var url = $link.attr('data-purchase-url'); - var text = $link.attr('data-purchase-text'); - if ($link.attr('data-discounted-price')) - { - var discountprice = $link.attr('data-discounted-price'); - var originalprice = $link.attr('data-original-price'); - text = 'Add to cart' + ' ' + originalprice + ' ' + discountprice; - } - $link.removeClass('highwire-ecommerce-item-in-cart').attr('href', url).html(text); - }); - } - /** * Build a list of cart item links. * diff --git a/web/modules/highwire/hwjma_ecommerce/src/Plugin/Block/DisplayPrice.php b/web/modules/highwire/hwjma_ecommerce/src/Plugin/Block/DisplayPrice.php index 556e8ff36..9d4b48b46 100644 --- a/web/modules/highwire/hwjma_ecommerce/src/Plugin/Block/DisplayPrice.php +++ b/web/modules/highwire/hwjma_ecommerce/src/Plugin/Block/DisplayPrice.php @@ -1,4 +1,4 @@ -entityTypeManager = $entity_type_manager; $this->moduleHandler = $module_handler; @@ -231,20 +231,21 @@ public static function create(ContainerInterface $container, array $configuratio $container->get('entity_display.repository'), $container->get('highwire_ecommerce.add_to_cart_link'), $container->get('highwire_content.lookup'), - $container->get('highwire_client.factory')->get('hwhwjmaclient:catalog'), + $container->get('highwire_client.factory')->get('hwphpclient:catalog'), $container->get('request_stack'), $container->get('config.factory'), $container->get('logger.factory')->get('hwjma_ecommerce'), - $container->get('hwhwjma.atomx'), + $container->get('hwphp.atomx'), $container->get('cache.default') ); + } /** * {@inheritdoc} */ public function build(): array { - + // Create block render array. $build = ['#theme' => 'hwjma_access_panel', '#user_access' => FALSE]; @@ -253,12 +254,12 @@ public function build(): array { // Check if user has full access to this content. if ($this->userHasAccess($this->contextNode)) { - - // Return has access panel. + // return has access panel. $this->userAccess = TRUE; $build['#user_access'] = TRUE; return $build; } + $this->checkAccessChildren(); if ($this->userAccess) { $build['#user_access'] = TRUE; @@ -278,8 +279,24 @@ public function build(): array { $build['#user_access'] = TRUE; } - // Get the catalog data for the context data. - $node_apath = isset($this->contextNode->apath) ? $this->contextNode->apath->value : ''; + // Check if content is refworks book, refworks child and display not available for purchase. + if ($this->contextNode->getType() == HW_NODE_TYPE_REFERENCE) { + $build['#purchase_children']['title'] = 'Accessing individual reference entries'; + $build['#purchase_children']['text'] = 'Individual reference entries are not currently available for purchase.'; + $node_apath = isset($this->contextNode->apath) ? $this->contextNode->apath->value : ''; + } + elseif (in_array($this->contextNode->getType(), HW_NODE_TYPE_REFERENCE_ENTRY)) { + $parent_book_ref = $this->contextNode->get('parent_book'); + if (!empty($parent_book_ref) && $parent_book_ref->entity->getType() == 'item_reference_book') { + $build['#purchase_children']['title'] = 'Accessing individual reference entries'; + $build['#purchase_children']['text'] = 'Individual reference entries are not currently available for purchase.'; + $node_apath = $parent_book_ref->entity->get('apath')->getString(); + } + } + else { + // Get the catalog data for the context data. + $node_apath = isset($this->contextNode->apath) ? $this->contextNode->apath->value : ''; + } try { $offers_response = $this->catalog->getOffer([$node_apath], TRUE, TRUE); $offers = $offers_response->getData(); @@ -288,10 +305,11 @@ public function build(): array { $this->logger->error($ex->getMessage()); return $build; } + // Load all the nodes for apaths in the Catalog response. $apaths = $offers->getAllApaths(); try { - if ($nids = $this->lookup->nidsFromApaths($apaths)); + $nids = ($this->lookup->nidsFromApaths($apaths)) ?? null; } catch (ApathNotFoundException $ex) { if (empty($nids)) { @@ -324,7 +342,6 @@ public function build(): array { $grouped_products = $this->groupProductsByType($pricing_item); $types = array_keys($grouped_products); $container_type = end($types); - // Build pricing item list per type. $pricing_item_products = []; foreach ($grouped_products as $type => $products) { @@ -341,12 +358,15 @@ public function build(): array { } } + // Build child offers prompt text. $child_offers_prompt = $this->buildChildOffersPrompt(); if (!empty($child_offers_prompt)) { $build['#purchase_children'] = $child_offers_prompt; } - $build['#cache']['contexts'][] = 'user'; + + $build['#cache']['contexts'][] = 'user'; + return $build; } @@ -373,6 +393,7 @@ public function defaultConfiguration(): array { */ public function blockForm($form, FormStateInterface $form_state): array { $form = parent::blockForm($form, $form_state); + $form['list_titles'] = [ '#type' => 'container', '#tree' => TRUE, @@ -448,7 +469,6 @@ public function blockForm($form, FormStateInterface $form_state): array { } if (!empty($page_variant_config)) { - // Look for the node type selection criteria. foreach ($page_variant_config as $variant_config) { if (in_array($variant_config['id'], ['entity_bundle:node', 'node_type']) && !empty($variant_config['bundles'])) { @@ -461,15 +481,9 @@ public function blockForm($form, FormStateInterface $form_state): array { // Only display types related to the node type selection criteria // (i.e. books + book chunks, journals + journal chunks, refbooks + refbook chunks). foreach ($node_types as $type) { - if (in_array($type, hwjma_core_get_book_chunk_types()) || $type == HW_NODE_TYPE_MONOGRAPH) { - $node_types = hwjma_core_get_book_chunk_types(); - $node_types[] = HW_NODE_TYPE_MONOGRAPH; - break; - } - - if (in_array($type, hwjma_core_get_book_chunk_types()) || $type == HW_NODE_TYPE_REPORT_GUIDELINE) { + if (in_array($type, hwjma_core_get_book_chunk_types()) || $type == HW_NODE_TYPE_BOOK) { $node_types = hwjma_core_get_book_chunk_types(); - $node_types[] = HW_NODE_TYPE_REPORT_GUIDELINE; + $node_types[] = HW_NODE_TYPE_BOOK; break; } @@ -479,8 +493,9 @@ public function blockForm($form, FormStateInterface $form_state): array { break; } - if ($type == HW_NODE_TYPE_TEST_REVIEW) { - $node_types[] = HW_NODE_TYPE_TEST_REVIEW; + if (in_array($type, hwjma_core_get_reference_chunk_types()) || $type == HW_NODE_TYPE_REFERENCE) { + $node_types = hwjma_core_get_reference_chunk_types(); + $node_types[] = HW_NODE_TYPE_REFERENCE; break; } } @@ -490,6 +505,7 @@ public function blockForm($form, FormStateInterface $form_state): array { if (empty($node_types)) { $node_types = $this->lookup->getHighWireContentTypes(); } + foreach ($node_types as $node_type) { $view_modes = ['' => t('None')]; $view_modes += $this->entityDisplayRepository->getViewModeOptionsByBundle('node', $node_type); @@ -512,6 +528,7 @@ public function blockForm($form, FormStateInterface $form_state): array { $access_rule = $this->entityTypeManager->getStorage('access_control_rule')->load($entity_id); $access_options[$entity_id] = $access_rule->get('label'); } + $form['access_control_rule'] = [ '#type' => 'select', '#title' => t('Access Control Rule'), @@ -552,6 +569,7 @@ public function getProductDisplay(Node $product_node): array { if (!empty($this->configuration['view_modes']) && !empty($this->configuration['view_modes'][$node_type])) { $view_mode = $this->configuration['view_modes'][$node_type]; } + if (!empty($view_mode)) { $build = $view_builder->view($product_node, $view_mode); } @@ -561,6 +579,7 @@ public function getProductDisplay(Node $product_node): array { $build = $product_link->toRenderable(); } } + return $build; } @@ -612,10 +631,12 @@ public function userHasAccess(Node $node) { if (!$this->moduleHandler->moduleExists('highwire_access_control') || empty($this->configuration['access_control_rule'])) { return FALSE; } + $access_rule = $this->entityTypeManager->getStorage('access_control_rule')->load($this->configuration['access_control_rule']); if (empty($node->apath) || empty($access_rule)) { return FALSE; } + $apath = $node->apath->value; // Check user access. @@ -630,7 +651,7 @@ public function userHasAccess(Node $node) { * Function to check user access for all children. */ protected function checkAccessChildren() { - if (!$this->showChildren() || !$this->moduleHandler->moduleExists('highwire_access_control') || empty($this->configuration['access_control_rule'])) { + if (!$this->showChildren() || !$this->moduleHandler->moduleExists('highwire_access_control') || empty($this->configuration['access_control_rule'])) { return; } $access_rule = $this->entityTypeManager->getStorage('access_control_rule')->load($this->configuration['access_control_rule']); @@ -640,10 +661,8 @@ protected function checkAccessChildren() { // Get children of current node. $node = !empty($this->contextNode) ? $this->contextNode : $this->getContextValue('node'); - //$child_apaths = $this->getChildApaths($node); $apath = $node->get('apath')->value; - // Check access and group apaths. $user_access_children = $user_noaccess_children = []; if (!empty($child_apaths)) { @@ -658,15 +677,9 @@ protected function checkAccessChildren() { } } } - // Store apaths for later. - $this->userAccessChildren = $user_access_children; + $this->userAccessChildren = $user_access_children; $this->userNoAccessChildren = $user_noaccess_children; - - // If the user has access to all the children, set access to true. - // if (count($child_apaths) !== 0 && count($child_apaths) == count($user_access_children)) { - // $this->userAccess = TRUE; - // } } /** @@ -677,9 +690,8 @@ protected function checkAccessChildren() { */ protected function buildUserAccessChildren(): array { $build = []; - // Check AC for items we have access for. - $user_access = $this->userAccessChildren; + $user_access = $this->userAccessChildren; $children_users_have = $this->getChildrenUserHasAccessDisplay($user_access); if (!empty($children_users_have)) { $access_items = []; @@ -687,7 +699,6 @@ protected function buildUserAccessChildren(): array { // Split children up by content type foreach ($children_users_have as $child) { if (isset($child['#node'])) { - // Group book entry content types. if (in_array($child['#node']->getType(), ['item_front_matter', 'item_back_matter', 'item_chapter'])) { $access_items['book_entry'][] = $child; @@ -697,8 +708,10 @@ protected function buildUserAccessChildren(): array { } } } + $build = []; $title_config = !empty($this->configuration['list_titles']) ? $this->configuration['list_titles'] : []; + foreach (array_keys($access_items) as $item_section) { $title = ''; if (!empty($title_config['user_access_already'])) { @@ -732,7 +745,8 @@ protected function getChildApaths(Node $node) { if (!empty($cache->data)) { return $cache->data; } - switch($node->getType()) { + + switch($node->getType()) { case HW_NODE_TYPE_JOURNAL: try { $corpus = $node->get('corpus')->value; @@ -750,6 +764,7 @@ protected function getChildApaths(Node $node) { } } '; + $this->atomx->setIndexes([$policy . ":" . $corpus]); $results = array_keys($this->atomx->search($search_query)); $this->defaultCache->set($cid, $results); @@ -796,40 +811,7 @@ protected function getChildApaths(Node $node) { default: return []; - break; } - - // $children = isset($node->children) && !$node->children->isEmpty() ? $node->children : []; - // if (!isset($node->children) || $node->children->isEmpty()) { - // return; - // } - // foreach ($node->children as $child) { - // $child_node = $child->entity; - // $process_children = FALSE; - - // // Books - // if ($child_node && isset($child_node->book_has_body) && !empty($child_node->book_has_body->value) && isset($child_node->apath)) { - // $process_children = TRUE; - // } - - // // Journal articles - // if ($child_node && isset($child_node->has_full_text) && (!empty($child_node->has_full_text->value) || !empty($child_node->has_full_text_pdf->value)) && isset($child_node->apath)) { - // $process_children = TRUE; - // } - - // // Journal - // if ($child_node->getType() == HW_NODE_TYPE_JOURNAL || $child_node->getType() == HW_NODE_TYPE_ISSUE) { - // $process_children = TRUE; - // } - - // if ($process_children) { - // $child_apath = $child_node->apath->value; - // if (!empty($child_apath) && !in_array($child_apath, $child_apaths)) { - // $child_apaths[] = $child_node->apath->value; - // } - // } - // $this->getChildApathsRecursive($child_node, $child_apaths); - // } } /** @@ -840,16 +822,18 @@ protected function getChildApaths(Node $node) { * * @return array * Render array of node links. - */ + */ public function getChildrenUserHasAccessDisplay(array $user_access_apaths): array { + $access_nids = $this->lookup->nidsFromApaths($user_access_apaths); $access_nodes = $this->entityTypeManager->getStorage('node')->loadMultiple($access_nids); $view_builder = $this->entityTypeManager->getViewBuilder('node'); + $purchased_parents = []; + $access_items = []; foreach ($access_nodes as $access_node) { $access_node_type = $access_node->getType(); - // Books if (in_array($access_node_type, hwjma_core_get_book_chunk_types())) { $access_items[] = $this->getProductDisplay($access_node); @@ -857,7 +841,6 @@ public function getChildrenUserHasAccessDisplay(array $user_access_apaths): arra // Journals if (in_array($access_node_type, hwjma_core_get_journal_chunk_types())) { - // Journals and Journal issues. if ($access_node_type == HW_NODE_TYPE_JOURNAL || $access_node_type == HW_NODE_TYPE_ISSUE) { $purchased_parents[] = $access_node->apath->value; @@ -871,8 +854,9 @@ public function getChildrenUserHasAccessDisplay(array $user_access_apaths): arra } } } + return $access_items; - } + } /** * Get the display for a group of products. @@ -887,7 +871,6 @@ public function getChildrenUserHasAccessDisplay(array $user_access_apaths): arra * Render array. */ public function buildPurchaseOffers(array $products, string $currency_code, string $title = ''): array { - // Build list item display. $items = []; foreach ($products as $product) { @@ -896,6 +879,7 @@ public function buildPurchaseOffers(array $products, string $currency_code, stri $items[] = $product_item; } } + if (empty($items)) { return []; } @@ -908,6 +892,7 @@ public function buildPurchaseOffers(array $products, string $currency_code, stri '#attributes' => ['class' => ['list-unstyled']], '#context' => ['list_style' => 'ecommerce_purchase_offers'], ]; + return $build; } @@ -924,6 +909,7 @@ public function buildPurchaseOffers(array $products, string $currency_code, stri */ public function buildPurchaseOffer(Product $product, string $currency_code): array { $build = []; + $product_node = $this->getProductNode($product); $purchase_options = $product->getPurchaseOptions(); if (empty($product_node) || empty($purchase_options)) { @@ -946,6 +932,7 @@ public function buildPurchaseOffer(Product $product, string $currency_code): arr if (empty($purchase_option)) { continue; } + foreach ($purchase_option as $interval => $prices) { $price = !empty($prices[$currency_code]) ? $prices[$currency_code] : []; if (empty($price)) { @@ -955,10 +942,14 @@ public function buildPurchaseOffer(Product $product, string $currency_code): arr // Build purchase option. $purchase_link = $this->buildPurchaseLink($product, $product_node, $price, $product_node_vars); if (!empty($purchase_link)) { + $duration = $price->getInterval(IntervalFormatter::readable()); + if ($duration == '11 months, 30 days') { + $duration = '1 Year'; + } $purchase_options_build[] = [ '#theme' => 'hwjma_purchase_offer_item', '#type' => $disposition, - '#duration' => $price->getInterval(IntervalFormatter::hours()) . ' hours', + '#duration' => $duration, '#purchase_link' => $purchase_link, ]; } @@ -971,7 +962,8 @@ public function buildPurchaseOffer(Product $product, string $currency_code): arr '#product' => $product_display, '#purchase_offers' => $purchase_options_build, ]; - } + } + return $build; } @@ -1013,6 +1005,7 @@ public function buildPurchaseLink(Product $product, Node $product_node, Price $p else { $issue = ''; } + $product_node->setTitle($journal_title . $vol . ($vol && $issue ? ', ' : '') . $issue); } @@ -1029,27 +1022,12 @@ public function buildPurchaseLink(Product $product, Node $product_node, Price $p // Alter display of purchase link. $purchase_link['#attributes']['class'][] = 'btn'; $purchase_link['#attributes']['class'][] = 'btn-primary'; - $user_ip = $this->requestStack->getCurrentRequest()->getClientIp(); - $user_currency = $this->catalog->getUserCurrency($user_ip)->getData(); - $currencysymbol = $this->getCurrencySymbol($user_currency); - //Check for dicount given - $discountdata = $this->addToCartLink->getDiscountFlag(); + // Alter link text. $display_price = $price->getDisplayPrice(); + if (!empty($display_price)) { - if (!empty($discountdata)) { - $purchase_link['#title'] = $this->t('Add to cart (:symbol:discount) (:price)', - [':symbol' => $currencysymbol, - ':price' => $display_price, - ':discount' => $discountdata - ] - ); - $purchase_link['#attributes']['data-original-price'] = '(' . $currencysymbol . $discountdata . ')'; - $purchase_link['#attributes']['data-discounted-price'] = '(' . $display_price . ')'; - } - else { - $purchase_link['#title'] = $this->t('Add to cart (:price)', [':price' => $display_price]); - } + $purchase_link['#title'] = $this->t('Add to cart (:price)', [':price' => $display_price]); $purchase_link['#attributes']['data-purchase-text'] = $purchase_link['#title']; } @@ -1057,15 +1035,18 @@ public function buildPurchaseLink(Product $product, Node $product_node, Price $p if (!empty($add_query_params)) { $purchase_link_query = $purchase_link['#url']->getOption('query'); $sku = $product->getSku(); + foreach ($add_query_params as $k => $v) { if (empty($v)) { continue; } $purchase_link_query[$this->addToCartLink->getHmac($k, $v, $sku, $this->apikey)] = $v; } + $purchase_link['#url']->setOption('query', $purchase_link_query); $purchase_link['#attributes']['data-purchase-url'] = $purchase_link['#url']->toString(); } + return $purchase_link; } @@ -1081,28 +1062,18 @@ public function buildPurchaseLink(Product $product, Node $product_node, Price $p public function getProductImage(Node $product_node): string { $type = $product_node->getType(); $img_url = ''; + if (in_array($type, hwjma_core_get_book_chunk_types())) { $img_url = Url::fromUserInput('/themes/scolaris_hwjma/images/icon-chapter.png', ['absolute' => TRUE])->toString(); } elseif ($type == HW_NODE_TYPE_ARTICLE) { - // Get Parent Issue to fetch its image as article dont have its own - $parent_issue_id = $product_node->get('parent_issue')->getString(); - if (!empty($parent_issue_id)) { - $parent_issue_data = Node::load($parent_issue_id); - if (!empty($parent_issue_data) && $parent_issue_data->hasField('variant_cover_image') && !$parent_issue_data->get('variant_cover_image')->isEmpty()) { - $img_field = $parent_issue_data->variant_cover_image->first()->getValue(); - if (!empty($img_field['uri'])) { - $img_url = ImageStyle::load('cover_results_item')->buildUrl($img_field['uri']); - } - } - } + $img_url = Url::fromUserInput('/themes/scolaris_hwjma/images/icon-article.png', ['absolute' => TRUE])->toString(); } else { $img_field = []; switch ($type) { - case HW_NODE_TYPE_MONOGRAPH: - case HW_NODE_TYPE_REPORT_GUIDELINE: - case HW_NODE_TYPE_TEST_REVIEW: + case HW_NODE_TYPE_BOOK: + case HW_NODE_TYPE_REFERENCE: if (!empty($product_node) && $product_node->hasField('cover_image') && !$product_node->get('cover_image')->isEmpty()) { $img_field = $product_node->cover_image->first()->getValue(); } @@ -1110,11 +1081,11 @@ public function getProductImage(Node $product_node): string { case HW_NODE_TYPE_JOURNAL: case HW_NODE_TYPE_ISSUE: + case HW_NODE_TYPE_ARTICLE: if (!empty($product_node) && $product_node->hasField('variant_cover_image') && !$product_node->get('variant_cover_image')->isEmpty()) { $img_field = $product_node->variant_cover_image->first()->getValue(); } break; - } if (!empty($img_field['uri'])) { $img_url = ImageStyle::load('cover_results_item')->buildUrl($img_field['uri']); @@ -1135,9 +1106,11 @@ public function getProductImage(Node $product_node): string { public function getProductSource(Node $product_node): string { $type = $product_node->getType(); $source = ''; - if ($type == HW_NODE_TYPE_MONOGRAPH || $type == HW_NODE_TYPE_REPORT_GUIDELINE || $type == HW_NODE_TYPE_JOURNAL || $type == HW_NODE_TYPE_TEST_REVIEW) { + + if ($type == HW_NODE_TYPE_BOOK || $type == HW_NODE_TYPE_JOURNAL || $type == HW_NODE_TYPE_REFERENCE) { return $source; } + if (in_array($type, hwjma_core_get_book_chunk_types())) { if ($product_node->hasField('parent_book') && !$product_node->get('parent_book')->isEmpty()) { $source_node_data = $product_node->parent_book->first()->getValue(); @@ -1151,7 +1124,6 @@ public function getProductSource(Node $product_node): string { } } } - // todo: refactor book and journal sources code. if (in_array($type, hwjma_core_get_journal_chunk_types())) { if ($product_node->hasField('parent-journal') && !$product_node->get('parent-journal')->isEmpty()) { @@ -1168,6 +1140,7 @@ public function getProductSource(Node $product_node): string { } // @TODO: Add support for issue & article types. + return $source; } @@ -1184,8 +1157,7 @@ public function getProductTitleSuffix(Node $product_node): string { $type = $product_node->getType(); $title_suffix = ''; switch ($type) { - case HW_NODE_TYPE_MONOGRAPH: - case HW_NODE_TYPE_REPORT_GUIDELINE: + case HW_NODE_TYPE_BOOK: if ($product_node->hasField('edition') && !$product_node->get('edition')->isEmpty()) { $edition = $product_node->get('edition')->getString(); if (is_numeric($edition) && intval($edition) > 1) { @@ -1196,6 +1168,7 @@ public function getProductTitleSuffix(Node $product_node): string { } break; } + return $title_suffix; } @@ -1203,7 +1176,7 @@ public function getProductTitleSuffix(Node $product_node): string { * Get product list title based on type and container type. * * @param string $type - * The type of product. + * The type of product. * @param string $container_type * The product's root container product type. * @@ -1216,29 +1189,29 @@ public function buildPurchaseOffersTitle(string $type, string $container_type = $product_node_types = $this->getProductNodeTypes($type); $title_config = !empty($this->configuration['list_titles']) ? $this->configuration['list_titles'] : []; $node_type = !empty($this->contextNode) ? $this->contextNode->getType() : $this->getContextValue('node')->getType(); + if (in_array($node_type, $product_node_types)) { - // Label for this content type. $display_node_type = $node_type; $title = !empty($title_config['purchase_offers_current']) ? $title_config['purchase_offers_current'] : ''; - } + } else { $display_node_type = reset($product_node_types); if ($type == $container_type) { - // Label for container type. $title = !empty($title_config['purchase_offers_container']) ? $title_config['purchase_offers_container'] : ''; } else { - - // Label for parent type that is not the root container. + // Label for parent type that is not the root container. $title = !empty($title_config['purchase_offers_default']) ? $title_config['purchase_offers_default'] : ''; } } + $t_values = !empty($display_node_type) ? [':type' => $this->getTypeLabel($display_node_type), ':types' => $this->getTypeLabelPlural($display_node_type)] : []; if (!empty($title)) { $title = $this->t($title, $t_values); } + return $title; } @@ -1248,11 +1221,14 @@ public function buildPurchaseOffersTitle(string $type, string $container_type = public function buildChildOffersPrompt(): array { $build = []; $child_prompt_config = !empty($this->configuration['child_offers_prompt']) ? $this->configuration['child_offers_prompt'] : []; + if (empty($child_prompt_config) || (empty($child_prompt_config['title']) && empty($child_prompt_config['text']))) { return $build; } + $node_type = !empty($this->contextNode) ? $this->contextNode->getType() : $this->getContextValue('node')->getType(); $child_types = $this->getChildTypes($node_type); + if (empty($child_types) || empty($this->userNoAccessChildren)) { return $build; } @@ -1307,8 +1283,7 @@ public function buildChildOffersPrompt(): array { public function showChildren(): bool { $node_type = !empty($this->contextNode) ? $this->contextNode->getType() : $this->getContextValue('node')->getType(); switch ($node_type) { - case HW_NODE_TYPE_MONOGRAPH: - case HW_NODE_TYPE_REPORT_GUIDELINE: + case HW_NODE_TYPE_BOOK: case HW_NODE_TYPE_JOURNAL: case HW_NODE_TYPE_ISSUE: return TRUE; @@ -1328,8 +1303,7 @@ public function showChildren(): bool { */ public function getChildTypes(string $node_type): array { switch ($node_type) { - case HW_NODE_TYPE_MONOGRAPH: - case HW_NODE_TYPE_REPORT_GUIDELINE: + case HW_NODE_TYPE_BOOK: $chapter_types = hwjma_core_get_book_chunk_types(); $types = [reset($chapter_types)]; break; @@ -1345,8 +1319,8 @@ public function getChildTypes(string $node_type): array { default: $types = []; break; - } + return $types; } @@ -1366,16 +1340,12 @@ public function getTypeLabel(string $node_type): string { } else { switch ($node_type) { - case HW_NODE_TYPE_MONOGRAPH: - $label = 'monograph'; - break; - - case HW_NODE_TYPE_REPORT_GUIDELINE: - $label = 'report-guideline'; + case HW_NODE_TYPE_BOOK: + $label = 'book'; break; case HW_NODE_TYPE_ISSUE: - $label = 'whole issue'; + $label = 'particular issue'; break; case HW_NODE_TYPE_ARTICLE: @@ -1386,8 +1356,8 @@ public function getTypeLabel(string $node_type): string { $label = 'journal'; break; - case HW_NODE_TYPE_TEST_REVIEW: - $label = 'test-review'; + case HW_NODE_TYPE_REFERENCE: + $label = 'reference work'; break; } } @@ -1410,12 +1380,8 @@ public function getTypeLabelPlural(string $node_type): string { } else { switch ($node_type) { - case HW_NODE_TYPE_MONOGRAPH: - $label = 'monographs'; - break; - - case HW_NODE_TYPE_REPORT_GUIDELINE: - $label = 'report-guidelines'; + case HW_NODE_TYPE_BOOK: + $label = 'books'; break; case HW_NODE_TYPE_ISSUE: @@ -1430,10 +1396,9 @@ public function getTypeLabelPlural(string $node_type): string { $label = 'journals'; break; - case HW_NODE_TYPE_TEST_REVIEW: - $label = 'test-reviews'; + case HW_NODE_TYPE_REFERENCE: + $label = 'reference works'; break; - } } return $label; @@ -1450,15 +1415,14 @@ public function getTypeLabelPlural(string $node_type): string { */ public function getProductNodeTypes(string $product_type): array { $type_map = [ - 'monograph' => [HW_NODE_TYPE_MONOGRAPH], - 'report-guideline' => [HW_NODE_TYPE_REPORT_GUIDELINE], - 'monograph-chapter' => hwjma_core_get_book_chunk_types(), - 'report-guideline-chapter' => hwjma_core_get_book_chunk_types(), + 'ebook' => [HW_NODE_TYPE_BOOK], + 'chapter' => hwjma_core_get_book_chunk_types(), 'journal' => [HW_NODE_TYPE_JOURNAL], 'issue' => [HW_NODE_TYPE_ISSUE], 'article' => [HW_NODE_TYPE_ARTICLE], - 'test-review' => [HW_NODE_TYPE_TEST_REVIEW], + 'refwork' => [HW_NODE_TYPE_REFERENCE], ]; + if (!empty($type_map[$product_type])) { return $type_map[$product_type]; } @@ -1477,21 +1441,17 @@ public function getProductNodeTypes(string $product_type): array { */ protected function groupProductsByType(PricingItem $pricing_item): array { $node_type = $this->contextNode->getType(); - $chapter_type = $this->contextNode->get('chapter_type')->getString(); - $chapter_type_order = ($chapter_type == 'monograph-item-chapter') ? 'monograph' : 'report-guideline'; - $type_order_unit = ($chapter_type == 'monograph-item-chapter') ? 'monograph-chapter' : 'report-guideline-chapter'; $type_order = []; if (in_array($node_type, hwjma_core_get_book_chunk_types())) { - $type_order = [$type_order_unit, $chapter_type_order]; + $type_order = ['chapter', 'ebook']; + } + elseif (in_array($node_type, hwjma_core_get_reference_chunk_types())) { + $type_order = ['refwork']; } else { switch ($node_type) { - case HW_NODE_TYPE_MONOGRAPH: - $type_order = ['monograph']; - break; - - case HW_NODE_TYPE_REPORT_GUIDELINE: - $type_order = ['report-guideline']; + case HW_NODE_TYPE_BOOK: + $type_order = ['ebook']; break; case HW_NODE_TYPE_JOURNAL: @@ -1506,45 +1466,22 @@ protected function groupProductsByType(PricingItem $pricing_item): array { $type_order = ['article', 'issue', 'journal']; break; - case HW_NODE_TYPE_TEST_REVIEW: - $type_order = ['test-review']; + case HW_NODE_TYPE_REFERENCE: + $type_order = ['refwork']; break; } } + if (empty($type_order)) { return []; } + $products = []; foreach ($type_order as $type) { $products[$type] = $pricing_item->getProductByType($type); } + return $products; } - /** - * Get products currency symbol. - * - */ - public function getCurrencySymbol($cur) { - if (!$cur) { - return false; - } - $currencies = array( - 'USD' => '$', // US Dollar - 'EUR' => '€', // Euro - 'CRC' => '₡', // Costa Rican Colón - 'GBP' => '£', // British Pound Sterling - 'ILS' => '₪', // Israeli New Sheqel - 'INR' => '₹', // Indian Rupee - 'JPY' => '¥', // Japanese Yen - 'KRW' => '₩', // South Korean Won - 'NGN' => '₦', // Nigerian Naira - ); - if (array_key_exists($cur, $currencies)) { - return $currencies[$cur]; - } - else { - return $cur; - } - } } \ No newline at end of file diff --git a/web/modules/highwire/hwjma_ecommerce/templates/hwjma-access-panel.html.twig b/web/modules/highwire/hwjma_ecommerce/templates/hwjma-access-panel.html.twig index 6ed5eab8a..784ab1c1e 100644 --- a/web/modules/highwire/hwjma_ecommerce/templates/hwjma-access-panel.html.twig +++ b/web/modules/highwire/hwjma_ecommerce/templates/hwjma-access-panel.html.twig @@ -11,4 +11,4 @@ {% endif %} {% endblock %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/web/modules/highwire/hwjma_ecommerce/templates/hwjma-purchase-offer-item.html.twig b/web/modules/highwire/hwjma_ecommerce/templates/hwjma-purchase-offer-item.html.twig index 258bf6e06..723a99d50 100644 --- a/web/modules/highwire/hwjma_ecommerce/templates/hwjma-purchase-offer-item.html.twig +++ b/web/modules/highwire/hwjma_ecommerce/templates/hwjma-purchase-offer-item.html.twig @@ -11,4 +11,4 @@ {{ purchase_link }} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/web/modules/highwire/hwjma_ecommerce/templates/hwjma-purchase-offer.html.twig b/web/modules/highwire/hwjma_ecommerce/templates/hwjma-purchase-offer.html.twig index d2f5388fb..a923e4f8d 100644 --- a/web/modules/highwire/hwjma_ecommerce/templates/hwjma-purchase-offer.html.twig +++ b/web/modules/highwire/hwjma_ecommerce/templates/hwjma-purchase-offer.html.twig @@ -9,4 +9,4 @@ {% endfor %} {% endif %} - \ No newline at end of file + diff --git a/web/themes/highwire/hwjma_theme/apps/drupal-default/hwjma_theme/includes/layout.theme.inc b/web/themes/highwire/hwjma_theme/apps/drupal-default/hwjma_theme/includes/layout.theme.inc index b5f97d0e6..66cf9e1df 100755 --- a/web/themes/highwire/hwjma_theme/apps/drupal-default/hwjma_theme/includes/layout.theme.inc +++ b/web/themes/highwire/hwjma_theme/apps/drupal-default/hwjma_theme/includes/layout.theme.inc @@ -232,7 +232,7 @@ function hwjma_preprocess_region(&$variables) { } // Add blocks. and Add shopping cart. - /* $block_manager = \Drupal::service('plugin.manager.block'); + $block_manager = \Drupal::service('plugin.manager.block'); $current_user = \Drupal::currentUser(); $cart_block = $block_manager->createInstance('highwire_ecommerce_shopping_cart', []); $cart_access = $cart_block->access($current_user); @@ -242,7 +242,7 @@ function hwjma_preprocess_region(&$variables) { if (!empty($shopping_cart)) { $variables['shopping_cart'] = $shopping_cart; } - } */ + } } break; } diff --git a/web/themes/highwire/hwjma_theme/apps/drupal-default/hwjma_theme/templates/system/region--header-auth.html.twig b/web/themes/highwire/hwjma_theme/apps/drupal-default/hwjma_theme/templates/system/region--header-auth.html.twig index 8aec14c55..d89cb526e 100755 --- a/web/themes/highwire/hwjma_theme/apps/drupal-default/hwjma_theme/templates/system/region--header-auth.html.twig +++ b/web/themes/highwire/hwjma_theme/apps/drupal-default/hwjma_theme/templates/system/region--header-auth.html.twig @@ -1,2 +1,2 @@ + {% include "@molecules/global/region--header-auth.twig" %} - \ No newline at end of file diff --git a/web/themes/highwire/hwjma_theme/source/default/_patterns/02-molecules/global/region--header-auth.twig b/web/themes/highwire/hwjma_theme/source/default/_patterns/02-molecules/global/region--header-auth.twig index b2ac14098..8be534249 100755 --- a/web/themes/highwire/hwjma_theme/source/default/_patterns/02-molecules/global/region--header-auth.twig +++ b/web/themes/highwire/hwjma_theme/source/default/_patterns/02-molecules/global/region--header-auth.twig @@ -1,7 +1,12 @@ {% set content = content ? content : true %} - {% embed "@molecules/global/region.twig" %} +{% embed "@molecules/global/region.twig" %} {% block content %} + {# {% if not logged_in %} + {% include "@molecules/global/login-prompt.twig" %} + {% else %} + {% include "@molecules/global/login.twig" %} #} {{ content }} + {# {% endif %} #} {{ shopping_cart }} {% endblock %} {% endembed %} \ No newline at end of file diff --git a/web/themes/highwire/hwjma_theme/source/default/css/scss/_custom-style.scss b/web/themes/highwire/hwjma_theme/source/default/css/scss/_custom-style.scss index 89347da37..a13ea4823 100755 --- a/web/themes/highwire/hwjma_theme/source/default/css/scss/_custom-style.scss +++ b/web/themes/highwire/hwjma_theme/source/default/css/scss/_custom-style.scss @@ -652,7 +652,7 @@ input[list]+ul[list] { border-bottom: 1px solid $secondary; margin-bottom: 20px; } - .bps-purchase-offer { + .hwjma-purchase-offer { display: flex; justify-content: space-between; width: 100%; From 8760010581db4f5204447a3895dfc0e7786b2858 Mon Sep 17 00:00:00 2001 From: Rajat Gupta Date: Fri, 3 Nov 2023 05:57:04 -0400 Subject: [PATCH 2/4] JCOREX-145:Foxycart --- config/sync/core.extension.yml | 2 + config/sync/highwire_client.settings.yml | 299 ++++++++++++++++++ ...splay.markup_display.abstract_article_.yml | 2 +- config/sync/hwjma_ecommerce.settings.yml | 7 + ...age_variant.node_view-panels_variant-1.yml | 27 ++ 5 files changed, 336 insertions(+), 1 deletion(-) create mode 100644 config/sync/highwire_client.settings.yml create mode 100644 config/sync/hwjma_ecommerce.settings.yml diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 248e8efaa..e2b948f3c 100755 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -52,6 +52,7 @@ module: highwire_core: 0 highwire_counter: 0 highwire_display: 0 + highwire_ecommerce: 0 highwire_hwphp: 0 highwire_kafka: 0 highwire_markup: 0 @@ -67,6 +68,7 @@ module: hwjma_basic_config: 0 hwjma_content_display: 0 hwjma_core: 0 + hwjma_ecommerce: 0 hwjma_search: 0 image: 0 image_captcha: 0 diff --git a/config/sync/highwire_client.settings.yml b/config/sync/highwire_client.settings.yml new file mode 100644 index 000000000..c11f83049 --- /dev/null +++ b/config/sync/highwire_client.settings.yml @@ -0,0 +1,299 @@ +highwire_client_configuration: + debug_all: 0 + disable_all_cache: 0 + 'hwphpclient:access-control': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + extra_settings: + access_control_context: '' + publisher_id: '' + 'hwphpclient:concurrency-ticket-store': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + extra_settings: { } + 'hwphpclient:a4d-extract': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:date': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:alerts': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:capture': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:saved-search': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:markers': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:features': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:workspaces': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:tags': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:taggings': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:preferences': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:report-data': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:atom-lite': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:atom-lite-reprocessor': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:markup': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:htmlpdf': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:pdf-stamper': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:binary': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:sass': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:atom-collections': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:taxonomy': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:atomx': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:atom': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:catalog': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:foxycart-user': + env: custom + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:embargo': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:pdf-extract': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:content-sync': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:links': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:staticfs': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:usage-stats': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:transfer-token-auth': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:transfer-token-token': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:star-logger': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:marc-records': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:casa-token': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + extra_settings: + context: '' + subscriber_base_url: / + 'hwphpclient:casa-validation': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + extra_settings: + context: '' + 'hwphpclient:casa-vouchers': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + extra_settings: + context: '' + 'hwphpclient:sigma-publisher': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + extra_settings: + context: '' + api_key: '' + 'hwphpclient:site-data': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:cct-collections': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:ai-recommendations': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:three-play-plugin': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + 'hwphpclient:ecommerce-transactions': + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 + SAMSSigma: + env: production + custom_url: '' + timeout: '' + cache_ttl: '' + debug: 0 diff --git a/config/sync/highwire_markup_display.markup_display.abstract_article_.yml b/config/sync/highwire_markup_display.markup_display.abstract_article_.yml index bf19235e7..9db757b74 100644 --- a/config/sync/highwire_markup_display.markup_display.abstract_article_.yml +++ b/config/sync/highwire_markup_display.markup_display.abstract_article_.yml @@ -7,10 +7,10 @@ label: 'Abstract (Article)' configurations: - markup_profile: journal_full_text_abstract + access_rule: '' field_group_settings: field_group_formatter: '0' weight: '1' - access_rule: '' markup_field_enabled: true markup_field_content_types: - journal_article diff --git a/config/sync/hwjma_ecommerce.settings.yml b/config/sync/hwjma_ecommerce.settings.yml new file mode 100644 index 000000000..4d1c9cf46 --- /dev/null +++ b/config/sync/hwjma_ecommerce.settings.yml @@ -0,0 +1,7 @@ +form_defaults: + book_user_has_access_heading: 'You already have access to these chapters:' + book_purchase_access_heading: 'Get access to this book:' + chapter_purchase_chapter_heading: 'Get access to this chapter:' + chapter_purchase_book_heading: 'Get access to this chapter:' +_core: + default_config_hash: G2NpWOXK1BIRca1OKrWM_LK4OF2ngbbpPAFproLWaJs diff --git a/config/sync/page_manager.page_variant.node_view-panels_variant-1.yml b/config/sync/page_manager.page_variant.node_view-panels_variant-1.yml index b6feef299..39e478610 100644 --- a/config/sync/page_manager.page_variant.node_view-panels_variant-1.yml +++ b/config/sync/page_manager.page_variant.node_view-panels_variant-1.yml @@ -6,6 +6,7 @@ dependencies: - page_manager.page.node_view module: - ctools + - hwjma_ecommerce - journal_article_detail - node - panels @@ -68,6 +69,32 @@ variant_settings: id: '' context_mapping: node: node + 8d7c4b01-d1e2-4bc7-b3a6-1d0657969660: + id: hwjma_display_price + label: 'HWJMA Display Price' + provider: hwjma_ecommerce + label_display: '0' + list_titles: + user_access_already: 'You already have access to these :types:' + purchase_offers_current: 'Get access to this :type:' + purchase_offers_container: 'Get access to the entire :type:' + purchase_offers_default: 'Get access to the :type:' + child_offers_prompt: + title: 'Get access to individual :types:' + text: 'Open :a :type to see its purchasing options.' + region: top + weight: 0 + uuid: 8d7c4b01-d1e2-4bc7-b3a6-1d0657969660 + context_mapping: + node: node + view_modes: + journal: default + journal_article: default + journal_fragment: '' + journal_issue: default + journal_volume: '' + relationship: '' + access_control_rule: online_access id: panels_variant uuid: 913cdc11-eec4-463b-af89-51b8f40e5a98 label: null From 8f149f381fbcc8e3f848d03c6dee77f162637925 Mon Sep 17 00:00:00 2001 From: Rajat Gupta Date: Fri, 3 Nov 2023 06:21:56 -0400 Subject: [PATCH 3/4] JCOREX-145:Foxycart --- .../_patterns/03-components/site/_journal-article.scss | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web/themes/highwire/hwjma_theme/source/default/_patterns/03-components/site/_journal-article.scss b/web/themes/highwire/hwjma_theme/source/default/_patterns/03-components/site/_journal-article.scss index 03b2bae3d..a1c7e57b1 100755 --- a/web/themes/highwire/hwjma_theme/source/default/_patterns/03-components/site/_journal-article.scss +++ b/web/themes/highwire/hwjma_theme/source/default/_patterns/03-components/site/_journal-article.scss @@ -313,6 +313,16 @@ width: 100%; max-width: 21.7%; padding: 1rem 1.375rem 0; + a.hwjma-access-panel { + padding: 0; + margin-top: 15px; + display: inline-block; + font-family: $font-family-monospace; + &:hover { + color: $primary; + text-decoration: underline; + } + } } &__txtwrap{ width: 59%; From 8322acef655cf76fae481323bef2de1da30b1c93 Mon Sep 17 00:00:00 2001 From: Rajat Gupta Date: Thu, 16 Nov 2023 03:03:59 -0500 Subject: [PATCH 4/4] JCOREX-145:Foxycart --- .../_patterns/02-molecules/global/region--header-auth.twig | 7 +------ .../hwjma_theme/source/default/css/scss/_custom-style.scss | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/web/themes/highwire/hwjma_theme/source/default/_patterns/02-molecules/global/region--header-auth.twig b/web/themes/highwire/hwjma_theme/source/default/_patterns/02-molecules/global/region--header-auth.twig index 8be534249..f6b0b0c21 100755 --- a/web/themes/highwire/hwjma_theme/source/default/_patterns/02-molecules/global/region--header-auth.twig +++ b/web/themes/highwire/hwjma_theme/source/default/_patterns/02-molecules/global/region--header-auth.twig @@ -1,12 +1,7 @@ {% set content = content ? content : true %} {% embed "@molecules/global/region.twig" %} {% block content %} - {# {% if not logged_in %} - {% include "@molecules/global/login-prompt.twig" %} - {% else %} - {% include "@molecules/global/login.twig" %} #} {{ content }} - {# {% endif %} #} {{ shopping_cart }} {% endblock %} -{% endembed %} \ No newline at end of file +{% endembed %} diff --git a/web/themes/highwire/hwjma_theme/source/default/css/scss/_custom-style.scss b/web/themes/highwire/hwjma_theme/source/default/css/scss/_custom-style.scss index a13ea4823..4b2218118 100755 --- a/web/themes/highwire/hwjma_theme/source/default/css/scss/_custom-style.scss +++ b/web/themes/highwire/hwjma_theme/source/default/css/scss/_custom-style.scss @@ -233,7 +233,7 @@ picture img { border: 1px solid $secondary; } .login-accordion { - display: none; + display: block; .right-toggle-icon { @extend .d-block; @extend .float-medium-tablet-end;