From 332a2309745a1c3eef89cbf328c34d7d2e23a67e Mon Sep 17 00:00:00 2001 From: "@ChristelLoftus" <christel@bob.co.za> Date: Tue, 6 Aug 2024 13:39:44 +0200 Subject: [PATCH] issue with dependency injection --- Model/Carrier/BobGo.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Model/Carrier/BobGo.php b/Model/Carrier/BobGo.php index 09574ba..83e3c15 100644 --- a/Model/Carrier/BobGo.php +++ b/Model/Carrier/BobGo.php @@ -19,6 +19,7 @@ class BobGo extends AbstractCarrier implements CarrierInterface protected $rateResultFactory; protected $rateMethodFactory; + protected $logger; public function __construct( ScopeConfigInterface $scopeConfig, @@ -30,15 +31,21 @@ class BobGo extends AbstractCarrier implements CarrierInterface ) { $this->rateResultFactory = $rateResultFactory; $this->rateMethodFactory = $rateMethodFactory; + $this->logger = $logger; parent::__construct($scopeConfig, $rateErrorFactory, $logger, $data); } public function collectRates(RateRequest $request) { + $this->logger->debug('BobGo collectRates method called'); + if (!$this->getConfigFlag('active')) { + $this->logger->debug('BobGo is not active'); return false; } + $this->logger->debug('BobGo is active'); + $result = $this->rateResultFactory->create(); $method = $this->rateMethodFactory->create(); @@ -49,6 +56,7 @@ class BobGo extends AbstractCarrier implements CarrierInterface $method->setMethodTitle($this->getConfigData('name')); $shippingCost = (float)$this->getConfigData('shipping_cost'); + $this->logger->debug('Shipping Cost: ' . $shippingCost); $method->setPrice($shippingCost); $method->setCost($shippingCost); -- GitLab