Skip to content

di

Auto Added by WPeMatico

Is it possible to override type configuration in the di.xml of a module in Magento2?

I want to override the file “FoomanEmailAttachmentsObserverAbstractSendInvoiceObserver”. Here is the code in the di.xml. <!– module introduced preferences –> <preference for=”FoomanEmailAttachmentsModelApiAttachmentContainerInterface” type=”FoomanEmailAttachmentsModelAttachmentContainer”/> <type name=”FoomanEmailAttachmentsObserverAbstractSendOrderObserver”> <arguments> <argument name=”pdfRenderer” xsi:type=”object”>FoomanEmailAttachmentsModelNoneRenderer</argument> </arguments> </type> <virtualType name=”fooman_emailattachments_invoice_pdf_renderer” type=”FoomanEmailAttachmentsModelPdfRenderer”> <arguments> <argument name=”pdfRenderer” xsi:type=”object”>MagentoSalesModelOrderPdfInvoice</argument> </arguments> </virtualType> <type… Read More »Is it possible to override type configuration in the di.xml of a module in Magento2?

Does area emulation also influence DI / plugins?

We are reading the Magento configurable configuration inside an API call: private function getSpConfig($product) { if ($product->getTypeId() != ‘configurable’) { return null; } /** * @var ConfigurableBlock */ $configurableBlock = $this->_layoutInterface->createBlock(ConfigurableBlock::class); $configurableBlock->setData(‘product’, $product); $spConfig = json_decode($configurableBlock->getJsonConfig(), true); usort($spConfig[‘attributes’], function ($a,… Read More »Does area emulation also influence DI / plugins?

Override MagentoCatalogModelLayer

I want to override the class MagentoCatalogModelLayer In my /etc/di.xml <preference for=”MagentoCatalogModelLayer” type=”CustomModuleModelLayer” /> Then I did the class <?php namespace CustomModuleModel; class Layer extends MagentoCatalogModelLayer { public function getProductCollection() { //Logic to modify the $collection data return $collection; }… Read More »Override MagentoCatalogModelLayer