Class eabi_dpd_parcelstore_dpd_helper
Helper class for DPD shipping method related actions
getLocaleToTerritory
originates from Zend Framework since
PrestaShop does not support proper locales and PHP itself does not too.
Methods summary
public
string
|
#
getOpeningsDescriptionFromTerminal( string $dpdOpeningDescription, string $locale = null )
Converts DPD op=pudo Opening Times into human readable format.
- Input:
1:11:0:16:0,2:7:30:20:0,3:7:30:20:0,4:7:30:20:0,5:7:30:20:0,6:7:30:20:0,7:8:0:16:0
- Result: (E-R 7:30-20; L 8-16; P 11-16)
Converts DPD op=pudo Opening Times into human readable format.
- Input:
1:11:0:16:0,2:7:30:20:0,3:7:30:20:0,4:7:30:20:0,5:7:30:20:0,6:7:30:20:0,7:8:0:16:0
- Result: (E-R 7:30-20; L 8-16; P 11-16)
Parameters
- $dpdOpeningDescription
string $dpdOpeningDescription DPD Openings description
- $locale
string $locale language code to be used for printing out weekday names
Returns
string
|
protected
|
#
setTimestamp( DateTime & $dateTime, integer $timeStamp )
Emulates DateTime::setTimeStamp for PHP 5.2
Emulates DateTime::setTimeStamp for PHP 5.2
Parameters
- $dateTime
DateTime
$dateTime
- $timeStamp
integer $timeStamp
|
protected
string
|
#
_getLocalizedWeekdayName( DateTime $time, string $locale )
Attempts to return short weekday name for specified date if possible
If not possible, then <span
class="php-keyword2">strftime</span>(<span
class="php-quote">'%a'</span>) is performed
Attempts to return short weekday name for specified date if possible
If not possible, then <span
class="php-keyword2">strftime</span>(<span
class="php-quote">'%a'</span>) is performed
Parameters
- $time
DateTime
$time
- $locale
string $locale language code
Returns
string
|
public
string|null
|
#
getLocaleToTerritory( string $territory )
Returns the expected locale for a given territory
Returns the expected locale for a given territory
Parameters
- $territory
string $territory Territory for which the locale is being searched
Returns
string|null Locale string or null when no locale has been found
|
public
integer
|
#
getNumberOfPackagesFromItemWeights( array $itemWeights, integer $maximumWeight )
Takes in array of parcel weights and returns number of packages calculated by
maximum allowed weight per package
Uses better methology to find number of packages than regular cart weight
divided by maximum package weight
For example, if maximum package weight is 31kg, ang we have 3x 20kg packages,
then number of packages would be 3 (not 2)
If maximum package weight is not defined, then it returns 1
If single item in <span
class="php-var">$itemWeights</span> exceeds <span
class="php-var">$maximumWeight</span> then this function returns
false
Takes in array of parcel weights and returns number of packages calculated by
maximum allowed weight per package
Uses better methology to find number of packages than regular cart weight
divided by maximum package weight
For example, if maximum package weight is 31kg, ang we have 3x 20kg packages,
then number of packages would be 3 (not 2)
If maximum package weight is not defined, then it returns 1
If single item in <span
class="php-var">$itemWeights</span> exceeds <span
class="php-var">$maximumWeight</span> then this function returns
false
Parameters
- $itemWeights
array $itemWeights array of item weights
- $maximumWeight
integer $maximumWeight maximum allowed weight of one package
Returns
integer
|
public
eabi_dpd_parcelstore_dpd_api
|
#
getApi( string $storeId = null, string $code = eabi_dpd_parcelstore::CONST_PREFIX )
Gets cached DPD API instance for specified PrestaShop store id and shipping
method code.
Gets cached DPD API instance for specified PrestaShop store id and shipping
method code.
Parameters
- $storeId
string $storeId store id to fetch the api for
- $code
string $code shipping method code to fetch the api for
Returns
|
Properties summary
protected
array
|
$_apis
|
array() |
|