Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Pcompared Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Pcompared:

Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Abstract Mage_Adminhtml_Block_Sales_Order_Create_Abstract 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 ()
 getHeaderText ()
 getItemCollection ()
 canRemoveItems ()
 getIdentifierId ($item)
 getProductId ($item)


Detailed Description

Definition at line 35 of file Pcompared.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 Pcompared.php.

00038     {
00039         parent::__construct();
00040         $this->setId('sales_order_create_sidebar_pcompared');
00041         $this->setDataId('pcompared');
00042     }


Member Function Documentation

canRemoveItems (  ) 

Retrieve availability removing items in block

Returns:
bool

Reimplemented from Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Abstract.

Definition at line 93 of file Pcompared.php.

00094     {
00095         return false;
00096     }

getHeaderText (  ) 

Definition at line 44 of file Pcompared.php.

00045     {
00046         return Mage::helper('sales')->__('Recently Compared Products');
00047     }

getIdentifierId ( item  ) 

Get product Id

Parameters:
Mage_Catalog_Model_Product $item
Returns:
int

Reimplemented from Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Abstract.

Definition at line 104 of file Pcompared.php.

00105     {
00106         return $item->getId();
00107     }

getItemCollection (  ) 

Retrieve item collection

Returns:
mixed

Reimplemented from Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Abstract.

Definition at line 54 of file Pcompared.php.

00055     {
00056         $productCollection = $this->getData('item_collection');
00057         if (is_null($productCollection)) {
00058             // get products to skip
00059             $skipProducts = array();
00060             if ($collection = $this->getCreateOrderModel()->getCustomerCompareList()) {
00061                 $collection = $collection->getItemCollection()
00062                     ->useProductItem(true)
00063                     ->setStoreId($this->getStoreId())
00064                     ->setCustomerId($this->getCustomerId())
00065                     ->load();
00066                 foreach ($collection as $_item) {
00067                     $skipProducts[] = $_item->getProductId();
00068                 }
00069             }
00070 
00071             // prepare products collection and apply visitors log to it
00072             $productCollection = Mage::getModel('catalog/product')->getCollection()
00073                 ->setStoreId($this->getQuote()->getStoreId())
00074                 ->addStoreFilter($this->getQuote()->getStoreId())
00075                 ->addAttributeToSelect('name')
00076                 ->addAttributeToSelect('price')
00077                 ->addAttributeToSelect('small_image');
00078             Mage::getResourceSingleton('reports/event')->applyLogToCollection(
00079                 $productCollection, Mage_Reports_Model_Event::EVENT_PRODUCT_COMPARE, $this->getCustomerId(), 0, $skipProducts
00080             );
00081 
00082             $productCollection->load();
00083             $this->setData('item_collection', $productCollection);
00084         }
00085         return $productCollection;
00086     }

getProductId ( item  ) 

Retrieve product identifier of block item

Parameters:
mixed $item
Returns:
int

Definition at line 115 of file Pcompared.php.

00115                                         {
00116         return $item->getId();
00117     }


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

Generated on Sat Jul 4 17:23:00 2009 for Magento by  doxygen 1.5.8