Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Pviewed Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Pviewed:

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)


Detailed Description

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

00038     {
00039         parent::__construct();
00040         $this->setId('sales_order_create_sidebar_pviewed');
00041         $this->setDataId('pviewed');
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 95 of file Pviewed.php.

00096     {
00097         return false;
00098     }

getHeaderText (  ) 

Definition at line 44 of file Pviewed.php.

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

getIdentifierId ( item  ) 

Retrieve identifier of block item

Parameters:
Varien_Object $item
Returns:
int

Reimplemented from Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Abstract.

Definition at line 106 of file Pviewed.php.

00107     {
00108         return $item->getId();
00109     }

getItemCollection (  ) 

Retrieve item collection

Returns:
mixed

Reimplemented from Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Abstract.

Definition at line 54 of file Pviewed.php.

00055     {
00056         $productCollection = $this->getData('item_collection');
00057         if (is_null($productCollection)) {
00058             $stores = array();
00059             $website = Mage::app()->getStore($this->getStoreId())->getWebsite();
00060             foreach ($website->getStores() as $store) {
00061                 $stores[] = $store->getId();
00062             }
00063 
00064             $collection = Mage::getModel('reports/event')
00065                 ->getCollection()
00066                 ->addStoreFilter($stores)
00067                 ->addRecentlyFiler(Mage_Reports_Model_Event::EVENT_PRODUCT_VIEW, $this->getCustomerId(), 0);
00068             $productIds = array();
00069             foreach ($collection as $event) {
00070                 $productIds[] = $event->getObjectId();
00071             }
00072 
00073             $productCollection = null;
00074             if ($productIds) {
00075                 $productCollection = Mage::getModel('catalog/product')
00076                     ->getCollection()
00077                     ->setStoreId($this->getQuote()->getStoreId())
00078                     ->addStoreFilter($this->getQuote()->getStoreId())
00079                     ->addAttributeToSelect('name')
00080                     ->addAttributeToSelect('price')
00081                     ->addAttributeToSelect('small_image')
00082                     ->addIdFilter($productIds)
00083                     ->load();
00084             }
00085             $this->setData('item_collection', $productCollection);
00086         }
00087         return $productCollection;
00088     }


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