Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Data Fields | |
const | KEY_PRODUCT_SKU = 'product_sku' |
const | KEY_OPTION_ID = 'option_id' |
const | KEY_TITLE = 'title' |
const | KEY_TYPE = 'type' |
const | KEY_SORT_ORDER = 'sort_order' |
const | KEY_IS_REQUIRE = 'is_require' |
const | KEY_PRICE = 'price' |
const | KEY_PRICE_TYPE = 'price_type' |
const | KEY_SKU = 'sku' |
const | KEY_FILE_EXTENSION = 'file_extension' |
const | KEY_MAX_CHARACTERS = 'max_characters' |
const | KEY_IMAGE_SIZE_Y = 'image_size_y' |
const | KEY_IMAGE_SIZE_X = 'image_size_x' |
![]() | |
const | CUSTOM_ATTRIBUTES = 'custom_attributes' |
![]() | |
const | EXTENSION_ATTRIBUTES_KEY = 'extension_attributes' |
![]() | |
const | OPTION_GROUP_TEXT = 'text' |
const | OPTION_GROUP_FILE = 'file' |
const | OPTION_GROUP_SELECT = 'select' |
const | OPTION_GROUP_DATE = 'date' |
const | OPTION_TYPE_FIELD = 'field' |
const | OPTION_TYPE_AREA = 'area' |
const | OPTION_TYPE_FILE = 'file' |
const | OPTION_TYPE_DROP_DOWN = 'drop_down' |
const | OPTION_TYPE_RADIO = 'radio' |
const | OPTION_TYPE_CHECKBOX = 'checkbox' |
const | OPTION_TYPE_MULTIPLE = 'multiple' |
const | OPTION_TYPE_DATE = 'date' |
const | OPTION_TYPE_DATE_TIME = 'date_time' |
const | OPTION_TYPE_TIME = 'time' |
Protected Member Functions | |
_getResource () | |
_construct () | |
_clearData () | |
_clearReferences () | |
_getValidationRulesBeforeSave () | |
![]() | |
filterCustomAttributes ($data) | |
initializeCustomAttributes () | |
convertCustomAttributeValues (array &$customAttributes) | |
getCustomAttributesCodes () | |
_setExtensionAttributes (\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes) | |
_getExtensionAttributes () | |
![]() | |
_construct () | |
_init ($resourceModel) | |
_setResourceModel ($resourceName, $collectionName=null) | |
_getResource () | |
_getEventData () | |
_beforeLoad ($modelId, $field=null) | |
_afterLoad () | |
_hasModelChanged () | |
_getValidatorBeforeSave () | |
_createValidatorBeforeSave () | |
_getValidationRulesBeforeSave () | |
_clearReferences () | |
_clearData () | |
![]() | |
_getData ($key) | |
_underscore ($name) | |
Protected Attributes | |
$optionRepository | |
$product | |
$options = [] | |
$values = null | |
$productOptionValue | |
$optionTypeFactory | |
$string | |
$validatorPool | |
![]() | |
$extensionAttributesFactory | |
$extensionAttributes | |
$customAttributeFactory | |
$customAttributesCodes = null | |
$customAttributesChanged = false | |
![]() | |
$_eventPrefix = 'core_abstract' | |
$_eventObject = 'object' | |
$_idFieldName = 'id' | |
$_hasDataChanges = false | |
$_origData | |
$_isDeleted = false | |
$_resource | |
$_resourceCollection | |
$_resourceName | |
$_collectionName | |
$_cacheTag = false | |
$_dataSaveAllowed = true | |
$_isObjectNew = null | |
$_validatorBeforeSave = null | |
$_eventManager | |
$_cacheManager | |
$_registry | |
$_logger | |
$_appState | |
$_actionValidator | |
$storedData = [] | |
![]() | |
$_data = [] | |
Static Protected Attributes | |
static | $typePercent = 'percent' |
![]() | |
static | $_underscoreCache = [] |
Catalog product option model
@api @method int getProductId() @method \Magento\Catalog\Model\Product\Option setProductId(int $value)
Definition at line 32 of file Option.php.
__construct | ( | \Magento\Framework\Model\Context | $context, |
\Magento\Framework\Registry | $registry, | ||
\Magento\Framework\Api\ExtensionAttributesFactory | $extensionFactory, | ||
\Magento\Framework\Api\AttributeValueFactory | $customAttributeFactory, | ||
Option\Value | $productOptionValue, | ||
\Magento\Catalog\Model\Product\Option\Type\Factory | $optionFactory, | ||
\Magento\Framework\Stdlib\StringUtils | $string, | ||
Option\Validator\Pool | $validatorPool, | ||
\Magento\Framework\Model\ResourceModel\AbstractResource | $resource = null , |
||
\Magento\Framework\Data\Collection\AbstractDb | $resourceCollection = null , |
||
array | $data = [] , |
||
ProductCustomOptionValuesInterfaceFactory | $customOptionValuesFactory = null |
||
) |
\Magento\Framework\Model\Context | $context | |
\Magento\Framework\Registry | $registry | |
\Magento\Framework\Api\ExtensionAttributesFactory | $extensionFactory | |
\Magento\Framework\Api\AttributeValueFactory | $customAttributeFactory | |
Option\Value | $productOptionValue | |
Option\Type\Factory | $optionFactory | |
\Magento\Framework\Stdlib\StringUtils | $string | |
Option\Validator\Pool | $validatorPool | |
\Magento\Framework\Model\ResourceModel\AbstractResource | $resource | |
\Magento\Framework\Data\Collection\AbstractDb | $resourceCollection | |
array | $data | |
ProductCustomOptionValuesInterfaceFactory | null | $customOptionValuesFactory | @SuppressWarnings(PHPMD.ExcessiveParameterList) |
Definition at line 126 of file Option.php.
|
protected |
|
protected |
|
protected |
|
protected |
Get resource instance
Definition at line 164 of file Option.php.
|
protected |
addOption | ( | $option | ) |
Add option for save it
array | $option |
Definition at line 241 of file Option.php.
addValue | ( | Option\Value | $value | ) |
Add value of option to values array
Option\Value | $value |
Definition at line 184 of file Option.php.
afterSave | ( | ) |
Definition at line 402 of file Option.php.
beforeSave | ( | ) |
{} @SuppressWarnings(PHPMD.CyclomaticComplexity)
if previous option has different group from one is came now need to remove all data of previous group
Definition at line 352 of file Option.php.
deletePrices | ( | $optionId | ) |
Delete prices of option
int | $optionId |
Definition at line 448 of file Option.php.
deleteTitles | ( | $optionId | ) |
Delete titles of option
int | $optionId |
Definition at line 460 of file Option.php.
duplicate | ( | $oldProductId, | |
$newProductId | |||
) |
Duplicate options for product
int | $oldProductId | |
int | $newProductId |
Definition at line 511 of file Option.php.
getExtensionAttributes | ( | ) |
{Retrieve existing extension attributes object or create a new one.
Implements ProductCustomOptionInterface.
Definition at line 833 of file Option.php.
getFileExtension | ( | ) |
Implements ProductCustomOptionInterface.
Definition at line 654 of file Option.php.
getGroupByType | ( | $type = null | ) |
Get group name of option by given option type
string | $type |
Definition at line 308 of file Option.php.
getImageSizeX | ( | ) |
Implements ProductCustomOptionInterface.
Definition at line 670 of file Option.php.
getImageSizeY | ( | ) |
Implements ProductCustomOptionInterface.
Definition at line 678 of file Option.php.
getIsRequire | ( | ) |
Get is require
Implements ProductCustomOptionInterface.
Definition at line 626 of file Option.php.
getMaxCharacters | ( | ) |
Implements ProductCustomOptionInterface.
Definition at line 662 of file Option.php.
getOptionId | ( | ) |
Get option id
Implements ProductCustomOptionInterface.
Definition at line 585 of file Option.php.
getOptions | ( | ) |
getOptionValuesByOptionId | ( | $optionIds, | |
$storeId | |||
) |
Get collection of values by given option ids
array | $optionIds | |
int | $storeId |
Definition at line 497 of file Option.php.
getPrice | ( | $flag = false | ) |
Return price. If $flag is true and price is percent return converted percent to price
bool | $flag |
Definition at line 432 of file Option.php.
getPriceType | ( | ) |
Get price type
Implements ProductCustomOptionInterface.
Definition at line 636 of file Option.php.
getProduct | ( | ) |
getProductOptionCollection | ( | Product | $product | ) |
Product | $product |
Definition at line 858 of file Option.php.
getProductOptions | ( | Product | $product | ) |
Product | $product |
Definition at line 473 of file Option.php.
getProductSku | ( | ) |
Get product SKU
Implements ProductCustomOptionInterface.
Definition at line 570 of file Option.php.
getRegularPrice | ( | ) |
Return regular price.
Definition at line 844 of file Option.php.
getSearchableData | ( | $productId, | |
$storeId | |||
) |
Retrieve option searchable data
int | $productId | |
int | $storeId |
Definition at line 525 of file Option.php.
getSku | ( | ) |
Get Sku
Implements ProductCustomOptionInterface.
Definition at line 646 of file Option.php.
getSortOrder | ( | ) |
Get sort order
Implements ProductCustomOptionInterface.
Definition at line 615 of file Option.php.
getTitle | ( | ) |
Get option title
Implements ProductCustomOptionInterface.
Definition at line 595 of file Option.php.
getType | ( | ) |
Get option type
Implements ProductCustomOptionInterface.
Definition at line 605 of file Option.php.
getValueById | ( | $valueId | ) |
Get value by given id
int | $valueId |
Definition at line 196 of file Option.php.
getValueInstance | ( | ) |
Retrieve value instance
Definition at line 230 of file Option.php.
getValues | ( | ) |
Implements ProductCustomOptionInterface.
Definition at line 220 of file Option.php.
getValuesCollection | ( | ) |
Get collection of values for current option
Definition at line 483 of file Option.php.
groupFactory | ( | $type | ) |
Group model factory
string | $type | Option type |
LocalizedException |
Definition at line 336 of file Option.php.
hasValues | ( | $type = null | ) |
Whether or not the option type contains sub-values
string | $type |
Definition at line 212 of file Option.php.
setExtensionAttributes | ( | \Magento\Catalog\Api\Data\ProductCustomOptionExtensionInterface | $extensionAttributes | ) |
{Set an extension attributes object.
\Magento\Catalog\Api\Data\ProductCustomOptionExtensionInterface | $extensionAttributes |
\Magento\Catalog\Api\Data\ProductCustomOptionExtensionInterface | $extensionAttributes |
Implements ProductCustomOptionInterface.
Definition at line 890 of file Option.php.
setFileExtension | ( | $fileExtension | ) |
string | $fileExtension |
Implements ProductCustomOptionInterface.
Definition at line 786 of file Option.php.
setImageSizeX | ( | $imageSizeX | ) |
int | $imageSizeX |
Implements ProductCustomOptionInterface.
Definition at line 804 of file Option.php.
setImageSizeY | ( | $imageSizeY | ) |
int | $imageSizeY |
Implements ProductCustomOptionInterface.
Definition at line 813 of file Option.php.
setIsRequire | ( | $isRequired | ) |
Set is require
bool | $isRequired |
Implements ProductCustomOptionInterface.
Definition at line 744 of file Option.php.
setMaxCharacters | ( | $maxCharacters | ) |
int | $maxCharacters |
Implements ProductCustomOptionInterface.
Definition at line 795 of file Option.php.
setOptionId | ( | $optionId | ) |
Set option id
int | $optionId |
Implements ProductCustomOptionInterface.
Definition at line 700 of file Option.php.
setOptions | ( | $options | ) |
Set options for array
array | $options |
Definition at line 263 of file Option.php.
setPrice | ( | $price | ) |
Set price
float | $price |
Implements ProductCustomOptionInterface.
Definition at line 755 of file Option.php.
setPriceType | ( | $priceType | ) |
Set price type
string | $priceType |
Implements ProductCustomOptionInterface.
Definition at line 766 of file Option.php.
setProduct | ( | Product | $product = null | ) |
Set product instance
Product | $product |
Definition at line 296 of file Option.php.
setProductSku | ( | $productSku | ) |
Set product SKU
string | $productSku |
Implements ProductCustomOptionInterface.
Definition at line 689 of file Option.php.
setSku | ( | $sku | ) |
Set Sku
string | $sku |
Implements ProductCustomOptionInterface.
Definition at line 777 of file Option.php.
setSortOrder | ( | $sortOrder | ) |
Set sort order
int | $sortOrder |
Implements ProductCustomOptionInterface.
Definition at line 733 of file Option.php.
setTitle | ( | $title | ) |
Set option title
string | $title |
Implements ProductCustomOptionInterface.
Definition at line 711 of file Option.php.
setType | ( | $type | ) |
Set option type
string | $type |
Implements ProductCustomOptionInterface.
Definition at line 722 of file Option.php.
setValues | ( | array | $values = null | ) |
ProductCustomOptionValuesInterface[] | $values |
Implements ProductCustomOptionInterface.
Definition at line 822 of file Option.php.
unsetOptions | ( | ) |
|
protected |
Definition at line 38 of file Option.php.
|
protected |
Definition at line 70 of file Option.php.
|
protected |
Definition at line 89 of file Option.php.
|
protected |
#- #-
Definition at line 65 of file Option.php.
|
protected |
Definition at line 82 of file Option.php.
|
protected |
Definition at line 94 of file Option.php.
|
staticprotected |
|
protected |
Definition at line 99 of file Option.php.
|
protected |
Definition at line 75 of file Option.php.
const KEY_FILE_EXTENSION = 'file_extension' |
Definition at line 58 of file Option.php.
const KEY_IMAGE_SIZE_X = 'image_size_x' |
Definition at line 61 of file Option.php.
const KEY_IMAGE_SIZE_Y = 'image_size_y' |
Definition at line 60 of file Option.php.
const KEY_IS_REQUIRE = 'is_require' |
Definition at line 54 of file Option.php.
const KEY_MAX_CHARACTERS = 'max_characters' |
Definition at line 59 of file Option.php.
const KEY_OPTION_ID = 'option_id' |
Definition at line 50 of file Option.php.
const KEY_PRICE = 'price' |
Definition at line 55 of file Option.php.
const KEY_PRICE_TYPE = 'price_type' |
Definition at line 56 of file Option.php.
const KEY_PRODUCT_SKU = 'product_sku' |
#+ Constants
Definition at line 49 of file Option.php.
const KEY_SKU = 'sku' |
Definition at line 57 of file Option.php.
const KEY_SORT_ORDER = 'sort_order' |
Definition at line 53 of file Option.php.
const KEY_TITLE = 'title' |
Definition at line 51 of file Option.php.
const KEY_TYPE = 'type' |
Definition at line 52 of file Option.php.