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

Go to the source code of this file.

Variables

 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
 
 $installer = Bootstrap::getObjectManager()->create(\Magento\Catalog\Setup\CategorySetup::class)
 
 $data
 
 $optionsPerAttribute = 3
 
 $data ['swatch_input_type'] = 'visual'
 
 $data ['swatchvisual']['value']
 
 $data ['optionvisual']['value']
 
 $data ['options']['option']
 
 $options = []
 
foreach($data['options']['option'] as $optionData) $attribute
 
 $eavConfig = Bootstrap::getObjectManager()->get(\Magento\Eav\Model\Config::class)
 
 $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class)
 
 $category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Category::class)
 
 $indexerCollection = Bootstrap::getObjectManager()->get(\Magento\Indexer\Model\Indexer\Collection::class)
 

Variable Documentation

◆ $attribute

$attribute
Initial value:
= $objectManager->create(
\Magento\Catalog\Api\Data\ProductAttributeInterface::class,
['data' => $data]
)

Definition at line 82 of file products_with_layered_navigation_swatch.php.

◆ $category

$category = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Category::class)

Definition at line 176 of file products_with_layered_navigation_swatch.php.

◆ $data [1/5]

$data
Initial value:
= [
'attribute_code' => 'color_swatch',
'entity_type_id' => $installer->getEntityTypeId('catalog_product'),
'is_global' => 1,
'is_user_defined' => 1,
'frontend_input' => 'select',
'is_unique' => 0,
'is_required' => 0,
'is_searchable' => 1,
'is_visible_in_advanced_search' => 1,
'is_comparable' => 1,
'is_filterable' => 1,
'is_filterable_in_search' => 1,
'is_used_for_promo_rules' => 0,
'is_html_allowed_on_front' => 1,
'is_visible_on_front' => 1,
'used_in_product_listing' => 1,
'used_for_sort_by' => 1,
'frontend_label' => ['Test Swatch'],
'backend_type' => 'int',
'use_product_image_for_swatch' => 0,
'update_product_preview_image' => 0,
]

Definition at line 16 of file products_with_layered_navigation_swatch.php.

◆ $data [2/5]

$data[ 'swatch_input_type'] = 'visual'

Definition at line 41 of file products_with_layered_navigation_swatch.php.

◆ $data [3/5]

$data[ 'swatchvisual'][ 'value']
Initial value:
= array_reduce(
function ($values, $index) use ($optionsPerAttribute) {
$values['option_' . $index] = '#'
. str_repeat(
dechex(255 * $index / $optionsPerAttribute),
3
);
return $values;
},
[]
)
$values
Definition: options.phtml:88
$index
Definition: list.phtml:44

Definition at line 42 of file products_with_layered_navigation_swatch.php.

◆ $data [4/5]

$data[ 'optionvisual'][ 'value']
Initial value:
= array_reduce(
function ($values, $index) use ($optionsPerAttribute) {
$values['option_' . $index] = ['option ' . $index];
return $values;
},
[]
)
$values
Definition: options.phtml:88
$index
Definition: list.phtml:44

Definition at line 54 of file products_with_layered_navigation_swatch.php.

◆ $data [5/5]

$data[ 'options'][ 'option']
Initial value:
= array_reduce(
function ($values, $index) use ($optionsPerAttribute) {
$values[] = [
'label' => 'option ' . $index,
'value' => 'option_' . $index,
];
return $values;
},
[]
)
$values
Definition: options.phtml:88
$index
Definition: list.phtml:44

Definition at line 63 of file products_with_layered_navigation_swatch.php.

◆ $eavConfig

$eavConfig = Bootstrap::getObjectManager()->get(\Magento\Eav\Model\Config::class)

Definition at line 93 of file products_with_layered_navigation_swatch.php.

◆ $indexerCollection

$indexerCollection = Bootstrap::getObjectManager()->get(\Magento\Indexer\Model\Indexer\Collection::class)

Definition at line 203 of file products_with_layered_navigation_swatch.php.

◆ $installer

$installer = Bootstrap::getObjectManager()->create(\Magento\Catalog\Setup\CategorySetup::class)

Definition at line 14 of file products_with_layered_navigation_swatch.php.

◆ $objectManager

Definition at line 12 of file products_with_layered_navigation_swatch.php.

◆ $options

$options = []

Definition at line 75 of file products_with_layered_navigation_swatch.php.

◆ $optionsPerAttribute

$optionsPerAttribute = 3

Definition at line 39 of file products_with_layered_navigation_swatch.php.

◆ $product

$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class)

Definition at line 106 of file products_with_layered_navigation_swatch.php.