\OrderCore

Summary

Methods
Properties
Constants
__construct()
getFields()
add()
getTaxCalculationMethod()
deleteProduct()
getCartProducts()
deleteCustomization()
getHistory()
getProductsDetail()
getFirstMessage()
setProductPrices()
getProducts()
getIdOrderProduct()
getTaxesAverageUsed()
getVirtualProducts()
isVirtual()
getDiscounts()
getCartRules()
getDiscountsCustomer()
getCurrentState()
getCurrentStateFull()
hasBeenDelivered()
hasProductReturned()
hasBeenPaid()
hasBeenShipped()
isInPreparation()
isPaidAndShipped()
getCustomerOrders()
getOrdersIdByDate()
getOrdersWithInformations()
getOrdersIdInvoiceByDate()
getOrderIdsByStatus()
getTotalProductsWithoutTaxes()
getTotalProductsWithTaxes()
getCustomer()
getCustomerNbOrders()
getOrderByCartId()
addDiscount()
addCartRule()
getNumberOfDays()
isReturnable()
getLastInvoiceNumber()
setLastInvoiceNumber()
getInvoiceNumber()
setInvoice()
setDeliverySlip()
setDeliveryNumber()
getDeliveryNumber()
setDelivery()
getByDelivery()
getByReference()
getTotalWeight()
getInvoice()
isAssociatedAtGuest()
getCartIdStatic()
getWsOrderRows()
setCurrentState()
addWs()
deleteAssociations()
getPreviousOrderId()
getNextOrderId()
getOrderDetailList()
generateReference()
orderContainProduct()
useOneAfterAnotherTaxComputationMethod()
getOrderPaymentCollection()
addOrderPayment()
getDocuments()
getReturn()
getShipping()
getOrderSlipsCollection()
getInvoicesCollection()
getDeliverySlipsCollection()
getNotPaidInvoicesCollection()
getTotalPaid()
getOrdersTotalPaid()
updateShippingCost()
getProductTaxesBreakdown()
getShippingTaxesBreakdown()
getWrappingTaxesBreakdown()
getEcoTaxTaxesBreakdown()
hasInvoice()
hasDelivery()
getWarehouseList()
getCurrentOrderState()
getWebserviceObjectList()
getBrother()
getOrderPayments()
getUniqReference()
getUniqReferenceOf()
getIdOrderCarrier()
sortDocuments()
getWsShippingNumber()
setWsShippingNumber()
getWsCurrentState()
setWsCurrentState()
$id_address_delivery
$id_address_invoice
$id_shop_group
$id_shop
$id_cart
$id_currency
$id_lang
$id_customer
$id_carrier
$current_state
$secure_key
$payment
$module
$conversion_rate
$recyclable
$gift
$gift_message
$mobile_theme
$shipping_number
$total_discounts
$total_discounts_tax_incl
$total_discounts_tax_excl
$total_paid
$total_paid_tax_incl
$total_paid_tax_excl
$total_paid_real
$total_products
$total_products_wt
$total_shipping
$total_shipping_tax_incl
$total_shipping_tax_excl
$carrier_tax_rate
$total_wrapping
$total_wrapping_tax_incl
$total_wrapping_tax_excl
$invoice_number
$delivery_number
$invoice_date
$delivery_date
$valid
$date_add
$date_upd
$reference
$round_mode
$definition
ROUND_ITEM
ROUND_LINE
ROUND_TOTAL
_deleteProduct()
setProductCustomizedDatas()
setProductCurrentStock()
setProductImageInformations()
$webserviceParameters
$_taxCalculationMethod
$_historyCache
$cacheCustomer
N/A
No private methods found
No private properties found
N/A

Constants

ROUND_ITEM

ROUND_ITEM

ROUND_LINE

ROUND_LINE

ROUND_TOTAL

ROUND_TOTAL

Properties

$id_address_delivery

$id_address_delivery : integer

Type

integer — Delivery address id

$id_address_invoice

$id_address_invoice : integer

Type

integer — Invoice address id

$id_shop_group

$id_shop_group : 

Type

$id_shop

$id_shop : 

Type

$id_cart

$id_cart : integer

Type

integer — Cart id

$id_currency

$id_currency : integer

Type

integer — Currency id

$id_lang

$id_lang : integer

