Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
Configurable Class Reference
Inheritance diagram for Configurable:
Configurable IdentityInterface AbstractView AbstractProduct Template AbstractBlock DataObject BlockInterface Configurable

Public Member Functions

 __construct (Context $context, ArrayUtils $arrayUtils, EncoderInterface $jsonEncoder, Data $helper, CatalogProduct $catalogProduct, CurrentCustomer $currentCustomer, PriceCurrencyInterface $priceCurrency, ConfigurableAttributeData $configurableAttributeData, SwatchData $swatchHelper, Media $swatchMediaHelper, array $data=[], SwatchAttributesProvider $swatchAttributesProvider=null, UrlBuilder $imageUrlBuilder=null)
 
 getCacheKey ()
 
 getJsonSwatchConfig ()
 
 getNumberSwatchesPerProduct ()
 
 setProduct (Product $product)
 
 getProduct ()
 
 toHtml ()
 
 getMediaCallback ()
 
 getIdentities ()
 
 getJsonSwatchSizeConfig ()
 
- Public Member Functions inherited from Configurable
 __construct (\Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\ConfigurableProduct\Helper\Data $helper, \Magento\Catalog\Helper\Product $catalogProduct, CurrentCustomer $currentCustomer, PriceCurrencyInterface $priceCurrency, ConfigurableAttributeData $configurableAttributeData, array $data=[], Format $localeFormat=null, Session $customerSession=null, \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Variations\Prices $variationPrices=null)
 
 getCacheKeyInfo ()
 
 getAllowAttributes ()
 
 getAllowProducts ()
 
 getCurrentStore ()
 
 getJsonConfig ()
 
 showMinimalPrice ()
 
- Public Member Functions inherited from AbstractView
 __construct (\Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, array $data=[])
 
 getProduct ()
 
 decorateArray ($array, $prefix='decorated_', $forceSetAll=false)
 
- Public Member Functions inherited from AbstractProduct
 __construct (\Magento\Catalog\Block\Product\Context $context, array $data=[])
 
 getAddToCartUrl ($product, $additional=[])
 
 getSubmitUrl ($product, $additional=[])
 
 getAddToWishlistParams ($product)
 
 getAddToCompareUrl ()
 
 getMinimalQty ($product)
 
 getReviewsSummaryHtml (\Magento\Catalog\Model\Product $product, $templateType=false, $displayIfNoReviews=false)
 
 getProduct ()
 
 getProductUrl ($product, $additional=[])
 
 hasProductUrl ($product)
 
 getColumnCount ()
 
 addColumnCountLayoutDepend ($pageLayout, $columnCount)
 
 removeColumnCountLayoutDepend ($pageLayout)
 
 getColumnCountLayoutDepend ($pageLayout)
 
 getPageLayout ()
 
 getCanShowProductPrice ($product)
 
 displayProductStockStatus ()
 
 getRandomString ($length, $chars=null)
 
 getProductPrice (\Magento\Catalog\Model\Product $product)
 
 isRedirectToCartEnabled ()
 
 getProductDetailsHtml (\Magento\Catalog\Model\Product $product)
 
 getDetailsRenderer ($type=null)
 
 getImage ($product, $imageId, $attributes=[])
 
- Public Member Functions inherited from Template
 __construct (Template\Context $context, array $data=[])
 
 setTemplateContext ($templateContext)
 
 getTemplate ()
 
 setTemplate ($template)
 
 getTemplateFile ($template=null)
 
 getArea ()
 
 assign ($key, $value=null)
 
 fetchView ($fileName)
 
 getBaseUrl ()
 
 getObjectData (\Magento\Framework\DataObject $object, $key)
 
 getCacheKeyInfo ()
 
- Public Member Functions inherited from AbstractBlock
 __construct (\Magento\Framework\View\Element\Context $context, array $data=[])
 
 getJsLayout ()
 
 getRequest ()
 
 getParentBlock ()
 
 setLayout (\Magento\Framework\View\LayoutInterface $layout)
 
 getLayout ()
 
 setNameInLayout ($name)
 
 getChildNames ()
 
 setAttribute ($name, $value=null)
 
 setChild ($alias, $block)
 
 addChild ($alias, $block, $data=[])
 
 unsetChild ($alias)
 
 unsetCallChild ($alias, $callback, $result, $params)
 
 unsetChildren ()
 
 getChildBlock ($alias)
 
 getChildHtml ($alias='', $useCache=true)
 
 getChildChildHtml ($alias, $childChildAlias='', $useCache=true)
 
 getBlockHtml ($name)
 
 insert ($element, $siblingName=0, $after=true, $alias='')
 
 append ($element, $alias='')
 
 getGroupChildNames ($groupName)
 
 getChildData ($alias, $key='')
 
 getUiId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getJsId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getUrl ($route='', $params=[])
 
 getViewFileUrl ($fileId, array $params=[])
 
 formatDate ( $date=null, $format=\IntlDateFormatter::SHORT, $showTime=false, $timezone=null)
 
 formatTime ( $time=null, $format=\IntlDateFormatter::SHORT, $showDate=false)
 
 getModuleName ()
 
 escapeHtml ($data, $allowedTags=null)
 
 escapeJs ($string)
 
 escapeHtmlAttr ($string, $escapeSingleQuote=true)
 
 escapeCss ($string)
 
 stripTags ($data, $allowableTags=null, $allowHtmlEntities=false)
 
 escapeUrl ($string)
 
 escapeXssInUrl ($data)
 
 escapeQuote ($data, $addSlashes=false)
 
 escapeJsQuote ($data, $quote='\'')
 
 getNameInLayout ()
 
 getCacheKeyInfo ()
 
 getCacheKey ()
 
 getVar ($name, $module=null)
 
 isScopePrivate ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 

Data Fields

const SWATCH_RENDERER_TEMPLATE = 'Magento_Swatches::product/view/renderer.phtml'
 
const CONFIGURABLE_RENDERER_TEMPLATE = 'Magento_ConfigurableProduct::product/view/type/options/configurable.phtml'
 
const MEDIA_CALLBACK_ACTION = 'swatches/ajax/media'
 
const SWATCH_IMAGE_NAME = 'swatchImage'
 
const SWATCH_THUMBNAIL_NAME = 'swatchThumb'
 
- Data Fields inherited from Template
const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink'
 
- Data Fields inherited from AbstractBlock
const CACHE_GROUP = \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER
 
const CACHE_KEY_PREFIX = 'BLOCK_'
 

Protected Member Functions

 getCacheLifetime ()
 
 getSwatchAttributesData ()
 
 initIsProductHasSwatchAttribute ()
 
 isProductHasSwatchAttribute ()
 
 addSwatchDataForAttribute (array $options, array $swatchesCollectionArray, array $attributeDataArray)
 
 addAdditionalMediaData (array $swatch, $optionId, array $attributeDataArray)
 
 extractNecessarySwatchData (array $swatchDataArray)
 
 getVariationMedia ($attributeCode, $optionId)
 
 getSwatchProductImage (Product $childProduct, $imageType)
 
 isProductHasImage (Product $product, $imageType)
 
 _toHtml ()
 
 getRendererTemplate ()
 
 getHtmlOutput ()
 
- Protected Member Functions inherited from Configurable
 _getAdditionalConfig ()
 
 getOptionImages ()
 
 getOptionPrices ()
 
 _registerJsPrice ($price)
 
- Protected Member Functions inherited from AbstractProduct
 _addProductAttributesAndPrices (\Magento\Catalog\Model\ResourceModel\Product\Collection $collection)
 
 getDetailsRendererList ()
 
- Protected Member Functions inherited from Template
 _construct ()
 
 _toHtml ()
 
 getRootDirectory ()
 
 getMediaDirectory ()
 
- Protected Member Functions inherited from AbstractBlock
 _construct ()
 
 _prepareLayout ()
 
 _beforeToHtml ()
 
 _afterToHtml ($html)
 
 _toHtml ()
 
 _getNotFoundUrl ($route='', $params=['_direct'=> 'core/index/notFound'])
 
 getCacheTags ()
 
 getCacheLifetime ()
 
 _loadCache ()
 
 _saveCache ($data)
 
 _getSidPlaceholder ($cacheKey=null)
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Protected Attributes

 $product
 
 $swatchHelper
 
 $swatchMediaHelper
 
 $isProductHasSwatchAttribute
 
- Protected Attributes inherited from Configurable
 $catalogProduct = null
 
 $currentCustomer
 
 $_prices = []
 
 $jsonEncoder
 
 $helper
 
 $priceCurrency
 
 $configurableAttributeData
 
- Protected Attributes inherited from AbstractView
 $arrayUtils
 
- Protected Attributes inherited from AbstractProduct
 $_priceBlock = []
 
 $_useLinkForAsLowAs = true
 
 $_defaultColumnCount = 3
 
 $_columnCountLayoutDepend = []
 
 $_coreRegistry
 
 $_taxData
 
 $_catalogConfig
 
 $_mathRandom
 
 $_cartHelper
 
 $_wishlistHelper
 
 $_compareProduct
 
 $_imageHelper
 
 $reviewRenderer
 
 $stockRegistry
 
 $imageBuilder
 
- Protected Attributes inherited from Template
 $_viewVars = []
 
 $_baseUrl
 
 $_jsUrl
 
 $_allowSymlinks
 
 $_filesystem
 
 $_template
 
 $templateEnginePool
 
 $_storeManager
 
 $_appState
 
 $directory
 
 $templateContext
 
 $pageConfig
 
 $resolver
 
 $validator
 
- Protected Attributes inherited from AbstractBlock
 $_design
 
 $_session
 
 $_sidResolver
 
 $_nameInLayout
 
 $_layout
 
 $jsLayout = []
 
 $_request
 
 $_urlBuilder
 
 $_eventManager
 
 $_frontController
 
 $_assetRepo
 
 $_viewConfig
 
 $_cacheState
 
 $_logger
 
 $_escaper
 
 $filterManager
 
 $_localeDate
 
 $inlineTranslation
 
 $_isScopePrivate = false
 
 $_scopeConfig
 
 $_cache
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractBlock
static extractModuleName ($className)
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Swatch renderer block

@api @SuppressWarnings(PHPMD.CouplingBetweenObjects)

Since
100.0.2

Definition at line 32 of file Configurable.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Context  $context,
ArrayUtils  $arrayUtils,
EncoderInterface  $jsonEncoder,
Data  $helper,
CatalogProduct  $catalogProduct,
CurrentCustomer  $currentCustomer,
PriceCurrencyInterface  $priceCurrency,
ConfigurableAttributeData  $configurableAttributeData,
SwatchData  $swatchHelper,
Media  $swatchMediaHelper,
array  $data = [],
SwatchAttributesProvider  $swatchAttributesProvider = null,
UrlBuilder  $imageUrlBuilder = null 
)

@SuppressWarnings(PHPMD.ExcessiveParameterList)

Parameters
Context$context
ArrayUtils$arrayUtils
EncoderInterface$jsonEncoder
Data$helper
CatalogProduct$catalogProduct
CurrentCustomer$currentCustomer
PriceCurrencyInterface$priceCurrency
ConfigurableAttributeData$configurableAttributeData
SwatchData$swatchHelper
Media$swatchMediaHelper
array$data
SwatchAttributesProvider | null$swatchAttributesProvider
UrlBuilder | null$imageUrlBuilder

Definition at line 110 of file Configurable.php.

124  {
125  $this->swatchHelper = $swatchHelper;
126  $this->swatchMediaHelper = $swatchMediaHelper;
127  $this->swatchAttributesProvider = $swatchAttributesProvider
128  ?: ObjectManager::getInstance()->get(SwatchAttributesProvider::class);
129  $this->imageUrlBuilder = $imageUrlBuilder ?? ObjectManager::getInstance()->get(UrlBuilder::class);
130  parent::__construct(
131  $context,
132  $arrayUtils,
133  $jsonEncoder,
134  $helper,
139  $data
140  );
141  }

Member Function Documentation

◆ _toHtml()

_toHtml ( )
protected

Return HTML code

Returns
string

Definition at line 437 of file Configurable.php.

438  {
439  return $this->getHtmlOutput();
440  }

◆ addAdditionalMediaData()

addAdditionalMediaData ( array  $swatch,
  $optionId,
array  $attributeDataArray 
)
protected

Add media from variation

Parameters
array$swatch
integer$optionId
array$attributeDataArray
Returns
array

Definition at line 294 of file Configurable.php.

295  {
296  if (isset($attributeDataArray['use_product_image_for_swatch'])
297  && $attributeDataArray['use_product_image_for_swatch']
298  ) {
299  $variationMedia = $this->getVariationMedia($attributeDataArray['attribute_code'], $optionId);
300  if (! empty($variationMedia)) {
301  $swatch['type'] = Swatch::SWATCH_TYPE_VISUAL_IMAGE;
302  $swatch = array_merge($swatch, $variationMedia);
303  }
304  }
305  return $swatch;
306  }

◆ addSwatchDataForAttribute()

addSwatchDataForAttribute ( array  $options,
array  $swatchesCollectionArray,
array  $attributeDataArray 
)
protected

Add Swatch Data for attribute

Parameters
array$options
array$swatchesCollectionArray
array$attributeDataArray
Returns
array

Definition at line 269 of file Configurable.php.

273  {
274  $result = [];
275  foreach ($options as $optionId => $label) {
276  if (isset($swatchesCollectionArray[$optionId])) {
277  $result[$optionId] = $this->extractNecessarySwatchData($swatchesCollectionArray[$optionId]);
278  $result[$optionId] = $this->addAdditionalMediaData($result[$optionId], $optionId, $attributeDataArray);
279  $result[$optionId]['label'] = $label;
280  }
281  }
282 
283  return $result;
284  }
$label
Definition: details.phtml:21
addAdditionalMediaData(array $swatch, $optionId, array $attributeDataArray)

◆ extractNecessarySwatchData()

extractNecessarySwatchData ( array  $swatchDataArray)
protected

Retrieve Swatch data for config

Parameters
array$swatchDataArray
Returns
array

Definition at line 314 of file Configurable.php.

315  {
316  $result['type'] = $swatchDataArray['type'];
317 
318  if ($result['type'] == Swatch::SWATCH_TYPE_VISUAL_IMAGE && !empty($swatchDataArray['value'])) {
319  $result['value'] = $this->swatchMediaHelper->getSwatchAttributeImage(
321  $swatchDataArray['value']
322  );
323  $result['thumb'] = $this->swatchMediaHelper->getSwatchAttributeImage(
325  $swatchDataArray['value']
326  );
327  } else {
328  $result['value'] = $swatchDataArray['value'];
329  }
330 
331  return $result;
332  }

◆ getCacheKey()

getCacheKey ( )

Get Key for caching block content

Returns
string
Since
100.1.0

Definition at line 149 of file Configurable.php.

150  {
151  return parent::getCacheKey() . '-' . $this->getProduct()->getId();
152  }

◆ getCacheLifetime()

getCacheLifetime ( )
protected

Get block cache life time

Returns
int
Since
100.1.0

Definition at line 160 of file Configurable.php.

161  {
162  return parent::hasCacheLifetime() ? parent::getCacheLifetime() : 3600;
163  }

◆ getHtmlOutput()

getHtmlOutput ( )
protected
Deprecated:
100.1.5 Now is used _toHtml() directly
Returns
string

Definition at line 459 of file Configurable.php.

460  {
461  return parent::_toHtml();
462  }

◆ getIdentities()

getIdentities ( )

Return unique ID(s) for each object in system

Returns
string[]
Since
100.1.0

Implements IdentityInterface.

Definition at line 478 of file Configurable.php.

479  {
480  if ($this->product instanceof \Magento\Framework\DataObject\IdentityInterface) {
481  return $this->product->getIdentities();
482  } else {
483  return [];
484  }
485  }

◆ getJsonSwatchConfig()

getJsonSwatchConfig ( )

Get Swatch config data

Returns
string

Definition at line 170 of file Configurable.php.

