Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
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 () | |
![]() | |
__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 () | |
![]() | |
__construct (\Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, array $data=[]) | |
getProduct () | |
decorateArray ($array, $prefix='decorated_', $forceSetAll=false) | |
![]() | |
__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=[]) | |
![]() | |
__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 () | |
![]() | |
__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 () | |
![]() | |
__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' |
![]() | |
const | XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink' |
![]() | |
const | CACHE_GROUP = \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER |
const | CACHE_KEY_PREFIX = 'BLOCK_' |
Additional Inherited Members | |
![]() | |
static | extractModuleName ($className) |
![]() | |
static | $_underscoreCache = [] |
Swatch renderer block
@api @SuppressWarnings(PHPMD.CouplingBetweenObjects)
Definition at line 32 of file Configurable.php.
__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)
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.
|
protected |
Return HTML code
Definition at line 437 of file Configurable.php.
|
protected |
Add media from variation
array | $swatch | |
integer | $optionId | |
array | $attributeDataArray |
Definition at line 294 of file Configurable.php.
|
protected |
Add Swatch Data for attribute
array | $options | |
array | $swatchesCollectionArray | |
array | $attributeDataArray |
Definition at line 269 of file Configurable.php.
|
protected |
Retrieve Swatch data for config
array | $swatchDataArray |
Definition at line 314 of file Configurable.php.
getCacheKey | ( | ) |
Get Key for caching block content
Definition at line 149 of file Configurable.php.
|
protected |
|
protected |
Definition at line 459 of file Configurable.php.
getIdentities | ( | ) |
Return unique ID(s) for each object in system
Implements IdentityInterface.
Definition at line 478 of file Configurable.php.
getJsonSwatchConfig | ( | ) |
Get Swatch config data
Definition at line 170 of file Configurable.php.
getJsonSwatchSizeConfig | ( | ) |
Get Swatch image size config data.
Definition at line 492 of file Configurable.php.
getMediaCallback | ( | ) |
Definition at line 467 of file Configurable.php.
getNumberSwatchesPerProduct | ( | ) |
Get number of swatches from config to show on product listing. Other swatches can be shown after click button 'Show more'
Definition at line 196 of file Configurable.php.
getProduct | ( | ) |
Override parent function
Definition at line 221 of file Configurable.php.
|
protected |
Return renderer template
Template for product with swatches is different from product without swatches
Definition at line 449 of file Configurable.php.
|
protected |
Definition at line 233 of file Configurable.php.
|
protected |
Product | $childProduct | |
string | $imageType |
Definition at line 371 of file Configurable.php.
|
protected |
Generate Product Media array
string | $attributeCode | |
integer | $optionId |
Definition at line 341 of file Configurable.php.
|
protected |
@codeCoverageIgnore
Definition at line 244 of file Configurable.php.
|
protected |
Product | $product | |
string | $imageType |
Definition at line 391 of file Configurable.php.
|
protected |
Check that product has at least one swatch attribute
Definition at line 255 of file Configurable.php.
setProduct | ( | Product | $product | ) |
Set product to block
Product | $product |
Definition at line 210 of file Configurable.php.
toHtml | ( | ) |
Produce and return block's html output
Implements BlockInterface.
Definition at line 423 of file Configurable.php.
|
protected |
Definition at line 82 of file Configurable.php.
|
protected |
Definition at line 63 of file Configurable.php.
|
protected |
Definition at line 68 of file Configurable.php.
|
protected |
Definition at line 73 of file Configurable.php.
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.
const MEDIA_CALLBACK_ACTION = 'swatches/ajax/media' |
Action name for ajax request
Definition at line 48 of file Configurable.php.
const SWATCH_IMAGE_NAME = 'swatchImage' |
Name of swatch image for json config
Definition at line 53 of file Configurable.php.
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.
const SWATCH_THUMBNAIL_NAME = 'swatchThumb' |
Name of swatch thumbnail for json config
Definition at line 58 of file Configurable.php.