Skip to content

Commit 0c578cc

Browse files
committed
10998-dont-track-backend-orders-in-ga refactoring
1 parent a622a98 commit 0c578cc

File tree

3 files changed

+11
-55
lines changed

3 files changed

+11
-55
lines changed

Block/Adminhtml/System/Config/Form/InfoPlan.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,12 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
3838
}
3939

4040
$html = '';
41-
$html .= '<div style="padding:10px;background-color:#f8f8f8;border:1px solid #ddd;margin-bottom:7px;">';
42-
$html .= $this->getText() . ' <a style="color: #ef672f; text-decoration: underline;" href="https://magefan.com/magento-2-google-tag-manager/pricing?utm_source=gtm_config&utm_medium=link&utm_campaign=regular" target="_blank">Read more</a>.';
43-
$html .= '</div>';
41+
42+
if ($text = $this->getText()) {
43+
$html .= '<div style="padding:10px;background-color:#f8f8f8;border:1px solid #ddd;margin-bottom:7px;">';
44+
$html .= $text . ' <a style="color: #ef672f; text-decoration: underline;" href="https://magefan.com/magento-2-google-tag-manager/pricing?utm_source=gtm_config&utm_medium=link&utm_campaign=regular" target="_blank">Read more</a>.';
45+
$html .= '</div>';
46+
}
4447

4548
$optionAvailableInText = ($this->getMinPlan() == 'Extra')
4649
? 'This option is available in <strong>Extra</strong> plan only.'
@@ -50,6 +53,9 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
5053
require(["jquery", "Magento_Ui/js/modal/alert", "domReady!"], function($, alert){
5154
setInterval(function(){
5255
var plusSection = $("#{$this->getSectionId()}-state").parent(".section-config");
56+
if (!plusSection.length) {
57+
plusSection = $("#{$this->getSectionId()}").parents("tr:first");
58+
}
5359
plusSection.find(".use-default").css("visibility", "hidden");
5460
plusSection.find("input,select").each(function(){
5561
$(this).attr("readonly", "readonly");
@@ -58,7 +64,7 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
5864
$(this).data("gtmdisabled", 1);
5965
$(this).click(function(){
6066
alert({
61-
title: "You cannot change this option.",
67+
title: "You cannot use this option.",
6268
content: "{$optionAvailableInText}",
6369
buttons: [{
6470
text: "Upgrade Plan Now",

Block/Adminhtml/System/Config/Form/InfoServerSideTracking.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
class InfoServerSideTracking extends InfoPlan
1212
{
13-
1413
/**
1514
* @return string
1615
*/

Block/Adminhtml/System/Config/Form/InfoTrackAdminOrders.php

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
class InfoTrackAdminOrders extends InfoPlan
1212
{
13-
1413
/**
1514
* @return string
1615
*/
@@ -32,54 +31,6 @@ protected function getSectionId(): string
3231
*/
3332
protected function getText(): string
3433
{
35-
return 'Track Admin Orders option is available in <strong>Extra</strong> plan only.';
36-
}
37-
38-
/**
39-
* Return info block html
40-
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
41-
* @return string
42-
*/
43-
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
44-
{
45-
if ($this->getModuleVersion->execute($this->getModuleName() . $this->getMinPlan())) {
46-
return '';
47-
}
48-
49-
$html = '<script>
50-
require(["jquery", "Magento_Ui/js/modal/alert", "domReady!"], function($, alert){
51-
setInterval(function(){
52-
var $plusSection = $("#row_mfgoogletagmanager_events_purchase_track_admin_orders");
53-
$plusSection.find(".use-default").css("visibility", "hidden");
54-
$plusSection.find("input,select").each(function(){
55-
$(this).attr("readonly", "readonly");
56-
$(this).removeAttr("disabled");
57-
if ($(this).data("gtmdisabled")) return;
58-
$(this).data("gtmdisabled", 1);
59-
$(this).click(function(){
60-
alert({
61-
title: "You cannot change this option.",
62-
content: "' .
63-
(
64-
($this->getMinPlan() == 'Extra')
65-
? 'This option is available in <strong>Extra</strong> plan only.'
66-
: 'This option is available in <strong>Plus or Extra</strong> plans only.'
67-
)
68-
. '",
69-
buttons: [{
70-
text: "Upgrade Plan Now",
71-
class: "action primary accept",
72-
click: function () {
73-
window.open("https://magefan.com/magento-2-google-tag-manager/pricing?utm_source=gtm_config&utm_medium=link&utm_campaign=regular");
74-
}
75-
}]
76-
});
77-
});
78-
});
79-
}, 1000);
80-
});
81-
</script>';
82-
83-
return $html;
34+
return '';
8435
}
8536
}

0 commit comments

Comments
 (0)