ModelHooks module

ShippingBatchEvent

Event of a shipping method job: the Request Job runs before the method creates the rates of a fulfillment, the Response Job after

A model in the Hooks module, with 21 members for templates, 18 API properties and 21 members for admin templates.

View
What Smarty and Twig templates receive. Properties in REST API responses and job payloads. What admin screen templates receive when you override them.

Templates view

Properties 21

Take no arguments.

# getType()
string
Gets the type of the event causing the hook execution. Always returns 'shipping' for shipping method jobs.
# getFulfillment()
?Fulfillment
Gets the fulfillment the shipping method creates the rates for. During the run it is the fulfillment of the checkout being built, which is not saved yet. Later, e.g. in the batch log, it is loaded by id, and it is null when the fulfillment was never saved.
# getCheckout()
?BaseOrder
Gets the checkout the rates are created for. Null in the batch log once the checkout became an order.
# getMethod()
?BaseMethod
Gets the shipping method whose job runs
# getDataDisplay()
string
Gets a string representation of the stage, the shipping method and the checkout for the batch table
# getStage()
?string
Gets the stage of the shipping method the job runs at: request before the method creates its rates, response after
# getCheckoutId()
?int
Gets the id of the checkout the rates are created for
# getCheckoutUuid()
?string
Gets the UUID of the checkout the rates are created for
# getFulfillmentId()
?int
Gets the id of the fulfillment the rates are created for. Null while the checkout is being built, as the fulfillment is not saved yet.
# getMethodId()
?int
Gets the id of the shipping method whose job runs
# getMethodName()
?string
Gets the name of the shipping method whose job runs
# getRequestData()
array
Gets the request the method is about to send, which the Request Job may change. Empty for a method without a carrier request, e.g. the Template method, and in the response stage.
# getRates()
array
Gets the rate list the method offers, as plain entries with name, serviceLevel, courierName, amount, surcharge, estimatedDelivery and data, in the order the job refers to them by index. Empty in the request stage.
# getTypeDisplay()
string
Get a string representation of the batch event based on its type
# getId()
?int
# getCreated()
?DateTime
Date the record was created.
# getCreatedBy()
?User
Get the user that triggered the event
# getBatch()
?Batch
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned

API & Jobs view

API & JobsEach property is a key in REST API responses and job payloads. Its name is the template getter without get, is or has. Methods that need arguments are not available here.

Properties 18

Read-only values on the record.

# type
string
Gets the type of the event causing the hook execution. Always returns 'shipping' for shipping method jobs.
# fulfillment
?Fulfillment
Gets the fulfillment the shipping method creates the rates for. During the run it is the fulfillment of the checkout being built, which is not saved yet. Later, e.g. in the batch log, it is loaded by id, and it is null when the fulfillment was never saved.
# checkout
?BaseOrder
Gets the checkout the rates are created for. Null in the batch log once the checkout became an order.
# method
?BaseMethod
Gets the shipping method whose job runs
# dataDisplay
string
Gets a string representation of the stage, the shipping method and the checkout for the batch table
# stage
?string
Gets the stage of the shipping method the job runs at: request before the method creates its rates, response after
# checkoutId
?int
Gets the id of the checkout the rates are created for
# checkoutUuid
?string
Gets the UUID of the checkout the rates are created for
# fulfillmentId
?int
Gets the id of the fulfillment the rates are created for. Null while the checkout is being built, as the fulfillment is not saved yet.
# methodId
?int
Gets the id of the shipping method whose job runs
# methodName
?string
Gets the name of the shipping method whose job runs
# requestData
array
Gets the request the method is about to send, which the Request Job may change. Empty for a method without a carrier request, e.g. the Template method, and in the response stage.
# rates
array
Gets the rate list the method offers, as plain entries with name, serviceLevel, courierName, amount, surcharge, estimatedDelivery and data, in the order the job refers to them by index. Empty in the request stage.
# typeDisplay
string
Get a string representation of the batch event based on its type
# id
?int
# created
?DateTime
Date the record was created.
# createdBy
?User
Get the user that triggered the event
# batch
?Batch

Admin view

AdminAvailable in cdna-admin templates. Copy an admin template into your site repository to change how this record is edited.

Properties 21

Take no arguments.

# getType()
string
Gets the type of the event causing the hook execution. Always returns 'shipping' for shipping method jobs.
# getFulfillment()
?Fulfillment
Gets the fulfillment the shipping method creates the rates for. During the run it is the fulfillment of the checkout being built, which is not saved yet. Later, e.g. in the batch log, it is loaded by id, and it is null when the fulfillment was never saved.
# getCheckout()
?BaseOrder
Gets the checkout the rates are created for. Null in the batch log once the checkout became an order.
# getMethod()
?BaseMethod
Gets the shipping method whose job runs
# getDataDisplay()
string
Gets a string representation of the stage, the shipping method and the checkout for the batch table
# getStage()
?string
Gets the stage of the shipping method the job runs at: request before the method creates its rates, response after
# getCheckoutId()
?int
Gets the id of the checkout the rates are created for
# getCheckoutUuid()
?string
Gets the UUID of the checkout the rates are created for
# getFulfillmentId()
?int
Gets the id of the fulfillment the rates are created for. Null while the checkout is being built, as the fulfillment is not saved yet.
# getMethodId()
?int
Gets the id of the shipping method whose job runs
# getMethodName()
?string
Gets the name of the shipping method whose job runs
# getRequestData()
array
Gets the request the method is about to send, which the Request Job may change. Empty for a method without a carrier request, e.g. the Template method, and in the response stage.
# getRates()
array
Gets the rate list the method offers, as plain entries with name, serviceLevel, courierName, amount, surcharge, estimatedDelivery and data, in the order the job refers to them by index. Empty in the request stage.
# getTypeDisplay()
string
Get a string representation of the batch event based on its type
# getId()
?int
# getCreated()
?DateTime
Date the record was created.
# getCreatedBy()
?User
Get the user that triggered the event
# getBatch()
?Batch
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned