Mage_Adminhtml_Block_Customer_Edit_Tab_View_Sales Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Customer_Edit_Tab_View_Sales:

Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 _beforeToHtml ()
 getWebsiteCount ($websiteId)
 getRows ()
 getTotals ()
 getPriceFormatted ($price)

Protected Attributes

 $_collection
 $_groupedCollection
 $_websiteCounts
 $_currency


Detailed Description

Definition at line 34 of file Sales.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 54 of file Sales.php.

00055     {
00056         parent::__construct();
00057         $this->setId('customer_view_sales_grid');
00058     }


Member Function Documentation

_beforeToHtml (  ) 

Before rendering html, but after trying to load cache

Returns:
Mage_Core_Block_Abstract

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 60 of file Sales.php.

00061     {
00062         $this->_currency = Mage::getModel('directory/currency')
00063             ->load(Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE))
00064         ;
00065 
00066         $this->_collection = Mage::getResourceModel('sales/sale_collection')
00067             ->setCustomerFilter(Mage::registry('current_customer'))
00068             ->load()
00069         ;
00070 
00071         $this->_groupedCollection = array();
00072 
00073         foreach ($this->_collection as $sale) {
00074             if (!is_null($sale->getStoreId())) {
00075                 $store      = Mage::app()->getStore($sale->getStoreId());
00076                 $websiteId  = $store->getWebsiteId();
00077                 $groupId    = $store->getGroupId();
00078                 $storeId    = $store->getId();
00079 
00080                 $sale->setWebsiteId($store->getWebsiteId());
00081                 $sale->setWebsiteName($store->getWebsite()->getName());
00082                 $sale->setGroupId($store->getGroupId());
00083                 $sale->setGroupName($store->getGroup()->getName());
00084             }
00085             else {
00086                 $websiteId  = 0;
00087                 $groupId    = 0;
00088                 $storeId    = 0;
00089 
00090                 $sale->setStoreName(Mage::helper('customer')->__('Deleted Stores'));
00091             }
00092 
00093             $this->_groupedCollection[$websiteId][$groupId][$storeId] = $sale;
00094             $this->_websiteCounts[$websiteId] = isset($this->_websiteCounts[$websiteId]) ? $this->_websiteCounts[$websiteId] + 1 : 1;
00095         }
00096 
00097         return parent::_beforeToHtml();
00098     }

getPriceFormatted ( price  ) 

Definition at line 115 of file Sales.php.

00116     {
00117         return $this->_currency->format($price);
00118     }

getRows (  ) 

Definition at line 105 of file Sales.php.

00106     {
00107         return $this->_groupedCollection;
00108     }

getTotals (  ) 

Definition at line 110 of file Sales.php.

00111     {
00112         return $this->_collection->getTotals();
00113     }

getWebsiteCount ( websiteId  ) 

Definition at line 100 of file Sales.php.

00101     {
00102         return isset($this->_websiteCounts[$websiteId]) ? $this->_websiteCounts[$websiteId] : 0;
00103     }


Member Data Documentation

$_collection [protected]

Definition at line 42 of file Sales.php.

$_currency [protected]

Definition at line 52 of file Sales.php.

$_groupedCollection [protected]

Definition at line 44 of file Sales.php.

$_websiteCounts [protected]

Definition at line 45 of file Sales.php.


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

Generated on Sat Jul 4 17:22:48 2009 for Magento by  doxygen 1.5.8