Public Member Functions | |
__construct () | |
getHeaderText () | |
getItemCollection () | |
canRemoveItems () | |
getIdentifierId ($item) |
Definition at line 35 of file Pviewed.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 Pviewed.php.
00038 { 00039 parent::__construct(); 00040 $this->setId('sales_order_create_sidebar_pviewed'); 00041 $this->setDataId('pviewed'); 00042 }
canRemoveItems | ( | ) |
Retrieve availability removing items in block
Reimplemented from Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Abstract.
Definition at line 95 of file Pviewed.php.
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
Varien_Object | $item |
Reimplemented from Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Abstract.
Definition at line 106 of file Pviewed.php.
getItemCollection | ( | ) |
Retrieve item collection
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 }