如何在最近查看的产品中显示色样

时间:2018-10-16 12:12:48

标签: magento magento2

在phtml文件中,我刚刚添加了以下代码

$swatchBlock = $this->getLayout()
    ->createBlock("Magento\Swatches\Block\Product\Renderer\Listing\Configurable")
    ->setTemplate("Magento_Swatches::product/listing/renderer_widget.phtml");
echo $swatchBlock->setProduct($_item)->toHtml();

但最近基于UI组件和phtml进行查看的情况

$block->renderApp([
'widget_columns' => [
    'displayMode' => 'grid'
],
'image' => [
    'imageCode' => 'recently_viewed_products_grid_content_widget'
]

如何在html中渲染颜色色板或将其添加为小部件选项?

0 个答案:

没有答案