171  {
173  $allOptionIds = $this->getConfigurableOptionsIds($attributesData);
174  $swatchesData = $this->swatchHelper->getSwatchesByOptionsId($allOptionIds);
175 
176  $config = [];
177  foreach ($attributesData as $attributeId => $attributeDataArray) {
178  if (isset($attributeDataArray['options'])) {
179  $config[$attributeId] = $this->addSwatchDataForAttribute(
180  $attributeDataArray['options'],
181  $swatchesData,
182  $attributeDataArray
183  );
184  }
185  }
186 
187  return $this->jsonEncoder->encode($config);
188  }
$config
Definition: fraud_order.php:17
$attributesData
addSwatchDataForAttribute(array $options, array $swatchesCollectionArray, array $attributeDataArray)

◆ getJsonSwatchSizeConfig()

getJsonSwatchSizeConfig ( )

Get Swatch image size config data.

Returns
string

Definition at line 492 of file Configurable.php.

493  {
494  $imageConfig = $this->swatchMediaHelper->getImageConfig();
495  $sizeConfig = [];
496 
497  $sizeConfig[self::SWATCH_IMAGE_NAME]['width'] = $imageConfig[Swatch::SWATCH_IMAGE_NAME]['width'];
498  $sizeConfig[self::SWATCH_IMAGE_NAME]['height'] = $imageConfig[Swatch::SWATCH_IMAGE_NAME]['height'];
499  $sizeConfig[self::SWATCH_THUMBNAIL_NAME]['height'] = $imageConfig[Swatch::SWATCH_THUMBNAIL_NAME]['height'];
500  $sizeConfig[self::SWATCH_THUMBNAIL_NAME]['width'] = $imageConfig[Swatch::SWATCH_THUMBNAIL_NAME]['width'];
501 
502  return $this->jsonEncoder->encode($sizeConfig);
503  }

◆ getMediaCallback()

getMediaCallback ( )
Returns
string

Definition at line 467 of file Configurable.php.

468  {
469  return $this->getUrl(self::MEDIA_CALLBACK_ACTION, ['_secure' => $this->getRequest()->isSecure()]);
470  }

◆ getNumberSwatchesPerProduct()

getNumberSwatchesPerProduct ( )

Get number of swatches from config to show on product listing. Other swatches can be shown after click button 'Show more'

Returns
string

Definition at line 196 of file Configurable.php.

197  {
198  return $this->_scopeConfig->getValue(
199  'catalog/frontend/swatches_per_product',
201  );
202  }

◆ getProduct()

getProduct ( )

Override parent function

Returns
Product

Definition at line 221 of file Configurable.php.

222  {
223  if (!$this->product) {
224  $this->product = parent::getProduct();
225  }
226 
227  return $this->product;
228  }

◆ getRendererTemplate()

getRendererTemplate ( )
protected

Return renderer template

Template for product with swatches is different from product without swatches

Returns
string

Definition at line 449 of file Configurable.php.

◆ getSwatchAttributesData()

getSwatchAttributesData ( )
protected
Returns
array

Definition at line 233 of file Configurable.php.

234  {
235  return $this->swatchHelper->getSwatchAttributesAsArray($this->getProduct());
236  }

◆ getSwatchProductImage()

getSwatchProductImage ( Product  $childProduct,
  $imageType 
)
protected
Parameters
Product$childProduct
string$imageType
Returns
string

Definition at line 371 of file Configurable.php.

372  {
374  $swatchImageId = $imageType;
375  $imageAttributes = ['type' => Swatch::SWATCH_IMAGE_NAME];
376  } elseif ($this->isProductHasImage($childProduct, 'image')) {
377  $swatchImageId = $imageType == Swatch::SWATCH_IMAGE_NAME ? 'swatch_image_base' : 'swatch_thumb_base';
378  $imageAttributes = ['type' => 'image'];
379  }
380 
381  if (!empty($swatchImageId) && !empty($imageAttributes['type'])) {
382  return $this->imageUrlBuilder->getUrl($childProduct->getData($imageAttributes['type']), $swatchImageId);
383  }
384  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17

◆ getVariationMedia()

getVariationMedia (   $attributeCode,
  $optionId 
)
protected

Generate Product Media array

Parameters
string$attributeCode
integer$optionId
Returns
array

Definition at line 341 of file Configurable.php.

