Mage_Adminhtml_Block_Customer_Edit_Tab_View_Cart Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Customer_Edit_Tab_View_Cart:

Mage_Adminhtml_Block_Widget_Grid Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getRowUrl ($row)
 getHeadersVisibility ()

Protected Member Functions

 _prepareCollection ()
 _prepareColumns ()


Detailed Description

Definition at line 34 of file Cart.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 37 of file Cart.php.

00038     {
00039         parent::__construct();
00040         $this->setId('customer_view_cart_grid');
00041         $this->setDefaultSort('added_at', 'desc');
00042         $this->setSortable(false);
00043         $this->setPagerVisibility(false);
00044         $this->setFilterVisibility(false);
00045         $this->setEmptyText(Mage::helper('customer')->__('There are no items in customer\'s shopping cart at the moment'));
00046     }


Member Function Documentation

_prepareCollection (  )  [protected]

Prepare grid collection object

Returns:
this

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 48 of file Cart.php.

00049     {
00050         $quote = Mage::getModel('sales/quote');
00051         // set website to quote, if any
00052         if ($this->getWebsiteId()) {
00053             $quote->setWebsite(Mage::app()->getWebsite($this->getWebsiteId()));
00054         }
00055         $quote->loadByCustomer(Mage::registry('current_customer'));
00056 
00057         if ($quote) {
00058             $collection = $quote->getItemsCollection(false);
00059         }
00060         else {
00061             $collection = new Varien_Data_Collection();
00062         }
00063         $this->setCollection($collection);
00064 
00065         return parent::_prepareCollection();
00066     }

_prepareColumns (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 68 of file Cart.php.

00069     {
00070         $this->addColumn('product_id', array(
00071             'header' => Mage::helper('customer')->__('Product ID'),
00072             'index' => 'product_id',
00073             'width' => '100px',
00074         ));
00075 
00076         $this->addColumn('name', array(
00077             'header' => Mage::helper('customer')->__('Product Name'),
00078             'index' => 'name',
00079         ));
00080 
00081         $this->addColumn('sku', array(
00082             'header' => Mage::helper('customer')->__('SKU'),
00083             'index' => 'sku',
00084             'width' => '100px',
00085         ));
00086 
00087         $this->addColumn('qty', array(
00088             'header' => Mage::helper('customer')->__('Qty'),
00089             'index' => 'qty',
00090             'type'  => 'number',
00091             'width' => '60px',
00092         ));
00093 
00094         $this->addColumn('price', array(
00095             'header' => Mage::helper('customer')->__('Price'),
00096             'index' => 'price',
00097             'type'  => 'currency',
00098             'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
00099         ));
00100 
00101         $this->addColumn('total', array(
00102             'header' => Mage::helper('customer')->__('Total'),
00103             'index' => 'row_total',
00104             'type'  => 'currency',
00105             'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
00106         ));
00107 
00108         return parent::_prepareColumns();
00109     }

getHeadersVisibility (  ) 

Return visibility of column headers

Returns:
boolean

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 116 of file Cart.php.

00117     {
00118         return ($this->getCollection()->getSize() > 0);
00119     }

getRowUrl ( row  ) 

Definition at line 111 of file Cart.php.

00112     {
00113         return $this->getUrl('*/catalog_product/edit', array('id' => $row->getProductId()));
00114     }


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