ePages 6.11.0 - DE_EPAGES/Order/API/Order.pm

Package DE_EPAGES::Order::API::Order

This package provides the main customer order functions.

@EXPORT_OK
Basket2Order
SendOrderConfirmationMail
SendStatusChangeMail
SendStatusChangeMails
GetEditableOrder
CreateOrder
SendOrderDocumentAsPDFMail
GetLatestOrderInvoice
GenerateOrderDocumentPDF

Functions

Basket2Order
CreateOrder
GenerateOrderDocumentPDF
GetEditableOrder
GetLatestOrderInvoice
SendOrderConfirmationMail
SendOrderDocumentAsPDFMail
SendStatusChangeMail
SendStatusChangeMails

Basket2Order

Creates a customer order by a basket and deletes the basket at the end. Addresses will be copied and lineitemcontainer will be moved to new order.

Syntax
$Order = Basket2Order($Basket);
$Order = Basket2Order($Basket, $hOptions);
Example
$Order = Basket2Order($Basket, { SendConfirmationMail => 1 });
Input
$Basket (object)
basket
$hOptions (ref.hash)
(optional) order creation options.
This hash is passed to the hooks triggerd by this function.
  • SendConfirmationMail - trigger mail event 'CustomerOrderConfirmation',
    which sends order confirmation e-mail
    (optional, default=1) - boolean
Return
$Order (object)
new customer order
Hook
API_Basket2Order
triggered in basket to order transaction, hook parameter keys :
  • Basket - basket - object
  • Order - customer order - object
  • Options - order creation options - ref.hash
API_OrderCreated
triggered after order creation, hook parameter keys :
  • Order - customer order - object
  • Options - order creation options - ref.hash

CreateOrder

Creates an empty order which will belong to the given customer. Addresses are copied and an empty lineitemcontainer is added.

Syntax
$Order = CreateOrder($Customer, $hVars);
Input
$Customer (object)
customer
$hVars (ref.hash (optional))
  • CurrencyID - alpha currency code (ISO 4217) - char(3)
  • TaxModel - gross or net price - int
Return
$Order (object)
new customer order

GenerateOrderDocumentPDF

Converts order document (invoice, packing slip or credit note) to pdf document

Syntax
$hFileInfos = GenerateOrderDocumentPDF($Invoice);
Input
$OrderDocument (object)
OrderDocument (invoice, packing slip or credit note)
Return
$hPdfContent (ref.hash)
  • pdf - pdf document - binary
  • filename - name of pdf file - string

GetEditableOrder

Returns the editable order (copy and possible changed copy of order). If no editable order exists this function returns undef.

Syntax
$EditableOrder = GetEditableOrder($Order);
Input
$Order (object)
customer order
Return
$EditableOrder (string)
copy of order (optional)

GetLatestOrderInvoice

Returns the latest invoice document of an order

Syntax
GetLatestOrderInvoice($Order);
Input
$Order (object)
Order
Return
$Invoice (object)
invoice

SendOrderConfirmationMail

Send a confirmation mail to customer (Order.BillingAddress.EMail is used). The activated shop mail type 'CustomerOrderConfirmation' is used to define the content of the mail.

Syntax
SendOrderConfirmationMail($Order);
Input
$Order (object)
customer order

SendOrderDocumentAsPDFMail

Send an order document as pdf file mail to customer (Order.BillingAddress.EMail is used). The activated shop mail type 'OrderDocumentPDF' is used to define the content of the mail.

Syntax
SendOrderDocumentAsPDFMail($OrderDocument);
Input
$OrderDocument (object)
order document
$Servlet (object)
the servlet

SendStatusChangeMail

Send a status changed mail to customer (Order.BillingAddress.EMail is used). The activated shop mail type 'CustomerOrderStatus$Event' is used to define the content of the mail. This mail will not be send on event 'ArchivedOn'.

Syntax
SendStatusChangeMail($Order, $Event);
Input
$Order (object)
customer order
$Event (string)
name of order status

SendStatusChangeMails

Sends order status notification e-mails to the customer if a status was set (from null to not null). The e-mail address Order.BillingAddress.EMail is used. See also SendStatusChangeMail.

Syntax
SendStatusChangeMails($Order, $hOldStatus, $hNewStatus);
Input
$Order (object)
customer order
$hOldStatus (ref.hash.)
pevious status change dates
$hStatus (ref.hash)
new status change dates (name => DateTime).
This hash may contain other attribute values, but only the status
attributes defined in DE_EPAGES::Order::API::Constants
will be used.