From d249903f71f90d41b2f97ef84cafd38648a24ddc Mon Sep 17 00:00:00 2001 From: Jean-Michel Batty Date: Fri, 30 Aug 2024 14:03:56 -0500 Subject: [PATCH] Patch Release: Add warranty item details in the frontend, the Warranty Item was lacking details. this patch brings the warranty details and the parent order ID if present for PUE orders --- view/frontend/layout/sales_order_view.xml | 5 +++ .../order/item/additional-info.phtml | 43 +++++++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/view/frontend/layout/sales_order_view.xml b/view/frontend/layout/sales_order_view.xml index 658f3e10..cc8e8776 100644 --- a/view/frontend/layout/sales_order_view.xml +++ b/view/frontend/layout/sales_order_view.xml @@ -17,6 +17,11 @@ Extend_Warranty::order/item/additional-info.phtml + + Extend\Warranty\ViewModel\Warranty + + + getData('viewModel'); ?> getItem(); -$block->getChildBlock('order.item.warranty')->setItem($_item); + + $_item = $block->getItem(); + $block->getChildBlock('order.item.warranty')->setItem($_item); + + if ($_item->getProductType()=='warranty'){ + + $_productOptions = $_item->getProductOptions(); + $_planId = isset($_productOptions["warranty_id"]) ? $_productOptions["warranty_id"] : ''; + $_parentSku= isset($_productOptions["associated_product"]) ? $_productOptions["associated_product"] : ''; + $_contractID = $viewModel->unserialize($_item->getContractId()) ?? []; + $_contractID = is_array($_contractID) ? $_contractID : [$_contractID]; + + $_refunded = (isset($_productOptions["refund"]) && true == $_productOptions["refund"]) + ? "-- All refunded --" : ''; + + //retrieve Parent Order ID if present + $currentOrderId = $_item->getOrderId(); + $parentOrderId = isset($_productOptions["parent_order_id"]) ? $_productOptions["parent_order_id"] : null; + $incrementId = $parentOrderId ? $viewModel->getOrderIncrementId($parentOrderId) : null; ?> +
+ + + escapeHtml(__('Contract ID'))?>: + + + escapeHtml($_refunded); ?> + +
escapeHtml(__('Plan ID'))?>: +
escapeHtml(__('Associated SKU'))?>: -getChildHtml('', false); +
+ $currentOrderId) && $incrementId) { + echo " Parent Order: $parentOrderId])."'>".$incrementId.""; + } + } +?> +getChildHtml('', false);