class OrderEventContainer

Class OrderEventContainer is injected as alligator.order.event.container. This container is connecting Order manager to other services

Methods

__construct(ContainerInterface $container)

OrderEventContainer constructor.

User|null
getLoggedUser()

Retrieve logged user. NULL if no user is logged in

bool
checkProductAddToCartPermission(array|string $productPermissions)

Check if user have permission to add to cart

Router
getRouter()

Retrieve router

array
getAllUsers()

Finds all users in the database.

array
findAllUserForCoupon()

Finds all users as a ARRAY

array
getMailFromDb(int $id)

Find email for user that match provided id

Address|null
findAddressForOrder(Order $order)

Find address for order

Promotion|null
savePromotion(Promotion $promotion)

Persist new promotion

User|null
findUserForCoupon(int $id)

Find user for provided id

mixed|null|object
findUserBy(array $array)

Find user for provided criteria

array
getAllUsersInArray(array $arrayOfUsers)

Find all users that match provided ids

Coupon|null
checkCoupon(string $code, User|null $user = null)

Check if coupon is valid for provided user(if provided user is NULL, check if coupon is valid for logged user)

mixed
setCouponPKToSession(Coupon $coupon)

Set coupon to session

int|null
getCouponPKFromSession()

Retrieve coupon from session

removeCouponFromSession()

Remove coupon from session

Coupon|null
getCouponById(int $couponId)

Find coupon for provided id

mixed
updateCoupon(Coupon $coupon)

Update coupon

Coupon|null
useCoupon(Coupon $coupon)

Increment coupon usage and set used to TRUE if number of uses reached usage limit

Tax|null
saveTax(Tax $tax)

Persist new tax

Tax
getCurrentTax()

Retrieve current tax

sendEditedStateOrderMail(Order $order, string $state = 'edit', array $additionalMails = array(), array|null $cardOrderInfo = null)

Send mail when order state is change

mixed
getSearchParam()

Retrieve search parameters from request

commentMerge(Order $order)

Add checkout comment to order

sendMails(string $template, string $from, array $to, array $context = array(), mixed $attachment = null, string $theme = null, mixed $entity = null)

Send mail with provided parameters

mixed
getAddressFromDB(mixed $id)

Find address by id

array
getAllShippingWithSelect()

Find all shipping providers

array
getAllGroupProductsForOrder(int $orderId)

Find all group products in order

getProductAttributeValuesRepository()

Retrieve product attribute values repository

getProductManager()

Retrieve product manager

getProductDB(Product $product)

Find product by id or slug

getCurrentUserSettings()

Retrieve current user settings

array
getAllStoresForPickUp()

Get all Stores from database

bool
activateCoupon(Order $order)

Active coupon that is cached in session

object|IdentityTranslator
getTranslator()

Retrieve translator

string|null
getCurrentTheme()

Retrieve current front theme name

createNewUser(User $user)

Persist user

ShippingProvider|Proxy|object|null
getShippingReference(int $id)

Retrieve reference for shipping provider

string
generateNextRoute(string $routeName)

Generate route for provided route name

mixed
doOrderItemsSearch(int $page, int $offset, int $productId, int $userId, int $reservationWarranty, int $maxQuantityPerOrderItem, array $searchParams, bool $count = false)

Find all orders that match provided criteria

dispatchAfterAddToCartLogicEvent(Order $order, OrderItem|null $orderItem = null, string|null $action = null, bool $isOrderMerging = false)

Dispatch event after add to cart

dispatchBuyXGetYOfferEvent(Order|null $order, OrderItem|null $orderItem, string|null $action, string|null $eventName = BuyXGetYProductEvent::PRODUCT_BUY_X_GET_Y_CHECK_ACTION_EVENT, boolean $hasItem = true, int|null $oldQty = null)

Dispatch event to deal with buy x get y logic(if buy X get Y plugin is activated)

dispatchAfterAddToCartSpecialOfferEvent(Order $order)

Dispatch event to deal with special offer logic(if special offer plugin is activated)

Event
dispatchEvent(string $name, Event $event)

Dispatch provided event

float|int
getCurrencyRatio(string $current)

Get relative ratio between default and provided currency

mixed
getCashCheckoutSettings()

Retrieve cached checkout settings

array
getUsersByStringParam(int $page = 1, int $offset = 10, string|null $params = null)

Find all users with pagination

array
getUserInfoForOrder(int $id)

Find user by id

User|Proxy|null
getUserByPk(int $id)

Retrieve reference for user that match provided id

string|null
getPaymentTypeByPk(int $id)

Find payment type by id

array
getAllPaymentTypes()

Find all payment types

