Documentation

Mage_Bundle_Model_Product_Type extends Mage_Catalog_Model_Product_Type_Abstract
in package

Maho

Tags
copyright

Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)

copyright

Copyright (c) 2019-2025 The OpenMage Contributors (https://openmage.org)

copyright

Copyright (c) 2024 Maho (https://mahocommerce.com)

license

https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)

Table of Contents

Constants

CALCULATE_CHILD  = 0
CALCULATE_PARENT  = 1
OPTION_PREFIX  = 'option_'
Item options prefix
PROCESS_MODE_FULL  = 'full'
Process modes
PROCESS_MODE_LITE  = 'lite'
Process modes
SHIPMENT_SEPARATELY  = 1
values for shipment type (invoice etc)
SHIPMENT_TOGETHER  = 0

Properties

$_canConfigure  : bool
Product is configurable
$_canUseQtyDecimals  : bool
Whether product quantity is fractional number or not
$_fileQueue  : array<string|int, mixed>
File queue array
$_isComposite  : bool
Product is composite
$_keyOptionsCollection  : string
Cache key for Options Collection
$_keySelectionsCollection  : string
Cache key for Selections Collection
$_keyUsedOptions  : string
Cache key for used options
$_keyUsedOptionsIds  : string
Cache key for used options ids
$_keyUsedSelections  : string
Cache key for used Selections
$_keyUsedSelectionsIds  : string
Cache key for used selections ids
$_product  : Mage_Catalog_Model_Product
Product model instance, if not used as a singleton
$_typeId  : string
Product type instance id
$cacheKeyEditableAttributes  : string
Cache key for Editable Products

Methods

addFileQueue()  : mixed
Add file to File Queue
assignProductToOption()  : Mage_Catalog_Model_Product_Type_Abstract
Implementation of product specify logic of which product needs to be assigned to option.
attributesCompare()  : int
Compare attributes sorting
beforeSave()  : $this
Before save type related data
canConfigure()  : bool
Check if product can be configured
canUseQtyDecimals()  : bool
Check if product qty is fractional number
checkProductBuyState()  : $this
Check if product can be bought
checkProductConfiguration()  : array<string|int, mixed>
Check product's options configuration
getAttributeById()  : Mage_Eav_Model_Entity_Attribute_Abstract|null
Retrieve product attribute by identifier
getChildrenIds()  : array<string|int, mixed>
Retrieve Required children ids Return grouped array, ex array( group => array(ids) )
getEditableAttributes()  : array<string|int, mixed>
Retrieve product type attributes
getForceChildItemQtyChanges()  : true
Allow for updates of chidren qty's
getOptions()  : array<string|int, mixed>
Retrieve bundle options items
getOptionsByIds()  : Mage_Bundle_Model_Resource_Option_Collection
Retrieve bundle options collection based on ids
getOptionsCollection()  : Mage_Bundle_Model_Resource_Option_Collection
Retrieve bundle option collection
getOptionsIds()  : array<string|int, mixed>
Retrieve bundle options ids
getOptionSku()  : string
Default action to get sku of product with option
getOrderOptions()  : array<string|int, mixed>
Prepare additional options/information for order item which will be created from this product
getParentIdsByChild()  : array<string|int, mixed>
Retrieve parent ids array by requered child
getProduct()  : Mage_Catalog_Model_Product
Retrieve catalog product object
getProductsToPurchaseByReqGroups()  : array<string|int, mixed>
Retrieve products divided into groups required to purchase At least one product in each group has to be purchased
getRelationInfo()  : Varien_Object
Return relation info about used products
getSearchableData()  : array<string|int, mixed>
Retrieve additional searchable data from type instance Using based on product id and store_id data
getSelectionsByIds()  : Mage_Bundle_Model_Resource_Selection_Collection
Retrieve bundle selections collection based on ids
getSelectionsCollection()  : Mage_Bundle_Model_Resource_Selection_Collection
Retrieve bundle selections collection based on used options
getSetAttributes()  : array<string|int, mixed>
Get array of product set attributes
getSku()  : string
Return product sku based on sku_type attribute
getSpecifyOptionMessage()  : string
Retrieve message for specify option(s)
getStoreFilter()  : Mage_Core_Model_Store|int|null
Retrieve store filter for associated products
getWeight()  : float
Return product weight based on weight_type attribute
hasOptions()  : bool
Return true if product has options
hasRequiredOptions()  : bool
Check if product has required options
isComposite()  : bool
Check if product is composite (grouped, configurable, etc)
isMapEnabledInOptions()  : bool|null
Check if Minimum Advertise Price is enabled at least in one option
isSalable()  : bool
Checking if we can sale this bundle
isVirtual()  : bool
Check is virtual product
prepareForCart()  : array<string|int, mixed>|string
Initialize product(s) for add to cart process
prepareForCartAdvanced()  : array<string|int, mixed>|string
Initialize product(s) for add to cart process.
prepareQuoteItemQty()  : int
Prepare Quote Item Quantity
processBuyRequest()  : array<string|int, mixed>
Prepare selected options for bundle product
processConfiguration()  : array<string|int, mixed>|string
Process product configuration
processFileQueue()  : Mage_Catalog_Model_Product_Type_Abstract
Process File Queue
save()  : $this
Save type related data
setConfig()  : Mage_Catalog_Model_Product_Type_Abstract
Setting specified product type variables
setProduct()  : Mage_Catalog_Model_Product_Type_Abstract
Specify type instance product, if not used as a singleton
setStoreFilter()  : $this
Set store filter for associated products
setTypeId()  : Mage_Catalog_Model_Product_Type_Abstract
Specify type identifier
shakeSelections()  : int
Sort selections method for usort function Sort selections by option position, selection position and selection id
updateQtyOption()  : Mage_Bundle_Model_Product_Type
Method is needed for specific actions to change given quote options values according current product type logic Example: the cataloginventory validation of decimal qty can change qty to int, so need to change quote item qty option value too.
_isStrictProcessMode()  : bool
Check if current process mode is strict
_prepareOptions()  : array<string|int, mixed>
Process custom defined options for product
_prepareOptionsForCart()  : array<string|int, mixed>
Process product custom defined options for cart
_prepareProduct()  : array<string|int, mixed>|string
Prepare product and its configuration to be added to some products list.
_removeNotApplicableAttributes()  : mixed
Remove don't applicable attributes data

Constants

CALCULATE_CHILD

public mixed CALCULATE_CHILD = 0

CALCULATE_PARENT

public mixed CALCULATE_PARENT = 1

OPTION_PREFIX

Item options prefix

public mixed OPTION_PREFIX = 'option_'

PROCESS_MODE_FULL

Process modes

public mixed PROCESS_MODE_FULL = 'full'

Full validation - all required options must be set, whole configuration must be valid

PROCESS_MODE_LITE

Process modes

public mixed PROCESS_MODE_LITE = 'lite'

Lite validation - only received options are validated

SHIPMENT_SEPARATELY

values for shipment type (invoice etc)

public mixed SHIPMENT_SEPARATELY = 1

SHIPMENT_TOGETHER

public mixed SHIPMENT_TOGETHER = 0

Properties

$_canConfigure

Product is configurable

protected bool $_canConfigure = \true

$_canUseQtyDecimals

Whether product quantity is fractional number or not

protected bool $_canUseQtyDecimals = \true

$_fileQueue

File queue array

protected array<string|int, mixed> $_fileQueue = []

$_isComposite

Product is composite

protected bool $_isComposite = \true

$_keyOptionsCollection

Cache key for Options Collection

protected string $_keyOptionsCollection = '_cache_instance_options_collection'

$_keySelectionsCollection

Cache key for Selections Collection

protected string $_keySelectionsCollection = '_cache_instance_selections_collection'

$_keyUsedOptions

Cache key for used options

protected string $_keyUsedOptions = '_cache_instance_used_options'

$_keyUsedOptionsIds

Cache key for used options ids

protected string $_keyUsedOptionsIds = '_cache_instance_used_options_ids'

$_keyUsedSelections

Cache key for used Selections

protected string $_keyUsedSelections = '_cache_instance_used_selections'

$_keyUsedSelectionsIds

Cache key for used selections ids

protected string $_keyUsedSelectionsIds = '_cache_instance_used_selections_ids'

$_typeId

Product type instance id

protected string $_typeId

$cacheKeyEditableAttributes

Cache key for Editable Products

protected string $cacheKeyEditableAttributes = '_cache_editable_attributes'

Methods

addFileQueue()

Add file to File Queue

public addFileQueue(array<string|int, mixed> $queueOptions) : mixed
Parameters
$queueOptions : array<string|int, mixed>

Array of File Queue (eg. ['operation'=>'move', 'src_name'=>'filename', 'dst_name'=>'filename2'])

assignProductToOption()

Implementation of product specify logic of which product needs to be assigned to option.

public assignProductToOption(Mage_Catalog_Model_Product $optionProduct, Mage_Sales_Model_Quote_Item_Option $option[, Mage_Catalog_Model_Product $product = null ]) : Mage_Catalog_Model_Product_Type_Abstract

For example if product which was added to option already removed from catalog.

Parameters
$optionProduct : Mage_Catalog_Model_Product
$option : Mage_Sales_Model_Quote_Item_Option
$product : Mage_Catalog_Model_Product = null
Return values
Mage_Catalog_Model_Product_Type_Abstract

canUseQtyDecimals()

Check if product qty is fractional number

public canUseQtyDecimals() : bool
Return values
bool

getChildrenIds()

Retrieve Required children ids Return grouped array, ex array( group => array(ids) )

public getChildrenIds(int $parentId[, bool $required = true ]) : array<string|int, mixed>
Parameters
$parentId : int
$required : bool = true
Attributes
#[Override]
Return values
array<string|int, mixed>

getOptionSku()

Default action to get sku of product with option

public getOptionSku([Mage_Catalog_Model_Product $product = null ][, string $sku = '' ]) : string
Parameters
$product : Mage_Catalog_Model_Product = null

Product with Custom Options

$sku : string = ''

Product SKU without option

Return values
string

getOrderOptions()

Prepare additional options/information for order item which will be created from this product

public getOrderOptions([Mage_Catalog_Model_Product $product = null ]) : array<string|int, mixed>
Parameters
$product : Mage_Catalog_Model_Product = null
Attributes
#[Override]
Return values
array<string|int, mixed>

getParentIdsByChild()

Retrieve parent ids array by requered child

public getParentIdsByChild(int|array<string|int, mixed> $childId) : array<string|int, mixed>
Parameters
$childId : int|array<string|int, mixed>
Attributes
#[Override]
Return values
array<string|int, mixed>

getProductsToPurchaseByReqGroups()

Retrieve products divided into groups required to purchase At least one product in each group has to be purchased

public getProductsToPurchaseByReqGroups([Mage_Catalog_Model_Product $product = null ]) : array<string|int, mixed>
Parameters
$product : Mage_Catalog_Model_Product = null
Attributes
#[Override]
Return values
array<string|int, mixed>

getRelationInfo()

Return relation info about used products

public getRelationInfo() : Varien_Object
Attributes
#[Override]
Return values
Varien_Object

Object with information data

getSearchableData()

Retrieve additional searchable data from type instance Using based on product id and store_id data

public getSearchableData([Mage_Catalog_Model_Product $product = null ]) : array<string|int, mixed>
Parameters
$product : Mage_Catalog_Model_Product = null
Attributes
#[Override]
Return values
array<string|int, mixed>

getSpecifyOptionMessage()

Retrieve message for specify option(s)

public getSpecifyOptionMessage() : string
Attributes
#[Override]
Return values
string

isMapEnabledInOptions()

Check if Minimum Advertise Price is enabled at least in one option

public isMapEnabledInOptions(Mage_Catalog_Model_Product $product[, int $visibility = null ]) : bool|null
Parameters
$product : Mage_Catalog_Model_Product
$visibility : int = null
Attributes
#[Override]
Return values
bool|null

prepareForCartAdvanced()

Initialize product(s) for add to cart process.

public prepareForCartAdvanced(Varien_Object $buyRequest[, Mage_Catalog_Model_Product $product = null ][, null|string $processMode = null ]) : array<string|int, mixed>|string

Advanced version of func to prepare product for cart - processMode can be specified there.

Parameters
$buyRequest : Varien_Object
$product : Mage_Catalog_Model_Product = null
$processMode : null|string = null
Return values
array<string|int, mixed>|string

updateQtyOption()

Method is needed for specific actions to change given quote options values according current product type logic Example: the cataloginventory validation of decimal qty can change qty to int, so need to change quote item qty option value too.

public updateQtyOption(array<string|int, mixed> $options, Varien_Object $option, mixed $value[, Mage_Catalog_Model_Product $product = null ]) : Mage_Bundle_Model_Product_Type
Parameters
$options : array<string|int, mixed>
$option : Varien_Object
$value : mixed
$product : Mage_Catalog_Model_Product = null
Attributes
#[Override]
Return values
Mage_Bundle_Model_Product_Type

_isStrictProcessMode()

Check if current process mode is strict

protected _isStrictProcessMode(string $processMode) : bool
Parameters
$processMode : string
Return values
bool

_prepareProduct()

Prepare product and its configuration to be added to some products list.

protected _prepareProduct(Varien_Object $buyRequest, Mage_Catalog_Model_Product $product, string $processMode) : array<string|int, mixed>|string

Perform standard preparation process and then prepare of bundle selections options.

Parameters
$buyRequest : Varien_Object
$product : Mage_Catalog_Model_Product
$processMode : string
Attributes
#[Override]
Return values
array<string|int, mixed>|string

        
On this page

Search results