Beispiel #1
0
 /**
  * Get allowed shipping methods
  * @param $requestedCode
  * @return array
  */
 public function getAllowedMethodsByCode($requestedCode = null)
 {
     $arr = [];
     $allowedConfigValue = $this->shipperDataHelper->getConfigValue($this->shipperDataHelper->getAllowedMethodsPath());
     $allowed = $this->shipperDataHelper->decode($allowedConfigValue);
     if (is_null($allowed)) {
         $this->shipperLogger->postDebug('Shipperhq_Shipper', 'Allowed methods config is empty', 'Please refresh your carriers by pressing Save button on the shipping method configuration screen from Stores > Configuration > Shipping Methods');
         return $arr;
     }
     $arr = $this->allowedMethodsHelper->getAllowedMethodsArray($allowed, $requestedCode);
     if (count($arr) < 1 && $this->getConfigFlag(self::ACTIVE_FLAG)) {
         $this->shipperLogger->postDebug('Shipperhq_Shipper', 'There are no allowed methods for ' . $requestedCode, 'If you expect to see shipping methods for this carrier, please refresh your carriers by pressing Save button on the shipping method configuration screen from Stores > Configuration > Shipping Methods');
     }
     return $arr;
 }