File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public function log(Varien_Event_Observer $observer) {
2828 /**
2929 * @return int
3030 */
31- private function getUserId () {
31+ protected function getUserId () {
3232 if ($ this ->getUser ()) {
3333 $ userId = $ this ->getUser ()
3434 ->getUserId ();
@@ -41,7 +41,7 @@ private function getUserId() {
4141 /**
4242 * @return string
4343 */
44- private function getUserName () {
44+ protected function getUserName () {
4545 if ($ this ->getUser ()) {
4646 $ userName = $ this ->getUser ()
4747 ->getUsername ();
@@ -54,7 +54,7 @@ private function getUserName() {
5454 /**
5555 * @return Mage_Admin_Model_User|NULL
5656 */
57- private function getUser () {
57+ protected function getUser () {
5858 /**
5959 * @var $session Mage_Admin_Model_Session
6060 */
@@ -65,14 +65,14 @@ private function getUser() {
6565 /**
6666 * @return string
6767 */
68- private function getUserAgent () {
68+ protected function getUserAgent () {
6969 return (isset ($ _SERVER ['HTTP_USER_AGENT ' ]) ? (string )$ _SERVER ['HTTP_USER_AGENT ' ] : '' );
7070 }
7171
7272 /**
7373 * @return MageTest_Core_Helper_Http
7474 */
75- private function getRemoteAddr () {
75+ protected function getRemoteAddr () {
7676 return Mage::helper ('core/http ' )
7777 ->getRemoteAddr ();
7878 }
Original file line number Diff line number Diff line change 1+ <?php
2+ class Firegento_AdminLogger_Model_Observer_Product_Attribute_Update
3+ extends Firegento_AdminLogger_Model_Observer_Log
4+ {
5+
6+ public function catalogProductAttributeUpdateBefore (Varien_Event_Observer $ observer )
7+ {
8+ /** @var Firegento_AdminLogger_Model_History $history */
9+ $ history = Mage::getModel ('firegento_adminlogger/history ' );
10+
11+ $ objectType = get_class (Mage::getModel ('catalog/product ' ));
12+ $ content = json_encode ($ observer ->getEvent ()->getAttributesData ());
13+ $ userAgent = $ this ->getUserAgent ();
14+ $ ip = $ this ->getRemoteAddr ();
15+ $ userId = $ this ->getUserId ();
16+ $ userName = $ this ->getUserName ();
17+
18+ foreach ($ observer ->getEvent ()->getProductIds () as $ productId ) {
19+ $ history ->setData (
20+ array (
21+ 'object_id ' => $ productId ,
22+ 'object_type ' => $ objectType ,
23+ 'content ' => $ content ,
24+ 'content_diff ' => '{} ' ,
25+ 'user_agent ' => $ userAgent ,
26+ 'ip ' => $ ip ,
27+ 'user_id ' => $ userId ,
28+ 'user_name ' => $ userName ,
29+ 'action ' => Firegento_AdminLogger_Helper_Data::ACTION_UPDATE ,
30+ 'created_at ' => now (),
31+ )
32+ );
33+ $ history ->save ();
34+ $ history ->clearInstance ();
35+ }
36+ }
37+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ class Firegento_AdminLogger_Model_Observer_Product_Import
3+ extends Firegento_AdminLogger_Model_Observer_Log
4+ {
5+
6+ public function catalogProductImportFinishBefore (Varien_Event_Observer $ observer )
7+ {
8+ $ productIds = $ observer ->getEvent ()->getAdapter ()->getAffectedEntityIds ();
9+
10+ /** @var Firegento_AdminLogger_Model_History $history */
11+ $ history = Mage::getModel ('firegento_adminlogger/history ' );
12+
13+ $ objectType = get_class (Mage::getModel ('catalog/product ' ));
14+ $ content = json_encode (array ('updated_during_import ' => '' ));
15+ $ userAgent = $ this ->getUserAgent ();
16+ $ ip = $ this ->getRemoteAddr ();
17+ $ userId = $ this ->getUserId ();
18+ $ userName = $ this ->getUserName ();
19+
20+ foreach ($ productIds as $ productId ) {
21+ $ history ->setData (
22+ array (
23+ 'object_id ' => $ productId ,
24+ 'object_type ' => $ objectType ,
25+ 'content ' => $ content ,
26+ 'content_diff ' => '{} ' ,
27+ 'user_agent ' => $ userAgent ,
28+ 'ip ' => $ ip ,
29+ 'user_id ' => $ userId ,
30+ 'user_name ' => $ userName ,
31+ 'action ' => Firegento_AdminLogger_Helper_Data::ACTION_UPDATE ,
32+ 'created_at ' => now (),
33+ )
34+ );
35+ $ history ->save ();
36+ }
37+ }
38+ }
Original file line number Diff line number Diff line change 9090 </firegento_adminlogger >
9191 </observers >
9292 </model_delete_after >
93+ <catalog_product_attribute_update_before >
94+ <observers >
95+ <firegento_adminlogger >
96+ <class >firegento_adminlogger/observer_product_attribute_update</class >
97+ <method >catalogProductAttributeUpdateBefore</method >
98+ </firegento_adminlogger >
99+ </observers >
100+ </catalog_product_attribute_update_before >
101+ <catalog_product_import_finish_before >
102+ <observers >
103+ <firegento_adminlogger >
104+ <class >firegento_adminlogger/observer_product_import</class >
105+ <method >catalogProductImportFinishBefore</method >
106+ </firegento_adminlogger >
107+ </observers >
108+ </catalog_product_import_finish_before >
93109 <firegento_adminlogger_rowurl >
94110 <observers >
95111 <catalog_product >
You can’t perform that action at this time.
0 commit comments