Created
February 13, 2025 12:37
-
-
Save goranefbl/b5f7b2f8e9396f6f6ecc7e0c489f6b2e to your computer and use it in GitHub Desktop.
hs-widget.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* @var $args array */ | |
$tracking_actions = false; | |
if ( class_exists('WC_Shipment_Tracking_Actions') ) { | |
$tracking_actions = new \WC_Shipment_Tracking_Actions(); | |
} | |
if ( ! class_exists( 'TomShippingBob' ) ) { | |
include_once "../inc/classes/TomShippingBob.class.php"; | |
} | |
$shipbobClass = TomShippingBob::getInstance(); | |
$selfClass = TOM_Helpscout::getInstance(); | |
function is_order_older_than_two_months($order_id, $is_refund) { | |
// Get the order object | |
$order = wc_get_order($order_id); | |
if (!$order) { | |
return false; // Order not found | |
} | |
// Get the order date | |
$order_date = $order->get_date_created(); | |
if (!$order_date) { | |
return false; // Order date not available | |
} | |
// Get current date | |
$current_date = new DateTime(); | |
// Calculate the difference between current date and order date | |
$interval = $current_date->diff($order_date); | |
// Set the threshold based on whether it's a refund or not | |
$month_threshold = $is_refund ? 5 : 2; | |
// Check if the difference is more than the threshold | |
if ($interval->y > 0 || $interval->m > $month_threshold || ($interval->m == $month_threshold && $interval->d > 0)) { | |
return true; // Order is older than the threshold | |
} | |
return false; | |
} | |
?> | |
<h2><i class="icon-cart"></i> <?php _e( 'Order History', 'helpscout' );?></h2> | |
<?php if ( count( $args['orders'] ) ) { ?> | |
<ul class="unstyled"> | |
<?php | |
if ( ! empty( $args['orders'] ) ) { | |
foreach ( $args['orders'] as $k_order => $order ) { ?> | |
<?php | |
$orderType = $order['type']; | |
$order_id = $order['id']; | |
$uspsStatusLabel = $order['uspsStatusLabel']; | |
$uspsStatusLabelShipBob = $order['uspsStatusLabelShipBob']; | |
$date_created = $order['date_created']; | |
$order_total = isset($order['upsell_clear']) ? $order['upsell_clear'] : $order['order_total']; | |
$order_total_clear = $order['order_total_clear']; | |
$order_url = $order['order_url']; | |
if ( empty( $order_url ) ) { | |
$order_url = $order['tracking_url']; | |
} | |
$order_status = $order['order_status']; | |
$shipbobData = $order['shipbobData']; | |
$shipbobDataReturnArr = $order['shipbobDataReturnArr']; | |
$uid = $order['uid']; | |
$email = $order['email']; | |
$status_color = $order['status_color']; | |
$order_status_name = $order['order_status_name']; | |
$get_total_refunded = $order['get_total_refunded']; | |
$get_refunds = $order['get_refunds']; | |
$get_payment_method_title = $order['get_payment_method_title']; | |
$get_payment_method = $order['get_payment_method']; | |
$get_transaction_id = $order['get_transaction_id']; | |
$get_items = $order['get_items']; | |
if ( isset( $order['shipbob_products'] ) ) { | |
$shipbob_products = $order['shipbob_products']; | |
} | |
$get_shipping_method = $order['get_shipping_method']; | |
$get_shipping_total = $order['get_shipping_total']; | |
$currency = $order['currency']; | |
$get_used_coupons = $order['get_used_coupons']; | |
$get_billing_first_name = $order['get_billing_first_name']; | |
$get_billing_last_name = $order['get_billing_last_name']; | |
$get_billing_company = $order['get_billing_company']; | |
$get_billing_address_1 = $order['get_billing_address_1']; | |
$get_billing_address_2 = $order['get_billing_address_2']; | |
$get_billing_city = $order['get_billing_city']; | |
$get_billing_postcode = $order['get_billing_postcode']; | |
$get_billing_state = $order['get_billing_state']; | |
$get_billing_country = $order['get_billing_country']; | |
$get_billing_phone = $order['get_billing_phone']; | |
$get_shipping_first_name = $order['get_shipping_first_name']; | |
$get_shipping_last_name = $order['get_shipping_last_name']; | |
$get_shipping_company = $order['get_shipping_company']; | |
$get_shipping_address_1 = $order['get_shipping_address_1']; | |
$get_shipping_address_2 = $order['get_shipping_address_2']; | |
$get_shipping_city = $order['get_shipping_city']; | |
$get_shipping_postcode = $order['get_shipping_postcode']; | |
$get_shipping_state = $order['get_shipping_state']; | |
$get_shipping_country = $order['get_shipping_country']; | |
$DocumentURL = $order['DocumentURL']; | |
$DocumentURL_upsale = $order['DocumentURL_upsale']; | |
$DocumentURL_upsell = $order['DocumentURL_upsell']; | |
$cancel_document_link = $order['cancel_document_link']; | |
$is_guest = $order['is_guest']; | |
$uid2 = ''; | |
if ( empty( $uid ) ) { | |
$userOr = get_user_by( 'email', $email ); | |
if ( $userOr && !is_wp_error( $userOr ) ) { | |
$uid2 = $userOr->ID; | |
} | |
} ?> | |
<div class="c-sb-section c-sb-section--toggle"> | |
<div class="c-sb-section__title js-sb-toggle"> | |
<?php if ( ! empty( $uid ) ) { ?> | |
<p> | |
<span class="green">Registered User</span> | |
</p> | |
<?php } else { | |
if ( !empty( $uid2 ) ) { ?> | |
<p> | |
<span class="red">Guest User that has account with current email.</span> | |
</p> | |
<?php } else { ?> | |
<p> | |
<span class="green">Guest</span> | |
</p> | |
<?php } | |
} ?> | |
</div> | |
</div> | |
<div class="c-sb-section c-sb-section--toggle"> | |
<div class="c-sb-section__title js-sb-toggle"> | |
<?php | |
if ( $orderType === 'manual' ) { | |
echo '<p><span>Manual Order: </span></p>'; | |
} | |
?> | |
<a href="<?php echo $order_url; ?>" target="_blank">#<?php echo $order_id; ?></a> <span | |
class="muted"><?php echo $date_created; ?></span> | |
- <?php echo $order_total; ?> <span | |
class="<?php echo $status_color; ?>"><?php echo $order_status_name; ?></span> | |
<i class="caret sb-caret"></i> | |
<?php if (!empty($order['main_refund']) || !empty($order['upsell_refund']) || !empty($get_refunds)) { ?> | |
<p> | |
<strong><?php _e( 'Refund History:', 'helpscout' ) ?></strong> | |
</p> | |
<ul> | |
<?php | |
$total_refunded = 0; | |
$main_refund = $order['main_refund']; | |
$upsell_refund = $order['upsell_refund']; | |
if (!empty($main_refund) && !empty($upsell_refund)) { | |
// Display PayPlus specific refunds | |
if (!empty($main_refund)) { | |
$total_refunded += floatval($main_refund); | |
echo "<li>" . date('m/d/Y') . " refunded " . wc_price($main_refund, array('currency' => $currency)) . " (Main Order)</li>"; | |
} | |
if (!empty($upsell_refund)) { | |
$total_refunded += floatval($upsell_refund); | |
echo "<li>" . date('m/d/Y') . " refunded " . wc_price($upsell_refund, array('currency' => $currency)) . " (Upsell)</li>"; | |
} | |
} else { | |
// Display regular refunds | |
foreach ( $get_refunds as $refund ) { | |
$refund_amount = $refund->get_amount(); | |
$refund_date = $refund->get_date_created()->format('m/d/Y'); | |
$total_refunded += $refund_amount; | |
echo "<li>{$refund_date} refunded " . wc_price($refund_amount, array('currency' => $currency)) . "</li>"; | |
} | |
} | |
?> | |
</ul> | |
<p> | |
<strong><?php _e( 'Total Refunded:', 'helpscout' ) ?></strong> | |
<span class="red"><?php echo wc_price($total_refunded, array('currency' => $currency)); ?></span> | |
</p> | |
<?php } ?> | |
</div> | |
<div class="c-sb-section__body"> | |
<div class="c-sb-list-group"> | |
<?php | |
if ( $tracking_actions ) { | |
$tracking_items = $tracking_actions->get_tracking_items( $order_id ); | |
if ( count( $tracking_items ) ) { ?> | |
<div class="c-sb-list-group__subheader t-tx-charcoal-500 tx-13 tx-500"><?php _e( 'Shipment Tracking', 'helpscout' ) ?></div> | |
<?php foreach ( $tracking_items as $tracking_item ) { | |
$formatted_tracking_item = $tracking_actions->get_formatted_tracking_item( $order_id, $tracking_item ); ?> | |
<ul class="c-sb-list c-sb-list--two-line"> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php echo $tracking_item['tracking_provider']; ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $tracking_item['tracking_number']; ?> - <a href="<?php echo $formatted_tracking_item['formatted_tracking_link'] ?>"><?php _e( 'Track', 'helpscout' ) ?></a> | |
</span> | |
</span> | |
</li> | |
<li class="c-sb-list-item"> | |
<div> | |
<?php | |
if (!is_order_older_than_two_months($order_id, false)) { | |
$usps_integration = TomUspsIntegration::getInstance(); | |
$tracking_data = $usps_integration->get_tracking_info($tracking_item['tracking_number'], $tracking_item['custom_tracking_provider'] ?? $tracking_item['tracking_provider'], $order_id); | |
if(isset($tracking_data['status']) && $tracking_data['status'] != 'error') { | |
// Get the most recent tracking detail | |
$latest_detail = end($tracking_data['tracking_details']); | |
// Output the formatted tracking information | |
echo "<div class='c-sb-list-group__subheader t-tx-charcoal-500 tx-13 tx-500'>Status</div>"; | |
echo "<strong>" . ucfirst($tracking_data['status']) . "</strong><br><br>"; | |
// Only show the event date if the status is not 'unknown' | |
if ($tracking_data['status'] != 'unknown') { | |
echo "<strong>" . $latest_detail['description'] . "</strong><br><br>"; | |
// Format the date | |
$event_date = date('F j, Y', strtotime($latest_detail['datetime'])); | |
echo "<strong>Last update: " . $event_date . "</strong><br><br>"; | |
} | |
} | |
} | |
?> | |
</div> | |
</li> | |
<?php if ( ! empty( $uspsStatusLabel ) ) : ?> | |
<li class="uspsTrackingLabel" | |
style="margin-top:0!important;padding-top:0!important;"> | |
<span><?php echo $uspsStatusLabel; ?></span> | |
</li> | |
<?php endif; ?> | |
</ul> | |
<?php } ?> | |
<?php } | |
} ?> | |
<?php if ( $order['is_forter'] == true ) : ?> | |
<div class="c-sb-list-group__subheader t-tx-charcoal-500 tx-13 tx-500">Forter:</div> | |
<p> | |
<span><a href="https://portal.forter.com/app/dashboard/transactions/id/<?php echo $order['id']; ?>/details/" aria-label="forter link" title="forter link" target="_blank" rel="nofollow"><strong><?php echo $order['id']; ?></strong></a></span> | |
<?php if ( $order['orderFraud'] == true ) : ?> | |
<br/><span style="display:inline-block;font-weight:bold;">marked as fruad</span> | |
<?php endif; ?> | |
</p> | |
<br/> | |
<?php endif; ?> | |
<?php if ( ! empty( $shipbobData['id'] ) ) : ?> | |
<div class="c-sb-list-group__subheader t-tx-charcoal-500 tx-13 tx-500">ShipBoB ID: </div> | |
<p> | |
<span><a href="https://web.shipbob.com/App/Merchant/#/Orders/<?php echo $shipbobData['id']; ?>/" | |
aria-label="ship bob id" title="ship bob id" target="_blank" | |
rel="nofollow"><strong><?php echo $shipbobData['id']; ?></strong></a></span> | |
</p> | |
<?php endif; ?> | |
<?php if ( ! empty( $shipbobDataReturnArr ) ) : | |
if ( ! is_array( $shipbobDataReturnArr ) ) { | |
$shipbobDataReturnArr = array( $shipbobDataReturnArr ); | |
} | |
?> | |
<?php foreach ( $shipbobDataReturnArr as $k => $shipbobDataReturn ) : ?> | |
<?php if ( ! empty( $shipbobDataReturn['id'] ) ) : ?> | |
<br/> | |
<div class="c-sb-list-group__subheader t-tx-charcoal-500 tx-13 tx-500">ShipBoB Return | |
Label: | |
</div> | |
<p> | |
<?php if ( is_array( $shipbobDataReturn['transactions'] ) ) { | |
$shipbobDataReturn['transactions'] = $shipbobDataReturn['transactions'][0]; | |
} ?> | |
<span><a href="https://web.shipbob.com/App/Merchant/#/returns/<?php echo $shipbobDataReturn['id']; ?>/" | |
aria-label="ship bob return label id" title="ship bob return label id" target="_blank" | |
rel="nofollow"><strong><?php echo $shipbobDataReturn['transactions']->transaction_type; ?></strong></a></span> | |
</p> | |
<br/> | |
<div class="c-sb-list-group__subheader t-tx-charcoal-500 tx-13 tx-500">ShipBoB Return | |
USPS Tracking number: | |
</div> | |
<p> | |
<span><a href="https://tools.usps.com/go/TrackConfirmAction?qtc_tLabels1=<?php echo $shipbobDataReturn['tracking_number']; ?>" | |
aria-label="ship bob return label id" title="ship bob return label id" target="_blank" | |
rel="nofollow"><strong><?php echo $shipbobDataReturn['tracking_number']; ?></strong></a></span> | |
</p> | |
<?php if ( ! empty( $uspsStatusLabelShipBob[ $k ] ) ) : ?> | |
<p class="uspsTrackingLabel"> | |
<span><?php echo $uspsStatusLabelShipBob[ $k ]; ?></span> | |
</p> | |
<?php endif; ?> | |
<br/> | |
<div> | |
<?php | |
if (!is_order_older_than_two_months($order_id, true)) { | |
$usps_integration = TomUspsIntegration::getInstance(); | |
$tracking_data = $usps_integration->get_tracking_info($shipbobDataReturn['tracking_number'], 'UPSMailInnovations', $order_id); | |
if(isset($tracking_data['status']) && $tracking_data['status'] != 'error') { | |
// Get the most recent tracking detail | |
$latest_detail = end($tracking_data['tracking_details']); | |
// Output the formatted tracking information | |
echo "<div class='c-sb-list-group__subheader t-tx-charcoal-500 tx-13 tx-500'>Status</div>"; | |
echo "<strong>" . ucfirst($tracking_data['status']) . "</strong><br><br>"; | |
// Only show the event date if the status is not 'unknown' | |
if ($tracking_data['status'] != 'unknown') { | |
echo "<strong>" . $latest_detail['description'] . "</strong><br><br>"; | |
// Format the date | |
$event_date = date('F j, Y', strtotime($latest_detail['datetime'])); | |
echo "<strong>Last update: " . $event_date . "</strong><br><br>"; | |
} | |
} | |
} | |
?> | |
</div> | |
<div> | |
<?php if ( ! empty( $shipbobDataReturn['inventory'] ) ) : ?> | |
<ul> | |
<?php foreach ( $shipbobDataReturn['inventory'] as $inv ) : ?> | |
<li> | |
<div> | |
<p style="display:block;">Name: <?php echo $inv['name'] . ' (id: ' . $inv['id'] . ')'; ?></p> | |
<p>quantity: <?php echo $inv['quantity']; ?></p> | |
</div> | |
<div> | |
<?php if ( ! empty( $inv['action_taken'] ) ) : ?> | |
<ul> | |
<?php foreach ( $inv['action_taken'] as $actionTaken ) : ?> | |
<li> | |
<p>Action: <?php echo $actionTaken['action'] ?></p> | |
<p>Reason: <?php echo $actionTaken['action_reason']; ?></p> | |
<p>Quantity: <?php echo $actionTaken['quantity_processed']; ?></p> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
<?php endif; ?> | |
</div> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
<?php endif; ?> | |
</div> | |
<br/> | |
<?php endif; ?> | |
<?php endforeach; ?> | |
<?php endif; ?> | |
<!-- <div class="c-sb-list-divider"></div> --> | |
<!-- Payment Method --> | |
<ul class="c-sb-list c-sb-list--two-line"> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Payment Method', 'helpscout' ); ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_payment_method_title; ?> | |
</span> | |
</span> | |
</li> | |
<?php if ( strpos( $get_payment_method, 'paypal' ) !== false ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Transaction ID', 'helpscout' ); ?> | |
<span class="c-sb-list-item__text"> | |
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=<?php echo $get_transaction_id; ?>" target="_blank"><?php echo $get_transaction_id; ?></a> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
</ul> | |
<div class="c-sb-list-group__subheader t-tx-charcoal-500 tx-13 tx-500"><?php _e( 'Line items', 'helpscout' ) ?></div> | |
<ul class="c-sb-list c-sb-list--compact"> | |
<?php if (!empty( $get_items ) ) { | |
foreach ( $get_items as $item_key => $item ) { | |
$item_data = $item->get_data(); ?> | |
<li class="c-sb-list-item c-sb-list-item--bullet"> | |
<strong><?php echo $item_data['name']; ?></strong> | |
x <?php echo $item_data['quantity']; ?> | |
- <?php echo wc_price( $item_data['total'] ); ?> | |
</li> | |
<?php } | |
} ?> | |
<?php if (!empty( $shipbob_products ) ) { | |
foreach ( $shipbob_products as $item_key2 => $item2 ) { ?> | |
<li class="c-sb-list-item c-sb-list-item--bullet"> | |
<strong><?php echo $item2->name;?></strong> | |
</li> | |
<?php } | |
} ?> | |
<?php if ( $get_shipping_method ) : ?> | |
<li class="c-sb-list-item c-sb-list-item--bullet"> | |
<strong><?php echo $get_shipping_method; ?></strong> x 1 | |
- <?php echo $currency . ' ' . $get_shipping_total; ?> | |
</li> | |
<?php endif; ?> | |
</ul> | |
<?php if ( ! empty( $get_used_coupons ) && count( $get_used_coupons ) > 0 ) : ?> | |
<ul class="c-sb-list c-sb-list--compact"> | |
<?php foreach ( $get_used_coupons as $coupon_code ) : | |
$coupon = new WC_Coupon( $coupon_code ); | |
$discount_type = $coupon->get_discount_type(); | |
$coupon_amount = $coupon->get_amount(); | |
if ( $discount_type == 'percent' ) { | |
$cAm = floor( $order_total_clear * ( $coupon_amount / 100 ) ); | |
} else { | |
$cAm = $coupon_amount; | |
} ?> | |
<li> | |
<ul> | |
<li>Used Coupon: <strong><?php echo $coupon_code; ?></strong></li> | |
<li>Amount: | |
<strong><?php echo $currency . $cAm; ?></strong> | |
</li> | |
</ul> | |
</li> | |
<?php endforeach; ?> | |
</ul> | |
<?php endif; ?> | |
<!-- Billing Address --> | |
<div class="c-sb-list-group__subheader t-tx-charcoal-500 tx-13 tx-500"><?php _e( 'Billing Address', 'helpscout' ) ?></div> | |
<ul class="c-sb-list c-sb-list--two-line"> | |
<!-- First name --> | |
<?php if ( ! empty( $get_billing_first_name ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'First name', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_billing_first_name; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Last name --> | |
<?php if ( ! empty( $get_billing_last_name ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Last name', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_billing_last_name; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Company --> | |
<?php if ( ! empty( $get_billing_company ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Company', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_billing_company; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Address line 1 --> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Address line 1', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_billing_address_1; ?> | |
</span> | |
</span> | |
</li> | |
<!-- Address line 2 --> | |
<?php if ( ! empty( $get_billing_address_2 ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Address line 2', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_billing_address_2; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- City --> | |
<?php if ( ! empty( $get_billing_city ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'City', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_billing_city; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Postcode / ZIP --> | |
<?php if ( ! empty( $get_billing_postcode ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Postcode / ZIP', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_billing_postcode; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- State / County --> | |
<?php if ( ! empty( $get_billing_state ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'State / County', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_billing_state; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Country / Region --> | |
<?php if ( ! empty( $get_billing_country ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Country / Region', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_billing_country; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Phone --> | |
<?php if ( ! empty( $get_billing_phone ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Phone', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_billing_phone; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
</ul> | |
<!-- Shipping Address --> | |
<div class="c-sb-list-group__subheader t-tx-charcoal-500 tx-13 tx-500"><?php _e( 'Shipping Address', 'helpscout' ) ?></div> | |
<ul class="c-sb-list c-sb-list--two-line"> | |
<!-- First name --> | |
<?php if ( ! empty( $get_shipping_first_name ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'First name', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_shipping_first_name; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Last name --> | |
<?php if ( ! empty( $get_shipping_last_name ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Last name', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_shipping_last_name; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Company --> | |
<?php if ( ! empty( $get_shipping_company ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Company', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_shipping_company; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Address line 1 --> | |
<?php if ( ! empty( $get_shipping_address_1 ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Address line 1', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_shipping_address_1; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Address line 2 --> | |
<?php if ( ! empty( $get_shipping_address_2 ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Address line 2', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_shipping_address_2; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- City --> | |
<?php if ( ! empty( $get_shipping_city ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'City', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_shipping_city; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Postcode / ZIP --> | |
<?php if ( ! empty( $get_shipping_postcode ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Postcode / ZIP', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_shipping_postcode; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- State / County --> | |
<?php if ( ! empty( $get_shipping_state ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'State / County', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_shipping_state; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
<!-- Country / Region --> | |
<?php if ( ! empty( $get_shipping_country ) ) { ?> | |
<li class="c-sb-list-item"> | |
<span class="c-sb-list-item__label"> | |
<?php _e( 'Country / Region', 'helpscout' ) ?> | |
<span class="c-sb-list-item__text"> | |
<?php echo $get_shipping_country; ?> | |
</span> | |
</span> | |
</li> | |
<?php } ?> | |
</ul> | |
<div class="c-sb-list-group__subheader t-tx-charcoal-500 tx-13 tx-500"><?php _e( 'Documents', 'helpscout' ) ?></div> | |
<div class="c-sb-list c-sb-list--compact"> | |
<?php | |
if ( ! empty( $DocumentURL ) ) { ?> | |
<div><a target="_blank" class="button tips invoice-button invoice-button-small" title="Print Invoice" href="<?php echo $DocumentURL; ?>">Print Invoice</a></div> | |
<?php } | |
if ( is_array( $DocumentURL_upsale ) ) { | |
foreach ( $DocumentURL_upsale as $kl => $vl ) { | |
if ( empty( $vl ) ) { | |
continue; | |
} | |
$c = $kl + 1; ?> | |
<a target="_blank" class="button tips invoice-button invoice-button-small iii" | |
title="Print Invoice Funnel #<?php echo $c; ?>" href="<?php echo $vl; ?>">Print | |
Invoice Funnel #<?php echo $c; ?></a> | |
<?php } | |
} else { ?> | |
<a id="" target="_blank" class="button tips invoice-button invoice-button-small iii" | |
title="Print Invoice Funnel #1" href="<?php echo $DocumentURL_upsale; ?>">Print Invoice | |
Funnel #1</a> | |
<?php } ?> | |
<?php if ( ! empty( $cancel_document_link ) ) { ?> | |
<div><a target="_blank" class="button tips invoice-button refund-button-small" | |
title="Print refund document" href="<?php echo $cancel_document_link; ?>">Print | |
Refund Document</a></div> | |
<?php } ?> | |
</div> | |
</div> | |
</div> | |
</div> | |
<?php } ?> | |
</ul> | |
<?php } | |
} else { ?> | |
<p class="muted">No orders found</p> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment