diff --git a/.DS_Store b/.DS_Store index f564ed7efa8259ef8da8bd747023d207203cec23..5a522609458bdc7950fbcca5ef75bd1ea890b4c3 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Block/System/Config/Form/Field/Version.php b/Block/System/Config/Form/Field/Version.php index 5d071801a406da9f220bf1fd0093996f8eeb5b3d..a98a00a41d2c1aab88dce26b916e386ce7c11dc7 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_CustomShipping - * @author info@bob.co.za - * @website https://www.bob.co.za + * @package BobGo + * @author support@bobgo.co.za + * @website https://www.bobgo.co.za */ class Version extends \Magento\Config\Block\System\Config\Form\Field { - const EXTENSION_URL = 'https://www.bob.co.za'; + const EXTENSION_URL = 'https://www.bobgo.co.za'; /** * @var \BobGroup\BobGo\Helper\Data $helper diff --git a/Helper/Data.php b/Helper/Data.php index d0627eefd27a235e7b0b5b498f8e22ab4fd1a215..85a24f2acfd9378effc0f68de7edca9ffaf1b72a 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -8,7 +8,7 @@ use Magento\Store\Model\ScopeInterface; /** * @category Bob Go - * @package bobgo_CustomShipping + * @package BobGo * @author Bob Go * @website https://www.bobgo.co.za */ diff --git a/Model/.DS_Store b/Model/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c57f259eff438387f424e69216bd5d94ea7e1d7f Binary files /dev/null and b/Model/.DS_Store differ diff --git a/Model/Carrier/AdditionalInfo.php b/Model/Carrier/AdditionalInfo.php new file mode 100644 index 0000000000000000000000000000000000000000..0b002a0ff7b8fdf82842f1adceef888dd8aaf052 --- /dev/null +++ b/Model/Carrier/AdditionalInfo.php @@ -0,0 +1,80 @@ +<?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 431e11b6fcf31a0ed6828d9d2d30321b1d2a5785..97f55764c2938644d1e927e1f8e5a73b2ab0d3db 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_CustomShipping + * @package BobGo * @author Bob Go * @website https://www.bobgo.co.za * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @@ -101,13 +101,18 @@ 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 Company $company; + public AdditionalInfo $additionalInfo; /** @@ -161,6 +166,7 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car $this->_storeManager = $storeManager; $this->_productCollectionFactory = $productCollectionFactory; + $this->scopeConfig = $scopeConfig; parent::__construct( $scopeConfig, $rateErrorFactory, @@ -181,10 +187,9 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car ); $this->jsonFactory = $jsonFactory; $this->curl = $curlFactory->create(); - $this->company = new Company(); + $this->additionalInfo = new AdditionalInfo($countryFactory); } - /* * 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 @@ -294,6 +299,7 @@ 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 @@ -814,43 +820,61 @@ class BobGo extends AbstractCarrierOnline implements \Magento\Shipping\Model\Car */ protected function _formatRates(mixed $rates, Result $result): void { - if (empty($rates)) { + if (empty($rates['rates'])) { // Check if the 'rates' key is empty or null $error = $this->_rateErrorFactory->create(); $error->setCarrierTitle($this->getConfigData('title')); $error->setErrorMessage($this->getConfigData('specificerrmsg')); $result->append($error); } else { - foreach ($rates['rates'] as $title) { + + foreach ($rates['rates'] as $rate) { $method = $this->_rateMethodFactory->create(); - if (isset($title)){ + + if (isset($rate)) { + // Set the carrier code $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 = $this->getWorkingDays(date('Y-m-d'), $title['min_delivery_date']); - $max_delivery_date = $this->getWorkingDays(date('Y-m-d'), $title['max_delivery_date']); + $min_delivery_date = isset($rate['min_delivery_date']) && $rate['min_delivery_date'] !== null + ? $this->getWorkingDays(date('Y-m-d'), $rate['min_delivery_date']) + : null; - $this->deliveryDays($min_delivery_date, $max_delivery_date, $method); + $max_delivery_date = isset($rate['max_delivery_date']) && $rate['max_delivery_date'] !== null + ? $this->getWorkingDays(date('Y-m-d'), $rate['max_delivery_date']) + : null; - } else { - $method->setCarrierTitle($this->getConfigData('title')); + $this->deliveryDays($min_delivery_date, $max_delivery_date, $method); } - } + // 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->setMethod($title['service_code']); - $method->setMethodTitle($title['service_name']); - $method->setPrice($title['total_price'] / self::UNITS); - $method->setCost($title['total_price'] / self::UNITS); + $method->setPrice($price); + $method->setCost($cost); - $result->append($method); + $result->append($method); + } } } } - /** * Prepare received checkpoints and activity from Bob Go Shipment Tracking API * @param $response @@ -865,7 +889,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; @@ -956,31 +980,37 @@ 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 . ' days'); + $method->setCarrierTitle('Delivery in '.$min_delivery_date . ' - ' . $max_delivery_date . ' days'); + } else { if ($min_delivery_date && $max_delivery_date == 1) { - $method->setCarrierTitle('delivery in '.$min_delivery_date . ' day'); + $method->setCarrierTitle('Delivery in '.$min_delivery_date . ' day'); + } else { + $method->setCarrierTitle('Delivery in ' . $min_delivery_date . ' days'); } } } + /** * @return mixed|string */ public function getDestComp(): mixed { - return $this->company->getDestComp(); + return $this->additionalInfo->getDestComp(); } /** * @return mixed|string */ public function getDestSuburb(): mixed { - return $this->company->getSuburb(); + return $this->additionalInfo->getSuburb(); } /** @@ -1040,4 +1070,79 @@ 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 deleted file mode 100644 index b5547595722df67b2535db561a06aad3c28b1918..0000000000000000000000000000000000000000 --- a/Model/Carrier/Company.php +++ /dev/null @@ -1,39 +0,0 @@ -<?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 4ccffa28748266b3e0d3e379a3c835055bc58f8b..df3a1686e3fd01edd219516128a84d8b410cd56d 100644 --- a/Model/Carrier/uData.php +++ b/Model/Carrier/uData.php @@ -10,11 +10,7 @@ class uData { /** Tracking Endpoint */ - //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'; + 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 new file mode 100644 index 0000000000000000000000000000000000000000..e3dad6096fe8e90968c7bf7a36e158a647b11ba4 --- /dev/null +++ b/Observer/ConfigChangeObserver.php @@ -0,0 +1,45 @@ +<?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/Plugin/.DS_Store b/Plugin/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..689f74aebb9f0ea93d13c40a72825a9e06df27b5 Binary files /dev/null and b/Plugin/.DS_Store differ diff --git a/Plugin/Block/.DS_Store b/Plugin/Block/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..17a3f4bbd7cabc8ac14985439ccbfd116d21bb32 Binary files /dev/null and b/Plugin/Block/.DS_Store differ diff --git a/Readme.md b/Readme.md index 1757dd1c4aee4dbe12ae6d84e0a637e311f49e72..7d691668472e29f39a24c24755fd7152166e1d11 100644 --- a/Readme.md +++ b/Readme.md @@ -1,29 +1,3 @@ -# 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 @@ -41,13 +15,12 @@ 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 BobGroup/BobGo +composer require bob-public-utils/bobgo-magento-extension ``` #### 2. Enter following commands to enable the module: @@ -60,7 +33,6 @@ 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 76742bd4a7f0a11b0de9a1d2606feb1895ef279c..b7c15e0d0b804af9ba3fda5d14a4b0ec2ae67d59 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/.DS_Store b/etc/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a959c9c8a835e4f3e5b3131f6477abb5843156c1 Binary files /dev/null and b/etc/.DS_Store differ diff --git a/etc/acl.xml b/etc/acl.xml new file mode 100644 index 0000000000000000000000000000000000000000..4abc946570172000c175f0e235d9ca2748bb621e --- /dev/null +++ b/etc/acl.xml @@ -0,0 +1,12 @@ +<?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 new file mode 100644 index 0000000000000000000000000000000000000000..1fac000e33b429aac75757c8e86d6d04f863e7a4 --- /dev/null +++ b/etc/adminhtml/events.xml @@ -0,0 +1,7 @@ +<?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 0d3fa3adc894f9aa28968138ba8856ee6379a46f..29ad3d7ad9047a1679564ec74d4288ac421efad8 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -2,22 +2,6 @@ <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"> @@ -39,41 +23,40 @@ <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="specificerrmsg" translate="label" type="textarea" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1"> - <label>Displayed Error Message</label> - <comment>The message displayed to the customer when no rates were available on Bob Go.</comment> + <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> - <field id="sallowspecific" translate="label" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="0"> + <!-- 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"> + <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> + </field> + <field id="sallowspecific" translate="label" type="select" sortOrder="90" showInDefault="0" showInWebsite="0" 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="1" showInWebsite="1" showInStore="0"> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="91" showInDefault="0" showInWebsite="0" 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="1" showInWebsite="1" showInStore="0"> + <field id="showmethod" translate="label" type="select" sortOrder="92" showInDefault="0" showInWebsite="0" 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="1" showInWebsite="1"> + <field id="unit_of_measure" translate="label" type="select" sortOrder="73" showInDefault="0" showInWebsite="0"> <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="1" showInWebsite="1"> + <field id="max_package_weight" translate="label" type="text" sortOrder="90" showInDefault="0" showInWebsite="0"> <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 eb34051b8ece8d438e1e19c5dae9a533cd4e25a2..9e4c9863ecbc0341accbf7d01547c7114a5ff3a2 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -9,15 +9,11 @@ <carriers> <bobgo> - <active>0</active> -<!-- <sallowspecific>1</sallowspecific> - <specificcountry>ZA</specificcountry>--> + <active>1</active> <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 2ee6f54f96f9264b803de3a8dd8f99b923988f76..f424156d3030c7560e9df0dbd97a35cd3ea16493 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -7,4 +7,11 @@ </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 d736136edb4535fca984abcd0b7d2b08fed15e6d..fe2b36da4d6bad5e35cb60c85d1f1ff05d245001 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -2,7 +2,7 @@ <!-- /** * @category Bob Go - * @package bobgo_CustomShipping + * @package BobGo * @author Bob Go */ --> @@ -15,6 +15,8 @@ <module name="Magento_Sales"/> <module name="Magento_Quote"/> <module name="Magento_SalesRule"/> + <module name="Magento_Config"/> + <module name="Magento_Shipping"/> </sequence> </module> </config> diff --git a/view/frontend/.DS_Store b/view/frontend/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..073d5f170af0ac13acc7ea6f79c8547b36d9f88d Binary files /dev/null and b/view/frontend/.DS_Store differ