Mage_Sales_Model_Observer Class Reference

List of all members.

Public Member Functions

 cleanExpiredQuotes ($schedule)
 substractQtyFromQuotes ($observer)
 markQuotesRecollectOnCatalogRules ($observer)
 catalogProductSaveAfter (Varien_Event_Observer $observer)
 catalogProductStatusUpdate (Varien_Event_Observer $observer)


Detailed Description

Definition at line 35 of file Observer.php.


Member Function Documentation

catalogProductSaveAfter ( Varien_Event_Observer observer  ) 

Catalog Product After Save (change status process)

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Sales_Model_Observer

Definition at line 92 of file Observer.php.

00093     {
00094         $product = $observer->getEvent()->getProduct();
00095         if ($product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
00096             return $this;
00097         }
00098 
00099         Mage::getResourceSingleton('sales/quote')->markQuotesRecollect($product->getId());
00100 
00101         return $this;
00102     }

catalogProductStatusUpdate ( Varien_Event_Observer observer  ) 

Catalog Mass Status update process

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Sales_Model_Observer

Definition at line 110 of file Observer.php.

00111     {
00112         $status     = $observer->getEvent()->getStatus();
00113         if ($status == Mage_Catalog_Model_Product_Status::STATUS_ENABLED) {
00114             return $this;
00115         }
00116         $productId  = $observer->getEvent()->getProductId();
00117         Mage::getResourceSingleton('sales/quote')->markQuotesRecollect($productId);
00118 
00119         return $this;
00120     }

cleanExpiredQuotes ( schedule  ) 

Clean expired quotes (cron process)

Parameters:
Mage_Cron_Model_Schedule $schedule
Returns:
Mage_Sales_Model_Observer

Definition at line 43 of file Observer.php.

00044     {
00045         $lifetimes = Mage::getConfig()->getStoresConfigByPath('checkout/cart/delete_quote_after');
00046         foreach ($lifetimes as $storeId=>$lifetime) {
00047             $lifetime *= 86400;
00048 
00049             $quotes = Mage::getModel('sales/quote')->getCollection();
00050             /* @var $quotes Mage_Sales_Model_Mysql4_Quote_Collection */
00051 
00052             $quotes->addFieldToFilter('store_id', $storeId);
00053             $quotes->addFieldToFilter('updated_at', array('to'=>date("Y-m-d", time()-$lifetime)));
00054             $quotes->addFieldToFilter('is_active', 0);
00055             $quotes->walk('delete');
00056         }
00057         return $this;
00058     }

markQuotesRecollectOnCatalogRules ( observer  ) 

When applying a catalog price rule, make related quotes recollect on demand

Parameters:
Varien_Event_Observer $observer
Returns:
Mage_Sales_Model_Observer

Definition at line 80 of file Observer.php.

00081     {
00082         Mage::getResourceSingleton('sales/quote')->markQuotesRecollectOnCatalogRules();
00083         return $this;
00084     }

substractQtyFromQuotes ( observer  ) 

When deleting product, substract it from all quotes quantities

Exceptions:
Exception 
Parameters:
Varien_Event_Observer 
Returns:
Mage_Sales_Model_Observer

Definition at line 67 of file Observer.php.

00068     {
00069         $product = $observer->getEvent()->getProduct();
00070         Mage::getResourceSingleton('sales/quote')->substractProductFromQuotes($product);
00071         return $this;
00072     }


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

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