Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Data Fields | |
const | CALCULATE_CHILD = 0 |
const | CALCULATE_PARENT = 1 |
const | SHIPMENT_SEPARATELY = 1 |
const | SHIPMENT_TOGETHER = 0 |
const | PROCESS_MODE_FULL = 'full' |
const | PROCESS_MODE_LITE = 'lite' |
const | OPTION_PREFIX = 'option_' |
Protected Member Functions | |
_isStrictProcessMode ($processMode) | |
_prepareOptions (\Magento\Framework\DataObject $buyRequest, $product, $processMode) | |
_removeNotApplicableAttributes ($product) | |
Protected Attributes | |
$_typeId | |
$_editableAttributes | |
$_isComposite = false | |
$_canConfigure = false | |
$_canUseQtyDecimals = true | |
$_fileQueue = [] | |
$_filesystem | |
$_fileStorageDb | |
$_cacheProductSetAttributes = '_cache_instance_product_set_attributes' | |
$_coreRegistry | |
$_eventManager | |
$_logger | |
$_catalogProductType | |
$_eavConfig | |
$_catalogProductOption | |
$productRepository | |
$serializer | |
@api Abstract model for product type implementation @SuppressWarnings(PHPMD.ExcessivePublicCount) @SuppressWarnings(PHPMD.TooManyFields) @SuppressWarnings(PHPMD.ExcessiveClassComplexity) @SuppressWarnings(PHPMD.CouplingBetweenObjects)
Definition at line 22 of file AbstractType.php.
__construct | ( | \Magento\Catalog\Model\Product\Option | $catalogProductOption, |
\Magento\Eav\Model\Config | $eavConfig, | ||
\Magento\Catalog\Model\Product\Type | $catalogProductType, | ||
\Magento\Framework\Event\ManagerInterface | $eventManager, | ||
\Magento\MediaStorage\Helper\File\Storage\Database | $fileStorageDb, | ||
\Magento\Framework\Filesystem | $filesystem, | ||
\Magento\Framework\Registry | $coreRegistry, | ||
\Psr\Log\LoggerInterface | $logger, | ||
ProductRepositoryInterface | $productRepository, | ||
\Magento\Framework\Serialize\Serializer\Json | $serializer = null |
||
) |
Construct
\Magento\Catalog\Model\Product\Option | $catalogProductOption | |
\Magento\Eav\Model\Config | $eavConfig | |
\Magento\Catalog\Model\Product\Type | $catalogProductType | |
\Magento\Framework\Event\ManagerInterface | $eventManager | |
\Magento\MediaStorage\Helper\File\Storage\Database | $fileStorageDb | |
\Magento\Framework\Filesystem | $filesystem | |
\Magento\Framework\Registry | $coreRegistry | |
\Psr\Log\LoggerInterface | $logger | |
ProductRepositoryInterface | $productRepository | |
\Magento\Framework\Serialize\Serializer\Json | null | $serializer | @SuppressWarnings(PHPMD.ExcessiveParameterList) |
Definition at line 189 of file AbstractType.php.
|
protected |
Check if current process mode is strict
string | $processMode |
Definition at line 552 of file AbstractType.php.
|
protected |
Process custom defined options for product
\Magento\Framework\DataObject | $buyRequest | |
\Magento\Catalog\Model\Product | $product | |
string | $processMode |
LocalizedException |
Definition at line 576 of file AbstractType.php.
|
protected |
Remove don't applicable attributes data
\Magento\Catalog\Model\Product | $product |
Definition at line 722 of file AbstractType.php.
addFileQueue | ( | $queueOptions | ) |
Add file to File Queue
array | $queueOptions | Array of File Queue (eg. ['operation'=>'move', 'src_name'=>'filename', 'dst_name'=>'filename2']) |
Definition at line 541 of file AbstractType.php.
assignProductToOption | ( | $optionProduct, | |
$option, | |||
$product | |||
) |
Implementation of product specify logic of which product needs to be assigned to option. For example if product which was added to option already removed from catalog.
\Magento\Catalog\Model\Product | $optionProduct | |
\Magento\Quote\Model\Quote\Item\Option | $option | |
\Magento\Catalog\Model\Product | $product |
Definition at line 950 of file AbstractType.php.
attributesCompare | ( | $attributeOne, | |
$attributeTwo | |||
) |
Compare attributes sorting
\Magento\Catalog\Model\Entity\Attribute | $attributeOne | |
\Magento\Catalog\Model\Entity\Attribute | $attributeTwo |
Definition at line 290 of file AbstractType.php.
beforeSave | ( | $product | ) |
Before save type related data
\Magento\Catalog\Model\Product | $product |
Definition at line 739 of file AbstractType.php.
canConfigure | ( | $product | ) |
Check if product can be configured
\Magento\Catalog\Model\Product | $product |
Definition at line 765 of file AbstractType.php.
canUseQtyDecimals | ( | ) |
Check if product qty is fractional number
Definition at line 775 of file AbstractType.php.
checkProductBuyState | ( | $product | ) |
Check if product can be bought
\Magento\Catalog\Model\Product | $product |
Definition at line 625 of file AbstractType.php.
checkProductConfiguration | ( | $product, | |
$buyRequest | |||
) |
Check product's options configuration
\Magento\Catalog\Model\Product | $product | |
\Magento\Framework\DataObject | $buyRequest |
cloning product because prepareForCart() method will modify it
Definition at line 1035 of file AbstractType.php.
|
abstract |
Delete data specific for this product type
\Magento\Catalog\Model\Product | $product |
getAssociatedProducts | ( | $product | ) |
\Magento\Catalog\Model\Product\Type\AbstractType | $product |
Definition at line 1099 of file AbstractType.php.
getAttributeById | ( | $attributeId, | |
$product | |||
) |
Retrieve product attribute by identifier
int | $attributeId | |
\Magento\Catalog\Model\Product | $product |
Definition at line 316 of file AbstractType.php.
getChildrenIds | ( | $parentId, | |
$required = true |
|||
) |
Retrieve Required children ids Return grouped array, ex array( group => array(ids) )
@deplacated TODO: refactor to child relation manager
int | $parentId | |
bool | $required |
Definition at line 249 of file AbstractType.php.
getEditableAttributes | ( | $product | ) |
Retrieve product type attributes
\Magento\Catalog\Model\Product | $product |
Definition at line 304 of file AbstractType.php.
getForceChildItemQtyChanges | ( | $product | ) |
Allow for updates of children qty's (applicable for complicated product types. As default returns false)
\Magento\Catalog\Model\Product | $product |
Definition at line 923 of file AbstractType.php.
getIdentities | ( | \Magento\Catalog\Model\Product | $product | ) |
Return array of specific to type product entities
\Magento\Catalog\Model\Product | $product |
Definition at line 1089 of file AbstractType.php.
getOptionSku | ( | $product, | |
$sku = '' |
|||
) |
Default action to get sku of product with option
\Magento\Catalog\Model\Product | $product | Product with Custom Options |
string | $sku | Product SKU without option |
Definition at line 802 of file AbstractType.php.
getOrderOptions | ( | $product | ) |
Prepare additional options/information for order item which will be created from this product
\Magento\Catalog\Model\Product | $product |
Definition at line 652 of file AbstractType.php.
getParentIdsByChild | ( | $childId | ) |
Retrieve parent ids array by required child
int | array | $childId |
Definition at line 261 of file AbstractType.php.
getProductsToPurchaseByReqGroups | ( | $product | ) |
Retrieve products divided into groups required to purchase At least one product in each group has to be purchased
\Magento\Catalog\Model\Product | $product |
Definition at line 1007 of file AbstractType.php.
getRelationInfo | ( | ) |
Return relation info about used products for specific type instance
Definition at line 231 of file AbstractType.php.
getSearchableData | ( | $product | ) |
Retrieve additional searchable data from type instance Using based on product id and store_id data
\Magento\Catalog\Model\Product | $product |
Definition at line 987 of file AbstractType.php.
getSetAttributes | ( | $product | ) |
Get array of product set attributes
\Magento\Catalog\Model\Product | $product |
Definition at line 272 of file AbstractType.php.
getSku | ( | $product | ) |
Default action to get sku of product
\Magento\Catalog\Model\Product | $product |
Definition at line 786 of file AbstractType.php.
getSpecifyOptionMessage | ( | ) |
Retrieve message for specify option(s)
Definition at line 562 of file AbstractType.php.
getStoreFilter | ( | $product | ) |
Retrieve store filter for associated products
\Magento\Catalog\Model\Product | $product |
Definition at line 894 of file AbstractType.php.
getWeight | ( | $product | ) |
Default action to get weight of product
\Magento\Catalog\Model\Product | $product |
Definition at line 839 of file AbstractType.php.
hasOptions | ( | $product | ) |
Return true if product has options
\Magento\Catalog\Model\Product | $product |
Definition at line 850 of file AbstractType.php.
hasRequiredOptions | ( | $product | ) |
Check if product has required options
\Magento\Catalog\Model\Product | $product |
Definition at line 880 of file AbstractType.php.
hasWeight | ( | ) |
Determine presence of weight for product type
Definition at line 1065 of file AbstractType.php.
isComposite | ( | $product | ) |
Check if product is composite
\Magento\Catalog\Model\Product | $product |
Definition at line 753 of file AbstractType.php.
isPossibleBuyFromList | ( | $product | ) |
Check if product can be potentially buyed from the category page or some other list
\Magento\Catalog\Model\Product | $product |
Definition at line 1111 of file AbstractType.php.
isSalable | ( | $product | ) |
Check is product available for sale
\Magento\Catalog\Model\Product | $product |
Definition at line 346 of file AbstractType.php.
isVirtual | ( | $product | ) |
Check is virtual product
\Magento\Catalog\Model\Product | $product |
Definition at line 335 of file AbstractType.php.
prepareForCart | ( | \Magento\Framework\DataObject | $buyRequest, |
$product | |||
) |
Initialize product(s) for add to cart process
\Magento\Framework\DataObject | $buyRequest | |
\Magento\Catalog\Model\Product | $product |
Definition at line 467 of file AbstractType.php.
prepareForCartAdvanced | ( | \Magento\Framework\DataObject | $buyRequest, |
$product, | |||
$processMode = null |
|||
) |
Initialize product(s) for add to cart process. Advanced version of func to prepare product for cart - processMode can be specified there.
\Magento\Framework\DataObject | $buyRequest | |
\Magento\Catalog\Model\Product | $product | |
null | string | $processMode |
Definition at line 450 of file AbstractType.php.
prepareQuoteItemQty | ( | $qty, | |
$product | |||
) |
Prepare Quote Item Quantity
int | float | $qty | |
\Magento\Catalog\Model\Product | $product |
Definition at line 936 of file AbstractType.php.
processBuyRequest | ( | $product, | |
$buyRequest | |||
) |
Prepare selected options for product
\Magento\Catalog\Model\Product | $product | |
\Magento\Framework\DataObject | $buyRequest |
Definition at line 1023 of file AbstractType.php.
processConfiguration | ( | \Magento\Framework\DataObject | $buyRequest, |
$product, | |||
$processMode = self::PROCESS_MODE_LITE |
|||
) |
Process product configuration
\Magento\Framework\DataObject | $buyRequest | |
\Magento\Catalog\Model\Product | $product | |
string | $processMode |
Definition at line 431 of file AbstractType.php.
save | ( | $product | ) |
Save type related data
\Magento\Catalog\Model\Product | $product |
Definition at line 703 of file AbstractType.php.
setConfig | ( | $config | ) |
Setting specified product type variables
array | $config |
Definition at line 967 of file AbstractType.php.
setImageFromChildProduct | ( | \Magento\Catalog\Model\Product | $product | ) |
Set image for product without image if possible
\Magento\Catalog\Model\Product | $product |
Definition at line 1077 of file AbstractType.php.
setStoreFilter | ( | $store, | |
$product | |||
) |
Set store filter for associated products
$store | int|\Magento\Store\Model\Store | |
\Magento\Catalog\Model\Product | $product |
Definition at line 907 of file AbstractType.php.
setTypeId | ( | $typeId | ) |
Specify type identifier
string | $typeId |
Definition at line 220 of file AbstractType.php.
updateQtyOption | ( | $options, | |
\Magento\Framework\DataObject | $option, | ||
$value, | |||
$product | |||
) |
Method is needed for specific actions to change given configuration options values according current product type logic Example: the cataloginventory validation of decimal qty can change qty to int, so need to change configuration item qty option value too.
array | $options | |
\Magento\Framework\DataObject | $option | |
int | float | null | $value | |
\Magento\Catalog\Model\Product | $product |
Definition at line 869 of file AbstractType.php.
|
protected |
Definition at line 111 of file AbstractType.php.
|
protected |
Definition at line 48 of file AbstractType.php.
|
protected |
Definition at line 55 of file AbstractType.php.
|
protected |
Definition at line 159 of file AbstractType.php.
|
protected |
Definition at line 145 of file AbstractType.php.
|
protected |
Definition at line 126 of file AbstractType.php.
|
protected |
Definition at line 152 of file AbstractType.php.
|
protected |
Definition at line 34 of file AbstractType.php.
|
protected |
Definition at line 133 of file AbstractType.php.
|
protected |
Definition at line 62 of file AbstractType.php.
|
protected |
Definition at line 104 of file AbstractType.php.
|
protected |
Definition at line 99 of file AbstractType.php.
|
protected |
Definition at line 41 of file AbstractType.php.
|
protected |
Definition at line 138 of file AbstractType.php.
|
protected |
Definition at line 29 of file AbstractType.php.
|
protected |
Definition at line 164 of file AbstractType.php.
|
protected |
Definition at line 172 of file AbstractType.php.
const CALCULATE_CHILD = 0 |
Definition at line 64 of file AbstractType.php.
const CALCULATE_PARENT = 1 |
Definition at line 66 of file AbstractType.php.
const OPTION_PREFIX = 'option_' |
Item options prefix
Definition at line 94 of file AbstractType.php.
const PROCESS_MODE_FULL = 'full' |
#- Process modes
Full validation - all required options must be set, whole configuration must be valid
Definition at line 82 of file AbstractType.php.
const PROCESS_MODE_LITE = 'lite' |
Process modes
Lite validation - only received options are validated
Definition at line 89 of file AbstractType.php.
const SHIPMENT_SEPARATELY = 1 |
#+ values for shipment type (invoice etc)
Definition at line 71 of file AbstractType.php.
const SHIPMENT_TOGETHER = 0 |
Definition at line 73 of file AbstractType.php.