interface DeliveryModuleInterface implements BaseModuleInterface

Methods

install( ConnectionInterface $con = null)

This method is called when the plugin is installed for the first time

update( string $currentVersion, string $newVersion, ConnectionInterface $con = null)

This method is called when a newer version of the plugin is installed

destroy( ConnectionInterface $con = null, bool $deleteModuleData = false)

This method is called just before the deletion of the module, giving the module an opportunity to delete its data.

activate( Module $moduleModel = null)

This method is called when the module is activated

deActivate( Module $moduleModel = null)

This method is called when the module is deactivated

bool
preActivation( ConnectionInterface $con = null)

This method is called before the module activation, and may prevent it by returning false.

postActivation( ConnectionInterface $con = null)

This method is called just after the module was successfully activated.

bool
preDeactivation( ConnectionInterface $con = null)

This method is called before the module de-activation, and may prevent it by returning false.

postDeactivation( ConnectionInterface $con = null)

This method is called just after the module was successfully deactivated.

setTitle( Module $module, array $titles)

Sets a module titles for various languages

static  string
getConfigValue( string $variableName, string $defaultValue = null, null $valueLocale = null)

Get a module's configuration variable

static  $this;
setConfigValue( string $variableName, string $variableValue, null $valueLocale = null, bool $createIfNotExists = true)

Set module configuration variable, creating it if required

deployImageFolder( Module $module, string $folderPath, ConnectionInterface $con = null)

Ensure the proper deployment of the module's images.

getModuleModel()

No description

static  string
getModuleId()

No description

static  string
getModuleCode()

No description

string
getCode()

No description

static 
getCompilers()

This method adds new compilers to Thelia container

array
getHooks()

No description

registerHooks()

Create or update module hooks returned by the getHooks function

boolean
isValidDelivery( Country $country)

This method is called by the Delivery loop, to check if the current module has to be displayed to the customer.

OrderPostage|float
getPostage( Country $country)

Calculate and return delivery price in the shop's default currency

bool
handleVirtualProductDelivery()

This method return true if your delivery manages virtual product delivery.

Details

in BaseModuleInterface at line 25
install( ConnectionInterface $con = null)

This method is called when the plugin is installed for the first time

Parameters

ConnectionInterface $con

in BaseModuleInterface at line 34
update( string $currentVersion, string $newVersion, ConnectionInterface $con = null)

This method is called when a newer version of the plugin is installed

Parameters

string $currentVersion the current (installed) module version, as defined in the module.xml file
string $newVersion the new module version, as defined in the module.xml file
ConnectionInterface $con

in BaseModuleInterface at line 44
destroy( ConnectionInterface $con = null, bool $deleteModuleData = false)

This method is called just before the deletion of the module, giving the module an opportunity to delete its data.

Parameters

ConnectionInterface $con
bool $deleteModuleData if true, the module should remove all its data from the system.

in BaseModuleInterface at line 51
activate( Module $moduleModel = null)

This method is called when the module is activated

Parameters

Module $moduleModel the module

in BaseModuleInterface at line 58
deActivate( Module $moduleModel = null)

This method is called when the module is deactivated

Parameters

Module $moduleModel the module

in BaseModuleInterface at line 68
bool preActivation( ConnectionInterface $con = null)

This method is called before the module activation, and may prevent it by returning false.

Parameters

ConnectionInterface $con

Return Value

bool true to continue module activation, false to prevent it.

in BaseModuleInterface at line 75
postActivation( ConnectionInterface $con = null)

This method is called just after the module was successfully activated.

Parameters

ConnectionInterface $con

in BaseModuleInterface at line 83
bool preDeactivation( ConnectionInterface $con = null)

This method is called before the module de-activation, and may prevent it by returning false.

Parameters

ConnectionInterface $con

Return Value

bool true to continue module de-activation, false to prevent it.

in BaseModuleInterface at line 90
postDeactivation( ConnectionInterface $con = null)

This method is called just after the module was successfully deactivated.

Parameters

ConnectionInterface $con

in BaseModuleInterface at line 99
setTitle( Module $module, array $titles)

Sets a module titles for various languages

Parameters

Module $module the module.
array $titles an associative array of locale => title_string

