Package DE_EPAGES::Order::API::Order
This package provides the main customer order functions.
@EXPORT_OK |
Functions
- Basket2Order
- CreateOrder
- CreateOrderWithContainer
- CreateOrderWithoutContainer
- GenerateOrderDocumentPDF
- GetEditableOrder
- GetLabelImagePath
- 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 |
|
Return |
|
Hook |
|
CreateOrder
Creates an empty order which will belong to the given customer. Addresses are copied and an empty lineitemcontainer is added. Sets the default shipping and payment method.
Syntax |
$Order = CreateOrder($Customer, $hVars); |
Input |
|
Return |
|
CreateOrderWithContainer
Creates an empty order for a customer without shipping and payment methods and without billing/shipping address. Creates a lineitem container and sets the shop address.
Syntax |
$Order = CreateOrderWithContainer( $Customer, $hValues ); |
Example |
Transaction( sub { $Order = CreateOrderWithContainer( $Customer, { 'Alias' => '1001' } ); $Order->set({ 'BillingAddress' => $Customer->get('BillingAddress')->clone({ 'Parent' => $Order, 'Alias' => 'BillingAddress' }), }); }); |
Input |
|
Return |
|
CreateOrderWithoutContainer
Creates an empty order which for a customer without line item container and without shop address.
Syntax |
$Order = CreateOrderWithoutContainer( $Customer, $hValues ); |
Example |
Transaction( sub { $Order = CreateOrderWithoutContainer( $Customer, { 'Alias' => '1001' } ); $Order->addLineItemContainer; $Order->set({ 'BillingAddress' => $Customer->get('BillingAddress')->clone({ 'Parent' => $Order, 'Alias' => 'BillingAddress' }), 'ShopAddress' => $Shop->get('Address')->clone({ 'Parent'=>$Order, 'Alias'=> 'ShopAddress' }), }); }); |
Input |
|
Return |
|
GenerateOrderDocumentPDF
Converts order document (invoice, packing slip, credit note or shipping label) to pdf document.
Syntax |
$hPdfContent = GenerateOrderDocumentPDF($Invoice); |
Input |
|
Return |
|
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 |
|
Return |
|
GetLabelImagePath
Sets and returns the path for the barcode image of a shipping label. Used by USPS when issueing (triggering) a shipping label (to store the recieved pdf) and when sending it by email (from the MBO order documents page). It could also be used by SEUR (since it has its own but exaclty the same function) and other delivery cartridges...
Syntax |
$Path = GetLabelImagePath($ShippingLabel, $FileExtension); |
Example |
my $Path = GetLabelImagePath($ShippingLabel, 'pdf'); |
Input |
|
Return |
|
GetLatestOrderInvoice
Returns the latest invoice document of an order
Syntax |
GetLatestOrderInvoice($Order); |
Input |
|
Return |
|
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 |
|
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. The OrderDocument must be Invoice, PackingSlip, CreditNote, or ShippingLabel.
Syntax |
SendOrderDocumentAsPDFMail($OrderDocument, $Servlet); |
Input |
|
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 |
|
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 |
|