簡體   English   中英

MagicZoomPlus:未捕獲錯誤:調用成員 function getShowSwatchTooltip() module-swatches/view/frontend/templates/product/view/renderer.phtml

[英]MagicZoomPlus:Uncaught Error: Call to a member function getShowSwatchTooltip() module-swatches/view/frontend/templates/product/view/renderer.phtml

MagicZoomPlus:致命錯誤-未捕獲錯誤:調用成員 function getShowSwatchTooltip() module-swatches/view/frontend/templates/product/view/renderer.phtml file: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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM