Join stock to product list collection

How and where i can join stock information (Qty) to product collection in product list. In catalog layer or somewere else? I try to <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:Api/etc/extension_attributes.xsd”> <extension_attributes for=”Magento\Catalog\Api\Data\ProductInterface”> <attribute code=”stock_item” type=”Magento\CatalogInventory\Api\Data\StockItemInterface”> <join reference_table=”cataloginventory_stock_item” reference_field=”product_id” join_on_field=”entity_id”> <field>qty</field> </join> </attribute> </extension_attributes> </config> But it’s does’t works for me.

Custom service worker

I’m trying to implement a notification system on my website. So I’m trying to register a service worker, and I can’t seem to make it work. I’ve created a module with the following layout : default.xml <?xml version=”1.0″?> <page xsi:noNamespaceSchemaLocation=”urn:magento:framework:View/Layout/etc/page_configuration.xsd” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”> <head> <script src=”[Vendor_Module]::js/main.js”/> </head> </page> And here’s how I’m trying to register my worker…

How to override SimpleProductPrice Model the right way?

I want to override the function executeByDimensions for some reasons. Below is my implementation. <!– Vendorname/Modulename/etc/di.xml –> <?xml version=”1.0″?> <config xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:ObjectManager/etc/config.xsd”> <preference for=”Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\SimpleProductPrice” type=”Vendorname\Modulename\Model\ResourceModel\Product\Indexer\Price\SimpleProductPrice” /> </config> And, <?php namespace Vendorname\Modulename\Model\ResourceModel\Product\Indexer\Price; use Magento\Catalog\Model\Indexer\Product\Price\TableMaintainer; use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\BasePriceModifier; use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\IndexTableStructure as IndexTableStructureFactory; use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\Query\BaseFinalPrice; use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\SimpleProductPrice as CoreSimpleProductPrice; /** * Simple Product Type Price Indexer */ class SimpleProductPrice…

Magento 2 Custom UI grid form.php validate upload file extension

I want to check the upload file extension in form.php, I have three upload file options I want to check the upload file is pdf or not. Thanks in advance. my form.php file is namespace Vendor\Extension\Block\Adminhtml\Blog\Edit; use Magento\Backend\Block\Template\Context; use Magento\Framework\Registry; use Magento\Framework\Data\FormFactory; use Vendor\Extension\Block\Adminhtml\Status; class Form extends \Magento\Backend\Block\Widget\Form\Generic { protected $_systemStore; public function __construct( Context…