1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34:
35: class Mage_Adminhtml_Block_Sales_Order_Create extends Mage_Adminhtml_Block_Widget_Form_Container
36: {
37: public function __construct()
38: {
39: $this->_objectId = 'order_id';
40: $this->_controller = 'sales_order';
41: $this->_mode = 'create';
42:
43: parent::__construct();
44:
45: $this->setId('sales_order_create');
46:
47: $customerId = $this->_getSession()->getCustomerId();
48: $storeId = $this->_getSession()->getStoreId();
49:
50:
51: $this->_updateButton('save', 'label', Mage::helper('sales')->__('Submit Order'));
52: $this->_updateButton('save', 'onclick', "order.submit()");
53: $this->_updateButton('save', 'id', 'submit_order_top_button');
54: if (is_null($customerId) || !$storeId) {
55: $this->_updateButton('save', 'style', 'display:none');
56: }
57:
58: $this->_updateButton('back', 'id', 'back_order_top_button');
59: $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getBackUrl() . '\')');
60:
61: $this->_updateButton('reset', 'id', 'reset_order_top_button');
62:
63: if (is_null($customerId)) {
64: $this->_updateButton('reset', 'style', 'display:none');
65: } else {
66: $this->_updateButton('back', 'style', 'display:none');
67: }
68:
69: $confirm = Mage::helper('sales')->__('Are you sure you want to cancel this order?');
70: $this->_updateButton('reset', 'label', Mage::helper('sales')->__('Cancel'));
71: $this->_updateButton('reset', 'class', 'cancel');
72: $this->_updateButton('reset', 'onclick', 'deleteConfirm(\''.$confirm.'\', \'' . $this->getCancelUrl() . '\')');
73: }
74:
75: 76: 77: 78: 79:
80: public function ()
81: {
82: $out = '<div id="order-header">'
83: . $this->getLayout()->createBlock('adminhtml/sales_order_create_header')->toHtml()
84: . '</div>';
85: return $out;
86: }
87:
88: 89: 90: 91: 92:
93: public function getFormHtml()
94: {
95: $html = parent::getFormHtml();
96: $html .= $this->getLayout()->createBlock('adminhtml/catalog_product_composite_configure')->toHtml();
97: return $html;
98: }
99:
100: public function ()
101: {
102: return 'width: 70%;';
103: }
104:
105: 106: 107: 108: 109:
110: protected function _getSession()
111: {
112: return Mage::getSingleton('adminhtml/session_quote');
113: }
114:
115: public function getCancelUrl()
116: {
117: if ($this->_getSession()->getOrder()->getId()) {
118: $url = $this->getUrl('*/sales_order/view', array(
119: 'order_id' => Mage::getSingleton('adminhtml/session_quote')->getOrder()->getId()
120: ));
121: } else {
122: $url = $this->getUrl('*/*/cancel');
123: }
124:
125: return $url;
126: }
127:
128: 129: 130: 131: 132:
133: public function getBackUrl()
134: {
135: return $this->getUrl('*/' . $this->_controller . '/');
136: }
137: }
138: