From c9d57b17a2c9c5cebe0045d89f0a71a55a151a79 Mon Sep 17 00:00:00 2001
From: Gundo Sifhufhi <sifhufhisg@gmail.com>
Date: Tue, 14 Feb 2023 14:04:29 +0200
Subject: [PATCH] Deactivated `Show Method if Not Applicable`: Strictly ZA.

---
 Block/System/Config/Form/Field/Version.php |  2 +-
 Model/Carrier/CustomShipping.php           |  3 +++
 Model/Source/Showmethod.php                | 17 +++++++++++++++++
 etc/adminhtml/system.xml                   |  2 +-
 etc/config.xml                             |  2 +-
 5 files changed, 23 insertions(+), 3 deletions(-)
 create mode 100644 Model/Source/Showmethod.php

diff --git a/Block/System/Config/Form/Field/Version.php b/Block/System/Config/Form/Field/Version.php
index 964f53c..1b2e435 100644
--- a/Block/System/Config/Form/Field/Version.php
+++ b/Block/System/Config/Form/Field/Version.php
@@ -39,7 +39,7 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field
     protected function _getElementHtml(AbstractElement $element)
     {
         $extensionVersion   = $this->_helper->getExtensionVersion();
-        $extensionTitle     = 'BobGo';
+        $extensionTitle     = 'Bob Go';
         $versionLabel       = sprintf(
             '<a href="%s" title="%s" target="_blank">%s</a>',
             self::EXTENSION_URL,
diff --git a/Model/Carrier/CustomShipping.php b/Model/Carrier/CustomShipping.php
index 1cf940d..db29d6f 100644
--- a/Model/Carrier/CustomShipping.php
+++ b/Model/Carrier/CustomShipping.php
@@ -408,6 +408,9 @@ class CustomShipping extends AbstractCarrierOnline implements \Magento\Shipping\
             'allspecificcountries' => [
                 'ZA' => __('South Africa'),
             ],
+            'showmethod' => [
+                '0' => __('No'),
+            ],
         ];
 
         if (!isset($codes[$type])) {
diff --git a/Model/Source/Showmethod.php b/Model/Source/Showmethod.php
new file mode 100644
index 0000000..d2c517c
--- /dev/null
+++ b/Model/Source/Showmethod.php
@@ -0,0 +1,17 @@
+<?php
+
+namespace bobgo\CustomShipping\Model\Source;
+
+class Showmethod extends Generic
+{
+    /**
+     * @return array
+     */
+    public function toOptionArray()
+    {
+        return [
+            ['value' => '0', 'label' => __('No')],
+        ];
+    }
+
+}
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 2174008..af55345 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -70,7 +70,7 @@
                 <field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="1" showInWebsite="1" showInStore="0">
                     <label>Show Method if Not Applicable</label>
                     <frontend_class>shipping-skip-hide</frontend_class>
-                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
+                    <source_model>bobgo\CustomShipping\Model\Source\Showmethod</source_model>
                 </field>
                 <field id="unit_of_measure" translate="label" type="select" sortOrder="73" showInDefault="1" showInWebsite="1" canRestore="1">
                     <label>Weight Unit</label>
diff --git a/etc/config.xml b/etc/config.xml
index aa8f79d..0a72bc6 100644
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -16,7 +16,7 @@
 
         <carriers>
             <bobgo>
-                <active>0</active>
+                <active>1</active>
                 <sallowspecific>0</sallowspecific>
                 <price>0.00</price>
                 <model>bobgo\CustomShipping\Model\Carrier\CustomShipping</model>
-- 
GitLab