Skip to content

Commit fd23c40

Browse files
authored
Order Tab Enhancements (#561)
* Order Tab Enhancements * Hide tab for non-Meta orders * Remove unneeded logic * Updated branding, content * Further edits * code review feedback
1 parent b9a6495 commit fd23c40

File tree

3 files changed

+14
-33
lines changed

3 files changed

+14
-33
lines changed

app/code/Meta/BusinessExtension/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
showInWebsite="0" showInStore="1">
8686
<fieldset_css>meta-section-config</fieldset_css>
8787
<label>Business Settings</label>
88-
<comment>Set your preferred business settings for Meta Commerce.
88+
<comment>Set your preferred business settings for Facebook &amp; Instagram.
8989
</comment>
9090
<depends>
9191
<field id="facebook_business_extension/business_extension/active">1</field>

app/code/Meta/Sales/Block/Adminhtml/Order/View/Tab/Facebook.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function getOrder()
7676
*/
7777
public function canShowTab()
7878
{
79-
return $this->systemConfig->isOnsiteCheckoutEnabled();
79+
return $this->getFacebookOrderId() !== null;
8080
}
8181

8282
/**
@@ -92,15 +92,15 @@ public function isHidden()
9292
*/
9393
public function getTabLabel()
9494
{
95-
return __('Meta');
95+
return __('Facebook & Instagram');
9696
}
9797

9898
/**
9999
* @inheritdoc
100100
*/
101101
public function getTabTitle()
102102
{
103-
return __('Meta');
103+
return __('Facebook & Instagram');
104104
}
105105

106106
/**
@@ -113,16 +113,6 @@ public function getFacebookOrderId()
113113
return $this->getOrder()->getExtensionAttributes()->getFacebookOrderId();
114114
}
115115

116-
/**
117-
* Check if order is Facebook order
118-
*
119-
* @return bool
120-
*/
121-
public function isFacebookOrder()
122-
{
123-
return $this->getFacebookOrderId() !== null;
124-
}
125-
126116
/**
127117
* Get order's facebook url
128118
*

app/code/Meta/Sales/view/adminhtml/templates/order/view/tab/facebook.phtml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,17 @@ $optInFlag = $block->isEmailRemarketingAllowedForOrder() ? 'Yes' : 'No';
99

1010
<section class="admin__page-section order-facebook">
1111
<div class="admin__page-section-title">
12-
<span class="title"><?= $block->escapeHtml(__('Meta')) ?></span>
12+
<span class="title"><?= $block->escapeHtml(__('Facebook & Instagram Details')) ?></span>
1313
</div>
1414
<div class="admin__page-section-content">
15-
<?php if ($block->isFacebookOrder()): ?>
16-
<div class="admin__page-section-item order-facebook-details">
17-
<div class="admin__page-section-item-title">
18-
<span class="title"><?= $block->escapeHtml(__('Details')) ?></span>
19-
</div>
20-
<address class="admin__page-section-item-content">
21-
<p><b>Magento order #</b>: <?= $block->getOrder()->getIncrementId() ?></p>
22-
<p><b>Meta order #</b>: <?= $block->getOrder()->getExtensionAttributes()->getFacebookOrderId() ?></p>
23-
<p><b>Channel</b>: <?= $block->getOrder()->getExtensionAttributes()->getChannel() ?></p>
24-
<p><b>Customer marketing opt-in</b>: <?= $optInFlag ?></p>
25-
<p><b><a href="<?= $block->escapeUrl($block->getOrderFacebookUrl()) ?>" target="_blank">Manage in Commerce Manager</a></b></p>
26-
</address>
27-
</div>
28-
<?php else: ?>
29-
<div class="admin__page-section-item order-not-a-facebook-order">
30-
<?= __('Not a Meta order') ?>
31-
</div>
32-
<?php endif; ?>
15+
<div class="admin__page-section-item order-facebook-details">
16+
<address class="admin__page-section-item-content">
17+
<p><b>Magento Order ID</b>: <?= $block->getOrder()->getIncrementId() ?></p>
18+
<p><b>Meta Order ID</b>: <?= $block->getOrder()->getExtensionAttributes()->getFacebookOrderId() ?></p>
19+
<p><b>Channel</b>: <?= $block->getOrder()->getExtensionAttributes()->getChannel() ?></p>
20+
<p><b>Email Marketing Allowed</b>: <?= $optInFlag ?></p>
21+
<p><b><a href="<?= $block->escapeUrl($block->getOrderFacebookUrl()) ?>" target="_blank">View in Commerce Manager</a></b></p>
22+
</address>
23+
</div>
3324
</div>
3425
</section>

0 commit comments

Comments
 (0)