Skip to content
Snippets Groups Projects
Commit 4631e15d authored by Francé Wilke's avatar Francé Wilke
Browse files

Fix Generic.php

parent d12b0aff
No related branches found
No related tags found
1 merge request!6Rates at checkout
Pipeline #65521 passed
......@@ -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
......
......@@ -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
*/
......
......@@ -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)
......
......@@ -2,19 +2,56 @@
namespace BobGroup\BobGo\Model\Source;
use Magento\Framework\Data\OptionSourceInterface;
use BobGroup\BobGo\Model\Carrier\BobGo;
/**
* bobgo generic source implementation
*/
class Generic implements OptionSourceInterface
{
/**
* @var BobGo
*/
protected BobGo $_shippingBobGo;
/**
* Bob Go Free Method source implementation
* Carrier code
* @var string
*/
class Freemethod extends Method
protected string $_code = '';
/**
* @param BobGo $shippingBobGo
*/
public function __construct(BobGo $shippingBobGo)
{
$this->_shippingBobGo = $shippingBobGo;
}
/**
* {@inheritdoc}
* Returns array to be used in multiselect on back-end
* @return array
*/
public function toOptionArray()
{
//Returns an array of arrays, each of which has a 'value' and a 'label'. The 'value' is the code for the shipping method, and the 'label' is the name of the shipping method.
$arr = parent::toOptionArray();
array_unshift($arr, ['value' => '', 'label' => __('None')]);
$configData = $this->_shippingBobGo->getCode($this->_code);
$arr = [];
if ($configData) {
$arr = array_map(
function ($code, $title) {
return [
'value' => $code,
'label' => $title
];
},
array_keys($configData),
$configData
);
}
return $arr;
}
}
......@@ -9,7 +9,7 @@
<carriers>
<bobgo>
<active>0</active>
<active>1</active>
<price>0.00</price>
<model>BobGroup\BobGo\Model\Carrier\BobGo</model>
<name>Fixed</name>
......
......@@ -2,7 +2,7 @@
<!--
/**
* @category Bob Go
* @package bobgo_CustomShipping
* @package BobGo
* @author Bob Go
*/
-->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment