Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Variables
configurable_product.php File Reference

Go to the source code of this file.

Variables

 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
 
 $storeManager = $objectManager->get(\Magento\Store\Model\StoreManager::class)
 
 $store = $storeManager->getStore('default')
 
 $productRepository = $objectManager->get(\Magento\Catalog\Api\ProductRepositoryInterface::class)
 
 $installer = $objectManager->get(\Magento\Catalog\Setup\CategorySetup::class)
 
 $attributeSetId = $installer->getAttributeSetId('catalog_product', 'Default')
 
 $attributeValues = []
 
 $associatedProductIds = []
 
 $attributeRepository = $objectManager->get(\Magento\Eav\Api\AttributeRepositoryInterface::class)
 
 $attribute = $attributeRepository->get('catalog_product', 'test_configurable')
 
 $options = $attribute->getOptions()
 
foreach(['simple1', 'simple2'] as $sku) $product
 
 $configurableAttributesData
 
 $optionsFactory = $objectManager->get(\Magento\ConfigurableProduct\Helper\Product\Options\Factory::class)
 
 $configurableOptions = $optionsFactory->create($configurableAttributesData)
 
 $extensionConfigurableAttributes = $product->getExtensionAttributes()
 

Variable Documentation

◆ $associatedProductIds

$associatedProductIds = []

Definition at line 20 of file configurable_product.php.

◆ $attribute

$attribute = $attributeRepository->get('catalog_product', 'test_configurable')

Definition at line 23 of file configurable_product.php.

◆ $attributeRepository

$attributeRepository = $objectManager->get(\Magento\Eav\Api\AttributeRepositoryInterface::class)

Definition at line 22 of file configurable_product.php.

◆ $attributeSetId

$attributeSetId = $installer->getAttributeSetId('catalog_product', 'Default')

Definition at line 18 of file configurable_product.php.

◆ $attributeValues

$attributeValues = []

Definition at line 19 of file configurable_product.php.

◆ $configurableAttributesData

$configurableAttributesData
Initial value:
= [
[
'attribute_id' => $attribute->getId(),
'code' => $attribute->getAttributeCode(),
'label' => $attribute->getStoreLabel(),
'position' => '0',
'values' => $attributeValues,
],
]

Definition at line 54 of file configurable_product.php.

◆ $configurableOptions

$configurableOptions = $optionsFactory->create($configurableAttributesData)

Definition at line 64 of file configurable_product.php.

◆ $extensionConfigurableAttributes

$extensionConfigurableAttributes = $product->getExtensionAttributes()

Definition at line 65 of file configurable_product.php.

◆ $installer

$installer = $objectManager->get(\Magento\Catalog\Setup\CategorySetup::class)

Definition at line 17 of file configurable_product.php.

◆ $objectManager

Definition at line 11 of file configurable_product.php.

◆ $options

$options = $attribute->getOptions()

Definition at line 24 of file configurable_product.php.

◆ $optionsFactory

$optionsFactory = $objectManager->get(\Magento\ConfigurableProduct\Helper\Product\Options\Factory::class)

Definition at line 63 of file configurable_product.php.

◆ $product

foreach ([ 'simple1', 'simple2'] as $sku) $product
Initial value:
= $objectManager->create(\Magento\Catalog\Model\Product::class)
->setTypeId('configurable')
->setId(666)
->setAttributeSetId($attributeSetId)
->setWebsiteIds([1])
->setName('Configurable Product')
->setSku('configurable')
->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
->setStockData([
'use_config_manage_stock' => 1,
'qty' => 100,
'is_qty_decimal' => 0,
'is_in_stock' => 1,
])

Definition at line 39 of file configurable_product.php.

◆ $productRepository

$productRepository = $objectManager->get(\Magento\Catalog\Api\ProductRepositoryInterface::class)

Definition at line 15 of file configurable_product.php.

◆ $store

$store = $storeManager->getStore('default')

Definition at line 14 of file configurable_product.php.

◆ $storeManager

$storeManager = $objectManager->get(\Magento\Store\Model\StoreManager::class)

Definition at line 13 of file configurable_product.php.