OrderListGenerator

Implements \OrderListGeneratorInterface

Class OrderListGenerator

category

System

package

Order

Methods

OrderListGenerator Constructor

__construct(\CI_DB_query_builder $db, \PaymentTitleProvider $paymentTitleProvider, \ShippingTitleProvider $shippingTitleProvider) 

Arguments

$db

\CI_DB_query_builder

$paymentTitleProvider

\PaymentTitleProvider

$shippingTitleProvider

\ShippingTitleProvider

Returns a string for the ::_select() method which contains column names of the orders table for address data.

_addressColumns(string $type) : string
Throws
\BadMethodCallException

Arguments

$type

string

Whether delivery or billing.

Response

string

Creates and returns a string collection which contains the invoice numbers of the order

_createInvoiceNumberCollectionByOrderId( $orderId) : \StringCollection
Throws
\InvalidArgumentException

Arguments

$orderId

Id of current order

Response

\StringCollection

Creates and returns a customer memo collection by the given customers id.

_createMemoCollectionByCustomersId(integer $customersId) : \CustomerMemoCollection

Arguments

$customersId

integer

Id of customer.

Response

\CustomerMemoCollection

Creates an order address block object by the given type and row_array (looped result of CIDB::result_array())

_createOrderAddressBlockByRow(string $type, array $row) : \OrderAddressBlock
Throws
\BadMethodCallException

Arguments

$type

string

Whether delivery or billing.

$row

array

Array which contain data about an order result row.

Response

\OrderAddressBlock

Creates and returns an order payment type instance by the given row data.

_createOrderPaymentType(array $row) : \OrderPaymentType

Arguments

$row

array

Row array with data about the order payment type.

Response

\OrderPaymentType

Creates and returns an order shipping type instance by the given row data.

_createOrderShippingType(array $row) : \OrderShippingType

Arguments

$row

array

Row array with data about the order shipping type.

Response

\OrderShippingType

Creates and returns whether an order shipping or payment type instance by the given row data and type argument.

_createOrderType(string $type, array $row) : \OrderShippingType|\OrderPaymentType
Throws
\InvalidArgumentException

Arguments

$type

string

Whether 'shipping' or 'payment', used to determine the expected order type class.

$row

array

Row array with data about the order type.

Response

\OrderShippingType|\OrderPaymentType

Creates and returns a string collection which contains the tracking links of the order.

_createTrackingLinksByOrderId(integer $orderId) : \StringCollection
Throws
\InvalidArgumentException

Arguments

$orderId

integer

Id of current order.

Response

\StringCollection

Creates and returns a ID collection which contains the withdrawal ids of the order.

_createWithdrawalIdsByOrderId(integer $orderId) : \IdCollection
Throws
\InvalidArgumentException

Arguments

$orderId

integer

Id of current order.

Response

\IdCollection

Returns a string for the ::_select() method which contains fallback customer status name if no value is set in the orders table.

_customersStatusColumns() : string

Response

string

Filter the order records.

_filter(array $filterParameters, \IntType|null $startIndex = null, \IntType|null $maxCount = null, \StringType|null $orderBy = null) : \CI_DB_result

Arguments

$filterParameters

array

Contains the column slug-names and their values.

$startIndex

\IntType|null

The start index of the wanted array to be returned (default = null).

$maxCount

\IntType|null

Maximum amount of items which should be returned (default = null).

$orderBy

\StringType|null

A string which defines how the items should be ordered (default = null).

Response

\CI_DB_result

Returns the title of the given payment or shipping title.

_getPaymentOrShippingTitle(string $method, string $type) : string

Arguments

$method

string

Payment or shipping method.

$type

string

Whether "payment" or "shipping".

Response

string

Execute the group by statement.

_group() : \OrderListGenerator

Response

\OrderListGenerator

Returns the instance object for method chaining.

Returns a string for the ::_select() method which contains fallback implosion of all invoice IDs of the order if no value is set in the orders table.

_invoicesColumns() : string

Response

string

Add limit configuration to the database object.

_limit(\IntType $startIndex = null, \IntType $maxCount = null) : \OrderListGenerator

Arguments

$startIndex

\IntType

$maxCount

\IntType

Response

\OrderListGenerator

Returns the instance object for method chaining.

Set the order by clause of the query.

_order(\StringType $orderBy = null) : \OrderListGenerator

Arguments

$orderBy

\StringType

Response

\OrderListGenerator

Returns the instance object for method chaining.

Returns a string for the ::_select() method which contains column names of the orders table.

_ordersColumns() : string

Response

string

Returns a string for the ::_select() method which contains column names of the orders status table.

_ordersStatusColumns() : string

Response

string

Returns a string for the ::_select() method which contains column names of the orders total table.

_ordersTotalColumns() : string

Response

string

Prepare the OrderListItemCollection object.

_prepareCollection(array $result) : \OrderListItemCollection

