cancel
Showing results for 
Search instead for 
Did you mean: 

How to know updated categorie on a product?

SOLVED

How to know updated categorie on a product?

Hello everyone,

I would like to know if it's possible to know an updated_at datetime when we add / remove a category on a product? We have a problem on products that they look moving category without humans actions..  The product are moving categories and adding special prices. that's realy strange and i would like to get information when the product are moving and updated special price.

Currently i'm trying to get the information by sql. But i'm unable to get the updated_at on the relation category/product or updated special price date.

Any idea how to know that? 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to know updated categorie on a product?

Hi @stebaribeau 

 

Create observer for save events as listed below:

For category save:

event: catalog_category_prepare_save

For save product:

event: catalog_product_save_after

 Using observer you can get update after save category or product.
Problem Solved? Please click on 'Kudos' & Accept as Solution!

 

Problem solved? Click Accept as Solution!

View solution in original post

3 REPLIES 3

Re: How to know updated categorie on a product?

Hello @stebaribeau 

 

We have to events in Magento default which you can use using observer by create events.xml in your custom module.

 

Event name: _move_before
File: vendor/magento/module-catalog/Model/Category.php

$this->_eventManager->dispatch($this->_eventPrefix . '_move_before', $eventParams);


Event name: _move_after
File: vendor/magento/module-catalog/Model/Category.php

$this->_eventManager->dispatch($this->_eventPrefix . '_move_after', $eventParams);


If this helps, Click on Kudos and Accept as Solution.

 

Thank you

Hiren Patel

Re: How to know updated categorie on a product?

Hi @stebaribeau 

 

Create observer for save events as listed below:

For category save:

event: catalog_category_prepare_save

For save product:

event: catalog_product_save_after

 Using observer you can get update after save category or product.
Problem Solved? Please click on 'Kudos' & Accept as Solution!

 

Problem solved? Click Accept as Solution!

Re: How to know updated categorie on a product?

thanks your soluce are good too.,. i can't only choose one! Smiley Happy

 

thanks both of you for your answer.