Type

integer — Language id

$id_customer

$id_customer : integer

Type

integer — Customer id

$id_carrier

$id_carrier : integer

Type

integer — Carrier id

$current_state

$current_state : integer

Type

integer — Order Status id

$secure_key

$secure_key : string

Type

string — Secure key

$payment

$payment : string

Type

string — Payment method

$module

$module : string

Type

string — Payment module

$conversion_rate

$conversion_rate : float

Type

float — Currency exchange rate

$recyclable

$recyclable : boolean

Type

boolean — Customer is ok for a recyclable package

$gift

$gift : boolean

Type

boolean — True if the customer wants a gift wrapping

$gift_message

$gift_message : string

Type

string — Gift message if specified

$mobile_theme

$mobile_theme : boolean

Type

boolean — Mobile Theme

$shipping_number

$shipping_number : string

Type

string — Shipping number

$total_discounts

$total_discounts : float

Type

float — Discounts total

$total_discounts_tax_incl

$total_discounts_tax_incl : 

Type

$total_discounts_tax_excl

$total_discounts_tax_excl : 

Type

$total_paid

$total_paid : float

Type

float — Total to pay

$total_paid_tax_incl

$total_paid_tax_incl : float

Type

float — Total to pay tax included

$total_paid_tax_excl

$total_paid_tax_excl : float

Type

float — Total to pay tax excluded

$total_paid_real

$total_paid_real : float

Type

float — Total really paid @deprecated 1.5.0.1

$total_products

$total_products : float

Type

float — Products total

$total_products_wt

$total_products_wt : float

Type

float — Products total tax included

$total_shipping

$total_shipping : float

Type

float — Shipping total

$total_shipping_tax_incl

$total_shipping_tax_incl : float

Type

float — Shipping total tax included

$total_shipping_tax_excl

$total_shipping_tax_excl : float

Type

float — Shipping total tax excluded

$carrier_tax_rate

$carrier_tax_rate : float

Type

float — Shipping tax rate

$total_wrapping

$total_wrapping : float

Type

float — Wrapping total

$total_wrapping_tax_incl

$total_wrapping_tax_incl : float

Type

float — Wrapping total tax included

$total_wrapping_tax_excl

$total_wrapping_tax_excl : float

Type

float — Wrapping total tax excluded

$invoice_number

$invoice_number : integer

Type

integer — Invoice number

$delivery_number

$delivery_number : integer

Type

integer — Delivery number

$invoice_date

$invoice_date : string

Type

string — Invoice creation date

$delivery_date

$delivery_date : string

Type

string — Delivery creation date

$valid

$valid : boolean

Type

boolean — Order validity: current order status is logable (usually paid and not canceled)

$date_add

$date_add : string

Type

string — Object creation date

$date_upd

$date_upd : string

Type

string — Object last modification date

$reference

$reference : string

Type

string — Order reference, this reference is not unique, but unique for a payment

$round_mode

$round_mode : integer

Type

integer — Round mode method used for this order

$definition

$definition : 

Type

$webserviceParameters

$webserviceParameters : 

Type

$_taxCalculationMethod

$_taxCalculationMethod : 

Type

$_historyCache

$_historyCache : 

Type

$cacheCustomer

$cacheCustomer : 

used to cache order customer

Type

Methods

__construct()

__construct(  $id = null,   $id_lang = null) 

Parameters

$id
$id_lang

getFields()

getFields() : array

Returns

array

add()

add(  $autodate = true,   $null_values = true) 

Parameters

$autodate
$null_values

getTaxCalculationMethod()

getTaxCalculationMethod() 

deleteProduct()

deleteProduct(  $order,   $orderDetail,   $quantity) 

Parameters

$order
$orderDetail
$quantity

getCartProducts()

getCartProducts() : array

This function return products of the orders It's similar to Order::getProducts but with similar outputs of Cart::getProducts

Returns

array

deleteCustomization()

deleteCustomization(  $id_customization,   $quantity,   $orderDetail) 

Parameters

$id_customization
$quantity
$orderDetail

getHistory()

getHistory(integer  $id_lang, integer  $id_order_state = false, integer  $no_hidden = false, integer  $filters) : array

Get order history

Parameters

integer $id_lang

Language id

integer $id_order_state

Filter a specific order status

integer $no_hidden

Filter no hidden status

integer $filters

Flag to use specific field filter

Returns

array —

History entries ordered by date DESC

getProductsDetail()

getProductsDetail() 

getFirstMessage()

getFirstMessage() 

setProductPrices()

setProductPrices(  $row) 

Marked as deprecated but should not throw any "deprecated" message This function is used in order to keep front office backward compatibility 14 -> 1.5 (Order History)

Parameters

$row

getProducts()

getProducts(  $products = false,   $selectedProducts = false,   $selectedQty = false) : array

Get order products

Parameters

$products
$selectedProducts
$selectedQty

Returns

array —

Products with price, quantity (with taxe and without)

getIdOrderProduct()

getIdOrderProduct(  $id_customer,   $id_product) 

Parameters

$id_customer
$id_product

getTaxesAverageUsed()

getTaxesAverageUsed() 

getVirtualProducts()

getVirtualProducts() : integer

Count virtual products in order

Returns

integer —

number of virtual products

isVirtual()

isVirtual(boolean  $strict = true) : boolean

Check if order contains (only) virtual products

Parameters

boolean $strict

If false return true if there are at least one product virtual

Returns

boolean —

true if is a virtual order or false

getDiscounts()

getDiscounts(  $details = false) 

Parameters

$details

getCartRules()

getCartRules() 

getDiscountsCustomer()

getDiscountsCustomer(  $id_customer,   $id_cart_rule) 

Parameters

$id_customer
$id_cart_rule

getCurrentState()

getCurrentState() : integer

Get current order status (eg. Awaiting payment, Delivered.

..)

Returns

integer —

Order status id

getCurrentStateFull()

getCurrentStateFull(  $id_lang) : array

Get current order status name (eg. Awaiting payment, Delivered.

..)

Parameters

$id_lang

Returns

array —

Order status details

hasBeenDelivered()

hasBeenDelivered() 

hasProductReturned()

hasProductReturned() 

Has products returned by the merchant or by the customer?

hasBeenPaid()

hasBeenPaid() 

hasBeenShipped()

hasBeenShipped() 

isInPreparation()

isInPreparation() 

isPaidAndShipped()

isPaidAndShipped() : boolean

Checks if the current order status is paid and shipped

Returns

boolean

getCustomerOrders()

getCustomerOrders(integer  $id_customer, boolean  $showHiddenStatus = false, \Context  $context = null) : array

Get customer orders

Parameters

integer $id_customer

Customer id

boolean $showHiddenStatus

Display or not hidden order statuses

\Context $context

Returns

array —

Customer orders

getOrdersIdByDate()

getOrdersIdByDate(  $date_from,   $date_to,   $id_customer = null,   $type = null) 

Parameters

$date_from
$date_to
$id_customer
$type

getOrdersWithInformations()

getOrdersWithInformations(  $limit = null, \Context  $context = null) 

Parameters

$limit
\Context $context

getOrdersIdInvoiceByDate()

getOrdersIdInvoiceByDate(  $date_from,   $date_to,   $id_customer = null,   $type = null) : array

Parameters

$date_from
$date_to
$id_customer
$type

Returns

array

getOrderIdsByStatus()

getOrderIdsByStatus(  $id_order_state) : array

Parameters

$id_order_state

Returns

array

getTotalProductsWithoutTaxes()

getTotalProductsWithoutTaxes(  $products = false) : \Product

Get product total without taxes

Parameters

$products

Returns

\Product —

total without taxes

getTotalProductsWithTaxes()

getTotalProductsWithTaxes(  $products = false) : \Product

Get product total with taxes

Parameters

$products

Returns

\Product —

total with taxes

getCustomer()

getCustomer() : \Customer

Get order customer

Returns

\Customer —

$customer

getCustomerNbOrders()

getCustomerNbOrders(integer  $id_customer) : array

Get customer orders number

Parameters

integer $id_customer

Customer id

Returns

array —

Customer orders number

getOrderByCartId()

getOrderByCartId(integer  $id_cart) : array

Get an order by its cart id

Parameters

integer $id_cart

Cart id

Returns

array —

Order details

addDiscount()

addDiscount(integer  $id_cart_rule, string  $name, float  $value) : boolean

Parameters

integer $id_cart_rule
string $name
float $value

