php - MagicZoomPlus:未捕获错误:调用成员函数 getShowSwatchTooltip() module-swatches/view/frontend/templates/product/view/renderer.phtml

标签 php xml magento magento2 magiczoomplus

MagicZoomPlus: fatal error -未捕获错误:调用成员函数 getShowSwatchTooltip() module-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问题

最佳答案

这个答案是从问题本身得出的


解决方案 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>

关于php - MagicZoomPlus:未捕获错误:调用成员函数 getShowSwatchTooltip() module-swatches/view/frontend/templates/product/view/renderer.phtml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60050840/

相关文章:

php - 使用 PHP 创建、编辑和删除 crontab 作业?

java - 如何在xml文件中调用外部xsd?

java - CollapsingToolbarLayout 和工具栏操作按钮

Magento-何时使用 Mage::getResourceModel 和 Mage::getModel

php - 对用于产品定制的 PHP 电子商务框架有何建议?

magento - 如何启用magento xml-rpc?

php - 安装 Acquia CLI 时出错

php - 将explode与php和mysql一起使用

php - 如何列出数据库中具有重复索引的记录

xml - AIX 中最简单的嵌套 XML 解析