【问题标题】:MagicZoomPlus:Uncaught Error: Call to a member function getShowSwatchTooltip() module-swatches/view/frontend/templates/product/view/renderer.phtmlMagicZoomPlus:未捕获错误:调用成员函数 getShowSwatchTooltip() module-swatches/view/frontend/templates/product/view/renderer.phtml
【发布时间】:2020-05-19 21:28:12
【问题描述】:

MagicZoomPlus:致命错误-未捕获错误:调用成员函数getShowSwatchTooltip()模块-swatches/view/frontend/templates/product/view/renderer.phtml 文件:catalog_product_view_type_configurable

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="product.info.options.wrapper">
            <block class="MagicToolbox\MagicZoomPlus\Block\Product\View\Type\Configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="Magento_ConfigurableProduct::product/view/type/options/configurable.phtml"/>
            <block class="MagicToolbox\MagicZoomPlus\Block\Product\Renderer\Configurable" name="product.info.options.swatches" as="swatch_options" before="-" />
        </referenceBlock>
    </body>
</page>

由于 Magento 版本升级没有 ViewModel 导致的问题

【问题讨论】:

  • 升级 Magento 2.3.4 后我也遇到了同样的问题。你有解决办法吗?
  • 您是否尝试过升级到最新版本的 MagicZoomPlus 模块?
  • @KirtiNariya 你必须解决这个问题吗? Magento 从 2.3 升级到 2.4.3 后,我也遇到了同样的问题

标签: php xml magento magento2 magiczoomplus


【解决方案1】:

这个答案来自问题本身


解决方案 1:编辑同一文件

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="product.info.options.wrapper">
            <block class="MagicToolbox\MagicZoomPlus\Block\Product\View\Type\Configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="Magento_ConfigurableProduct::product/view/type/options/configurable.phtml"/>
            <referenceBlock class="MagicToolbox\MagicZoomPlus\Block\Product\Renderer\Configurable" name="product.info.options.swatches" />
        </referenceBlock>
    </body>
</page>

解决方案 2:创建新的模块覆盖布局

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="product.info.options.configurable" remove="true"/>
        <referenceBlock name="product.info.options.wrapper">
            <referenceBlock name="product.info.options.swatches" remove="true"/>
            <block class="MagicToolbox\MagicZoomPlus\Block\Product\Renderer\Configurable" name="product.info.options.swatches.modified"
                   as="swatch_options_modied" before="-">
                <arguments>
                    <argument name="configurable_view_model"
                              xsi:type="object">Codilar\MagicZoomPlus\ViewModel\Configurable</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

【讨论】:

    猜你喜欢
    • 2019-05-20
    • 2021-05-07
    • 2020-12-19
    • 2018-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-09
    • 2021-05-21
    相关资源
    最近更新 更多