shipping fix
This commit is contained in:
parent
4fcd6e5209
commit
789acc413d
|
|
@ -27,11 +27,9 @@ class Checkout extends CheckoutController
|
|||
],400);
|
||||
}
|
||||
|
||||
Shipping::collectRates();
|
||||
|
||||
$addresses = core()->getCurrentChannel()->inventory_sources()->get();
|
||||
return response([
|
||||
'rates' => CartShippingRateResource::collection(Shipping::getRates()),
|
||||
'shipping' => Shipping::getShippingMethods(),
|
||||
'pickup_addresses' => PickupAddress::collection($addresses),
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@ return [
|
|||
'description' => 'Pickup from address',
|
||||
'active' => true,
|
||||
'is_calculate_tax' => false,
|
||||
'weight_price' => '40',
|
||||
'weight_price' => '20',
|
||||
'delivery_day_min' => '20',
|
||||
'delivery_day_max' => '25',
|
||||
'outlet_delivery' => '2',
|
||||
'type' => 'per_unit',
|
||||
'class' => 'Sarga\Admin\Shipment\Pickup',
|
||||
],
|
||||
|
|
@ -18,7 +21,10 @@ return [
|
|||
'description' => 'Courier Shipping',
|
||||
'active' => true,
|
||||
'is_calculate_tax' => false,
|
||||
'weight_price' => '40',
|
||||
'weight_price' => '20',
|
||||
'delivery_day_min' => '20',
|
||||
'delivery_day_max' => '25',
|
||||
'outlet_delivery' => '2',
|
||||
'class' => 'Sarga\Admin\Shipment\Courier',
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -34,6 +34,30 @@ return[
|
|||
'validation' => 'required_if:active,1',
|
||||
'channel_based' => false,
|
||||
'locale_based' => false,
|
||||
],[
|
||||
'name' => 'delivery_day_min',
|
||||
'title' => 'Estimated delivery day min',
|
||||
'type' => 'depends',
|
||||
'depend' => 'active:1',
|
||||
'validation' => 'required_if:active,1',
|
||||
'channel_based' => false,
|
||||
'locale_based' => false,
|
||||
],[
|
||||
'name' => 'delivery_day_max',
|
||||
'title' => 'Estimated delivery day max',
|
||||
'type' => 'depends',
|
||||
'depend' => 'active:1',
|
||||
'validation' => 'required_if:active,1',
|
||||
'channel_based' => false,
|
||||
'locale_based' => false,
|
||||
],[
|
||||
'name' => 'outlet_delivery',
|
||||
'title' => 'Outlet delivery day',
|
||||
'type' => 'depends',
|
||||
'depend' => 'active:1',
|
||||
'validation' => 'required_if:active,1',
|
||||
'channel_based' => false,
|
||||
'locale_based' => false,
|
||||
], [
|
||||
'name' => 'active',
|
||||
'title' => 'admin::app.admin.system.status',
|
||||
|
|
@ -78,6 +102,30 @@ return[
|
|||
'channel_based' => false,
|
||||
'locale_based' => false,
|
||||
], [
|
||||
'name' => 'delivery_day_min',
|
||||
'title' => 'Estimated delivery day min',
|
||||
'type' => 'depends',
|
||||
'depend' => 'active:1',
|
||||
'validation' => 'required_if:active,1',
|
||||
'channel_based' => false,
|
||||
'locale_based' => false,
|
||||
],[
|
||||
'name' => 'delivery_day_max',
|
||||
'title' => 'Estimated delivery day max',
|
||||
'type' => 'depends',
|
||||
'depend' => 'active:1',
|
||||
'validation' => 'required_if:active,1',
|
||||
'channel_based' => false,
|
||||
'locale_based' => false,
|
||||
],[
|
||||
'name' => 'outlet_delivery',
|
||||
'title' => 'Outlet delivery day',
|
||||
'type' => 'depends',
|
||||
'depend' => 'active:1',
|
||||
'validation' => 'required_if:active,1',
|
||||
'channel_based' => false,
|
||||
'locale_based' => false,
|
||||
],[
|
||||
'name' => 'active',
|
||||
'title' => 'admin::app.admin.system.status',
|
||||
'type' => 'boolean',
|
||||
|
|
|
|||
|
|
@ -54,10 +54,11 @@ class Courier extends AbstractShipping
|
|||
|
||||
if ($price = $this->getConfigData('weight_price')) {
|
||||
$total_weight = $cart->items->sum('total_weight');
|
||||
$cartShippingRate->price = core()->convertPrice($price * $total_weight,$cart->cart_currency_code);
|
||||
$cartShippingRate->price = core()->convertPrice($price * $total_weight);
|
||||
$cartShippingRate->base_price = $price * $total_weight;
|
||||
}
|
||||
|
||||
return $cartShippingRate;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -14,9 +14,6 @@ class Shipping
|
|||
*/
|
||||
protected $rates = [];
|
||||
|
||||
public function getRates(){
|
||||
return $this->rates;
|
||||
}
|
||||
/**
|
||||
* Collects rate from available shipping methods.
|
||||
*
|
||||
|
|
@ -135,7 +132,12 @@ class Shipping
|
|||
'code' => $object->getCode(),
|
||||
'method' => $object->getMethod(),
|
||||
'method_title' => $object->getTitle(),
|
||||
'description' => $object->getDescription()
|
||||
'description' => $object->getDescription(),
|
||||
'formatted_price' => core()->currency($object->getConfigData('weight_price')),
|
||||
'price' => core()->convertPrice($object->getConfigData('weight_price')),
|
||||
'outlet_delivery' => (double)$object->getConfigData('outlet_delivery'),
|
||||
'delivery_day_min' => (double)$object->getConfigData('delivery_day_min'),
|
||||
'delivery_day_max' => (double)$object->getConfigData('delivery_day_max'),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue