windows在php7.3下安装magento2.4报错问题处理

一、Invalid template file: 'D:/wwwroot/magento1.xxx.com/vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js'

1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'D:/wwwroot/magento1.xxx.com/vendor/magento/module-theme/view/frontend/templates/page/js/require_js.phtml' in module: '' block's name: 'require.js'
解决方案:
项目根目录找到文件:vendor/magento/framework/View/Element/Template/File/Validator.php

在138行的位置找到:
$realPath = $this->fileDriver->getRealPath($path);下面新增一行
$realPath = str_replace('\\', '/', $realPath); // extra code added

解决

二、Exception #0 (InvalidArgumentException): Class argument is invalid: Magento\Framework\View\Element\UiComponent\Context <pre>#1 Magento\Framework\Data\Argument\InterpreterInterface\Proxy->evaluate(array('name' => 'context', 'argument' => array('class' => array('name' => 'class', 'xsi:type' => 'string', 'value' => 'Magento\Framewor...'), 'namespace' => array('name' => 'namespace', 'xsi:type' => 'string', 'value' => 'productattach_fi...')))) called at [vendor\magento\framework\Data\Argument\Interpreter\Composite.php:61] #2 Magento\Framework\Data\Argument\Interpreter\Composite->evaluate(array('name' => 'context', 'argument' => array('class' => array('name' => 'class', 'xsi:type' => 'string', 'value' => 'Magento\Framewor...'), 'namespace' => array('name' => 'namespace', 'xsi:type' => 'string', 'value' => 'productattach_fi...')))) called at [vendor\magento\module-ui\Config\Data.php:164] #3 Magento\Ui\Config\Data->evaluateComponentArguments(array('productattach_fi...' => array('attributes' => array('name' => 'productattach_fi...', 'sorting' =>

解决办法

打开app/etc/di.xml

找到666--671行
 <type name="Magento\Framework\View\Element\UiComponent\Argument\Interpreter\ConfigurableObject">
        <arguments>
            <argument name="classWhitelist" xsi:type="array">
                <item name="0" xsi:type="string">Magento\Framework\Data\OptionSourceInterface</item>
                <item name="1" xsi:type="string">Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface</item>
                
            </argument>
        </arguments>
    </type>

在新增一行item2

<item name="2" xsi:type="string">Magento\Framework\View\Element\UiComponent\ContextInterface</item>

完整显示
 <type name="Magento\Framework\View\Element\UiComponent\Argument\Interpreter\ConfigurableObject">
        <arguments>
            <argument name="classWhitelist" xsi:type="array">
                <item name="0" xsi:type="string">Magento\Framework\Data\OptionSourceInterface</item>
                <item name="1" xsi:type="string">Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface</item>
				<item name="2" xsi:type="string">Magento\Framework\View\Element\UiComponent\ContextInterface</item>
            </argument>
        </arguments>
    </type>

三、后台试用审核插件报错处理

vi app/code/Kingcamp/Trialer/Block/Adminhtml/PhysicalStore/Grid.php +191

$this->setMassactionIdField('entity_id');

改成

$this->setMassactionIdField('id');

四、blog插件升级修改文件

vi vendor/mageplaza/magento-2-blog-extension/view/frontend/layout/ mpblog_post_index.xml  +27

            <container name="blog.top.container">
                    <block class="Magento\Cms\Block\Block" name="blog.top.slider">
                  <arguments>
                    <argument name="block_id" xsi:type="string">blogslider</argument>
                  </arguments>
                </block>
              </container>

示例:

注释copyright显示

<!--<block class="Magento\Framework\View\Element\Template" name="mpblog.copy.right" after="-" template="Mageplaza_Blog::html/copyright.phtml"/>-->

  1. 修改blog列表页面和详情页面 

vi vendor/mageplaza/magento-2-blog-extension/view/frontend/templates/post/list.phtml

vendor/mageplaza/magento-2-blog-extension/view/frontend/templates/post/view.phtml 

vendor/mageplaza/magento-2-blog-extension/Block/Frontend.php
285
//$html .= __('| Posted in %1', $categoryPost);

303 
/* 
       $html .= __(
                '| <i class="mp-blog-icon mp-blog-traffic" aria-hidden="true"></i> %1',
                $post->getViewTraffic()
            );
        */

注释

在其它网站使用blog时可以直接替换四个文件

五.后台全局css

.footer.content .block.newsletter{

    margin:auto;

}

.newsletter-popup.modal-popup .modal-content .block.newsletter{

   max-width:none !important;

}

.block.newsletter{

   max-width:none !important;

}

.minicart-wrapper{

  display:none !important;

}

.product-addto-links{

  display:none !important;

}

六.blog调用Block的生成banner方法

修改layout中的mpblog_post_index.xml代码


<reference name="content">
    <block type="cms/block" name="blockname" before="-">
        <action method="setBlockId"><id >block_id</id ></action>
    </block >
</reference >

引用后

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="mpblog_design"/>
    <body>
        <referenceContainer name="content">
	      <container name="blog.top.container">
             	<block class="Magento\Cms\Block\Block" name="blog.top.slider">
              	  <arguments>
                    <argument name="block_id" xsi:type="string">blogslider</argument>
             	  </arguments>
                </block>
	      </container>

		<block class="Mageplaza\Blog\Block\Post\Listpost" name="mpblog.post.list" as="mpblog_post" template="post/list.phtml"/>
	    <!--<block class="Magento\Framework\View\Element\Template" name="mpblog.copy.right" after="-" template="Mageplaza_Blog::html/copyright.phtml"/>-->
        </referenceContainer>
    </body>
</page>

在后台配置

七.Magento 2:无法更改索引器模式。管理错误 

We couldn't change indexer(s)' mode because of an error

修改数据库参数组,如下所示:log_bin_trust_function_creators=1

不是root用户, 没有权限链接MySQL 数据库实例启用函数、进程和触发器

 #mysql> set global log_bin_trust_function_creators=1;

1. mysql> SET GLOBAL log_bin_trust_function_creators = 1;

2. 系统启动时 --log-bin-trust-function-creators=1

3. 在my.ini(linux下为my.conf)文件中 [mysqld] 标记后加一行内容为 log-bin-trust-function-creators=1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值