Public Member Functions | |
__construct () | |
getOrder () | |
getOrderId () | |
getHeaderText () | |
getUrl ($params='', $params2=array()) | |
getEditUrl () | |
getCancelUrl () | |
getInvoiceUrl () | |
getCreditmemoUrl () | |
getHoldUrl () | |
getUnholdUrl () | |
getShipUrl () | |
getCommentUrl () | |
getReorderUrl () | |
Protected Member Functions | |
_isAllowedAction ($action) |
Definition at line 34 of file View.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 Mage_Adminhtml_Block_Widget_Form_Container.
Definition at line 37 of file View.php.
00038 { 00039 $this->_objectId = 'order_id'; 00040 $this->_controller = 'sales_order'; 00041 $this->_mode = 'view'; 00042 00043 parent::__construct(); 00044 00045 $this->_removeButton('delete'); 00046 $this->_removeButton('reset'); 00047 $this->_removeButton('save'); 00048 $this->setId('sales_order_view'); 00049 00050 if ($this->_isAllowedAction('edit') && $this->getOrder()->canEdit()) { 00051 $onclickJs = 'deleteConfirm(\'' 00052 . Mage::helper('sales')->__('Are you sure? This order will be cancelled and a new one will be created instead') 00053 . '\', \'' . $this->getEditUrl() . '\');'; 00054 $this->_addButton('order_edit', array( 00055 'label' => Mage::helper('sales')->__('Edit'), 00056 'onclick' => $onclickJs, 00057 )); 00058 // see if order has non-editable products as items 00059 $nonEditableTypes = array_keys(Mage::getResourceSingleton('sales/order')->aggregateProductsByTypes( 00060 $this->getOrder()->getId(), array_keys(Mage::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray()), false 00061 )); 00062 if ($nonEditableTypes) { 00063 $this->_updateButton('order_edit', 'onclick', 00064 'if (!confirm(\'' . Mage::helper('sales')->__( 00065 'This order contains (%s) items and therefore cannot be edited through the admin interface at this time, if you wish to continue editing the (%s) items will be removed, the order will be cancelled and a new order will be placed', 00066 implode(', ', $nonEditableTypes), 00067 implode(', ', $nonEditableTypes) 00068 ) . '\')) return false;' . $onclickJs 00069 ); 00070 } 00071 } 00072 00073 if ($this->_isAllowedAction('cancel') && $this->getOrder()->canCancel()) { 00074 $message = Mage::helper('sales')->__('Are you sure you want to cancel this order?'); 00075 $this->_addButton('order_cancel', array( 00076 'label' => Mage::helper('sales')->__('Cancel'), 00077 'onclick' => 'deleteConfirm(\''.$message.'\', \'' . $this->getCancelUrl() . '\')', 00078 )); 00079 } 00080 00081 if ($this->_isAllowedAction('creditmemo') && $this->getOrder()->canCreditmemo()) { 00082 $this->_addButton('order_creditmemo', array( 00083 'label' => Mage::helper('sales')->__('Credit Memo'), 00084 'onclick' => 'setLocation(\'' . $this->getCreditmemoUrl() . '\')', 00085 )); 00086 } 00087 00088 if ($this->_isAllowedAction('hold') && $this->getOrder()->canHold()) { 00089 $this->_addButton('order_hold', array( 00090 'label' => Mage::helper('sales')->__('Hold'), 00091 'onclick' => 'setLocation(\'' . $this->getHoldUrl() . '\')', 00092 )); 00093 } 00094 00095 if ($this->_isAllowedAction('unhold') && $this->getOrder()->canUnhold()) { 00096 $this->_addButton('order_unhold', array( 00097 'label' => Mage::helper('sales')->__('Unhold'), 00098 'onclick' => 'setLocation(\'' . $this->getUnholdUrl() . '\')', 00099 )); 00100 } 00101 00102 if ($this->_isAllowedAction('invoice') && $this->getOrder()->canInvoice()) { 00103 $_label = $this->getOrder()->getForcedDoShipmentWithInvoice()?'Invoice and Ship':'Invoice'; 00104 $this->_addButton('order_invoice', array( 00105 'label' => Mage::helper('sales')->__('%s', $_label), 00106 'onclick' => 'setLocation(\'' . $this->getInvoiceUrl() . '\')', 00107 )); 00108 } 00109 00110 if ($this->_isAllowedAction('ship') && $this->getOrder()->canShip() 00111 && !$this->getOrder()->getForcedDoShipmentWithInvoice()) { 00112 $this->_addButton('order_ship', array( 00113 'label' => Mage::helper('sales')->__('Ship'), 00114 'onclick' => 'setLocation(\'' . $this->getShipUrl() . '\')', 00115 )); 00116 } 00117 00118 if ($this->_isAllowedAction('reorder') && $this->getOrder()->canReorder()) { 00119 $this->_addButton('order_reorder', array( 00120 'label' => Mage::helper('sales')->__('Reorder'), 00121 'onclick' => 'setLocation(\'' . $this->getReorderUrl() . '\')', 00122 )); 00123 } 00124 }
_isAllowedAction | ( | $ | action | ) | [protected] |
Definition at line 212 of file View.php.
00213 { 00214 return Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/' . $action); 00215 }
getCancelUrl | ( | ) |
getCommentUrl | ( | ) |
getCreditmemoUrl | ( | ) |
getEditUrl | ( | ) |
getHeaderText | ( | ) |
Get header text
Reimplemented from Mage_Adminhtml_Block_Widget_Container.
Definition at line 146 of file View.php.
00147 { 00148 if ($_extOrderId = $this->getOrder()->getExtOrderId()) { 00149 $_extOrderId = '[' . $_extOrderId . '] '; 00150 } else { 00151 $_extOrderId = ''; 00152 } 00153 $text = Mage::helper('sales')->__('Order # %s %s| Order Date %s', 00154 $this->getOrder()->getRealOrderId(), 00155 $_extOrderId, 00156 $this->formatDate($this->getOrder()->getCreatedAtDate(), 'medium', true) 00157 ); 00158 return $text; 00159 }
getHoldUrl | ( | ) |
getInvoiceUrl | ( | ) |
getOrder | ( | ) |
Retrieve order model object
Definition at line 131 of file View.php.
00132 { 00133 return Mage::registry('sales_order'); 00134 }
getOrderId | ( | ) |
getReorderUrl | ( | ) |
getShipUrl | ( | ) |
getUnholdUrl | ( | ) |
getUrl | ( | $ | route = '' , |
|
$ | params = array() | |||
) |
Generate url by route and parameters
string | $route | |
array | $params |
Reimplemented from Mage_Core_Block_Abstract.
Definition at line 161 of file View.php.
00162 { 00163 $params2['order_id'] = $this->getOrderId(); 00164 return parent::getUrl($params, $params2); 00165 }