Returns

boolean

addCartRule()

addCartRule(integer  $id_cart_rule, string  $name, array  $values, integer  $id_order_invoice,   $free_shipping = null) : boolean

Parameters

integer $id_cart_rule
string $name
array $values
integer $id_order_invoice
$free_shipping

Returns

boolean

getNumberOfDays()

getNumberOfDays() 

isReturnable()

isReturnable() : boolean

Can this order be returned by the client?

Returns

boolean

getLastInvoiceNumber()

getLastInvoiceNumber() 

setLastInvoiceNumber()

setLastInvoiceNumber(  $order_invoice_id,   $id_shop) 

Parameters

$order_invoice_id
$id_shop

getInvoiceNumber()

getInvoiceNumber(  $order_invoice_id) 

Parameters

$order_invoice_id

setInvoice()

setInvoice(  $use_existing_payment = false) 

This method allows to generate first invoice of the current order

Parameters

$use_existing_payment

setDeliverySlip()

setDeliverySlip() 

This method allows to generate first delivery slip of the current order

setDeliveryNumber()

setDeliveryNumber(  $order_invoice_id,   $id_shop) 

Parameters

$order_invoice_id
$id_shop

getDeliveryNumber()

getDeliveryNumber(  $order_invoice_id) 

Parameters

$order_invoice_id

setDelivery()

setDelivery() 

getByDelivery()

getByDelivery(  $id_delivery) 

Parameters

$id_delivery

getByReference()

getByReference(string  $reference) : \PrestaShopCollection

Get a collection of orders using reference

Parameters

string $reference

Returns

\PrestaShopCollection —

Collection of Order

getTotalWeight()

getTotalWeight() 

getInvoice()

getInvoice(integer  $id_invoice) 

Parameters

integer $id_invoice

isAssociatedAtGuest()

isAssociatedAtGuest(  $email) 

Parameters

$email

getCartIdStatic()

getCartIdStatic(integer  $id_order, integer  $id_customer) : integer

Parameters

integer $id_order
integer $id_customer

optionnal

Returns

integer —

id_cart

getWsOrderRows()

getWsOrderRows() 

setCurrentState()

setCurrentState(integer  $id_order_state, integer  $id_employee) 

Set current order status

Parameters

integer $id_order_state
integer $id_employee

(/!\ not optional except for Webservice.

addWs()

addWs(  $autodate = true,   $nullValues = false) 

Parameters

$autodate
$nullValues

deleteAssociations()

deleteAssociations() 

getPreviousOrderId()

getPreviousOrderId() : integer

This method return the ID of the previous order

Returns

integer

getNextOrderId()

getNextOrderId() : integer

This method return the ID of the next order

Returns

integer

getOrderDetailList()

getOrderDetailList() : array

Get the an order detail list of the current order

Returns

array

generateReference()

generateReference() : String

Gennerate a unique reference for orders generated with the same cart id This references, is usefull for check payment

Returns

String

orderContainProduct()

orderContainProduct(  $id_product) 

Parameters

$id_product

useOneAfterAnotherTaxComputationMethod()

useOneAfterAnotherTaxComputationMethod() : boolean

This method returns true if at least one order details uses the One After Another tax computation method.

Returns

boolean

getOrderPaymentCollection()

getOrderPaymentCollection() : \PrestaShopCollection

This method allows to get all Order Payment for the current order

Returns

\PrestaShopCollection —

Collection of OrderPayment

addOrderPayment()

addOrderPayment(float  $amount_paid, string  $payment_method = null, string  $payment_transaction_id = null, \Currency  $currency = null, string  $date = null, \OrderInvoice  $order_invoice = null) : boolean

This method allows to add a payment to the current order

Parameters

float $amount_paid
string $payment_method
string $payment_transaction_id
\Currency $currency
string $date
\OrderInvoice $order_invoice

Returns

boolean

getDocuments()

getDocuments() : array

Returns the correct product taxes breakdown.

Get all documents linked to the current order

Returns

array

getReturn()

getReturn() 

getShipping()

getShipping() : array

Returns

array —

return all shipping method for the current order state_name sql var is now deprecated - use order_state_name for the state name and carrier_name for the carrier_name

getOrderSlipsCollection()

getOrderSlipsCollection() : \PrestaShopCollection

Get all order_slips for the current order

Returns

\PrestaShopCollection —

Collection of OrderSlip

getInvoicesCollection()

getInvoicesCollection() : \PrestaShopCollection

Get all invoices for the current order

Returns

\PrestaShopCollection —

Collection of OrderInvoice

getDeliverySlipsCollection()

getDeliverySlipsCollection() : \PrestaShopCollection

Get all delivery slips for the current order

Returns

\PrestaShopCollection —

Collection of OrderInvoice

getNotPaidInvoicesCollection()

getNotPaidInvoicesCollection() : \PrestaShopCollection

Get all not paid invoices for the current order

Returns

\PrestaShopCollection —

Collection of Order invoice not paid

getTotalPaid()

getTotalPaid(\Currency  $currency = null) : float

Get total paid

Parameters

\Currency $currency

currency used for the total paid of the current order

Returns

float —

amount in the $currency

getOrdersTotalPaid()

getOrdersTotalPaid() : float

Get the sum of total_paid_tax_incl of the orders with similar reference

Returns

float

updateShippingCost()

updateShippingCost(float  $amount) : boolean

This method allows to change the shipping cost of the current order

Parameters

float $amount

Returns

boolean

getProductTaxesBreakdown()

getProductTaxesBreakdown() : array

Returns the correct product taxes breakdown.

Returns

array

getShippingTaxesBreakdown()

getShippingTaxesBreakdown() : array

Returns the shipping taxes breakdown

Returns

array

getWrappingTaxesBreakdown()

getWrappingTaxesBreakdown() : array

Returns the wrapping taxes breakdown

Returns

array

getEcoTaxTaxesBreakdown()

getEcoTaxTaxesBreakdown() : array

Returns the ecotax taxes breakdown

Returns

array

hasInvoice()

hasInvoice() : boolean

Has invoice return true if this order has already an invoice

Returns

boolean

hasDelivery()

hasDelivery() : boolean

Has Delivery return true if this order has already a delivery slip

Returns

boolean

getWarehouseList()

getWarehouseList() 

Get warehouse associated to the order

return array List of warehouse

getCurrentOrderState()

getCurrentOrderState() : \OrderState

Returns

\OrderState —

or null if Order haven't a state

getWebserviceObjectList()

getWebserviceObjectList(  $sql_join,   $sql_filter,   $sql_sort,   $sql_limit) 

Parameters

$sql_join
$sql_filter
$sql_sort
$sql_limit

getBrother()

getBrother() 

Get all other orders with the same reference

getOrderPayments()

getOrderPayments() 

Get a collection of order payments

getUniqReference()

getUniqReference() 

Return a unique reference like : GWJTHMZUN#2

With multishipping, order reference are the same for all orders made with the same cart in this case this method suffix the order reference by a # and the order number

getUniqReferenceOf()

getUniqReferenceOf(  $id_order) 

Return a unique reference like : GWJTHMZUN#2

With multishipping, order reference are the same for all orders made with the same cart in this case this method suffix the order reference by a # and the order number

Parameters

$id_order

getIdOrderCarrier()

getIdOrderCarrier() 

Return id of carrier

Get id of the carrier used in order

sortDocuments()

sortDocuments(  $a,   $b) 

Parameters

$a
$b

getWsShippingNumber()

getWsShippingNumber() 

setWsShippingNumber()

setWsShippingNumber(  $shipping_number) 

Parameters

$shipping_number

getWsCurrentState()

getWsCurrentState(  $state) 

Parameters

$state

setWsCurrentState()

setWsCurrentState(  $state) 

Parameters

$state

_deleteProduct()

_deleteProduct(  $orderDetail,   $quantity) 

Parameters

$orderDetail
$quantity

setProductCustomizedDatas()

setProductCustomizedDatas(  $product,   $customized_datas) 

Parameters

$product
$customized_datas

setProductCurrentStock()

setProductCurrentStock(  $product) 

This method allow to add stock information on a product detail

If advanced stock management is active, get physical stock of this product in the warehouse associated to the ptoduct for the current order Else get the available quantity of the product in fucntion of the shop associated to the order

Parameters

$product

setProductImageInformations()

setProductImageInformations(  $product) 

This method allow to add image information on a product detail

Parameters

$product