2
如何在Magento2中覆盖或禁用核心插件?
我正在使用Magento2建立市场。因此,我需要能够使用供应商的客户凭证来加载客户的订单。 问题在于,Magento2使用插件来验证只有该订单的客户(或管理员)才能加载该订单。 在这种情况下,我需要覆盖整个插件或覆盖protected方法isAllowed()。不修改内核怎么办? Magento\Sales\Model\ResourceModel\Order\Plugin\Authorization 看起来像这样: use Magento\Authorization\Model\UserContextInterface; use Magento\Framework\Exception\NoSuchEntityException; class Authorization { /** * @var UserContextInterface */ protected $userContext; /** * @param UserContextInterface $userContext */ public function __construct( \Magento\Authorization\Model\UserContextInterface $userContext ) { $this->userContext = $userContext; } /** * Checks if order is allowed * * @param \Magento\Sales\Model\ResourceModel\Order $subject * @param …