Recently I am engaged in Secondary Development of magento, and encountered a problem, that is, I want to perform secondary processing on some data in the product data. After reading the code, we found that there was an event before initProduct: catalog_product_prepare_save, so I thought it would be okay to override this method. I found some information online and found that if I bind another event
Recently I am engaged in Secondary Development of magento, and encountered a problem, that is, I want to perform secondary processing on some data in the product data. After reading the code, we found that there was an event before initProduct: catalog_product_prepare_save, so I thought it would be okay to override this method. I found some information online and found that if I bind another event
Recently I am engaged in Secondary Development of magento, and encountered a problem, that is, I want to perform secondary processing on some data in the product data. After reading the code, we found that there was an event before initProduct: catalog_product_prepare_save, so I thought it would be okay to override this method. I found some information on the Internet and found that if I bind an event, multiple events will be executed. As a result, I added the events event to config. xml according to this idea.
Then add Observer. php under the Model to listen for events. In order to test whether the system's own event can work, I made an output in the system's default event and found that there was indeed a change. So it proves that my thinking is correct. Of course, this also draws on some online materials
Add the following to config. xml:
?? ?????? ?????????? ?????????????? ?????????????????? ????????????????????singleton?? ????????????????????Xxx_Web_Model_Observer?? ????????????????????prepareProductAuthor?? ?????????????????? ?????????????? ?????????? ?????? ??
Originally, my class was intended to be written as xxxx/observer, but it was okay. I don't know if I was wrong. Or .. At last, it is OK to write the detailed class name. (Or is it because it is not in the system directory, but in the local directory ?)
The Observer will not be written. Refer to core/mage/bundle/model/observer. php (case sensitive, I ignored it)
Original article address: Process catalog_product_prepare_save in magento. Thank you for sharing it with the original author.