you can load product collection by below code:
public function execute(\Magento\Framework\Event\Observer $observer)
{
$_product = $observer->getProduct()->getId(); // you will get product object
$_sku=$_product->getSku(); // for sku
}
Complete Answer:
Create events.xml file in \module\etc\adminhtml\events.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="catalog_product_save_after">
<observer name="catalog_product_save_after_handler" instance="Vendor\Module\Observer\SyncObserver"/>
</event>
</config>
Create observer file in Module\Observer\SyncObserver.php
<?php
class SyncObserver implements ObserverInterface {
function __construct
(
\Vendor\Module\Model\Engine $syncEngineFactory
) {
$this->syncEngineFactory = $syncEngineFactory;
}
public function execute(\Magento\Framework\Event\Observer $observer) {
$product = $observer->getProduct()->getId();
$this->productUpdate($product);
return $this;
public function productUpdate($product){
//$productId = 1;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$currentproduct = $objectManager->create('Vendor\Module\ResourceModel\Queue')->load($product,'entity_id'); //Erro here 'Recoverable Error: Argument 1 passed to Magento\Framework\Model\ResourceModel\Db\AbstractDb::load()
}
}
Reference : Get product from save event observer - Magento 2Get product from save event observer - Magento 2