I have tried to get the category id to store in my custom table with some values like cat_id, custom_value.
here i googled and get "catalog_category_prepare_save" to get category object when saving the existing category but when adding new order how will i get category id?
please suggest any events is there in magento2 for "catalog_category_prepare_save"? or suggest to some other method?
here by add my codes:
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_category_prepare_save">
<observer name="categoryattributes" instance="Namespace\Module\Observer\Categoryattributes"/>
</event>
</config>
Categoryattributes.php
<?php
namespace Namespace\Module\Observer;
class Categoryattributes implements \Magento\Framework\Event\ObserverInterface
{
private $category = null;
public function execute(\Magento\Framework\Event\Observer $observer)
{
$this->category = $observer->getEvent()->getCategory();
}
}