Mage_Reports_Model_Event_Observer Class Reference

List of all members.

Public Member Functions

 customerLogin (Varien_Event_Observer $observer)
 catalogProductView (Varien_Event_Observer $observer)
 sendfriendProduct (Varien_Event_Observer $observer)
 catalogProductCompareRemoveProduct (Varien_Event_Observer $observer)
 catalogProductCompareAddProduct (Varien_Event_Observer $observer)
 checkoutCartAddProduct (Varien_Event_Observer $observer)
 wishlistAddProduct (Varien_Event_Observer $observer)
 wishlistShare (Varien_Event_Observer $observer)
 eventClean (Varien_Event_Observer $observer)

Protected Member Functions

 _event ($eventTypeId, $objectId, $subjectId=null, $subtype=0)


Detailed Description

Definition at line 35 of file Observer.php.


Member Function Documentation

_event ( eventTypeId,
objectId,
subjectId = null,
subtype = 0 
) [protected]

Definition at line 37 of file Observer.php.

00038     {
00039         if (is_null($subjectId)) {
00040             if (Mage::getSingleton('customer/session')->isLoggedIn()) {
00041                 $customer = Mage::getSingleton('customer/session')->getCustomer();
00042                 $subjectId = $customer->getId();
00043             }
00044             else {
00045                 $subjectId = Mage::getSingleton('log/visitor')->getId();
00046                 $subtype = 1;
00047             }
00048         }
00049 
00050         $eventModel = Mage::getModel('reports/event');
00051         $storeId    = Mage::app()->getStore()->getId();
00052         $eventModel
00053             ->setEventTypeId($eventTypeId)
00054             ->setObjectId($objectId)
00055             ->setSubjectId($subjectId)
00056             ->setSubtype($subtype)
00057             ->setStoreId($storeId);
00058         $eventModel->save();
00059 
00060         return $this;
00061     }

catalogProductCompareAddProduct ( Varien_Event_Observer observer  ) 

Definition at line 96 of file Observer.php.

00097     {
00098         Mage::getSingleton('reports/session')->setData('compared_products', true);
00099         return $this->_event(
00100             Mage_Reports_Model_Event::EVENT_PRODUCT_COMPARE,
00101             $observer->getEvent()->getProduct()->getId()
00102         );
00103     }

catalogProductCompareRemoveProduct ( Varien_Event_Observer observer  ) 

Definition at line 91 of file Observer.php.

00092     {
00093         Mage::getSingleton('reports/session')->setData('compared_products', null);
00094     }

catalogProductView ( Varien_Event_Observer observer  ) 

Definition at line 74 of file Observer.php.

00075     {
00076         Mage::getSingleton('reports/session')->setData('viewed_products', true);
00077         return $this->_event(
00078             Mage_Reports_Model_Event::EVENT_PRODUCT_VIEW,
00079             $observer->getEvent()->getProduct()->getId()
00080         );
00081     }

checkoutCartAddProduct ( Varien_Event_Observer observer  ) 

Definition at line 105 of file Observer.php.

00106     {
00107         $quoteItem = $observer->getEvent()->getItem();
00108         if (!$quoteItem->getId() && !$quoteItem->getParentItem()) {
00109             $productId = $quoteItem->getProductId();
00110             $this->_event(Mage_Reports_Model_Event::EVENT_PRODUCT_TO_CART, $productId);
00111         }
00112         return $this;
00113     }

customerLogin ( Varien_Event_Observer observer  ) 

Definition at line 63 of file Observer.php.

00063                                                                    {
00064         if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
00065             return $this;
00066         }
00067         $customer = Mage::getSingleton('customer/session')->getCustomer();
00068         $visitorId = Mage::getSingleton('log/visitor')->getId();
00069         $customerId = $customer->getId();
00070         $eventModel = Mage::getModel('reports/event');
00071         $eventModel->updateCustomerType($visitorId, $customerId);
00072     }

eventClean ( Varien_Event_Observer observer  ) 

event clean

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Reports_Model_Event_Observer

Definition at line 137 of file Observer.php.

00138     {
00139         $event = Mage::getModel('reports/event');
00140         /* @var $event Mage_Reports_Model_Event */
00141         $event->clean();
00142 
00143         return $this;
00144     }

sendfriendProduct ( Varien_Event_Observer observer  ) 

Definition at line 83 of file Observer.php.

00084     {
00085         return $this->_event(
00086             Mage_Reports_Model_Event::EVENT_PRODUCT_SEND,
00087             $observer->getEvent()->getProduct()->getId()
00088         );
00089     }

wishlistAddProduct ( Varien_Event_Observer observer  ) 

Definition at line 115 of file Observer.php.

00116     {
00117         return $this->_event(
00118             Mage_Reports_Model_Event::EVENT_PRODUCT_TO_WISHLIST,
00119             $observer->getEvent()->getProduct()->getId()
00120         );
00121     }

wishlistShare ( Varien_Event_Observer observer  ) 

Definition at line 123 of file Observer.php.

00124     {
00125         return $this->_event(
00126             Mage_Reports_Model_Event::EVENT_WISHLIST_SHARE,
00127             $observer->getEvent()->getWishlist()->getId()
00128         );
00129     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:36 2009 for Magento by  doxygen 1.5.8