Constants

FILTER_ACTION_ALL

FILTER_ACTION_ALL

FILTER_ACTION_SHIPPING

FILTER_ACTION_SHIPPING

FILTER_ACTION_REDUCTION

FILTER_ACTION_REDUCTION

FILTER_ACTION_GIFT

FILTER_ACTION_GIFT

FILTER_ACTION_ALL_NOCAP

FILTER_ACTION_ALL_NOCAP

BO_ORDER_CODE_PREFIX

BO_ORDER_CODE_PREFIX

Properties

$id

$id : 

Type

$name

$name : 

Type

$id_customer

$id_customer : 

Type

$date_from

$date_from : 

Type

$date_to

$date_to : 

Type

$description

$description : 

Type

$quantity

$quantity : 

Type

$quantity_per_user

$quantity_per_user : 

Type

$priority

$priority : 

Type

$partial_use

$partial_use : 

Type

$code

$code : 

Type

$minimum_amount

$minimum_amount : 

Type

$minimum_amount_tax

$minimum_amount_tax : 

Type

$minimum_amount_currency

$minimum_amount_currency : 

Type

$minimum_amount_shipping

$minimum_amount_shipping : 

Type

$country_restriction

$country_restriction : 

Type

$carrier_restriction

$carrier_restriction : 

Type

$group_restriction

$group_restriction : 

Type

$cart_rule_restriction

$cart_rule_restriction : 

Type

$product_restriction

$product_restriction : 

Type

$shop_restriction

$shop_restriction : 

Type

$free_shipping

$free_shipping : 

Type

$reduction_percent

$reduction_percent : 

Type

$reduction_amount

$reduction_amount : 

Type

$reduction_tax

$reduction_tax : 

Type

$reduction_currency

$reduction_currency : 

Type

$reduction_product

$reduction_product : 

Type

$gift_product

$gift_product : 

Type

$gift_product_attribute

$gift_product_attribute : 

Type

$highlight

$highlight : 

Type

$active

$active : 

Type

$date_add

$date_add : 

Type

$date_upd

$date_upd : 

Type

$definition

$definition : 

Type

$only_one_gift

$only_one_gift : 

Type

Methods

add()

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

Parameters

$autodate
$null_values

update()

update(  $null_values = false) 

Parameters

$null_values

delete()

delete() 

copyConditions()

copyConditions(integer  $id_cart_rule_source, integer  $id_cart_rule_destination) 

Copy conditions from one cart rule to an other

Parameters

integer $id_cart_rule_source
integer $id_cart_rule_destination

getIdByCode()

getIdByCode(string  $code) : integer|boolean

Retrieves the id associated to the given code

Parameters

string $code

Returns

integer|boolean

getCustomerCartRules()

getCustomerCartRules(  $id_lang,   $id_customer, boolean  $active = false, boolean  $includeGeneric = true, boolean  $inStock = false, \Cart|null  $cart = null) : array

Parameters

$id_lang
$id_customer
boolean $active
boolean $includeGeneric
boolean $inStock
\Cart|null $cart

Returns

array

usedByCustomer()

usedByCustomer(  $id_customer) : boolean

Parameters

$id_customer

Returns

boolean

cartRuleExists()

cartRuleExists(  $name) : boolean

Parameters

$name

Returns

boolean

deleteByIdCustomer()

deleteByIdCustomer(  $id_customer) : boolean

Parameters

$id_customer

Returns

boolean

getProductRuleGroups()

getProductRuleGroups() : array

Returns

array

getProductRules()

getProductRules(  $id_product_rule_group) : array

Parameters

$id_product_rule_group

Returns

array —

('type' => ? , 'values' => ?)

checkValidity()

checkValidity(\Context  $context, boolean  $alreadyInCart = false, boolean  $display_error = true,   $check_carrier = true) : boolean|mixed|string

Check if this cart rule can be applied

Parameters

\Context $context
boolean $alreadyInCart

Check if the voucher is already on the cart

boolean $display_error

Display error

$check_carrier

Returns

boolean|mixed|string

getContextualValue()

getContextualValue(boolean  $use_tax, \Context  $context = null,   $filter = null,   $package = null, boolean  $use_cache = true) : float|integer|string

The reduction value is POSITIVE

Parameters

boolean $use_tax
\Context $context
$filter
$package
boolean $use_cache

Allow using cache to avoid multiple free gift using multishipping

Returns

float|integer|string

getCartAverageVatRate()

getCartAverageVatRate() : float

Return the estimated cart VAT from the difference between the total amount taxes included and taxes excluded.

Returns

float —

Estimated VAT rate.

cleanCache()

cleanCache() 

Make sure caches are empty Must be called before calling multiple time getContextualValue()

getAssociatedRestrictions()

getAssociatedRestrictions(  $type,   $active_only,   $i18n) 

Parameters

$type
$active_only
$i18n

autoRemoveFromCart()

autoRemoveFromCart(  $context = null) 

Parameters

$context

autoAddToCart()

autoAddToCart(\Context|null  $context = null) : mixed

Parameters

\Context|null $context

Returns

mixed

isFeatureActive()

isFeatureActive() : boolean

Returns

boolean

cleanProductRuleIntegrity()

cleanProductRuleIntegrity(  $type,   $list) 

Parameters

$type
$list

getCartsRuleByCode()

getCartsRuleByCode(  $name,   $id_lang,   $extended = false) : array

Parameters

$name
$id_lang
$extended

Returns

array

checkProductRestrictions()

checkProductRestrictions(\Context  $context,   $return_products = false,   $display_error = true,   $alreadyInCart = false) 

Parameters

\Context $context
$return_products
$display_error
$alreadyInCart

array_uintersect()

array_uintersect(  $array1,   $array2) 

Parameters

$array1
$array2

array_uintersect_compare()

array_uintersect_compare(  $a,   $b) 

Parameters

$a
$b

getCartRuleCombinations()

getCartRuleCombinations()