Methods summary
public
|
|
public
boolean
|
#
install( )
Performs following actions:
- Creates database table
eabi_carriermodule for holding list of
carriers using this class
- Creates database table
eabi_postoffice for holding pickup
points for the carrier modules
- Creates database table
eabi_cart_shipping for holding
information which shipping address in the cart has selected which parcel
terminal
- Adds hook
actionCarrierProcess - for validation, that terminal
was selected
- Adds hook
orderConfirmation - for displaying selected parcel
terminal in some emails
Performs following actions:
- Creates database table
eabi_carriermodule for holding list of
carriers using this class
- Creates database table
eabi_postoffice for holding pickup
points for the carrier modules
- Creates database table
eabi_cart_shipping for holding
information which shipping address in the cart has selected which parcel
terminal
- Adds hook
actionCarrierProcess - for validation, that terminal
was selected
- Adds hook
orderConfirmation - for displaying selected parcel
terminal in some emails
Returns
boolean
|
public
boolean
|
#
uninstall( )
Drops all the information that was created in the install process.
Drops all the information that was created in the install process.
Returns
boolean
|
public
boolean
|
#
setDisplayName( string $code, string $displayName )
Updates carrier_lang.delay descriptions, required for the
carrier to be displayed.
Updates carrier_lang.delay descriptions, required for the
carrier to be displayed.
Parameters
- $code
string $code carrier.external_module_name
- $displayName
string $displayName new name
Returns
boolean
|
public
|
#
setTaxGroup( string $code, integer $tax )
Sets tax group for current carrier.external_module_name
Sets tax group for current carrier.external_module_name
Parameters
- $code
string $code shipping method code
- $tax
integer $tax tax id
|
public
Eabi_Postoffice
|
#
setShippingModel( ModuleCore $shippingModel )
For allowing to overload getPostoffices method in shipping model
instance with name __getPostoffices
For allowing to overload getPostoffices method in shipping model
instance with name __getPostoffices
Parameters
- $shippingModel
ModuleCore $shippingModel
Returns
|
public
array
|
#
getPostOffices( string $code, integer $groupId = null, integer $officeId = null, integer $addressId = null )
Returns assoc array which should contain the actual postoffices which belong
to the selected group_id in alplabetically sorted order.
If no $groupId is supplied, then all the postoffices are returned.
Offices are sorted by
- group_sort descending
- group_name ascending
- name ascending
Returns assoc array which should contain the actual postoffices which belong
to the selected group_id in alplabetically sorted order.
If no $groupId is supplied, then all the postoffices are returned.
Offices are sorted by
- group_sort descending
- group_name ascending
- name ascending
Parameters
- $code
string $code carrier.external_module_name
- $groupId
integer $groupId
- $officeId
integer $officeId when only requesting one specific office
- $addressId
integer $addressId when supplied then only offices from the addressId country are
returned.
Returns
array
|
public
boolean|array
|
#
getPostOfficeGroups( string $code, integer $addressId = null )
Returns distinct group_name,group_id,group_sort as
Eabi_Postoffice_Model_Mysql4_Office_Collection of 'eabi_postoffice/office'
models
Result of this function is used to render the first select menu (county/city)
for this carrier.
If no groups can be found, then this function returns boolean false.
Returns distinct group_name,group_id,group_sort as
Eabi_Postoffice_Model_Mysql4_Office_Collection of 'eabi_postoffice/office'
models
Result of this function is used to render the first select menu (county/city)
for this carrier.
If no groups can be found, then this function returns boolean false.
Parameters
- $code
string $code carrier.external_module_name
- $addressId
integer $addressId when supplied then only groups from the addressId country are
returned
Returns
boolean|array
|
public
|
#
setOfficeToSession( type $code, type $addressId, type $placeId, type $groupId = null )
Once the user selects the actual office, an AJAX callback is performed and
this one inserts the selected office to the database
eabi_cart_shipping and also to the session, in order the customer
would easily reach latest selected offices and the order itself could be
placed.
Once the user selects the actual office, an AJAX callback is performed and
this one inserts the selected office to the database
eabi_cart_shipping and also to the session, in order the customer
would easily reach latest selected offices and the order itself could be
placed.
Parameters
- $code
type $code
- $addressId
type $addressId
- $placeId
type $placeId
- $groupId
type $groupId
|
public
array
|
#
getOfficesFromCart( integer $id_cart )
Returns array of selected parcel terminal names for the specified id_cart
Array keys are address ids and array values are parcel terminal names
Returns array of selected parcel terminal names for the specified id_cart
Array keys are address ids and array values are parcel terminal names
Parameters
Returns
array
|
public
array
|
#
getOfficeFromSession( integer $addressId )
Returns information about selected parcel terminal for the specified address,
if any exist.
Return format is following:
code - carrier method code for selected parcel terminal
place_id - selected parcel terminal remote id
address_id - address id reflected back
group_id - group_id where this terminal belongs to.
If no parcel terminal is found, then same element is returned, but it's
values are empty strings
Returns information about selected parcel terminal for the specified address,
if any exist.
Return format is following:
code - carrier method code for selected parcel terminal
place_id - selected parcel terminal remote id
address_id - address id reflected back
group_id - group_id where this terminal belongs to.
If no parcel terminal is found, then same element is returned, but it's
values are empty strings
Parameters
- $addressId
integer $addressId
Returns
array
|
public
boolean
|
#
addCarrierModule( string $code, string $class, string $trackingUrl = '' )
Registers carrier to eabi_carriermodule table as:
- Carrier based on price with range from €0 to €10000
- Adds Carrier to every shop
- Adds Carrier to every available language
- Adds Carrier to every available zone
- Adds Carrier to every available delivery option
Registers carrier to eabi_carriermodule table as:
- Carrier based on price with range from €0 to €10000
- Adds Carrier to every shop
- Adds Carrier to every available language
- Adds Carrier to every available zone
- Adds Carrier to every available delivery option
Parameters
- $code
string $code
- $class
string $class
- $trackingUrl
string $trackingUrl
Returns
boolean
|
public
boolean
|
#
removeCarrierModule( string $code )
Removes carrier from the system, only eabi_carriermodule entry
is kept so when reinstalling carrier, then selected parcel terminal names would
be restored
Removes carrier from the system, only eabi_carriermodule entry
is kept so when reinstalling carrier, then selected parcel terminal names would
be restored
Parameters
Returns
boolean
|
public
|
|
public
boolean|string
|
#
hookActionCarrierProcess( array $params )
If cart contains addresses, which require parcel terminal to be selected (Use
help of this module) then parcel terminals are validated.
If onepage checkout is active, then response is returned as json string and
displayed like alert in the checkout.
When checkout is 5 steps, then on error script exits and user is redirected
back to shipping method page, where get parameter
shipping_method_id with erroneus
carrier.external_module_name is returned
This PrestaShop hook uses following parameters:
cart - Current shopping cart instance for the customer
If cart contains addresses, which require parcel terminal to be selected (Use
help of this module) then parcel terminals are validated.
If onepage checkout is active, then response is returned as json string and
displayed like alert in the checkout.
When checkout is 5 steps, then on error script exits and user is redirected
back to shipping method page, where get parameter
shipping_method_id with erroneus
carrier.external_module_name is returned
This PrestaShop hook uses following parameters:
cart - Current shopping cart instance for the customer
Parameters
Returns
boolean|string
|
protected
integer
|
#
_getIdAddress( integer $origIdAddress )
Fix display bug right after login
select menu of pickup points not displayed after entering customer address
and then logging in instead
Fix display bug right after login
select menu of pickup points not displayed after entering customer address
and then logging in instead
Parameters
- $origIdAddress
integer $origIdAddress default cart->id_address_delivery
Returns
integer
|
public
|
#
hookDisplayOrderDetail( array $params )
Displays selected carrier info at the order detail view
<span class="php-var">$params</span> is assoc array,
which must contain at least order key, which should be instance of
Order
Displays selected carrier info at the order detail view
<span class="php-var">$params</span> is assoc array,
which must contain at least order key, which should be instance of
Order
Parameters
|
public
|
|
public
string|boolean
|
#
hookOrderConfirmation( array $params )
Renders information about chosen parcel terminal as HTML string.
This PrestaShop hook reads following parameters:
objOrder - Order instance which should render selected parcel
terminal
Renders information about chosen parcel terminal as HTML string.
This PrestaShop hook reads following parameters:
objOrder - Order instance which should render selected parcel
terminal
Parameters
Returns
string|boolean
|
protected
array|boolean
|
#
_getSingleTerminal( string $code )
If there is only one terminal in the list and it is not in the session, then
it would be loaded using this function. In every other case this function
returns false
If there is only one terminal in the list and it is not in the session, then
it would be loaded using this function. In every other case this function
returns false
Parameters
Returns
array|boolean
|
protected
boolean
|
#
_verifySelectedTerminal( string $code, integer $terminal )
Returns true if pickup point id is registered in local databse
Returns true if pickup point id is registered in local databse
Parameters
- $code
string $code shipping method code
- $terminal
integer $terminal remote place id for the parcel terminal
Returns
boolean
|
public
integer
|
#
idFromCode( string $code )
Returns carrier module id from its remote code
Returns carrier module id from its remote code
Parameters
- $code
string $code carrier code
Returns
integer
|
public
array|boolean
|
#
getCarrierFromCode( string $code )
Returns carrier table entry from external_module_name
Returns false, when not found
Returns carrier table entry from external_module_name
Returns false, when not found
Parameters
Returns
array|boolean
|
public
string
|
#
codeFromId( integer $id )
Returns carrier_code for the selected carrier id, if it is registered with
this module
Returns carrier_code for the selected carrier id, if it is registered with
this module
Parameters
Returns
string
|
public
null
|
#
refresh( string $code, boolean $byPassTimeCheck = false )
Attempts to synchronize list of parcel terminals with remote server if update
time was earlier than update interval for the current carrier.
Parameters
- $code
string $code carrier code
- $byPassTimeCheck
boolean $byPassTimeCheck when set to true, then data is updated anyway
Returns
null
|
protected
array
|
#
fromOfficeElement( array $officeElement, string $moduleCode, array $oldData = null )
Synchronizes remote pickup point with old data for specified module code.
Synchronizes remote pickup point with old data for specified module code.
Parameters
- $officeElement
array $officeElement
- $moduleCode
string $moduleCode
- $oldData
array $oldData
Returns
array
Throws
|
protected
|
#
assignGroup( array & $dataElement, type & $groups )
Keeps track of generated group_id-s based on the group_names, making sure
that each group has it's unique id.
Parameters
- $dataElement
array $dataElement
- $groups
type $groups
|
protected
boolean
|
#
_verifyCode( string $code )
Makes sure that carrier is registered with this module
Makes sure that carrier is registered with this module
Parameters
- $code
string $code carrier code
Returns
boolean
|
public
string
|
#
getOptionList( array $array, mixed $selected )
Returns HTML select list based on assoc array inputs and marks <span
class="php-var">$selected</span> as active option
Returns HTML select list based on assoc array inputs and marks <span
class="php-var">$selected</span> as active option
Parameters
- $array
array $array
- $selected
mixed $selected
Returns
string html select list
|
public
string
|
#
getMultiselectList( array $array, mixed $selected )
Returns HTML select[multiple=multiple] list based on assoc array inputs and
marks <span class="php-var">$selected</span> as active
option
Returns HTML select[multiple=multiple] list based on assoc array inputs and
marks <span class="php-var">$selected</span> as active
option
Parameters
- $array
array $array
- $selected
mixed $selected
Returns
string html select list
|
public
array
|
#
getCountriesAsOptions( boolean $emptyOption = false )
Returns list of alphabetically sorted countries as assoc array where array
keys are country ISO codes and values are localized country names
Returns list of alphabetically sorted countries as assoc array where array
keys are country ISO codes and values are localized country names
Parameters
- $emptyOption
boolean $emptyOption - adds text to the first place of countries list designated as
empty option
Returns
array
|
public
array
|
#
getTaxes( )
Returns all the available tax groups as assoc array where array keys are
tax_ids and values are tax names
Returns all the available tax groups as assoc array where array keys are
tax_ids and values are tax names
Returns
array
|
public
array
|
#
getClientGroups( )
Returns assoc array of client groups where array keys are group_ids and
values are client group names
Returns assoc array of client groups where array keys are group_ids and
values are client group names
Returns
array
|
public
string
|
#
encodeToJson( mixed $input )
<span class="php-keyword2">json_encode</span>
wrapper for using in heredoc syntax
<span class="php-keyword2">json_encode</span>
wrapper for using in heredoc syntax
Parameters
Returns
string
|
public
string
|
#
addSuccess( string $message )
Wraps input string with div.conf+confirm html string
Wraps input string with div.conf+confirm html string
Parameters
Returns
string
|
public
array
|
#
getDataFromOrder( OrderCore $order, string $prefix )
Attempts to fetch data from order that is stored by carriers extending
Eabi_Postoffice_Model_Carrier_Abstract
Data is stored in not visible on front order comment base64 encoded form and
starting with specified prefix.
If matching comment is found, it is decoded and returned as assoc array
Attempts to fetch data from order that is stored by carriers extending
Eabi_Postoffice_Model_Carrier_Abstract
Data is stored in not visible on front order comment base64 encoded form and
starting with specified prefix.
If matching comment is found, it is decoded and returned as assoc array
Parameters
- $order
OrderCore $order instance to look up the data for
- $prefix
string $prefix unique string prefix order comment should start with.
Returns
array
|
public
array
|
#
setDataToOrder( OrderCore $order, array $data, string $prefix )
Stores extra data for specified order in single order comment, which will
start with specified prefix.
If no matching order comment is found, then it is created automatically,
otherwise old one is updated.
Order comment is stored using following procedure:
- If old data is found, then it is merged with new data
- Data is json encoded and after that gzcompressed
- Now it is base64 encoded and divided into 40 char long lines and prefixed
with $prefix
- Result is stored to one of the comments contained within the order.
Stores extra data for specified order in single order comment, which will
start with specified prefix.
If no matching order comment is found, then it is created automatically,
otherwise old one is updated.
Order comment is stored using following procedure:
- If old data is found, then it is merged with new data
- Data is json encoded and after that gzcompressed
- Now it is base64 encoded and divided into 40 char long lines and prefixed
with $prefix
- Result is stored to one of the comments contained within the order.
Parameters
- $order
OrderCore $order Magento order instance to set up the data for
- $data
array $data
- $prefix
string $prefix
Returns
array
|
public
false|mixed
|
#
helper( string $name, type $prefix )
Returns new or cached class instance by prestashop module name and helper
name
How to build helper class?
- Create PHP file with name $name.php
- Give it class name asi $prefix_$name
- Place given file in the modules root folder
Returns new or cached class instance by prestashop module name and helper
name
How to build helper class?
- Create PHP file with name $name.php
- Give it class name asi $prefix_$name
- Place given file in the modules root folder
Parameters
- $name
string $name requested helper name
- $prefix
type $prefix PrestaShop module name, where helper should belong.
Returns
false|mixed false, when helper could not be found. Class instance otherwise.
|
public
boolean
|
#
upgrade_module_0_6( )
- Registers hook
displayOrderDetail - for displaying selected
pickup point on the order at the customer side
- Registers hook with name
displayPDFInvoice - for displaying
selected pickup point on the PDF invoice
- Registers hook
displayOrderDetail - for displaying selected
pickup point on the order at the customer side
- Registers hook with name
displayPDFInvoice - for displaying
selected pickup point on the PDF invoice
Returns
boolean
|