array
dispatchOneStepCheckoutChanges(mixed $data, Order $order)

Dispatch event to apply gift card

mixed
dispatchBeforeOneStepCheckoutEvent(Order $order, mixed $data)

Dispatch event before any one step checkout logic

null|SessionInterface
getSession()

Retrieve current session from request

forceInitialization()

Force caching shop parameters

array
getAllEmailsForArrayOfIds(array|null $ids = null)

Find all users that match provided ids(if ids are NULL, retrieve all users)

mixed
getOrderMergeType()

Retrieve current order merge type

getProductSettings()

Retrieve current product settings

null|Request
getCurrentRequest()

Retrieve current request

dispatchProductQuantityUnavailable(Order $order, OrderItem $orderItem, bool $removed = false)

Dispatch event

array
getPaymentTypeLimits()

Retrieve limits for payments(if payment is disabled for role)

dispatchProductAddToCartPermissionCheck(array|string $productPermissions)

Dispatch event to check if product can be added to cart

findUnitOfMeasurePricingRules()

Retrieve single unit of measure pricing rule(if it exist)

getPaymentTypeByName(string $paymentType)

Find payment type by name

string
getRouteForPayment(string $payment)

If payment type is card payment, and have custom page for paying, redirect buyer to that page

float|int
convertMoney(float $price, string $from, string $to)

Convert price from one currency to other

mixed|null
getDefaultPricelist()

Retrieve default pricelist for shop

float|int
getTotalGroupDiscount(int $productId, int $quantity)

Get total group discount, as array, containing percent and fixed discount

float
getTotalPricelistDiscount(array $productPricelistItemsArray, int $quantity)

Get total pricelist discount, represented as percent

string
getMultipleGroupsDiscountType()

Retrieve multiple group discount type

string
getCalculatePricelistGroupDiscounts()

Retrieve calculated pricelist group discounts

string|null
getUserPriceListCurrency()

Retrieve pricelist for user. NULL otherwise

float
convertOrderToPricelistCurrency(float $value, string $to)

Convert price from default currency to currency in order

mixed
dispatchCustomOneStepCheckoutRedirectEvent()

Dispatch event after saving order on one step checkout

object|Session
getCurrentSession()

Retrieve current session

bool
isAllowedToSeeOrderDetailsPage(int $id)

No description

Details

at line 52
__construct(ContainerInterface $container)

OrderEventContainer constructor.

Parameters

ContainerInterface $container

at line 62
User|null getLoggedUser()

Retrieve logged user. NULL if no user is logged in

Return Value

User|null

at line 79
bool checkProductAddToCartPermission(array|string $productPermissions)

Check if user have permission to add to cart

Parameters

array|string $productPermissions

Return Value

bool

at line 89
Router getRouter()

Retrieve router

Return Value

Router

at line 99
array getAllUsers()

Finds all users in the database.

Return Value

array

at line 109
array findAllUserForCoupon()

Finds all users as a ARRAY

Return Value

array

at line 121
array getMailFromDb(int $id)

Find email for user that match provided id

Parameters

int $id

Return Value

array

at line 133
Address|null findAddressForOrder(Order $order)

Find address for order

Parameters

Order $order

Return Value

Address|null

at line 145
Promotion|null savePromotion(Promotion $promotion)

Persist new promotion

Parameters

Promotion $promotion

Return Value

Promotion|null

at line 157
User|null findUserForCoupon(int $id)

Find user for provided id

Parameters

int $id

Return Value

User|null

at line 169
mixed|null|object findUserBy(array $array)

Find user for provided criteria

Parameters

array $array

Return Value

mixed|null|object

at line 181
array getAllUsersInArray(array $arrayOfUsers)

Find all users that match provided ids

Parameters

array $arrayOfUsers

Return Value

array User

at line 196
Coupon|null checkCoupon(string $code, User|null $user = null)

Check if coupon is valid for provided user(if provided user is NULL, check if coupon is valid for logged user)

Parameters

string $code
User|null $user

Return Value

Coupon|null

Exceptions

NonUniqueResultException

at line 223
mixed setCouponPKToSession(Coupon $coupon)

Set coupon to session

Parameters

Coupon $coupon

Return Value

mixed

at line 236
int|null getCouponPKFromSession()

Retrieve coupon from session

Return Value

int|null

at line 244
removeCouponFromSession()

Remove coupon from session

at line 259
Coupon|null getCouponById(int $couponId)

Find coupon for provided id

Parameters

int $couponId

Return Value

Coupon|null

at line 271
mixed updateCoupon(Coupon $coupon)

Update coupon

Parameters

Coupon $coupon

Return Value

mixed

at line 283
Coupon|null useCoupon(Coupon $coupon)

Increment coupon usage and set used to TRUE if number of uses reached usage limit

Parameters

Coupon $coupon

Return Value

Coupon|null

at line 295
Tax|null saveTax(Tax $tax)

Persist new tax

Parameters

Tax $tax

Return Value

Tax|null

at line 305
Tax getCurrentTax()

Retrieve current tax

Return Value

Tax

at line 320
sendEditedStateOrderMail(Order $order, string $state = 'edit', array $additionalMails = array(), array|null $cardOrderInfo = null)

Send mail when order state is change

Parameters

Order $order
string $state
array $additionalMails
array|null $cardOrderInfo

Exceptions

Exception

at line 355
mixed getSearchParam()

Retrieve search parameters from request

Return Value

mixed

at line 366
Order commentMerge(Order $order)

Add checkout comment to order

Parameters

Order $order

Return Value

Order

at line 382
sendMails(string $template, string $from, array $to, array $context = array(), mixed $attachment = null, string $theme = null, mixed $entity = null)

Send mail with provided parameters

Parameters

string $template
string $from
array $to
array $context
mixed $attachment
string $theme
mixed $entity

at line 394
mixed getAddressFromDB(mixed $id)

Find address by id

Parameters

mixed $id

Return Value

mixed

at line 404
array getAllShippingWithSelect()

Find all shipping providers

Return Value

array

at line 416
array getAllGroupProductsForOrder(int $orderId)

Find all group products in order

Parameters

int $orderId

Return Value

array

at line 426
ProductAttributeValuesRepository getProductAttributeValuesRepository()

Retrieve product attribute values repository

at line 436
ProductManager getProductManager()

Retrieve product manager

Return Value

ProductManager

at line 451
Product getProductDB(Product $product)

Find product by id or slug

Parameters

Product $product

Return Value

Product

Exceptions

NoResultException
NonUniqueResultException

at line 461
UserSettings getCurrentUserSettings()

Retrieve current user settings

Return Value

UserSettings

at line 471
array getAllStoresForPickUp()

Get all Stores from database

Return Value

array

at line 483
bool activateCoupon(Order $order)

Active coupon that is cached in session

Parameters

Order $order

Return Value

bool

at line 493
object|IdentityTranslator getTranslator()

Retrieve translator

Return Value

object|IdentityTranslator

at line 503
string|null getCurrentTheme()

Retrieve current front theme name

Return Value

string|null

at line 515
User createNewUser(User $user)

Persist user

Parameters

User $user

Return Value

User

at line 527
ShippingProvider|Proxy|object|null getShippingReference(int $id)

Retrieve reference for shipping provider

Parameters

int $id

Return Value

ShippingProvider|Proxy|object|null

at line 539
string generateNextRoute(string $routeName)

Generate route for provided route name

Parameters

string $routeName

Return Value

string

at line 560
mixed doOrderItemsSearch(int $page, int $offset, int $productId, int $userId, int $reservationWarranty, int $maxQuantityPerOrderItem, array $searchParams, bool $count = false)

Find all orders that match provided criteria

Parameters

int $page
int $offset
int $productId
int $userId
int $reservationWarranty
int $maxQuantityPerOrderItem
array $searchParams
bool $count

Return Value

mixed

Exceptions

Exception

at line 578
OrderEvent dispatchAfterAddToCartLogicEvent(Order $order, OrderItem|null $orderItem = null, string|null $action = null, bool $isOrderMerging = false)

Dispatch event after add to cart

Parameters

Order $order
OrderItem|null $orderItem
string|null $action
bool $isOrderMerging

Return Value

OrderEvent

at line 602
BuyXGetYProductEvent dispatchBuyXGetYOfferEvent(Order|null $order, OrderItem|null $orderItem, string|null $action, string|null $eventName = BuyXGetYProductEvent::PRODUCT_BUY_X_GET_Y_CHECK_ACTION_EVENT, boolean $hasItem = true, int|null $oldQty = null)

Dispatch event to deal with buy x get y logic(if buy X get Y plugin is activated)

Parameters

Order|null $order
OrderItem|null $orderItem
string|null $action
string|null $eventName
boolean $hasItem
int|null $oldQty

Return Value

BuyXGetYProductEvent

at line 622
SpecialOfferEvent dispatchAfterAddToCartSpecialOfferEvent(Order $order)

Dispatch event to deal with special offer logic(if special offer plugin is activated)

Parameters

Order $order

Return Value

SpecialOfferEvent

at line 638
Event dispatchEvent(string $name, Event $event)

Dispatch provided event

Parameters

string $name
Event $event

