程序笔记
发布时间:2022-05-30 发布网站:大佬教程 code.js-code.com
大佬教程收集整理的这篇文章主要介绍了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
name=
plugin name= =raining\Plugin\Product " = Disabled=
config
、新建文件vendermodulepluginproduct.PHP
?PHP
namespace Magestore\Training\Plugin;
class Product
public afterGetPrice\Magento\Catalog\Model\Product ,ult
ult 是执行-getPrice的结果
ult;
?table>
大佬总结
以上是大佬教程为你收集整理的magento2 使用Plugin全部内容,希望文章能够帮你解决magento2 使用Plugin所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。