Skip to content

Commit

Permalink
some changes in upsshipping v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
antuchaudharyqlo246 committed Jan 5, 2024
1 parent e4b0c14 commit 0bf6e74
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/Carriers/Ups.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Ups extends AbstractShipping
* Payment method code
*
* @var string
*/
*/
protected $code = 'ups';

/**
Expand All @@ -37,9 +37,7 @@ public function calculate()

$marketplaceShipping = session()->get('marketplace_shipping_rates');

if (isset($cartProducts)
&& $cartProducts == true) {

if (isset($cartProducts)) {
foreach ($cartProducts as $key => $fedexServices) {
$rate = $totalShippingCost = 0;
$upsMethod = $methodCode = $key;
Expand Down
12 changes: 6 additions & 6 deletions src/Helpers/ShippingMethodHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public function getAllCartProducts($address)
*/
protected function createSoapClient($address)
{
if (! core()->getConfigData('sales.carriers.ups.ups_active')) {
return false;
}

$cart = Cart::getCart();

$defaultChannel = core()->getCurrentChannelCode();
Expand All @@ -71,11 +75,6 @@ protected function createSoapClient($address)

$adminCompany = $adminData->hostname;

if (! core()->getConfigData('sales.carriers.ups.ups_active')) {

return false;
}

$sellerAdminData = $this->upsRepository->getSellerAdminData($cart->items()->get(), 'ups_postcode');

$sellerAdminServices = $allServices = [];
Expand Down Expand Up @@ -280,11 +279,11 @@ protected function getServiceName($serviceCode)
];

foreach ($mapServices as $key => $service) {

if ($key == $serviceCode) {
return $service;
}
}

return $serviceCode;
}

Expand Down Expand Up @@ -312,6 +311,7 @@ public function getWeight($weight)
} else {
$convertedWeight = $weight/0.45359237;
}

return $convertedWeight;
}

Expand Down

0 comments on commit 0bf6e74

Please sign in to comment.