Overview

Packages

  • Eabi
    • Dpd
  • None
  • PHP

Classes

  • dpdcodpayment
  • eabi_dpd_courier
  • Eabi_dpd_courierCourierModuleFrontController
  • eabi_dpd_parcelstore
  • eabi_dpd_parcelstore_data_send_executor
  • eabi_dpd_parcelstore_dpd_api
  • eabi_dpd_parcelstore_dpd_helper
  • eabi_dpd_parcelstore_html_helper
  • eabi_dpd_parcelstore_validator_helper
  • Eabi_dpd_parcelstoreCourierModuleFrontController
  • Eabi_Postoffice
  • eabi_postoffice_dialcode_helper
  • Eabi_PostofficePostofficeModuleFrontController

Functions

  • upgrade_module_0_3
  • upgrade_module_0_6
  • upgrade_module_0_8
  • Overview
  • Package
  • Class
  • Tree

Class eabi_dpd_parcelstore

Represents DPD parcel terminal shipping method.

Extra order data is stored under specialized order comment

Can perform following business actions:

  • Calculate shipping price based on country and weight
  • Display list of user selectable parcel terminals, which is auto updated.
  • Send information about shipment data to DPD server.
  • Call courier to pick up the shipment that was ordered using this carrier.
Module
Extended by eabi_dpd_parcelstore

Direct known subclasses

eabi_dpd_courier
Author: Matis
Located at eabi_dpd_parcelstore/eabi_dpd_parcelstore.php
Methods summary
final public
# __construct( )

Default constructor

Default constructor

protected
# _construct( )

Any setup parameters can be set up here.

Any setup parameters can be set up here.

final public boolean
# install( )

Performs install function for this module

Performs install function for this module

Returns

boolean
final public boolean
# uninstall( )

Performs uninstall function for this module

Performs uninstall function for this module

Returns

boolean
protected boolean
# _install( )

Performs following actions:

  • Registers hook extraCarrier
  • Registers carrier with name eabi_dpdee_parcelstore
  • Registers hook with name paymentConfirm - for auto sending data after payment
  • Registers hook with name actionAdminControllerSetMedia - for adding css,js scripts
  • Registers hook with name displayBackOfficeFooter - for adding call to courier button
  • Registers hook with name displayHeader - for adding css,js scripts
  • Registers hook with name displayFooter - for removing shipping methods at onepage checkouts, if HOOK_EXTRACARRIER is not called

Performs following actions:

  • Registers hook extraCarrier
  • Registers carrier with name eabi_dpdee_parcelstore
  • Registers hook with name paymentConfirm - for auto sending data after payment
  • Registers hook with name actionAdminControllerSetMedia - for adding css,js scripts
  • Registers hook with name displayBackOfficeFooter - for adding call to courier button
  • Registers hook with name displayHeader - for adding css,js scripts
  • Registers hook with name displayFooter - for removing shipping methods at onepage checkouts, if HOOK_EXTRACARRIER is not called

Returns

boolean
protected boolean
# _uninstall( )

Performs following actions:

  • Unregisters hook extraCarrier
  • Removes carrier with name eabi_dpdee_parcelstore
  • Unregisters hook with name paymentConfirm
  • Unregisters hook with name actionAdminControllerSetMedia
  • Unregisters hook with name displayBackOfficeFooter
  • Unregisters hook with name displayHeader
  • Unregisters hook with name displayFooter
  • If dataSendExecutor is available, then uninstall() method will be called on same object

Performs following actions:

  • Unregisters hook extraCarrier
  • Removes carrier with name eabi_dpdee_parcelstore
  • Unregisters hook with name paymentConfirm
  • Unregisters hook with name actionAdminControllerSetMedia
  • Unregisters hook with name displayBackOfficeFooter
  • Unregisters hook with name displayHeader
  • Unregisters hook with name displayFooter
  • If dataSendExecutor is available, then uninstall() method will be called on same object

Returns

boolean
public array
# getRequestForAutoSendData( OrderCore $order, AddressCore $address, array $selectedOfficeId, boolean $forceCod = false )

Prepares op=order request to be sent via DPD API.

Prepares op=order request to be sent via DPD API.

Parameters

$order
OrderCore
$order Order that is using this carrier
$address
AddressCore
$address address, that is from that order (one order can support multiple addresses)
$selectedOfficeId
array
$selectedOfficeId selected entry from table eabi_postoffice
$forceCod
boolean
$forceCod true if request should be sent as COD request