in BaseModuleInterface at line 109
static string getConfigValue( string $variableName, string $defaultValue = null, null $valueLocale = null)

Get a module's configuration variable

Parameters

string $variableName the variable name
string $defaultValue the default value, if variable is not defined
null $valueLocale the required locale, or null to get default one

Return Value

string the variable value

in BaseModuleInterface at line 121
static $this; setConfigValue( string $variableName, string $variableValue, null $valueLocale = null, bool $createIfNotExists = true)

Set module configuration variable, creating it if required

Parameters

string $variableName the variable name
string $variableValue the variable value
null $valueLocale the locale, or null if not required
bool $createIfNotExists if true, the variable will be created if not already defined

Return Value

$this;

Exceptions

LogicException if variable does not exists and $createIfNotExists is false

in BaseModuleInterface at line 141
deployImageFolder( Module $module, string $folderPath, ConnectionInterface $con = null)

Ensure the proper deployment of the module's images.

TODO : this method does not take care of internationalization. This is a bug.

Parameters

Module $module the module
string $folderPath the image folder path
ConnectionInterface $con

Exceptions

ModuleException
Exception
UnexpectedValueException

in BaseModuleInterface at line 147
Module getModuleModel()

Return Value

Module

Exceptions

ModuleException

in BaseModuleInterface at line 152
static string getModuleId()

Return Value

string The module id

in BaseModuleInterface at line 157
static string getModuleCode()

Return Value

string The module code, in a static way

in BaseModuleInterface at line 162
string getCode()

Return Value

string The module code

in BaseModuleInterface at line 200
static getCompilers()

This method adds new compilers to Thelia container

You must return an array. This array can contain : - arrays - one or many instance(s) of \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface

in the first case, your array must contains 2 indexes. The first is the compiler instance and the second the compilerPass type. Example : return array( array( new \MyModule\DependencyInjection\Compiler\MySuperCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPEBEFOREOPTIMIZATION ) );

In the seconde case, just an instance of CompilerPassInterface. Example : return array ( new \MyModule\DependencyInjection\Compiler\MySuperCompilerPass() );

But you can combine both behaviors Example :

return array( new \MyModule\DependencyInjection\Compiler\MySuperCompilerPass(), array( new \MyModule\DependencyInjection\Compiler\MyOtherSuperCompilerPass(), Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPEBEFOREOPTIMIZATION ) );

in BaseModuleInterface at line 244
array getHooks()

Return Value

array This method must be used when your module defines hooks. Override this and return an array of your hooks names to register them

This returned value must be like the example, only type and code are mandatory

Example:

return array(

 // Only register the title in the default language
 array(
     "type" => TemplateDefinition::BACK_OFFICE,
     "code" => "my_super_hook_name",
     "title" => "My hook",
     "description" => "My hook is really, really great",
 ),

 // Manage i18n
 array(
     "type" => TemplateDefinition::FRONT_OFFICE,
     "code" => "my_hook_name",
     "title" => array(
         "fr_FR" => "Mon Hook",
         "en_US" => "My hook",
     ),
     "description" => array(
         "fr_FR" => "Mon hook est vraiment super",
         "en_US" => "My hook is really, really great",
     ),
     "chapo" => array(
         "fr_FR" => "Mon hook est vraiment super",
         "en_US" => "My hook is really, really great",
     ),
     "block" => true,
     "active" => true
 )

);

in BaseModuleInterface at line 249
registerHooks()

Create or update module hooks returned by the getHooks function

at line 32
boolean isValidDelivery( Country $country)

This method is called by the Delivery loop, to check if the current module has to be displayed to the customer.

Override it to implements your delivery rules/

If you return true, the delivery method will de displayed to the customer If you return false, the delivery method will not be displayed

Parameters

Country $country the country to deliver to.

Return Value

boolean

at line 42
OrderPostage|float getPostage( Country $country)

Calculate and return delivery price in the shop's default currency

Parameters

Country $country the country to deliver to.

Return Value

OrderPostage|float the delivery price

Exceptions

DeliveryException if the postage price cannot be calculated.

at line 50
bool handleVirtualProductDelivery()

This method return true if your delivery manages virtual product delivery.

Return Value

bool