Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
__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) | |
![]() | |
toHtml () | |
Protected Member Functions | |
_addProductAttributesAndPrices (\Magento\Catalog\Model\ResourceModel\Product\Collection $collection) | |
getDetailsRendererList () | |
![]() | |
_construct () | |
_toHtml () | |
getRootDirectory () | |
getMediaDirectory () | |
![]() | |
_construct () | |
_prepareLayout () | |
_beforeToHtml () | |
_afterToHtml ($html) | |
_toHtml () | |
_getNotFoundUrl ($route='', $params=['_direct'=> 'core/index/notFound']) | |
getCacheTags () | |
getCacheLifetime () | |
_loadCache () | |
_saveCache ($data) | |
_getSidPlaceholder ($cacheKey=null) | |
![]() | |
_getData ($key) | |
_underscore ($name) | |
Protected Attributes | |
$_priceBlock = [] | |
$_useLinkForAsLowAs = true | |
$_defaultColumnCount = 3 | |
$_columnCountLayoutDepend = [] | |
$_coreRegistry | |
$_taxData | |
$_catalogConfig | |
$_mathRandom | |
$_cartHelper | |
$_wishlistHelper | |
$_compareProduct | |
$_imageHelper | |
$reviewRenderer | |
$stockRegistry | |
$imageBuilder | |
![]() | |
$_viewVars = [] | |
$_baseUrl | |
$_jsUrl | |
$_allowSymlinks | |
$_filesystem | |
$_template | |
$templateEnginePool | |
$_storeManager | |
$_appState | |
$directory | |
$templateContext | |
$pageConfig | |
$resolver | |
$validator | |
![]() | |
$_design | |
$_session | |
$_sidResolver | |
$_nameInLayout | |
$_layout | |
$jsLayout = [] | |
$_request | |
$_urlBuilder | |
$_eventManager | |
$_frontController | |
$_assetRepo | |
$_viewConfig | |
$_cacheState | |
$_logger | |
$_escaper | |
$filterManager | |
$_localeDate | |
$inlineTranslation | |
$_isScopePrivate = false | |
$_scopeConfig | |
$_cache | |
![]() | |
$_data = [] | |
Additional Inherited Members | |
![]() | |
static | extractModuleName ($className) |
![]() | |
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_' |
![]() | |
static | $_underscoreCache = [] |
Class AbstractProduct @api
Definition at line 16 of file AbstractProduct.php.
__construct | ( | \Magento\Catalog\Block\Product\Context | $context, |
array | $data = [] |
||
) |
|
protected |
Add all attributes and apply pricing logic to products collection to get correct values in different products lists. E.g. crosssells, upsells, new products, recently viewed
\Magento\Catalog\Model\ResourceModel\Product\Collection | $collection |
Definition at line 244 of file AbstractProduct.php.
addColumnCountLayoutDepend | ( | $pageLayout, | |
$columnCount | |||
) |
Add row size depends on page layout
string | $pageLayout | |
int | $columnCount |
Definition at line 319 of file AbstractProduct.php.
displayProductStockStatus | ( | ) |
Get if it is necessary to show product stock status
Definition at line 383 of file AbstractProduct.php.
getAddToCartUrl | ( | $product, | |
$additional = [] |
|||
) |
Retrieve url for add product to cart Will return product view page URL if product has required options
\Magento\Catalog\Model\Product | $product | |
array | $additional |
Definition at line 134 of file AbstractProduct.php.
getAddToCompareUrl | ( | ) |
Retrieve Add Product to Compare Products List URL
Definition at line 189 of file AbstractProduct.php.
getAddToWishlistParams | ( | $product | ) |
Retrieve add to wishlist params
\Magento\Catalog\Model\Product | $product |
Definition at line 179 of file AbstractProduct.php.
getCanShowProductPrice | ( | $product | ) |
Check whether the price can be shown for the specified product
\Magento\Catalog\Model\Product | $product |
Definition at line 373 of file AbstractProduct.php.
getColumnCount | ( | ) |
Retrieve product amount per row
Definition at line 299 of file AbstractProduct.php.
getColumnCountLayoutDepend | ( | $pageLayout | ) |
Retrieve row size depends on page layout
string | $pageLayout |
Definition at line 346 of file AbstractProduct.php.
getDetailsRenderer | ( | $type = null | ) |
null | $type |
Definition at line 479 of file AbstractProduct.php.
|
protected |
Definition at line 494 of file AbstractProduct.php.
getImage | ( | $product, | |
$imageId, | |||
$attributes = [] |
|||
) |
Retrieve product image
\Magento\Catalog\Model\Product | $product | |
string | $imageId | |
array | $attributes |
Definition at line 511 of file AbstractProduct.php.
getMinimalQty | ( | $product | ) |
Gets minimal sales quantity
\Magento\Catalog\Model\Product | $product |
Definition at line 200 of file AbstractProduct.php.
getPageLayout | ( | ) |
getProduct | ( | ) |
Retrieve currently viewed product object
Definition at line 228 of file AbstractProduct.php.
getProductDetailsHtml | ( | \Magento\Catalog\Model\Product | $product | ) |
Retrieve product details html
\Magento\Catalog\Model\Product | $product |
Definition at line 465 of file AbstractProduct.php.
getProductPrice | ( | \Magento\Catalog\Model\Product | $product | ) |
Return HTML block with price
\Magento\Catalog\Model\Product | $product |
Definition at line 408 of file AbstractProduct.php.
getProductUrl | ( | $product, | |
$additional = [] |
|||
) |
Retrieve Product URL using UrlDataObject
\Magento\Catalog\Model\Product | $product | |
array | $additional | the route params |
Definition at line 262 of file AbstractProduct.php.
getRandomString | ( | $length, | |
$chars = null |
|||
) |
Get random string
int | $length | |
string | null | $chars |
Definition at line 397 of file AbstractProduct.php.
getReviewsSummaryHtml | ( | \Magento\Catalog\Model\Product | $product, |
$templateType = false , |
|||
$displayIfNoReviews = false |
|||
) |
Get product reviews summary
\Magento\Catalog\Model\Product | $product | |
bool | $templateType | |
bool | $displayIfNoReviews |
Definition at line 215 of file AbstractProduct.php.
getSubmitUrl | ( | $product, | |
$additional = [] |
|||
) |
Retrieves url for form submitting.
Some objects can use setSubmitRouteData() to set route and params for form submitting, otherwise default url will be used
\Magento\Catalog\Model\Product | $product | |
array | $additional |
Definition at line 160 of file AbstractProduct.php.
hasProductUrl | ( | $product | ) |
Check Product has URL
\Magento\Catalog\Model\Product | $product |
Definition at line 280 of file AbstractProduct.php.
isRedirectToCartEnabled | ( | ) |
removeColumnCountLayoutDepend | ( | $pageLayout | ) |
Remove row size depends on page layout
string | $pageLayout |
Definition at line 331 of file AbstractProduct.php.
|
protected |
Definition at line 73 of file AbstractProduct.php.
|
protected |
Definition at line 63 of file AbstractProduct.php.
|
protected |
Definition at line 42 of file AbstractProduct.php.
|
protected |
Definition at line 83 of file AbstractProduct.php.
|
protected |
Definition at line 49 of file AbstractProduct.php.
|
protected |
Definition at line 35 of file AbstractProduct.php.
|
protected |
Definition at line 88 of file AbstractProduct.php.
|
protected |
Definition at line 68 of file AbstractProduct.php.
|
protected |
Definition at line 21 of file AbstractProduct.php.
|
protected |
Definition at line 56 of file AbstractProduct.php.
|
protected |
Definition at line 28 of file AbstractProduct.php.
|
protected |
Definition at line 78 of file AbstractProduct.php.
|
protected |
Definition at line 104 of file AbstractProduct.php.
|
protected |
Definition at line 93 of file AbstractProduct.php.
|
protected |
Definition at line 98 of file AbstractProduct.php.