This method will prepare the collection object which is going to be returned by both the "get" and "filter" methods. The following values are required to be present in each row of the $result parameter:

 - orders_id
 - customers_id
 - customers_firstname
 - customers_lastname
 - date_purchased
 - payment_class
 - payment_method
 - shipping_class
 - shipping_method
 - orders_status_id
 - orders_status_name
 - total_sum
Throws
\InvalidArgumentException

Arguments

$result

array

Contains the order data.

Response

\OrderListItemCollection

Execute the select and join methods.

_select() : \OrderListGenerator
Throws
\BadMethodCallException

Response

\OrderListGenerator

Returns the instance object for method chaining.

Set the where clauses for the filtered order records query.

_setFilterArguments(array $filterParameters, \IntType|null $startIndex = null, \IntType|null $maxCount = null, \StringType|null $orderBy = null) : \OrderListGeneratorInterface

This method contains the filtering logic. It can be overloaded in order to provide a custom filtering logic.

Throws
\BadMethodCallException

Arguments

$filterParameters

array

Contains the column slug-names and their values.

$startIndex

\IntType|null

The start index of the wanted array to be returned (default = null).

$maxCount

\IntType|null

Maximum amount of items which should be returned (default = null).

$orderBy

\StringType|null

A string which defines how the items should be ordered (default = null).

Response

\OrderListGeneratorInterface

Same instance for chained method calls.

_setKeywordWhereClause

_setKeywordWhereClause(\StringType $keyword) 

Arguments

$keyword

\StringType

Keyword string to be used for searching in order records.

Filter order list items by the provided parameters.

filterOrderList(array $filterParameters, \IntType|null $startIndex = null, \IntType|null $maxCount = null, \StringType|null $orderBy = null) : \OrderListItemCollection

The following slug names need to be used:

  • number => orders.orders_id
  • customer => orders.customers_lastname orders.customers_firstname
  • group => orders.customers_status_name
  • sum => orders_total.value
  • payment => orders.payment_method
  • shipping => orders.shipping_method
  • countryIsoCode => orders.delivery_country_iso_code_2
  • date => orders.date_purchased
  • status => orders_status.orders_status_name
  • totalWeight => orders.order_total_weight
Throws
\BadMethodCallException
\InvalidArgumentException

Arguments

$filterParameters

array

Contains the column slug-names and their values.

$startIndex

\IntType|null

The start index of the wanted array to be returned (default = null).

$maxCount

\IntType|null

Maximum amount of items which should be returned (default = null).

$orderBy

\StringType|null

A string which defines how the items should be ordered (default = null).

Response

\OrderListItemCollection

Get the filtered orders count.

filterOrderListCount(array $filterParameters) : integer

This number is useful for pagination functionality where the app needs to know the number of the filtered rows.

Throws
\BadMethodCallException

Arguments

$filterParameters

array

Response

integer

Get Order List Items

getOrderListByConditions(string|array $conditions = array(), \IntType $startIndex = null, \IntType $maxCount = null, \StringType $orderBy = null) : \OrderListItemCollection

Returns an order list item collection.

link

http://www.codeigniter.com/user_guide/database/query_builder.html#looking-for-specific-data

Throws
\InvalidArgumentException

If the result rows contain invalid values.

Arguments

$conditions

string|array

Provide a WHERE clause string or an associative array (actually any parameter that is acceptable by the "where" method of the CI_DB_query_builder method).

$startIndex

\IntType

The start index of the wanted array to be returned (default = null).

$maxCount

\IntType

Maximum amount of items which should be returned (default = null).

$orderBy

\StringType

A string which defines how the items should be ordered (default = null).

Response

\OrderListItemCollection

Filter records by a single keyword string.

getOrderListByKeyword(\StringType $keyword, \IntType|null $startIndex = null, \IntType|null $maxCount = null, \StringType|null $orderBy = null) : mixed
Throws
\InvalidArgumentException

If the result rows contain invalid values.

Arguments

$keyword

\StringType

Keyword string to be used for searching in order records.

$startIndex

\IntType|null

The start index of the wanted array to be returned (default = null).

$maxCount

\IntType|null

Maximum amount of items which should be returned (default = null).

$orderBy

\StringType|null

A string which defines how the items should be ordered (default = null).

Response

mixed

Get count of orders filtered by keyword

getOrderListByKeywordCount(\StringType $keyword) : integer

Arguments

$keyword

\StringType

Keyword string to be used for searching in order records.

Response

integer

Get the total count of all orders

getOrderListCount() : integer

Response

integer

Constants

FILTER_NO_VALUE

FILTER_NO_VALUE
var

Properties

db

db : \CI_DB_query_builder
var

Type(s)

\CI_DB_query_builder

defaultLanguageId

defaultLanguageId : integer
var

Type(s)

integer

paymentTitleProvider

paymentTitleProvider : \PaymentTitleProvider
var

Type(s)

\PaymentTitleProvider

shippingTitleProvider

shippingTitleProvider : \ShippingTitleProvider