00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_Sales_Order_Create_Sidebar_Abstract extends Mage_Adminhtml_Block_Sales_Order_Create_Abstract
00035 {
00036 protected $_sidebarStorageAction = 'add';
00037
00038
00039
00040
00041
00042
00043 public function getSidebarStorageAction()
00044 {
00045 return $this->_sidebarStorageAction;
00046 }
00047
00048
00049
00050
00051
00052
00053 public function canDisplay()
00054 {
00055 return $this->getCustomerId();
00056 }
00057
00058 public function canDisplayItemQty()
00059 {
00060 return false;
00061 }
00062
00063
00064
00065
00066
00067
00068 public function canRemoveItems()
00069 {
00070 return true;
00071 }
00072
00073
00074
00075
00076
00077
00078
00079 public function getIdentifierId($item)
00080 {
00081 return $item->getProductId();
00082 }
00083
00084
00085
00086
00087
00088
00089
00090 public function getItemId($item)
00091 {
00092 return $item->getId();
00093 }
00094
00095
00096
00097
00098
00099
00100 public function getItemCount()
00101 {
00102 $count = $this->getData('item_count');
00103 if (is_null($count)) {
00104 $count = count($this->getItems());
00105 $this->setData('item_count', $count);
00106 }
00107 return $count;
00108 }
00109
00110
00111
00112
00113
00114
00115 public function getItems()
00116 {
00117 if ($collection = $this->getItemCollection()) {
00118 $productTypes = Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray();
00119 $productTypes = array_keys($productTypes);
00120 if (is_array($collection)) {
00121 $items = $collection;
00122 } else {
00123 $items = $collection->getItems();
00124 }
00125
00126
00127
00128 foreach($items as $key=>$item) {
00129 if ($item instanceof Mage_Catalog_Model_Product) {
00130 $type = $item->getTypeId();
00131 } else if ($item instanceof Mage_Sales_Model_Order_Item) {
00132 $type = $item->getProductType();
00133 } else if ($item instanceof Mage_Sales_Model_Quote_Item) {
00134 $type = $item->getProductType();
00135 } else {
00136 $type = '';
00137 }
00138 if (!in_array($type, $productTypes)) {
00139 unset($items[$key]);
00140 }
00141 }
00142 return $items;
00143 }
00144 return array();
00145 }
00146
00147
00148
00149
00150
00151
00152 public function getItemCollection()
00153 {
00154 return false;
00155 }
00156
00157 public function canDisplayPrice()
00158 {
00159 return true;
00160 }
00161
00162 }