342  {
343  $variationProduct = $this->swatchHelper->loadFirstVariationWithSwatchImage(
344  $this->getProduct(),
346  );
347 
348  if (!$variationProduct) {
349  $variationProduct = $this->swatchHelper->loadFirstVariationWithImage(
350  $this->getProduct(),
352  );
353  }
354 
355  $variationMediaArray = [];
356  if ($variationProduct) {
357  $variationMediaArray = [
358  'value' => $this->getSwatchProductImage($variationProduct, Swatch::SWATCH_IMAGE_NAME),
359  'thumb' => $this->getSwatchProductImage($variationProduct, Swatch::SWATCH_THUMBNAIL_NAME),
360  ];
361  }
362 
363  return $variationMediaArray;
364  }
getSwatchProductImage(Product $childProduct, $imageType)
$attributeCode
Definition: extend.phtml:12

◆ initIsProductHasSwatchAttribute()

initIsProductHasSwatchAttribute ( )
protected
Deprecated:
100.2.0 Method isProductHasSwatchAttribute() is used instead of this.

@codeCoverageIgnore

Returns
void

Definition at line 244 of file Configurable.php.

245  {
246  $this->isProductHasSwatchAttribute = $this->swatchHelper->isProductHasSwatch($this->getProduct());
247  }

◆ isProductHasImage()

isProductHasImage ( Product  $product,
  $imageType 
)
protected
Parameters
Product$product
string$imageType
Returns
bool

Definition at line 391 of file Configurable.php.

392  {
393  return $product->getData($imageType) !== null && $product->getData($imageType) != SwatchData::EMPTY_IMAGE_VALUE;
394  }

◆ isProductHasSwatchAttribute()

isProductHasSwatchAttribute ( )
protected

Check that product has at least one swatch attribute

Returns
bool
Since
100.1.5

Definition at line 255 of file Configurable.php.

256  {
257  $swatchAttributes = $this->swatchAttributesProvider->provide($this->getProduct());
258  return count($swatchAttributes) > 0;
259  }

◆ setProduct()

setProduct ( Product  $product)

Set product to block

Parameters
Product$product
Returns
$this

Definition at line 210 of file Configurable.php.

211  {
212  $this->product = $product;
213  return $this;
214  }

◆ toHtml()

toHtml ( )

Produce and return block's html output

Returns
string
Since
100.2.0

Implements BlockInterface.

Definition at line 423 of file Configurable.php.

424  {
425  $this->setTemplate(
426  $this->getRendererTemplate()
427  );
428 
429  return parent::toHtml();
430  }

Field Documentation

◆ $isProductHasSwatchAttribute

Definition at line 82 of file Configurable.php.

◆ $product

$product
protected

Definition at line 63 of file Configurable.php.

◆ $swatchHelper

$swatchHelper
protected

Definition at line 68 of file Configurable.php.

◆ $swatchMediaHelper

$swatchMediaHelper
protected

Definition at line 73 of file Configurable.php.

◆ CONFIGURABLE_RENDERER_TEMPLATE

const CONFIGURABLE_RENDERER_TEMPLATE = 'Magento_ConfigurableProduct::product/view/type/options/configurable.phtml'

Path to default template file with standard Configurable renderer.

Definition at line 43 of file Configurable.php.

◆ MEDIA_CALLBACK_ACTION

const MEDIA_CALLBACK_ACTION = 'swatches/ajax/media'

Action name for ajax request

Definition at line 48 of file Configurable.php.

◆ SWATCH_IMAGE_NAME

const SWATCH_IMAGE_NAME = 'swatchImage'

Name of swatch image for json config

Definition at line 53 of file Configurable.php.

◆ SWATCH_RENDERER_TEMPLATE

const SWATCH_RENDERER_TEMPLATE = 'Magento_Swatches::product/view/renderer.phtml'

Path to template file with Swatch renderer.

Definition at line 38 of file Configurable.php.

◆ SWATCH_THUMBNAIL_NAME

const SWATCH_THUMBNAIL_NAME = 'swatchThumb'

Name of swatch thumbnail for json config

Definition at line 58 of file Configurable.php.


The documentation for this class was generated from the following file: