From 421641e5644a567b5d98b696461dcac11ba55f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=C3=A9=20Wilke?= <francewilke@gmail.com> Date: Wed, 14 Aug 2024 17:20:17 +0200 Subject: [PATCH] Go back to commit 75f0f6c6c03a0e2721f9d63018f504414dc6587b to test --- .DS_Store | Bin 6148 -> 8196 bytes Block/System/Config/Form/Field/Version.php | 8 +- Helper/Data.php | 2 +- Model/Carrier/AdditionalInfo.php | 80 ----------- Model/Carrier/BobGo.php | 159 ++++----------------- Model/Carrier/Company.php | 39 +++++ Model/Carrier/uData.php | 6 +- Observer/ConfigChangeObserver.php | 45 ------ Readme.md | 30 +++- composer.json | 2 +- etc/acl.xml | 12 -- etc/adminhtml/events.xml | 7 - etc/adminhtml/system.xml | 45 ++++-- etc/config.xml | 6 +- etc/frontend/di.xml | 7 - etc/module.xml | 4 +- 16 files changed, 143 insertions(+), 309 deletions(-) delete mode 100644 Model/Carrier/AdditionalInfo.php create mode 100644 Model/Carrier/Company.php delete mode 100644 Observer/ConfigChangeObserver.php delete mode 100644 etc/acl.xml delete mode 100644 etc/adminhtml/events.xml diff --git a/.DS_Store b/.DS_Store index 80b1e5c0b279ef32fb8ecef641bb2d2719afa40c..f564ed7efa8259ef8da8bd747023d207203cec23 100644 GIT binary patch literal 8196 zcmZQzU|@7AO)+F(kYHe7;9!8z0^AH(0Z1N%F(jFwA_^e$7#IW?7_xKH4TF>Oa|@s{ zqts{!jE2By2#kinXb6mkz+ejjMu>wraMb${*->&d1V%$(M1}yUe1Nv?85|&Oe1--H z4U%GDWMBYy0T>w=SYQFf2<`_kfaE}0K{QA!hz4n8U<9$iW`MOaFhaF5g1aFgeF9*k z7#YCY85qGfgT%qw85qGfGcYhhv@<Y5ZDxe_P#7WF85kkj85qH~gN+;|MnhmU1kgeN zlucL}oEUN#@)?rR`|qqB3=9lNvbp&#E=f80NuWW4X4g~pg=WVb(N&}nP*IS9JVF4@ zt;`Im3?&T7sAC5TtqcqdP#I)<BPO(}ltS!<%OdQ=ltr}<T!^qScrc_g<S-O4q%stt z+RFZrfq?-<9@*}d1;H^T5WCUTAY6b;4XQi9{$^pwWH4l~V8}yt1IqyhP=N}SL$+W4 zB0S9DdUNv;c4L#rVlOL$FGD^<3MdRvZC=C+j!n2MvfUF);dUeGN46ci3KaVxr7{PD zKSL5jF(~vI%0MKlD_Ao?=?h&AvRle~;cme&3)w~Z)S<WwG<F4w_W*_*hEj%fhD`K0 zag+n63nY1D_xN)DG;f5Z3lueoxWT0c)g9o0GZuz2hD?T3hH}(!F|Pur3#c5j{ZDVh z!vn4tIUKObquRRwtylnaK~*iNd;rm)Y7|6+G7uxEItJI_qxC;Hphk(&5Ez0XzzlJ- z1gQV-%D{kY{2!uflpGC#(GVDxA;8Gu671pxsnD@{5Y*QOH3Sl%vV<A}jF3r1uxdsI dNKc-T0n(FaWB`vLj1B~VLuZs24S|6P0RZy(_FVt~ delta 488 zcmZp1XfcprU|?W$DortDU=UznVBlbY&`g{Y3&ketDT=Uz<UwM^1xY#iNem1OJCimh zu3)SONiZ`cG88ZrB$Xpc7UX0WmlzmaV`O4xVP#|IVCUfGhz-ujFApwBEGaE^N-T;7 z@j~+RbCO`}#H6sy)be-%5$F88lElos)FP0Q;LMcNq{O0_@XWlF{Bo!K(!7*nuwIZv zeNti(2PX$-yntkNwXUJ5nYoUFv0<%_LbaulfsTTSu~}^`Cx@uAzI9N1c1~_yem4Uc zFfxKE1_oXz4WoJ(7#N`bNhwawNy^X90ZBoHa?%Zhlk;;6Ktf=g4Og9;@8SXt8jdaM zHU|oIjyWRC%FR!~BU_MxW-Q#)vf!e;ocz3WQ1EXooXoPAor6P=8EiF!05<~zgDV3A i6X(Xl@640=WgJ1V$iT?Jzyeah1c^ql*yebiIm`gVr))3) diff --git a/Block/System/Config/Form/Field/Version.php b/Block/System/Config/Form/Field/Version.php index a98a00a..5d07180 100644 --- a/Block/System/Config/Form/Field/Version.php +++ b/Block/System/Config/Form/Field/Version.php @@ -6,13 +6,13 @@ use Magento\Framework\Data\Form\Element\AbstractElement; /** * Displays Version number in System Configuration * @category BobGroup - * @package BobGo - * @author support@bobgo.co.za - * @website https://www.bobgo.co.za + * @package bobgo_CustomShipping + * @author info@bob.co.za + * @website https://www.bob.co.za */ class Version extends \Magento\Config\Block\System\Config\Form\Field { - const EXTENSION_URL = 'https://www.bobgo.co.za'; + const EXTENSION_URL = 'https://www.bob.co.za'; /** * @var \BobGroup\BobGo\Helper\Data $helper diff --git a/Helper/Data.php b/Helper/Data.php index 85a24f2..d0627ee 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -8,7 +8,7 @@ use Magento\Store\Model\ScopeInterface; /** * @category Bob Go - * @package BobGo + * @package bobgo_CustomShipping * @author Bob Go * @website https://www.bobgo.co.za */ diff --git a/Model/Carrier/AdditionalInfo.php b/Model/Carrier/AdditionalInfo.php deleted file mode 100644 index 0b002a0..0000000 --- a/Model/Carrier/AdditionalInfo.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php - -namespace BobGroup\BobGo\Model\Carrier; - -/** - * Get the AdditionalInfo information from the request body and return it - */ -class AdditionalInfo -{ - - /** - * @return mixed|string - */ - public function getDestComp(): mixed - { - $data = json_decode(file_get_contents('php://input'), true); - - if (isset($data['address']['company'])) { - $destComp = $data['address']['company']; - } else { - $destComp = ''; - } - return $destComp; - } - - public function getSuburb(): mixed - { - - $data = json_decode(file_get_contents('php://input'), true); - - if (isset($data['address']['custom_attributes'][0]['value'])) { - $destSub = $data['address']['custom_attributes'][0]['value']; - //print_r($destSub); - } else { - $destSub = ''; - } - return $destSub; - } - - /** - * @return mixed|string - */ - public function getDestTelephone(): mixed - { - $data = json_decode(file_get_contents('php://input'), true); - - if (isset($data['address']['telephone'])) { - $destTelephone = $data['address']['telephone']; - } else { - $destTelephone = ''; - } - return $destTelephone; - } - - - /** - * @var \BobGroup\BobGo\Model\Carrier\AdditionalInfo - */ - public $countryFactory; - - public function __construct($countryFactory) - { - $this->countryFactory = $countryFactory; - } - - /** - * country full name - * - * @return string - */ - public function getCountryName($countryId): string - { - $countryName = ''; - $country = $this->countryFactory->create()->loadByCode($countryId); - if ($country) { - $countryName = $country->getName(); - } - return $countryName; - } -} diff --git a/Model/Carrier/BobGo.php b/Model/Carrier/BobGo.php index 97f5576..431e11b 100644 --- a/Model/Carrier/BobGo.php +++ b/Model/Carrier/BobGo.php @@ -34,7 +34,7 @@ use Psr\Log\LoggerInterface; /** * Bob Go shipping implementation * @category Bob Go - * @package BobGo + * @package bobgo_CustomShipping * @author Bob Go * @website https://www.bobgo.co.za * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @@ -101,18 +101,13 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car */ protected \Magento\Framework\HTTP\Client\Curl $curl; - /** - * @var ScopeConfigInterface - */ - protected $scopeConfig; // Declare the scopeConfig property - /** * @param \Magento\Framework\Controller\Result\JsonFactory $jsonFactory */ protected JsonFactory $jsonFactory; private $cartRepository; - public AdditionalInfo $additionalInfo; + public Company $company; /** @@ -166,7 +161,6 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car $this->_storeManager = $storeManager; $this->_productCollectionFactory = $productCollectionFactory; - $this->scopeConfig = $scopeConfig; parent::__construct( $scopeConfig, $rateErrorFactory, @@ -187,9 +181,10 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car ); $this->jsonFactory = $jsonFactory; $this->curl = $curlFactory->create(); - $this->additionalInfo = new AdditionalInfo($countryFactory); + $this->company = new Company(); } + /* * Gets the base url of the store by stripping the http:// or https:// and wwww. from the url * leaving just "example.com" since Bob Go API uses this format and not the full url as the Identifier @@ -299,7 +294,6 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car if (!$this->isActive()) { return false; } - /** * Gets the destination company name from Company Name field in the checkout page * This method is used is the last resort to get the company name since the company name is not available in _rateFactory @@ -820,61 +814,43 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car */ protected function _formatRates(mixed $rates, Result $result): void { - if (empty($rates['rates'])) { // Check if the 'rates' key is empty or null + if (empty($rates)) { $error = $this->_rateErrorFactory->create(); $error->setCarrierTitle($this->getConfigData('title')); $error->setErrorMessage($this->getConfigData('specificerrmsg')); $result->append($error); } else { - - foreach ($rates['rates'] as $rate) { + foreach ($rates['rates'] as $title) { $method = $this->_rateMethodFactory->create(); - - if (isset($rate)) { - // Set the carrier code + if (isset($title)){ $method->setCarrier(self::CODE); - // Strip out the redundant 'bobgo_' prefix if present - $serviceCode = $rate['service_code']; - if (strpos($serviceCode, 'bobgo_') === 0) { - $serviceCode = substr($serviceCode, strlen('bobgo_')); - } - - // Set the method with the modified service code - $method->setMethod($serviceCode); - // Set additional info if required if ($this->getConfigData('additional_info') == 1) { - $min_delivery_date = isset($rate['min_delivery_date']) && $rate['min_delivery_date'] !== null - ? $this->getWorkingDays(date('Y-m-d'), $rate['min_delivery_date']) - : null; - - $max_delivery_date = isset($rate['max_delivery_date']) && $rate['max_delivery_date'] !== null - ? $this->getWorkingDays(date('Y-m-d'), $rate['max_delivery_date']) - : null; + $min_delivery_date = $this->getWorkingDays(date('Y-m-d'), $title['min_delivery_date']); + $max_delivery_date = $this->getWorkingDays(date('Y-m-d'), $title['max_delivery_date']); $this->deliveryDays($min_delivery_date, $max_delivery_date, $method); + + } else { + $method->setCarrierTitle($this->getConfigData('title')); } - // Set the method title, price, and cost -// $description = $rate['description']; - $service_name = $rate['service_name']; -// $method->setMethodTitle("$service_name | $description" ); - $method->setMethodTitle("$service_name"); - $price = $rate['total_price']; - $cost = $rate['total_price']; + } - $method->setPrice($price); - $method->setCost($cost); + $method->setMethod($title['service_code']); + $method->setMethodTitle($title['service_name']); + $method->setPrice($title['total_price'] / self::UNITS); + $method->setCost($title['total_price'] / self::UNITS); - $result->append($method); - } + $result->append($method); } } } + /** * Prepare received checkpoints and activity from Bob Go Shipment Tracking API * @param $response @@ -889,7 +865,7 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car 'activity' => $checkpoint['status'], 'deliverydate' => $this->formatDate($checkpoint['time']), 'deliverytime' => $this->formatTime($checkpoint['time']), - // 'deliverylocation' => 'Unavailable',//TODO: remove this line + // 'deliverylocation' => 'Unavailable',//TODO: remove this line ]; } return $result; @@ -980,37 +956,31 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car * @param $method * @return void */ - protected function deliveryDays(?int $min_delivery_date, ?int $max_delivery_date, $method): void + protected function deliveryDays(int $min_delivery_date, int $max_delivery_date, $method): void { - if ($min_delivery_date === null || $max_delivery_date === null) { - return; - } - if ($min_delivery_date !== $max_delivery_date) { - $method->setCarrierTitle('Delivery in '.$min_delivery_date . ' - ' . $max_delivery_date . ' days'); - } else { + $method->setCarrierTitle('delivery in '.$min_delivery_date . ' - ' . $max_delivery_date . ' days'); + }else{ + $method->setCarrierTitle('delivery in ' . $min_delivery_date . ' days'); if ($min_delivery_date && $max_delivery_date == 1) { - $method->setCarrierTitle('Delivery in '.$min_delivery_date . ' day'); - } else { - $method->setCarrierTitle('Delivery in ' . $min_delivery_date . ' days'); + $method->setCarrierTitle('delivery in '.$min_delivery_date . ' day'); } } } - /** * @return mixed|string */ public function getDestComp(): mixed { - return $this->additionalInfo->getDestComp(); + return $this->company->getDestComp(); } /** * @return mixed|string */ public function getDestSuburb(): mixed { - return $this->additionalInfo->getSuburb(); + return $this->company->getSuburb(); } /** @@ -1070,79 +1040,4 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car } return true; } - - public function triggerRatesTest() - { - // Check if the 'Show rates for checkout' setting is enabled - $isEnabled = $this->scopeConfig->getValue('carriers/bobgo/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); - - if ($isEnabled) { - // Sample test payload, replace with actual structure - $payload = [ - 'identifier' => $this->getBaseUrl(), - 'rate' => [ - 'origin' => [ - 'company' => 'Test Store', - 'address1' => '123 Test St', - 'address2' => '', - 'city' => 'Test City', - 'suburb' => 'Test Suburb', - 'province' => 'Test Province', - 'country_code' => 'ZA', - 'postal_code' => '2000', - ], - 'destination' => [ - 'company' => 'Test Company', - 'address1' => '456 Test Ave', - 'address2' => '', - 'suburb' => 'Test Suburb', - 'city' => 'Test City', - 'province' => 'Test Province', - 'country_code' => 'ZA', - 'postal_code' => '3000', - ], - 'items' => [ - [ - 'sku' => 'test-sku-1', - 'quantity' => 1, - 'price' => 100.00, - 'weight' => 500, // in grams - ] - ], - ] - ]; - - try { - // Perform the API request - $this->curl->addHeader('Content-Type', 'application/json'); - $this->curl->post($this->getApiUrl(), json_encode($payload)); - $statusCode = $this->curl->getStatus(); - $responseBody = $this->curl->getBody(); - - // Decode the response - $response = json_decode($responseBody, true); - - // Check if the response contains a 'message' (indicating an error) - if (isset($response['message'])) { - throw new \Exception('Error from BobGo: ' . $response['message']); - } - - // Check if the response contains rates with a valid id field - if (isset($response['rates']) && is_array($response['rates']) && !empty($response['rates'])) { - foreach ($response['rates'] as $rate) { - if (isset($rate['id']) && $rate['id'] !== null) { - return $response; // Successful response with a valid id - } - } - throw new \Exception('Rates received but id field is empty or invalid.'); - } else { - throw new \Exception('Received response but no valid rates were found.'); - } - } catch (\Exception $e) { - return false; - } - } - return false; - } - } diff --git a/Model/Carrier/Company.php b/Model/Carrier/Company.php new file mode 100644 index 0000000..b554759 --- /dev/null +++ b/Model/Carrier/Company.php @@ -0,0 +1,39 @@ +<?php + +namespace BobGroup\BobGo\Model\Carrier; + +/** + * Get the Company information from the request body and return it + */ +class Company +{ + + /** + * @return mixed|string + */ + public function getDestComp(): mixed + { + $data = json_decode(file_get_contents('php://input'), true); + + if (isset($data['address']['company'])) { + $destComp = $data['address']['company']; + } else { + $destComp = ''; + } + return $destComp; + } + + public function getSuburb(): mixed + { + + $data = json_decode(file_get_contents('php://input'), true); + + if (isset($data['address']['custom_attributes'][0]['value'])) { + $destSub = $data['address']['custom_attributes'][0]['value']; + //print_r($destSub); + } else { + $destSub = ''; + } + return $destSub; + } +} diff --git a/Model/Carrier/uData.php b/Model/Carrier/uData.php index df3a168..4ccffa2 100644 --- a/Model/Carrier/uData.php +++ b/Model/Carrier/uData.php @@ -10,7 +10,11 @@ class uData { /** Tracking Endpoint */ - public const TRACKING = 'https://api.dev.bobgo.co.za/tracking?channel=%s&tracking_reference=%s'; + //dev + public const TRACKING = 'https://api.dev.bobgo.co.za/tracking?channel=localhost&tracking_reference='; + + //production + //public const TRACKING = 'https://api.dev.bobgo.co.za/tracking?channel=%s&tracking_reference=%s'; /*** RATES API Endpoint*/ public const RATES_ENDPOINT = 'https://api.dev.bobgo.co.za/rates-at-checkout/magento'; diff --git a/Observer/ConfigChangeObserver.php b/Observer/ConfigChangeObserver.php deleted file mode 100644 index e3dad60..0000000 --- a/Observer/ConfigChangeObserver.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -namespace BobGroup\BobGo\Observer; - -use Magento\Framework\Event\Observer; -use Magento\Framework\Event\ObserverInterface; -use Magento\Framework\Message\ManagerInterface; -use Psr\Log\LoggerInterface; -use BobGroup\BobGo\Model\Carrier\BobGo; - -class ConfigChangeObserver implements ObserverInterface -{ - protected $bobGo; - protected $logger; - protected $messageManager; - - public function __construct( - BobGo $bobGo, - LoggerInterface $logger, - ManagerInterface $messageManager - ) { - $this->bobGo = $bobGo; - $this->logger = $logger; - $this->messageManager = $messageManager; - } - - public function execute(Observer $observer) - { - $changedPaths = $observer->getEvent()->getData('changed_paths'); - - if (is_array($changedPaths) && in_array('carriers/bobgo/active', $changedPaths)) { - - if ($this->bobGo->isActive()) { - $result = $this->bobGo->triggerRatesTest(); - - if ($result !== false) { - $this->messageManager->addSuccessMessage(__('Bob Go rates at checkout test is successful.')); - } else { - $this->messageManager->addErrorMessage(__('Bob Go rates at checkout test failed. Please visit https://www.bobgo.co.za/ and enable this channel for rates at checkout.')); - } - } - } - } - -} diff --git a/Readme.md b/Readme.md index 7d69166..1757dd1 100644 --- a/Readme.md +++ b/Readme.md @@ -1,3 +1,29 @@ +# Installing Magento locally + +**Note:** For more information, visit https://github.com/markshust/docker-magento + +1. Make sure you have `composer` installed globally and a GitHub personal access token configured using `composer global config github-oauth.github.com <YOUR_PERSONAL_ACCESS_TOKEN>` +2. Create a new folder, ie: `Documents/Magento` +3. `cd` into the folder +4. Run command `curl -s https://raw.githubusercontent.com/markshust/docker-magento/master/lib/onelinesetup | bash -s -- bobgomagento.test 2.4.4-p1 community` +5. When asked for the username and password, provide the Abobe public and private key: + +- Public key: `98b4828a495e7e0e13d80d8bf94f3b1c` +- Private key: `082ced46919bffe1b6db0f96de96d608` + +Once configured, do the following to create an admin user (and make life easier for yourself): + +- Create Admin User: `bin/magento admin:user:create` +- Disable 2FA: `bin/magento module:disable Magento_TwoFactorAuth` +- Disable Admin Captcha: `bin/magento config:set admin/captcha/enable 0` + + +### Adobe account details + +- Email: `tech@uafrica.com` +- Password: `mR3mdr0311@P` + + # Magento 2 Bob Go Shipping Extension ## Introduction @@ -15,12 +41,13 @@ A complete guide to install Magento Bob Go Shipping extension in Magento 2. Run the following command in Magento 2 root folder:</br> + >_Note: You must have composer installed on your server & at this point this option_ #### 1. Execute the following command to install the module: ``` -composer require bob-public-utils/bobgo-magento-extension +composer require BobGroup/BobGo ``` #### 2. Enter following commands to enable the module: @@ -33,6 +60,7 @@ bin/magento setup:di:compile bin/magento setup:static-content:deploy ``` + ### Option 2: Install via zip file 1. Download the extension zip file from the link below: </br> diff --git a/composer.json b/composer.json index b7c15e0..76742bd 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "license": [ - "AFL-3.0", + "AFL-3.0", "OSL-3.0" ], "autoload": { diff --git a/etc/acl.xml b/etc/acl.xml deleted file mode 100644 index 4abc946..0000000 --- a/etc/acl.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"> - <acl> - <resources> - <!-- Define at least one minimal resource --> - <resource id="Magento_Backend::admin"> - <!-- You can leave this empty if you don't want to define specific permissions --> - </resource> - </resources> - </acl> -</config> diff --git a/etc/adminhtml/events.xml b/etc/adminhtml/events.xml deleted file mode 100644 index 1fac000..0000000 --- a/etc/adminhtml/events.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0"?> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> - <event name="admin_system_config_changed_section_carriers"> - <observer name="bobgo_config_change_observer" instance="BobGroup\BobGo\Observer\ConfigChangeObserver" /> - </event> - -</config> diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 29ad3d7..0d3fa3a 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -2,6 +2,22 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> + <tab id="bobgo" translate="label" sortOrder="2"> + <label>Bob Go</label> + </tab> + <section id="BobGroup_BobGo" showInDefault="1"> + <tab>bobgo</tab> + <label>Settings</label> + <resource>Magento_Config::config</resource> + <group id="general" showInDefault="1"> + <label>Settings</label> + <field id="enabled" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> + <label>Extension enabled</label> + <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + </field> + </group> + </section> + <section id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <group id="store_information" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="suburb" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> @@ -23,40 +39,41 @@ <comment>When this setting is enabled, your customers will be presented with shipping rates at checkout, as configured on the Bob Go platform under Rates at checkout.</comment> <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> </field> - <field id="additional_info" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1"> - <label>Show additional rate information</label> - <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> - <comment>Displays the delivery timeframe and additional service level description as configured on Bob Go.</comment> - </field> - - <!-- Hiding these fields (specificerrmsg, sallowspecific, specificcountry, showmethod, unit_of_measure, max_package_weight) from the admin protal--> - <field id="specificerrmsg" translate="label" type="textarea" sortOrder="80" showInDefault="0" showInWebsite="0" showInStore="0"> + <field id="specificerrmsg" translate="label" type="textarea" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Displayed Error Message</label> - <comment>We could not find any shipping rates for your delivery address. Please make sure your address is correct. If you are experiencing problems, please contact BobGo (support@bobgo.co.za).</comment> + <comment>The message displayed to the customer when no rates were available on Bob Go.</comment> </field> - <field id="sallowspecific" translate="label" type="select" sortOrder="90" showInDefault="0" showInWebsite="0" showInStore="0"> + + <field id="sallowspecific" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Ship to Applicable Countries</label> <frontend_class>shipping-applicable-country</frontend_class> <source_model>Magento\Shipping\Model\Config\Source\Allspecificcountries</source_model> </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="91" showInDefault="0" showInWebsite="0" showInStore="0"> + + <field id="specificcountry" translate="label" type="multiselect" sortOrder="91" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Ship to Specific Countries</label> <source_model>Magento\Directory\Model\Config\Source\Country</source_model> <can_be_empty>1</can_be_empty> </field> - <field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="0" showInWebsite="0" showInStore="0"> + + <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> </field> - <field id="unit_of_measure" translate="label" type="select" sortOrder="73" showInDefault="0" showInWebsite="0"> + <field id="unit_of_measure" translate="label" type="select" sortOrder="73" showInDefault="1" showInWebsite="1"> <label>Weight Unit</label> <source_model>BobGroup\BobGo\Model\Source\Unitofmeasure</source_model> </field> - <field id="max_package_weight" translate="label" type="text" sortOrder="90" showInDefault="0" showInWebsite="0"> + <field id="max_package_weight" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1"> <label>Maximum Package Weight (Please consult your shipping carrier for maximum supported shipping weight)</label> <validate>validate-number validate-zero-or-greater</validate> </field> + <field id="additional_info" translate="label" type="select" sortOrder="7" showInDefault="1" showInWebsite="1"> + <label>Show additional rate information</label> + <source_model>Magento\Config\Model\Config\Source\Yesno</source_model> + <comment>Displays the delivery timeframe and additional service level description as configured on Bob Go.</comment> + </field> </group> </section> diff --git a/etc/config.xml b/etc/config.xml index 9e4c986..eb34051 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -9,11 +9,15 @@ <carriers> <bobgo> - <active>1</active> + <active>0</active> +<!-- <sallowspecific>1</sallowspecific> + <specificcountry>ZA</specificcountry>--> <price>0.00</price> <model>BobGroup\BobGo\Model\Carrier\BobGo</model> <name>Fixed</name> + <max_package_weight>300</max_package_weight> <title>Bob Go</title> + <specificerrmsg>We could not find any shipping rates for your delivery address. Please make sure your address is correct. If you are experiencing problems, please contact us.</specificerrmsg> </bobgo> </carriers> diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index f424156..2ee6f54 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -7,11 +7,4 @@ </argument> </arguments> </type> - <type name="BobGroup\BobGo\Observer\ConfigChangeObserver"> - <arguments> - <argument name="scopeConfig" xsi:type="object">Magento\Framework\App\Config\ScopeConfigInterface</argument> - <argument name="logger" xsi:type="object">Psr\Log\LoggerInterface</argument> - </arguments> - </type> - </config> diff --git a/etc/module.xml b/etc/module.xml index fe2b36d..d736136 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -2,7 +2,7 @@ <!-- /** * @category Bob Go - * @package BobGo + * @package bobgo_CustomShipping * @author Bob Go */ --> @@ -15,8 +15,6 @@ <module name="Magento_Sales"/> <module name="Magento_Quote"/> <module name="Magento_SalesRule"/> - <module name="Magento_Config"/> - <module name="Magento_Shipping"/> </sequence> </module> </config> -- GitLab