ShippingService
extends TransactionalService
in package
Class ShippingService
Tags
Table of Contents
Constants
- ARRAY_STR = [" ", "'price'=>"]
- PRICING_DATA = [1 => ['FR' => 7, 'EU' => 10], 2 => ['FR' => 7, 'EU' => 11], 3 => ['FR' => 7, 'EU' => 12], 4 => ['FR' => 8, 'EU' => 12], 5 => ['FR' => 9, 'EU' => 12], 6 => ['FR' => 9, 'EU' => 13], 7 => ['FR' => 11, 'EU' => 13], 8 => ['FR' => 11, 'EU' => 14], 9 => ['FR' => 12, 'EU' => 14], 10 => ['FR' => 16, 'EU' => 19], 11 => ['FR' => 18, 'EU' => 19], 12 => ['FR' => 18, 'EU' => 19], 13 => ['FR' => 20, 'EU' => 20], 14 => ['FR' => 20, 'EU' => 20], 15 => ['FR' => 20, 'EU' => 21], 16 => ['FR' => 22, 'EU' => 22], 17 => ['FR' => 22, 'EU' => 22], 18 => ['FR' => 23, 'EU' => 22], 19 => ['FR' => 25, 'EU' => 24], 20 => ['FR' => 25, 'EU' => 24], 21 => ['FR' => 25, 'EU' => 25], 22 => ['FR' => 25, 'EU' => 25], 23 => ['FR' => 25, 'EU' => 25], 24 => ['FR' => 25, 'EU' => 27], 25 => ['FR' => 25, 'EU' => 27], 26 => ['FR' => 28, 'EU' => 27], 27 => ['FR' => 28, 'EU' => 29], 28 => ['FR' => 28, 'EU' => 29], 29 => ['FR' => 28, 'EU' => 30], 30 => ['FR' => 28, 'EU' => 30]]
Properties
- $container : ContainerInterface
- $em : EntityManager
- $activeShippingServices : array<string|int, mixed>
- $chronopostNameByStore : array<string|int, mixed>
- $configCode : string
- $currentStoreId : mixed
- $isShippingRatesSynced : bool
Methods
- addRepository() : void
- Add a repository to this service
- addService() : void
- Add a service to this service
- calculateChronopostShippingAmount() : mixed
- calculateEcoShippingAmount() : mixed
- calculateEtageShippingAmount() : mixed
- calculateShippingAmountForSaleProduct() : float|int
- calculateShippingRateForEco() : int
- Calculate fees for Eco
- calculatEtageWithAssemblyShippingAmount() : mixed
- calculateTruskShippingAmount() : float
- calculateVirShippingAmount() : float
- getCategoriesExtraShippingAmount() : mixed
- getEntityManager() : EntityManager
- Getter of the Entity Manager
- getEuropeShippingPrice() : int|false
- Calculate the shipping price for Europe based on weight and country code
- getMonocolisShippingPriceByProduct() : false|float
- getMonocolisShippingPriceByWeight() : int|null
- getNonMonocolisPriceByProduct() : mixed
- getProductCarrier() : bool
- Get product carrier
- getShippingAmountForSale() : float
- Get ShippingAmountForSale
- getShippingMethodForSale() : string
- Get Sale shipping method with checking all sale products
- getShippingWithAssemblyAmountByProduct() : mixed
- isChronopostableProduct() : bool
- Check whether a sale product is chronopostable
- isSaleProductChronopostable() : bool
- Check whether a sale product is chronopostable
- isShippingRatesSynced() : bool
- setEntityManager() : mixed
- Setter of the Entity Manager
- setIsShippingRatesSynced() : mixed
- syncShippingRates() : mixed
- Syncing with Magento before we run
- calculateShippingAmountForSaleProductV2() : mixed
- calculateShippingRateForChronopost() : int
- Calculating shipping rate for chronopost
- checkAndUpdateShippingData() : mixed
- check shipping data if data is older than 20 hours then get it again from Magento
- checkConfig() : mixed
- checking if shipping service has line in config table
- generateIntervalFromFeeTable() : array<string|int, mixed>
- Generating interval from fee table
- getFeeTable() : array<string|int, mixed>
- Getting sorted fee table with price and price interval
- getFilteredStoreRates() : mixed
- Get filtered rates for store
- getShippingPrice() : float
- Getting lowest shipping price
- getShippingRatesForStore() : mixed
- Getting shipping rates for store
- isProductWeightInInterval() : int
- sortFeesTable() : array<string|int, mixed>
- Sorting fee table
Constants
ARRAY_STR
public
mixed
ARRAY_STR
= [" ", "'price'=>"]
PRICING_DATA
public
mixed
PRICING_DATA
= [1 => ['FR' => 7, 'EU' => 10], 2 => ['FR' => 7, 'EU' => 11], 3 => ['FR' => 7, 'EU' => 12], 4 => ['FR' => 8, 'EU' => 12], 5 => ['FR' => 9, 'EU' => 12], 6 => ['FR' => 9, 'EU' => 13], 7 => ['FR' => 11, 'EU' => 13], 8 => ['FR' => 11, 'EU' => 14], 9 => ['FR' => 12, 'EU' => 14], 10 => ['FR' => 16, 'EU' => 19], 11 => ['FR' => 18, 'EU' => 19], 12 => ['FR' => 18, 'EU' => 19], 13 => ['FR' => 20, 'EU' => 20], 14 => ['FR' => 20, 'EU' => 20], 15 => ['FR' => 20, 'EU' => 21], 16 => ['FR' => 22, 'EU' => 22], 17 => ['FR' => 22, 'EU' => 22], 18 => ['FR' => 23, 'EU' => 22], 19 => ['FR' => 25, 'EU' => 24], 20 => ['FR' => 25, 'EU' => 24], 21 => ['FR' => 25, 'EU' => 25], 22 => ['FR' => 25, 'EU' => 25], 23 => ['FR' => 25, 'EU' => 25], 24 => ['FR' => 25, 'EU' => 27], 25 => ['FR' => 25, 'EU' => 27], 26 => ['FR' => 28, 'EU' => 27], 27 => ['FR' => 28, 'EU' => 29], 28 => ['FR' => 28, 'EU' => 29], 29 => ['FR' => 28, 'EU' => 30], 30 => ['FR' => 28, 'EU' => 30]]
Properties
$container
protected
ContainerInterface
$container
$em
protected
EntityManager
$em
The Entity Manager
$activeShippingServices
private
array<string|int, mixed>
$activeShippingServices
= [2 => ['chronopost', 'chronopostcclassic', 'ECO', 'owsh1'], 3 => ['chronopost', 'ECO', 'owsh1'], 4 => ['chronopost', 'ECO', 'owsh1'], 8 => ['chronopost', 'ECO', 'owsh1'], 9 => ['chronopost', 'ECO', 'owsh1'], 11 => ['chronopost', 'ECO', 'owsh1'], 14 => ['chronopost', 'chronopostcclassic', 'ECO', 'owsh1'], 15 => ['chronopost', 'chronopostcclassic', 'ECO', 'owsh1'], 23 => ['chronopost', 'chronopostcclassic', 'ECO', 'owsh1'], 24 => ['chronopost', 'chronopostcclassic', 'ECO', 'owsh1'], 25 => ['chronopost', 'chronopostcclassic', 'ECO', 'owsh1'], 26 => ['chronopost', 'chronopostcclassic', 'ECO', 'owsh1'], 27 => ['chronopost', 'chronopostcclassic', 'ECO', 'owsh1'], 28 => ['chronopost', 'chronopostcclassic', 'ECO', 'owsh1'], 29 => ['chronopost', 'chronopostcclassic', 'ECO', 'owsh1'], 30 => ['chronopost', 'chronopostcclassic', 'ECO', 'owsh1']]
$chronopostNameByStore
private
array<string|int, mixed>
$chronopostNameByStore
= [14 => 'chronopostcclassic', 3 => 'chronopost']
$configCode
private
string
$configCode
= 'MZ_SHIPPING_CONFIG'
$currentStoreId
private
mixed
$currentStoreId
= 3
Tags
$isShippingRatesSynced
private
bool
$isShippingRatesSynced
= false
Methods
addRepository()
Add a repository to this service
public
addRepository(int $key, string $class) : void
Parameters
- $key : int
-
Key
- $class : string
-
Class
addService()
Add a service to this service
public
addService(int $key, mixed $service) : void
Parameters
- $key : int
-
Key
- $service : mixed
calculateChronopostShippingAmount()
public
calculateChronopostShippingAmount(Product $product, mixed $quantity) : mixed
Parameters
- $product : Product
- $quantity : mixed
calculateEcoShippingAmount()
public
calculateEcoShippingAmount(Sale $sale, Product $logidavProduct, mixed $method, mixed $sp) : mixed
Parameters
calculateEtageShippingAmount()
public
calculateEtageShippingAmount(mixed $product, mixed $qty) : mixed
Parameters
- $product : mixed
- $qty : mixed
calculateShippingAmountForSaleProduct()
public
calculateShippingAmountForSaleProduct(mixed $sale, mixed $product[, false $methodeShipped = false ]) : float|int
Parameters
- $sale : mixed
- $product : mixed
- $methodeShipped : false = false
Return values
float|intcalculateShippingRateForEco()
Calculate fees for Eco
public
calculateShippingRateForEco(Product $product, mixed $qty) : int
Parameters
- $product : Product
- $qty : mixed
Return values
intcalculatEtageWithAssemblyShippingAmount()
public
calculatEtageWithAssemblyShippingAmount(mixed $product, mixed $qty) : mixed
Parameters
- $product : mixed
- $qty : mixed
calculateTruskShippingAmount()
public
calculateTruskShippingAmount(mixed $product, mixed $sale, mixed $qty) : float
Parameters
- $product : mixed
- $sale : mixed
- $qty : mixed
Return values
floatcalculateVirShippingAmount()
public
calculateVirShippingAmount(mixed $product, mixed $qty) : float
Parameters
- $product : mixed
- $qty : mixed
Return values
floatgetCategoriesExtraShippingAmount()
public
getCategoriesExtraShippingAmount(mixed $cats) : mixed
Parameters
- $cats : mixed
getEntityManager()
Getter of the Entity Manager
public
getEntityManager() : EntityManager
Return values
EntityManagergetEuropeShippingPrice()
Calculate the shipping price for Europe based on weight and country code
public
getEuropeShippingPrice(float $weight, string $countryCode) : int|false
Parameters
- $weight : float
-
The weight of the item
- $countryCode : string
-
The ISO country code of the destination country
Return values
int|false —The calculated shipping price if successful, false otherwise
getMonocolisShippingPriceByProduct()
public
getMonocolisShippingPriceByProduct(Product $product[, int $qty = 1 ][, int $storeId = 3 ]) : false|float
Parameters
- $product : Product
- $qty : int = 1
- $storeId : int = 3
Return values
false|floatgetMonocolisShippingPriceByWeight()
public
getMonocolisShippingPriceByWeight(mixed $weight, mixed $region) : int|null
Parameters
- $weight : mixed
- $region : mixed
Return values
int|nullgetNonMonocolisPriceByProduct()
public
getNonMonocolisPriceByProduct(Product $product, mixed $qty[, mixed $storeId = 3 ]) : mixed
Parameters
- $product : Product
- $qty : mixed
- $storeId : mixed = 3
getProductCarrier()
Get product carrier
public
getProductCarrier(Product $product[, int $storeId = 3 ]) : bool
Parameters
- $product : Product
- $storeId : int = 3
Return values
boolgetShippingAmountForSale()
Get ShippingAmountForSale
public
getShippingAmountForSale(mixed $sale) : float
Parameters
- $sale : mixed
Return values
floatgetShippingMethodForSale()
Get Sale shipping method with checking all sale products
public
getShippingMethodForSale(Sale $sale) : string
Parameters
- $sale : Sale
Return values
stringgetShippingWithAssemblyAmountByProduct()
public
getShippingWithAssemblyAmountByProduct(mixed $product) : mixed
Parameters
- $product : mixed
isChronopostableProduct()
Check whether a sale product is chronopostable
public
isChronopostableProduct(Product $product[, int $qty = 1 ]) : bool
Parameters
- $product : Product
- $qty : int = 1
Return values
boolisSaleProductChronopostable()
Check whether a sale product is chronopostable
public
isSaleProductChronopostable(SaleProduct $saleProduct) : bool
Parameters
- $saleProduct : SaleProduct
Return values
boolisShippingRatesSynced()
public
isShippingRatesSynced() : bool
Return values
boolsetEntityManager()
Setter of the Entity Manager
public
setEntityManager(EntityManager $em) : mixed
Parameters
- $em : EntityManager
-
the Entity Manager
setIsShippingRatesSynced()
public
setIsShippingRatesSynced(bool $isShippingRatesSynced) : mixed
Parameters
- $isShippingRatesSynced : bool
syncShippingRates()
Syncing with Magento before we run
public
syncShippingRates() : mixed
calculateShippingAmountForSaleProductV2()
private
calculateShippingAmountForSaleProductV2(mixed $sale, mixed $product) : mixed
Parameters
- $sale : mixed
- $product : mixed
calculateShippingRateForChronopost()
Calculating shipping rate for chronopost
private
calculateShippingRateForChronopost(Product $product, mixed $quantity, array<string|int, mixed> $tableConfig) : int
Parameters
- $product : Product
- $quantity : mixed
- $tableConfig : array<string|int, mixed>
Return values
intcheckAndUpdateShippingData()
check shipping data if data is older than 20 hours then get it again from Magento
private
checkAndUpdateShippingData() : mixed
checkConfig()
checking if shipping service has line in config table
private
checkConfig() : mixed
generateIntervalFromFeeTable()
Generating interval from fee table
private
generateIntervalFromFeeTable(array<string|int, mixed> $feesTable) : array<string|int, mixed>
Parameters
- $feesTable : array<string|int, mixed>
Return values
array<string|int, mixed>getFeeTable()
Getting sorted fee table with price and price interval
private
getFeeTable(string $feeTableString) : array<string|int, mixed>
Parameters
- $feeTableString : string
Return values
array<string|int, mixed>getFilteredStoreRates()
Get filtered rates for store
private
getFilteredStoreRates(mixed $storesRate, mixed $storeId) : mixed
Parameters
- $storesRate : mixed
- $storeId : mixed
getShippingPrice()
Getting lowest shipping price
private
getShippingPrice(array<string|int, mixed> $shippingPrices) : float
Parameters
- $shippingPrices : array<string|int, mixed>
Return values
floatgetShippingRatesForStore()
Getting shipping rates for store
private
getShippingRatesForStore(mixed $storeId) : mixed
Parameters
- $storeId : mixed
isProductWeightInInterval()
private
isProductWeightInInterval(mixed $product, mixed $quantity, mixed $feesTable) : int
Parameters
- $product : mixed
- $quantity : mixed
- $feesTable : mixed
Return values
intsortFeesTable()
Sorting fee table
private
sortFeesTable(array<string|int, mixed> $feeTable) : array<string|int, mixed>
Parameters
- $feeTable : array<string|int, mixed>