Return Value

Event

at line 650
float|int getCurrencyRatio(string $current)

Get relative ratio between default and provided currency

Parameters

string $current

Return Value

float|int

at line 660
mixed getCashCheckoutSettings()

Retrieve cached checkout settings

Return Value

mixed

at line 674
array getUsersByStringParam(int $page = 1, int $offset = 10, string|null $params = null)

Find all users with pagination

Parameters

int $page
int $offset
string|null $params

Return Value

array

at line 686
array getUserInfoForOrder(int $id)

Find user by id

Parameters

int $id

Return Value

array

at line 698
User|Proxy|null getUserByPk(int $id)

Retrieve reference for user that match provided id

Parameters

int $id

Return Value

User|Proxy|null

at line 710
string|null getPaymentTypeByPk(int $id)

Find payment type by id

Parameters

int $id

Return Value

string|null

at line 720
array getAllPaymentTypes()

Find all payment types

Return Value

array

at line 733
array dispatchOneStepCheckoutChanges(mixed $data, Order $order)

Dispatch event to apply gift card

Parameters

mixed $data
Order $order

Return Value

array

at line 751
mixed dispatchBeforeOneStepCheckoutEvent(Order $order, mixed $data)

Dispatch event before any one step checkout logic

Parameters

Order $order
mixed $data

Return Value

mixed

at line 766
null|SessionInterface getSession()

Retrieve current session from request

Return Value

null|SessionInterface

at line 774
forceInitialization()

Force caching shop parameters

at line 786
array getAllEmailsForArrayOfIds(array|null $ids = null)

Find all users that match provided ids(if ids are NULL, retrieve all users)

Parameters

array|null $ids

Return Value

array

at line 796
mixed getOrderMergeType()

Retrieve current order merge type

Return Value

mixed

at line 806
ProductSettings getProductSettings()

Retrieve current product settings

Return Value

ProductSettings

at line 816
null|Request getCurrentRequest()

Retrieve current request

Return Value

null|Request

at line 830
EventWithResult|Event dispatchProductQuantityUnavailable(Order $order, OrderItem $orderItem, bool $removed = false)

Dispatch event

Parameters

Order $order
OrderItem $orderItem
bool $removed

Return Value

EventWithResult|Event

at line 849
array getPaymentTypeLimits()

Retrieve limits for payments(if payment is disabled for role)

Return Value

array

at line 861
EventWithResult|Event dispatchProductAddToCartPermissionCheck(array|string $productPermissions)

Dispatch event to check if product can be added to cart

Parameters

array|string $productPermissions

Return Value

EventWithResult|Event

at line 874
UnitOfMeasureWeightPricing findUnitOfMeasurePricingRules()

Retrieve single unit of measure pricing rule(if it exist)

at line 886
PaymentType getPaymentTypeByName(string $paymentType)

Find payment type by name

Parameters

string $paymentType

Return Value

PaymentType

at line 898
string getRouteForPayment(string $payment)

If payment type is card payment, and have custom page for paying, redirect buyer to that page

Parameters

string $payment

Return Value

string

at line 920
float|int convertMoney(float $price, string $from, string $to)

Convert price from one currency to other

Parameters

float $price
string $from
string $to

Return Value

float|int

at line 930
mixed|null getDefaultPricelist()

Retrieve default pricelist for shop

Return Value

mixed|null

at line 943
float|int getTotalGroupDiscount(int $productId, int $quantity)

Get total group discount, as array, containing percent and fixed discount

Parameters

int $productId
int $quantity

Return Value

float|int

at line 956
float getTotalPricelistDiscount(array $productPricelistItemsArray, int $quantity)

Get total pricelist discount, represented as percent

Parameters

array $productPricelistItemsArray
int $quantity

Return Value

float

at line 966
string getMultipleGroupsDiscountType()

Retrieve multiple group discount type

Return Value

string

at line 976
string getCalculatePricelistGroupDiscounts()

Retrieve calculated pricelist group discounts

Return Value

string

at line 986
string|null getUserPriceListCurrency()

Retrieve pricelist for user. NULL otherwise

Return Value

string|null

at line 1006
float convertOrderToPricelistCurrency(float $value, string $to)

Convert price from default currency to currency in order

Parameters

float $value
string $to

Return Value

float

at line 1016
mixed dispatchCustomOneStepCheckoutRedirectEvent()

Dispatch event after saving order on one step checkout

Return Value

mixed

at line 1029
object|Session getCurrentSession()

Retrieve current session

Return Value

object|Session

at line 1039
bool isAllowedToSeeOrderDetailsPage(int $id)

Parameters

int $id

Return Value

bool