加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 创业 > C语言 > 正文

magento2 使用Plugin

发布时间:2020-12-15 00:03:53 所属栏目:C语言 来源:网络整理
导读:table class="bash" tr class="li1" td class="ln"pre class="de1"1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 中,我通过使用event事件来实现某个扩展,有时候,在么事件的情况下,可以是用重写的方式进行扩展,但是重写的时候会导致与其他模块
<tr class="li1">
<td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

中,我通过使用event事件来实现某个扩展,有时候,在么事件的情况下,可以是用重写的方式进行扩展,但是重写的时候会导致与其他模块发生冲突。 在magento2中,也有事件、重写等方法对magento进行扩展,但magento2新增了一个方法‘Plugin’,降低了模块冲突的几率。 、新建文件vendermoduleeetcdi.xml: config ? = ? ? plugin = =rainingPluginProduct " = = ? config 、新建文件vendermodulepluginproduct.php ?php namespace MagestoreTrainingPlugin; ? class Product ? ? public afterGetPriceMagentoCatalogModelProduct , ? ? ? ? ? ? 是执行-getPrice的结果 ? ? ? ? ; ? ? ?(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

<table class="bash">

    推荐文章
      热点阅读