如何在magento中的标准magento Luma主题中向左侧边栏添加带有图片的块,如图中所示

我试过这种方法
app/design/frontend/TestTheme/Theme/Magento_Catalog/layout/catalog_product_view.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="catalog.compare.sidebar">
<action method="setPageTitle">
<argument name="logo_file" xsi:type="string">images/logo.svg</argument>
<argument name="logo_img_width" xsi:type="number">200</argument>
<argument name="logo_img_height" xsi:type="number">200</argument>
</action>
</referenceBlock>
</body>
</page>但这不管用
发布于 2019-07-31 16:19:39
Magento_Theme
---layout
-----default.xml
---youtemps
-----img.phtmlmb不是最好的实现,但是这个方法会给你带来文本,不幸的是,没有演示我无法告诉你如何显示。
我希望你能被告知如何改进这个方法,或者尝试根据我的代码完成我的任务。
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="sidebar.additional">
<container name="sidebar.img.container" htmlClass="pseudo-container" htmlTag="div">
<block class="Magento\Framework\View\Element\Template" name="testtest.sidebar.sell" as="sell_lable" template="Magento_Theme::youtemps/img.phtml" before="-"/>
</container>
</referenceContainer>
</body>
</page>更新,在phtml文件中添加以下代码
<h2 style="margin: 0">hot price</h2>
<img src="<?php echo $this->getViewFileUrl('images/sell-sidebar.jpg'); ?>" style="margin-bottom: 10px" alt="" />在您的Magento_Theme文件夹中添加图像文件夹并放入您的图像文件夹中,接下来插入到getViewFileUrl('images/sell-sidebar.jpg');的路径相对为Magento_Theme
https://stackoverflow.com/questions/57293298
复制相似问题