1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Adminhtml
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: /**
28: * Adminhtml sales order create sidebar wishlist block
29: *
30: * @category Mage
31: * @package Mage_Adminhtml
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Wishlist
35: extends Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Abstract
36: {
37: /**
38: * Storage action on selected item
39: *
40: * @var string
41: */
42: protected $_sidebarStorageAction = 'add_wishlist_item';
43:
44: protected function _construct()
45: {
46: parent::_construct();
47: $this->setId('sales_order_create_sidebar_wishlist');
48: $this->setDataId('wishlist');
49: }
50:
51: public function getHeaderText()
52: {
53: return Mage::helper('sales')->__('Wishlist');
54: }
55:
56: /**
57: * Retrieve item collection
58: *
59: * @return mixed
60: */
61: public function getItemCollection()
62: {
63: $collection = $this->getData('item_collection');
64: if (is_null($collection)) {
65: $collection = $this->getCreateOrderModel()->getCustomerWishlist(true);
66: if ($collection) {
67: $collection = $collection->getItemCollection()->load();
68: }
69: $this->setData('item_collection', $collection);
70: }
71: return $collection;
72: }
73:
74: /**
75: * Retrieve all items
76: *
77: * @return array
78: */
79: public function getItems()
80: {
81: $items = parent::getItems();
82: foreach ($items as $item) {
83: $product = $item->getProduct();
84: $item->setName($product->getName());
85: $item->setPrice($product->getFinalPrice(1));
86: $item->setTypeId($product->getTypeId());
87: }
88: return $items;
89: }
90:
91: /**
92: * Retrieve product identifier linked with item
93: *
94: * @param Mage_Wishlist_Model_Item $item
95: * @return int
96: */
97: public function getProductId($item)
98: {
99: return $item->getProduct()->getId();
100: }
101:
102: /**
103: * Retrieve identifier of block item
104: *
105: * @param Varien_Object $item
106: * @return int
107: */
108: public function getIdentifierId($item)
109: {
110: return $item->getId();
111: }
112:
113: /**
114: * Retrieve possibility to display quantity column in grid of wishlist block
115: *
116: * @return bool
117: */
118: public function canDisplayItemQty()
119: {
120: return true;
121: }
122: }
123: