Public Member Functions | |
__construct () | |
getRowUrl ($row) | |
getHeadersVisibility () | |
Protected Member Functions | |
_prepareCollection () | |
_prepareColumns () |
Definition at line 34 of file Cart.php.
__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 }
_prepareCollection | ( | ) | [protected] |
Prepare grid collection object
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
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 | ) |