Overview

Namespaces

  • None
  • PHP

Classes

  • Eabi_DpdEE_Block_Adminhtml_Config_Form_Field_Country
  • Eabi_DpdEE_Block_Info_Payment
  • Eabi_DpdEE_Block_Invoice
  • Eabi_DpdEE_Block_Order_Courier
  • Eabi_DpdEE_Helper_Data
  • Eabi_DpdEE_Model_Api
  • Eabi_DpdEE_Model_Button_Courier
  • Eabi_DpdEE_Model_Config
  • Eabi_DpdEE_Model_Flat
  • Eabi_DpdEE_Model_Observer
  • Eabi_DpdEE_Model_Payment_Processor
  • Eabi_DpdEE_Model_Post
  • Eabi_DpdEE_Model_Source_Label_Position
  • Eabi_DpdEE_Model_Source_Service
  • Eabi_Livehandler_Adminhtml_LivehandlerController
  • Eabi_Livehandler_Adminhtml_RemoveController
  • Eabi_Livehandler_Block_Adminhtml_Config_Form_Field_Button
  • Eabi_Livehandler_Block_Adminhtml_Config_Form_Field_Remove
  • Eabi_Livehandler_Block_Email
  • Eabi_LiveHandler_Block_Footer
  • Eabi_Livehandler_Helper_Data
  • Eabi_Livehandler_Helper_Keypair
  • Eabi_Livehandler_IndexController
  • Eabi_Livehandler_Model_Abstract
  • Eabi_Livehandler_Model_Action_Abstract
  • Eabi_Livehandler_Model_Action_Postoffice_Print
  • Eabi_Livehandler_Model_Action_Postoffice_Send
  • Eabi_Livehandler_Model_Adminhtml_Gridmanager
  • Eabi_Livehandler_Model_Directory_Collection
  • Eabi_Livehandler_Model_Entry
  • Eabi_Livehandler_Model_File_Object
  • Eabi_Livehandler_Model_Mysql4_Entry
  • Eabi_Livehandler_Model_Mysql4_Entry_Collection
  • Eabi_Livehandler_Model_Ordergrid
  • Eabi_Livehandler_Model_System_Config_Backend_Button
  • Eabi_Postoffice_Adminhtml_PostofficeController
  • Eabi_Postoffice_Block_Adminhtml_Config_Form_Field_License
  • Eabi_Postoffice_Block_Adminhtml_Config_Form_Field_Remove
  • Eabi_Postoffice_Block_Config_Rebuildbutton
  • Eabi_Postoffice_Helper_Countrycode
  • Eabi_Postoffice_Helper_Data
  • Eabi_Postoffice_IndexController
  • Eabi_Postoffice_Model_Carrier_Abstract
  • Eabi_Postoffice_Model_Carrier_Result
  • Eabi_Postoffice_Model_Carriermodule
  • Eabi_Postoffice_Model_Mysql4_Carriermodule
  • Eabi_Postoffice_Model_Mysql4_Carriermodule_Collection
  • Eabi_Postoffice_Model_Mysql4_Office
  • Eabi_Postoffice_Model_Mysql4_Office_Collection
  • Eabi_Postoffice_Model_Observer
  • Eabi_Postoffice_Model_Office
  • Eabi_Postoffice_Model_Orderview
  • Eabi_Postoffice_Model_Source_Sendevent
  • Eabi_Postoffice_Model_Updater
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: /*
  3:   
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * or OpenGPL v3 license (GNU Public License V3.0)
  9:  * that is bundled with this package in the file LICENSE.txt.
 10:  * It is also available through the world-wide-web at this URL:
 11:  * http://opensource.org/licenses/osl-3.0.php
 12:  * or
 13:  * http://www.gnu.org/licenses/gpl-3.0.txt
 14:  * If you did not receive a copy of the license and are unable to
 15:  * obtain it through the world-wide-web, please send an email
 16:  * to info@e-abi.ee so we can send you a copy immediately.
 17:  *
 18:  * DISCLAIMER
 19:  *
 20:  * Do not edit or add to this file if you wish to upgrade this module to newer
 21:  * versions in the future.
 22:  *
 23:  * @category   Eabi
 24:  * @package    Eabi_Dpd
 25:  * @copyright  Copyright (c) 2014 Aktsiamaailm LLC (http://en.e-abi.ee/)
 26:  * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 27:  * @license    http://www.gnu.org/licenses/gpl-3.0.txt  GNU Public License V3.0
 28:  * @author     Matis Halmann
 29:  * 
 30: 
 31:  */
 32: 
 33: /**
 34:  * <p>Creates the extra buttons in the sales/order/view in admin.</p>
 35:  * <p>Added buttons are:
 36:  * <ul>
 37:  * <li>Send parcel data to server - if automatic data sending is available for the selected order and data has not been already sent</li>
 38:  * <li>Print packing slip - If automatic data has been sent and packing slip print functionality is available.</li>
 39:  * </ul>
 40:  * </p>
 41:  * 
 42:  *
 43:  * @author matishalmann
 44:  */
 45: class Eabi_Postoffice_Model_Orderview extends Eabi_Livehandler_Model_Adminhtml_Gridmanager {
 46: 
 47:     private $_incrementId;
 48:     private $_orderId;
 49: 
 50:     public function _construct() {
 51:         parent::_construct();
 52:         $this->_init('eabi_postoffice/orderview');
 53:         
 54:         $orderId = Mage::app()->getRequest()->getParam('order_id');
 55:         
 56:         $order = Mage::getModel('sales/order')->load($orderId);
 57:         if (is_object($order) && $order->getId() > 0) {
 58:             $this->_incrementId = $order->getIncrementId();
 59:             $this->_orderId = $order->getId();
 60:             $barcode = Mage::helper('eabi_postoffice')->getBarcode($order->getIncrementId());
 61:             
 62:             if (is_string($barcode) || is_array($barcode)) {
 63:                 $url = Mage::helper('adminhtml')->getUrl('eabi_postoffice/adminhtml_postoffice/addresscardpdf', array('order_id'=> $orderId));
 64:                 
 65:                 $this->addActionButton('eabi_get_addresscard', Mage::helper('eabi_postoffice')->__('Print packing slip'), "setLocation('".$url."')");
 66:             }
 67:             
 68:             if (Mage::helper('eabi_postoffice')->isDataSent($order->getIncrementId()) === false) {
 69:             $confirmText = str_replace('\"', '"', addslashes(Mage::helper('eabi_postoffice')->__('Send shipping data to server') . '?'));
 70:             $dataSendTextSuccess = str_replace('\"', '"', addslashes(Mage::helper('eabi_postoffice')->__('Data sent to server, please verify the status from the order comments')));
 71:             $url = Mage::helper('adminhtml')->getUrl('eabi_postoffice/adminhtml_postoffice/autosend', array('order_id' => $this->_orderId));
 72: $js = <<<EOT
 73: if(confirm("{$confirmText}")){new Ajax.Request("{$url}",{method:"get",onSuccess:function(a){json=a.responseText.evalJSON(true);if(json){if(json["error"]){alert(json["error"])}else if(json["success"]){alert("{$dataSendTextSuccess}");location.reload(true)}}else{alert("Fatal error")}},onFailure:function(){alert("Fatal error")}})}; return false;
 74: EOT;
 75:                 
 76:                 $this->addActionButton('eabi_send_data_to_server', Mage::helper('eabi_postoffice')->__('Send shipping data to server'), $js);
 77:             }
 78:             
 79:         }
 80:         
 81:         
 82:     }
 83:     
 84:     protected function _getAdditionalJs($currentJs) {
 85:         if ($currentJs != '' && $this->_incrementId != '') {
 86:             $confirmText = str_replace('\"', '"', addslashes(Mage::helper('eabi_postoffice')->__('Send shipping data to server') . '?'));
 87:             $dataSendTextSuccess = str_replace('\"', '"', addslashes(Mage::helper('eabi_postoffice')->__('Data sent to server, please verify the status from the order comments')));
 88:             $url = Mage::helper('adminhtml')->getUrl('eabi_postoffice/adminhtml_postoffice/autosend', array('order_id' => $this->_orderId));
 89:             return '';
 90: 
 91: 
 92:             return <<<EOT
 93:             
 94: function eabi_autosend_data() {
 95:     var eabi_confirmR = confirm('{$confirmText}');
 96:     if (confirm('{$confirmText}')) {
 97:         new Ajax.Request('{$url}', {
 98:             method: 'get',
 99:             onSuccess: function(transport) {
100:                 json = transport.responseText.evalJSON(true);
101:                 if (json) {
102:                     if (json['error']) {
103:                         alert(json['error']);
104:                     } else if (json['success']) {
105:                         alert('{$datasendTextSuccess}');
106:                         location.reload(true);
107:                     }
108:                 } else {
109:                     alert('Fatal error');
110:                 }
111:             },
112:             onFailure: function() {
113:                alert('Fatal error');
114:             }
115:         });
116:     }
117: }
118: EOT;
119:         }
120:         return '';
121:     }
122:     
123:     
124:     public function service($postData) {
125:         return array();
126:     }
127:     
128: }
129: 
130: 
131: 
DPD Eesti - Pakivedu.ee Shipping module for Magento API documentation generated by ApiGen 2.8.0