magento2 使用Plugin

前端之家收集整理的这篇文章主要介绍了magento2 使用Plugin前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<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事件来实现某个扩展,有时候,在么事件的情况下,可以是用重写的方式进行扩展,但是重写的时候会导致与其他模块发生冲突。 在magento2中,也有事件、重写等方法对magento进行扩展,但magento2新增了一个方法‘Plugin’,降低了模块冲突的几率。 、新建文件vendermoduleeetcdi.xml: config   =     plugin = =raining\Plugin\Product " = =   config 、新建文件vendermodulepluginproduct.PHP ?PHP namespace Magestore\Training\Plugin;   class Product     public afterGetPrice\Magento\Catalog\Model\Product ,             是执行-getPrice的结果         ;     ?

猜你在找的程序笔记相关文章