Returns

array
request that is passed directly to DPD
protected
# _getCurrencyIso( mixed $id_currency )
public string
# hookPaymentConfirm( array & $params )

Automatic data sending is executed at the moment, when order is marked as Paid.

Automatic data sending is executed at the moment, when order is marked as Paid.

Parameters

$params
array
$params

Returns

string
public
# hookActionAdminControllerSetMedia( )

For adding CSS,JS scripts in backoffice

For adding CSS,JS scripts in backoffice

public
# hookDisplayBackOfficeFooter( )

Module that adds the button to call the courier.

Module that adds the button to call the courier.

protected
# _getFooterJs( mixed $jsonParams )
protected
# _toJson( mixed $input )
public
# hookDisplayHeader( )

For adding CSS,JS scripts in frontend

For adding CSS,JS scripts in frontend

public string
# hookDisplayFooter( )

For adding HOOK_EXTRACARRIER callout, when original callout did not occur when it had to.

PrestaShop does not call extracarrier when for example address is not entered yet

For adding HOOK_EXTRACARRIER callout, when original callout did not occur when it had to.

PrestaShop does not call extracarrier when for example address is not entered yet

Returns

string
protected array
# _postValidation( )

Validates Admin Configuration Form and returns array of error message on validation failure.

Validates Admin Configuration Form and returns array of error message on validation failure.

Returns

array
error messages as array, if any
public string
# hookExtraCarrier( array $params )

This hook is called right after PrestaShop own carriers are rendered.

Returns HTML, which:

  • Replaces PrestaShop carrier element with ajax refreshing select menu element
  • Hides PrestaShop carrier, when this carrier should not be available

Current PrestaShops extraCarrier hook uses following parameters:

  • cart - Cart instance for current customer or order
  • address - Address instance for current cart

Checks following and hides if:

  • Shipping is not allowed for the specified country
  • Products in the cart contain specific HTML comment string
  • Any of the products is overweight

This hook is called right after PrestaShop own carriers are rendered.

Returns HTML, which:

  • Replaces PrestaShop carrier element with ajax refreshing select menu element
  • Hides PrestaShop carrier, when this carrier should not be available

Current PrestaShops extraCarrier hook uses following parameters:

  • cart - Cart instance for current customer or order
  • address - Address instance for current cart

Checks following and hides if:

  • Shipping is not allowed for the specified country
  • Products in the cart contain specific HTML comment string
  • Any of the products is overweight

Parameters

$params
array
$params

Returns

string
protected
# _isSerialized( mixed $input )
public string
# getContent( )

PrestaShop implementation for displaing configuration form for this module

PrestaShop implementation for displaing configuration form for this module

Returns

string
protected string
# _displayForm( )

Generates actual configuration form by rules

Generates actual configuration form by rules

Returns

string
public mixed
# getConfigData( string $param )

Fetches configuration for this instance.

Fetches configuration for this instance.

Parameters

$param
string
$param

Returns

mixed
public mixed
# getConfigDataForThis( string $param )

Gets configuration data only for this instance.

Gets configuration data only for this instance.

Parameters

$param
string
$param

Returns

mixed
protected string
# _getFormHtml( string $action, string $method, array $formFields )

Renders form HTML from the form fields configuration

Renders form HTML from the form fields configuration

Parameters

$action
string
$action action url
$method
string
$method form element method attribute
$formFields
array
$formFields form fields array

Returns

string
resulting html
public float
# getOrderShippingCostExternal( CartCode $cartObject )

Parameters

$cartObject
CartCode
$cartObject

Returns

float

See

eabi_dpd_parcelstore::getOrderShippingCost()
public float
# getOrderShippingCost( CartCore $cartObject, float $shippingPrice = 0 )

Attemps to calculate shipping price from price-country shipping price matrix.

If unsuccessful, then default handling fee is returned.

If shipping calculation mode is set Per Item, then price will be multiplied by number of packages

Attemps to calculate shipping price from price-country shipping price matrix.

If unsuccessful, then default handling fee is returned.

If shipping calculation mode is set Per Item, then price will be multiplied by number of packages

Parameters

$cartObject
CartCore
$cartObject
$shippingPrice
float
$shippingPrice

Returns

float
public boolean|float
# getCodFee( AddressCore $address )

Returns cash on delivery fee based on address

Does not check if Cash on delivery is available

Returns false if country is unspecified.

Returns cash on delivery fee based on address

Does not check if Cash on delivery is available

Returns false if country is unspecified.

Parameters

$address
AddressCore
$address

Returns

boolean|float
public boolean
# isCodEnabled( AddressCore $address )

Returns true if cash on delivery is allowed for specified address

Checks if COD is allowed by configuration variable payment/dpdcodpayment/active and COD fee is determined in shipping price matrix

Returns true if cash on delivery is allowed for specified address

Checks if COD is allowed by configuration variable payment/dpdcodpayment/active and COD fee is determined in shipping price matrix

Parameters

$address
AddressCore
$address

Returns

boolean
protected
# _getTaxRateForCart( CartCore $cart )

Parameters

$cart
CartCore
$cart
protected array
# _decodeShippingMatrix( string $input )

Decodes json encoded string to assoc array (array keys are country ISO codes) and returns in following format:

  • country_id - Country ISO code, also array key for this element
  • base_price - base shipping price up to 10kg
  • kg_price - additional shipping price for each 10kg
  • free_shipping_from - when and if to apply free shipping

Decodes json encoded string to assoc array (array keys are country ISO codes) and returns in following format:

  • country_id - Country ISO code, also array key for this element
  • base_price - base shipping price up to 10kg
  • kg_price - additional shipping price for each 10kg
  • free_shipping_from - when and if to apply free shipping

Parameters

$input
string
$input

Returns

array
protected array
# _initFormFields( )

Creates admin form fields for this module and caches them after creation

Creates admin form fields for this module and caches them after creation

Returns

array

See

eabi_dpd_parcelstore_html_helper
public string
# displayInfoByCart( integer $cart_id )

This function is called when store administrator is viewing the order.

Renders the selected parcelstore

This function is called when store administrator is viewing the order.

Renders the selected parcelstore

Parameters

$cart_id
integer
$cart_id id cart for the order

Returns

string
html string
public array
# addArrayAfterKey( array $inputArray, array $appendArray, boolean $afterKey = false )

Adds <span class="php-var">$appendArray</span> after specified

$afterKey

inside <span class="php-var">$inputArray</span>

Adds <span class="php-var">$appendArray</span> after specified

$afterKey

inside <span class="php-var">$inputArray</span>

Parameters

$inputArray
array
$inputArray original assoc array
$appendArray
array
$appendArray array to be appended to original assoc array
$afterKey
boolean
$afterKey when not supplied or key is not found, then appendArray is added to the end

Returns

array
public Eabi_Postoffice
# _getHelperModule( )

Returns cached instance of base helper module

Returns cached instance of base helper module

Returns

Eabi_Postoffice
public integer
# getUpdateInterval( )

Indicates that parcel terminals should be updated once every 1440 minutes (24h)

Indicates that parcel terminals should be updated once every 1440 minutes (24h)

Returns

integer
public null
# setLastUpdated( integer $lastUpdated )

Marks that this modules pickup point list updated as of timestamp

Marks that this modules pickup point list updated as of timestamp

Parameters

$lastUpdated
integer
$lastUpdated timestamp

Returns

null
public integer
# getLastUpdated( )

Returns unix timestamp, when pickup points for this module were last updated

Returns unix timestamp, when pickup points for this module were last updated

Returns

integer
timestamp
public string
# getGroupTitle( array $group )

Should return group title for current pickup point.

Should return group title for current pickup point.

Parameters

$group
array
$group row from database eabi_postoffice

Returns

string
public string
# getTerminalTitle( string $terminal )

Returns parcel terminal name when short names are enabled.

Returns parcel terminal name with address, telephone, opening times when short names are disabled.

Returns parcel terminal name when short names are enabled.

Returns parcel terminal name with address, telephone, opening times when short names are disabled.

Parameters

$terminal
string
$terminal

Returns

string
public string
# getAdminTerminalTitle( array $terminal )

Returns parcel terminal name when short names are enabled.

Returns parcel terminal name with address, telephone, opening times when short names are disabled.

Returns parcel terminal name when short names are enabled.

Returns parcel terminal name with address, telephone, opening times when short names are disabled.

Parameters

$terminal
array
$terminal

Returns

string
public string
# ls( string $string )

Calls this modules l function

Calls this modules l function

Parameters

$string
string
$string

Returns

string
public array|boolean
# getOfficeList( )

Returns array of parcel terminals from DPD server or boolean false if fetching failed.

Returns array of parcel terminals from DPD server or boolean false if fetching failed.

Returns

array|boolean
protected string
# _getDescription( array $parcelT )

Fetches one line long human readable parcel terminal description from DPD Pudo instance

Fetches one line long human readable parcel terminal description from DPD Pudo instance

Parameters

$parcelT
array
$parcelT

Returns

string
public integer
# getGroupSort( string $group_name )

Groups parcel terminals by following rules:

  • In Estonia parcel terminals from Tallinn, Tartu, Pärnu are displayed first respectively and remaining parcel terminals are displayed in alphabetical order.
  • In Latvia parcel terminals from Riga, Daugavpils, Liepaja, Jelgava, Jurmala are displayed first respectively and remaining parcel terminals are displayed in alphabetical order.
  • In Lithuania parcel terminals from Vilnius, Kaunas, Klaipeda, Siauliai, Alytus are displayed first respectively and remaining parcel terminals are displayed in alphabetical order.

Groups parcel terminals by following rules:

  • In Estonia parcel terminals from Tallinn, Tartu, Pärnu are displayed first respectively and remaining parcel terminals are displayed in alphabetical order.
  • In Latvia parcel terminals from Riga, Daugavpils, Liepaja, Jelgava, Jurmala are displayed first respectively and remaining parcel terminals are displayed in alphabetical order.
  • In Lithuania parcel terminals from Vilnius, Kaunas, Klaipeda, Siauliai, Alytus are displayed first respectively and remaining parcel terminals are displayed in alphabetical order.

Parameters

$group_name
string
$group_name

Returns

integer

See

Eabi_Postoffice_Model_Carrier_Abstract::getGroupSort()
protected eabi_dpd_parcelstore_validator_helper
# _getValidator( )

Returns

eabi_dpd_parcelstore_validator_helper
protected eabi_dpd_parcelstore_html_helper
# _getHtmlHelper( )

Returns

eabi_dpd_parcelstore_html_helper
protected eabi_dpd_parcelstore_dpd_helper
# _getDpdHelper( )

Returns

eabi_dpd_parcelstore_dpd_helper
protected eabi_postoffice_dialcode_helper
# _getDialCodeHelper( )

Returns

eabi_postoffice_dialcode_helper
protected string
# _getRemark( OrderCore $order )

Returns empty string

Returns empty string

Parameters

$order
OrderCore
$order

Returns

string
protected integer
# _getNumberOfPackagesForOrder( OrderCore $order )

Returns number or parcels for the order according to Maximum Package Weight defined in DPD settings

Returns number or parcels for the order according to Maximum Package Weight defined in DPD settings

Parameters

$order
OrderCore
$order

Returns

integer

See

Eabi_Postoffice_Helper_Data::getNumberOfPackagesFromItemWeights()
public boolean
# upgrade_module_0_6( )

Adds 2.5€ COD fee to Estonia, Latvia, Lithuania

Adds 2.5€ COD fee to Estonia, Latvia, Lithuania

Returns

boolean
public
# upgrade_module_0_8( )
Constants summary
string CONST_PREFIX 'E_DPDEEP_'
#
string TRACKING_URL 'https://tracking.dpd.de/cgi-bin/delistrack?typ=1&lang=en&pknr=@'
#

@ will be replaced with actual tracking number.

@ will be replaced with actual tracking number.

string ORDER_COMMENT_START_PREFIX '-----EABI_DPDEE-----'
#

If order comment starts with prefix marked here and is not visible on the frontend, then it is considered as extra data order comment.

If order comment starts with prefix marked here and is not visible on the frontend, then it is considered as extra data order comment.

string NAME 'eabi_dpd_parcelstore'
#

Shipping method code

Shipping method code

Properties summary
protected string $_const_prefix
#

Copy of CONST_PREFIX for the instance

Copy of CONST_PREFIX for the instance

protected static boolean $_footerCalled false
#

For making sure that subclass would not call the footer itself again.

For making sure that subclass would not call the footer itself again.

protected boolean $_carrierDisplayed false
#

To prevent displaying carrier extra code more than once.

To prevent displaying carrier extra code more than once.

protected static Eabi_Postoffice $_helperModuleInstance
#

Makes sure only one instance is queried

Makes sure only one instance is queried

public eabi_dpd_parcelstore_data_send_executor $dataSendExecutor
#

Handles functions related to automated data sending and packing slip sending

Handles functions related to automated data sending and packing slip sending

API documentation generated by ApiGen 2.8.0