Raveinfosys_OrderExporter - Version 1.0.0

Version Notes

This is stable version of this extension and has been tested on various version of community editions.

In this particular version we are supporting it to run on PHP V 5.4.X

Download this release

Release Info

Developer Rave Infosys
Extension Raveinfosys_OrderExporter
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (24) hide show
  1. app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter.php +12 -0
  2. app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter/Edit.php +45 -0
  3. app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter/Edit/Form.php +19 -0
  4. app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter/Edit/Tab/Form.php +76 -0
  5. app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter/Edit/Tabs.php +24 -0
  6. app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter/Grid.php +143 -0
  7. app/code/community/Raveinfosys/Exporter/Block/Exporter.php +17 -0
  8. app/code/community/Raveinfosys/Exporter/Block/Sales/Order/Form/Form.php +12 -0
  9. app/code/community/Raveinfosys/Exporter/Block/Sales/Order/Items.php +12 -0
  10. app/code/community/Raveinfosys/Exporter/Helper/Data.php +98 -0
  11. app/code/community/Raveinfosys/Exporter/Model/Createorder.php +444 -0
  12. app/code/community/Raveinfosys/Exporter/Model/Exporter.php +136 -0
  13. app/code/community/Raveinfosys/Exporter/Model/Exportorders.php +321 -0
  14. app/code/community/Raveinfosys/Exporter/Model/Importorders.php +280 -0
  15. app/code/community/Raveinfosys/Exporter/Model/Operations/Creditmemo.php +86 -0
  16. app/code/community/Raveinfosys/Exporter/Model/Operations/Invoice.php +48 -0
  17. app/code/community/Raveinfosys/Exporter/Model/Operations/Shipment.php +50 -0
  18. app/code/community/Raveinfosys/Exporter/controllers/Adminhtml/ExporterController.php +57 -0
  19. app/code/community/Raveinfosys/Exporter/controllers/Adminhtml/ImporterController.php +46 -0
  20. app/code/community/Raveinfosys/Exporter/etc/config.xml +138 -0
  21. app/design/adminhtml/default/default/layout/exporter.xml +20 -0
  22. app/etc/modules/Raveinfosys_Exporter.xml +9 -0
  23. package.xml +19 -0
  24. var/raveinfosys/exporter/order_exception_log.htm +1 -0
app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Raveinfosys_Exporter_Block_Adminhtml_Exporter extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_exporter';
7
+ $this->_blockGroup = 'exporter';
8
+ $this->_headerText = Mage::helper('exporter')->__('Order Export');
9
+ $this->_addButtonLabel = Mage::helper('exporter')->__('Export All Orders');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Block_Adminhtml_Exporter_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'exporter';
11
+ $this->_controller = 'adminhtml_exporter';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('exporter')->__('Save Item'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('exporter')->__('Delete Item'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+ function toggleEditor() {
24
+ if (tinyMCE.getInstanceById('exporter_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'exporter_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'exporter_content');
28
+ }
29
+ }
30
+
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+ }
36
+
37
+ public function getHeaderText()
38
+ {
39
+ if( Mage::registry('exporter_data') && Mage::registry('exporter_data')->getId() ) {
40
+ return Mage::helper('exporter')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('exporter_data')->getTitle()));
41
+ } else {
42
+ return Mage::helper('exporter')->__('Add Item');
43
+ }
44
+ }
45
+ }
app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Block_Adminhtml_Exporter_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter/Edit/Tab/Form.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Block_Adminhtml_Exporter_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'config_form',
9
+ 'action' => $this->getUrl('*/*/importOrders'),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ ));
13
+ $form->setUseContainer(true);
14
+ $this->setForm($form);
15
+ $fieldset = $form->addFieldset('exporter_form', array('legend'=>Mage::helper('exporter')->__('Import Orders')));
16
+
17
+ $fieldset->addField('store_id', 'select', array(
18
+ 'name' => 'store_id',
19
+ 'label' => Mage::helper('exporter')->__('Store View'),
20
+ 'title' => Mage::helper('exporter')->__('Store View'),
21
+ 'required' => true,
22
+ 'values' => Mage::getModel('exporter/exporter')->getStoreIds(),
23
+ ));
24
+
25
+
26
+ $fieldset->addField('import_limit', 'select', array(
27
+ 'label' => Mage::helper('exporter')->__('Order Import Limit'),
28
+ 'name' => 'import_limit',
29
+ 'required' => true,
30
+ 'values' => array(
31
+ array(
32
+ 'value' => '50',
33
+ 'label' => Mage::helper('exporter')->__('50'),
34
+ ),
35
+
36
+ array(
37
+ 'value' => '100',
38
+ 'label' => Mage::helper('exporter')->__('100'),
39
+ ),
40
+
41
+ array(
42
+ 'value' => '150',
43
+ 'label' => Mage::helper('exporter')->__('150'),
44
+ ),
45
+
46
+ array(
47
+ 'value' => '200',
48
+ 'label' => Mage::helper('exporter')->__('200'),
49
+ ),
50
+ ),
51
+ ));
52
+
53
+ $fieldset->addField('order_csv', 'file', array(
54
+ 'label' => Mage::helper('exporter')->__('Orders CSV File : '),
55
+ 'required' => true,
56
+ 'name' => 'order_csv',
57
+ 'after_element_html' => '</br>Note : <small>Strictly recommend to use the csv file which has been generated by the same module.</small>',
58
+ ));
59
+
60
+ $fieldset->addField('submit', 'submit', array(
61
+ 'value' => 'Import',
62
+ 'after_element_html' => '<small></small>',
63
+ 'class' => 'form-button',
64
+ 'tabindex' => 1
65
+ ));
66
+
67
+ if ( Mage::getSingleton('adminhtml/session')->getExporterData() )
68
+ {
69
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getExporterData());
70
+ Mage::getSingleton('adminhtml/session')->setExporterData(null);
71
+ } elseif ( Mage::registry('exporter_data') ) {
72
+ $form->setValues(Mage::registry('exporter_data')->getData());
73
+ }
74
+ return parent::_prepareForm();
75
+ }
76
+ }
app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Block_Adminhtml_Exporter_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('exporter_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('exporter')->__('Import Orders'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('exporter')->__('Import Orders'),
18
+ 'title' => Mage::helper('exporter')->__('Import Orders'),
19
+ 'content' => $this->getLayout()->createBlock('exporter/adminhtml_exporter_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/community/Raveinfosys/Exporter/Block/Adminhtml/Exporter/Grid.php ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Block_Adminhtml_Exporter_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('sales_order_export_grid');
9
+ $this->setUseAjax(true);
10
+ $this->setDefaultSort('created_at');
11
+ $this->setDefaultDir('DESC');
12
+ $this->setSaveParametersInSession(true);
13
+ }
14
+
15
+ /**
16
+ * Retrieve collection class
17
+ *
18
+ * @return string
19
+ */
20
+ protected function _getCollectionClass()
21
+ {
22
+ return 'sales/order_grid_collection';
23
+ }
24
+
25
+ protected function _prepareCollection()
26
+ {
27
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
28
+ $this->setCollection($collection);
29
+ return parent::_prepareCollection();
30
+ }
31
+
32
+ protected function _prepareColumns()
33
+ {
34
+
35
+ $this->addColumn('real_order_id', array(
36
+ 'header'=> Mage::helper('sales')->__('Order #'),
37
+ 'width' => '80px',
38
+ 'type' => 'text',
39
+ 'index' => 'increment_id',
40
+ ));
41
+
42
+ if (!Mage::app()->isSingleStoreMode()) {
43
+ $this->addColumn('store_id', array(
44
+ 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
45
+ 'index' => 'store_id',
46
+ 'type' => 'store',
47
+ 'store_view'=> true,
48
+ 'display_deleted' => true,
49
+ ));
50
+ }
51
+
52
+ $this->addColumn('created_at', array(
53
+ 'header' => Mage::helper('sales')->__('Purchased On'),
54
+ 'index' => 'created_at',
55
+ 'type' => 'datetime',
56
+ 'width' => '100px',
57
+ ));
58
+
59
+ $this->addColumn('billing_name', array(
60
+ 'header' => Mage::helper('sales')->__('Bill to Name'),
61
+ 'index' => 'billing_name',
62
+ ));
63
+
64
+ $this->addColumn('shipping_name', array(
65
+ 'header' => Mage::helper('sales')->__('Ship to Name'),
66
+ 'index' => 'shipping_name',
67
+ ));
68
+
69
+ $this->addColumn('base_grand_total', array(
70
+ 'header' => Mage::helper('sales')->__('G.T. (Base)'),
71
+ 'index' => 'base_grand_total',
72
+ 'type' => 'currency',
73
+ 'currency' => 'base_currency_code',
74
+ ));
75
+
76
+ $this->addColumn('grand_total', array(
77
+ 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
78
+ 'index' => 'grand_total',
79
+ 'type' => 'currency',
80
+ 'currency' => 'order_currency_code',
81
+ ));
82
+
83
+ $this->addColumn('status', array(
84
+ 'header' => Mage::helper('sales')->__('Status'),
85
+ 'index' => 'status',
86
+ 'type' => 'options',
87
+ 'width' => '70px',
88
+ 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
89
+ ));
90
+
91
+ if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
92
+ $this->addColumn('action',
93
+ array(
94
+ 'header' => Mage::helper('sales')->__('Action'),
95
+ 'width' => '50px',
96
+ 'type' => 'action',
97
+ 'getter' => 'getId',
98
+ 'actions' => array(
99
+ array(
100
+ 'caption' => Mage::helper('sales')->__('View'),
101
+ 'url' => array('base'=>'adminhtml/sales_order/view'),
102
+ 'field' => 'order_id'
103
+ )
104
+ ),
105
+ 'filter' => false,
106
+ 'sortable' => false,
107
+ 'index' => 'stores',
108
+ 'is_system' => true,
109
+ ));
110
+ }
111
+
112
+
113
+ return parent::_prepareColumns();
114
+ }
115
+
116
+ protected function _prepareMassaction()
117
+ {
118
+ $this->setMassactionIdField('entity_id');
119
+ $this->getMassactionBlock()->setFormFieldName('order_ids');
120
+ $this->getMassactionBlock()->setUseSelectAll(false);
121
+
122
+ $this->getMassactionBlock()->addItem('export_order', array(
123
+ 'label'=> Mage::helper('sales')->__('Export Orders'),
124
+ 'url' => $this->getUrl('*/*/exportCsv'),
125
+ ));
126
+
127
+
128
+ return $this;
129
+ }
130
+
131
+ public function getGridUrl()
132
+ {
133
+ return $this->getUrl('*/*/grid', array('_current'=>true));
134
+ }
135
+
136
+ public function getRowUrl($row)
137
+ {
138
+ return false;
139
+ }
140
+
141
+
142
+
143
+ }
app/code/community/Raveinfosys/Exporter/Block/Exporter.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Raveinfosys_Exporter_Block_Exporter extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getExporter()
10
+ {
11
+ if (!$this->hasData('exporter')) {
12
+ $this->setData('exporter', Mage::registry('exporter'));
13
+ }
14
+ return $this->getData('exporter');
15
+
16
+ }
17
+ }
app/code/community/Raveinfosys/Exporter/Block/Sales/Order/Form/Form.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Raveinfosys_Exporter_Block_Sales_Order_Form_Form extends Mage_Adminhtml_Block_Sales_Order_Shipment_View_Form
3
+ {
4
+ public function canCreateShippingLabel()
5
+ {
6
+ $shippingCarrier = $this->getOrder()->getShippingCarrier();
7
+ if($shippingCarrier)
8
+ return $shippingCarrier && $shippingCarrier->isShippingLabelsAvailable();
9
+ else
10
+ return $shippingCarrier;
11
+ }
12
+ }
app/code/community/Raveinfosys/Exporter/Block/Sales/Order/Items.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Raveinfosys_Exporter_Block_Sales_Order_Items extends Mage_Adminhtml_Block_Sales_Order_Shipment_Create_Items
3
+ {
4
+ public function canCreateShippingLabel()
5
+ {
6
+ $shippingCarrier = $this->getOrder()->getShippingCarrier();
7
+ if($shippingCarrier)
8
+ return $shippingCarrier && $shippingCarrier->isShippingLabelsAvailable();
9
+ else
10
+ return $shippingCarrier;
11
+ }
12
+ }
app/code/community/Raveinfosys/Exporter/Helper/Data.php ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public $error_file = '';
6
+
7
+ public function __construct()
8
+ {
9
+ $this->error_file = Mage::getBaseDir('var') .'/raveinfosys/exporter/order_exception_log.htm';
10
+ $handle = fopen($this->error_file, "a+");
11
+ chmod($this->error_file, 0777);
12
+ }
13
+
14
+ public function logException(Exception $exception,$order_id,$type,$line_nuber = '')
15
+ {
16
+ $message = $exception->getMessage();
17
+ $code = $exception->getCode();
18
+ $file = $exception->getFile();
19
+ $line = $exception->getLine();
20
+ $trace = $exception->getTraceAsString();
21
+ $date = date('M d, Y h:iA');
22
+
23
+ if($type=='order'){
24
+ $log_message = "<p><strong>Order Id:</strong> {$order_id}
25
+ <p><strong>Error Message:</strong> {$message}</p>
26
+ <p><strong>Line Number:</strong> {$line_nuber}</p>";
27
+ }
28
+ else if($type=='invoice'){
29
+ $log_message = "<p><strong>Invoice Error : </strong></p>
30
+ <p><strong>Order Id:</strong> {$order_id}</p>
31
+ <p><strong>Error Message:</strong> {$message}</p>";
32
+ }
33
+ else if($type=='shipment'){
34
+ $log_message = "<p><strong>Shipment Error : </strong></p>
35
+ <p><strong>Order Id:</strong> {$order_id}</p>
36
+ <p><strong>Error Message:</strong> {$message}</p>";
37
+ }
38
+ else if($type=='creditmemo'){
39
+ $log_message = "<p><strong>Creditmemo Error : </strong></p>
40
+ <p><strong>Order Id:</strong> {$order_id}</p>
41
+ <p><strong>Error Message:</strong> {$message}</p>";
42
+ }
43
+
44
+ if( is_file($this->error_file) === false ) {
45
+ file_put_contents($this->error_file, '');
46
+ }
47
+
48
+ $content = file_get_contents($this->error_file);
49
+ file_put_contents($this->error_file, $content.$log_message);
50
+ }
51
+
52
+ public function logAvailable($order_id,$type,$line_nuber)
53
+ {
54
+ $message = "Order id already exist";
55
+ $log_message = "<p><strong>Order Id:</strong> {$order_id}</p>
56
+ <p><strong>Error Message:</strong> {$message}</p>
57
+ <p><strong>Line Number:</strong> {$line_nuber}</p>";
58
+
59
+ if( is_file($this->error_file) === false ) {
60
+ file_put_contents($this->error_file, '');
61
+ }
62
+ $content = file_get_contents($this->error_file);
63
+ file_put_contents($this->error_file, $content.$log_message);
64
+ }
65
+
66
+ public function header()
67
+ {
68
+ file_put_contents($this->error_file, '<h3 style="text-align:center;">Error information:</h3><hr /><br />');
69
+ }
70
+
71
+ public function isPrintable()
72
+ {
73
+ if(filesize($this->error_file)>67)
74
+ return true;
75
+ }
76
+
77
+ public function footer()
78
+ {
79
+ $content = file_get_contents($this->error_file);
80
+ file_put_contents($this->error_file, $content.'<br /><hr /><br /><br />');
81
+ }
82
+
83
+ public function unlinkFile()
84
+ {
85
+ unlink($this->error_file);
86
+ }
87
+
88
+ public function getVersion()
89
+ {
90
+ $m= new Mage;
91
+ $version=$m->getVersion();
92
+ if(in_array($version,array('1.5.0.0','1.5.0.1','1.5.1.0','1.6.0.0','1.9.1.1','1.10.0.2','1.10.1.1','1.11.0.0')))
93
+ return true;
94
+ else
95
+ return false;
96
+ }
97
+
98
+ }
app/code/community/Raveinfosys/Exporter/Model/Createorder.php ADDED
@@ -0,0 +1,444 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Model_Createorder extends Mage_Core_Model_Abstract
4
+ {
5
+ public $last_order_increment_id = null ;
6
+ public $order_items = array() ;
7
+ public $shipped_item = array() ;
8
+ public $invoiced_item = array() ;
9
+ public $credit_item = array() ;
10
+ public $canceled_item = array() ;
11
+ public $partial_shipped = false;
12
+ public $partial_credited = false;
13
+ public $partial_invoiced = false;
14
+ public $order_status = null;
15
+ public $order_detai_arr = null;
16
+ public $parent_id_flag = 0;
17
+ public $parent_id = 0;
18
+ public $store_id = 0;
19
+ public $invoice_created_at = '';
20
+ public $shipment_created_at = '';
21
+
22
+ public function _construct()
23
+ {
24
+ $this->setLastOrderItemId();
25
+ }
26
+
27
+ public function setItemData()
28
+ {
29
+ $order = $this->getOrderModel($this->last_order_increment_id);
30
+ $shipped_item = array();
31
+ $invoiced_item = array();
32
+ $credit_item = array();
33
+ $canceled_item = array();
34
+ $itemCount = 0;
35
+ $orderItems = $this->order_items;
36
+ foreach($order->getAllItems() as $item)
37
+ {
38
+ $shipped_item[$item->getItemId()] = $orderItems[$itemCount]['qty_shipped'];
39
+ $invoiced_item[$item->getItemId()] = $orderItems[$itemCount]['qty_invoiced'];
40
+ $credit_item[$item->getItemId()] = $orderItems[$itemCount]['qty_refunded'];
41
+ $canceled_item[$item->getItemId()] = $orderItems[$itemCount]['qty_canceled'];
42
+
43
+ if($orderItems[$itemCount]['qty_shipped']>0)
44
+ $this->partial_shipped = true;
45
+
46
+ if($orderItems[$itemCount]['qty_invoiced']>0)
47
+ $this->partial_invoiced = true;
48
+
49
+ if($orderItems[$itemCount]['qty_refunded']>0)
50
+ $this->partial_credited = true;
51
+
52
+ $itemCount++;
53
+ }
54
+
55
+ $this->invoiced_item = $invoiced_item;
56
+ $this->shipped_item = $shipped_item;
57
+ $this->credit_item = $credit_item;
58
+ $this->canceled_item = $canceled_item;
59
+ }
60
+
61
+ public function setGlobalData($last_order_increment_id,$order_items,$sales_order_arr)
62
+ {
63
+ $this->last_order_increment_id = $last_order_increment_id;
64
+ $this->order_items = $order_items;
65
+ $this->order_detai_arr = $sales_order_arr;
66
+ $this->order_status = $sales_order_arr['order_state'];
67
+ $this->invoice_created_at = $sales_order_arr['invoice_created_at'];
68
+ $this->shipment_created_at = $sales_order_arr['shipment_created_at'];
69
+ $this->setTime($last_order_increment_id,$sales_order_arr);
70
+ $this->setItemData();
71
+ }
72
+
73
+ public function setTime($last_order_increment_id,$sales_order_arr)
74
+ {
75
+ Mage::getModel('sales/order')->loadByIncrementId($last_order_increment_id)
76
+ ->setCreatedAt($sales_order_arr['created_at'])
77
+ ->setUpdatedAt($sales_order_arr['updated_at'])
78
+ ->save()
79
+ ->unsetData();
80
+ }
81
+
82
+ public function setLastOrderItemId()
83
+ {
84
+ $resource = Mage::getSingleton('core/resource');
85
+ $conn = $resource->getConnection('core_read');
86
+ $results = $conn->query("SHOW TABLE STATUS LIKE '".$resource->getTableName('sales/order_item')."'")->fetchAll();
87
+ foreach($results as $data)
88
+ $this->parent_id_flag = $data['Auto_increment']-1;
89
+ }
90
+
91
+
92
+ //To create order
93
+ public function createOrder($sales_order_arr,$sales_order_item_arr,$store_id)
94
+ {
95
+ $this->store_id = $store_id;
96
+ if(!$this->orderIdStatus($sales_order_arr['increment_id']))
97
+ return 2;
98
+
99
+ $transaction = Mage::getSingleton('core/resource_transaction');
100
+ $order = Mage::getModel('sales/order')
101
+ ->setIncrementId($sales_order_arr['increment_id'])
102
+ ->setStoreId($this->store_id)
103
+ ->setStatus($sales_order_arr['order_status'])
104
+ ->setHoldBeforeState($sales_order_arr['hold_before_state'])
105
+ ->setHoldBeforeStatus($sales_order_arr['hold_before_status'])
106
+ ->setIsVirtual($sales_order_arr['is_virtual'])
107
+ ->setBaseCurrencyCode($sales_order_arr['base_currency_code'])
108
+ ->setStoreCurrencyCode($sales_order_arr['store_currency_code'])
109
+ ->setGlobalCurrencyCode($sales_order_arr['store_currency_code'])
110
+ ->setOrderCurrencyCode($sales_order_arr['order_currency_code']);
111
+
112
+ // Set Customer data
113
+
114
+ $custm_detail = $this->getCustomerInfo($sales_order_arr['customer_email']);
115
+
116
+ if($custm_detail)
117
+ {
118
+ $order->setCustomerEmail($custm_detail['email'])
119
+ ->setCustomerFirstname($custm_detail['firstname'])
120
+ ->setCustomerLastname($custm_detail['lastname'])
121
+ ->setCustomerId($custm_detail['entity_id'])
122
+ ->setCustomerGroupId($custm_detail['group_id']);
123
+ }
124
+ else
125
+ {
126
+ $order->setCustomerEmail($sales_order_arr['customer_email'])
127
+ ->setCustomerFirstname($sales_order_arr['customer_firstname'])
128
+ ->setCustomerLastname($sales_order_arr['customer_lasttname'])
129
+ ->setCustomerIsGuest(1)
130
+ ->setCustomerGroupId(0);
131
+ }
132
+
133
+
134
+ // Set Billing Address
135
+ $billingAddress = Mage::getModel('sales/order_address')
136
+ ->setStoreId($this->store_id)
137
+ ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_BILLING)
138
+ ->setCustomerAddressId($sales_order_arr['billing_address']['customer_address_id'])
139
+ ->setPrefix($sales_order_arr['billing_address']['prefix'])
140
+ ->setFirstname($sales_order_arr['billing_address']['firstname'])
141
+ ->setMiddlename($sales_order_arr['billing_address']['middlename'])
142
+ ->setLastname($sales_order_arr['billing_address']['lastname'])
143
+ ->setSuffix($sales_order_arr['billing_address']['suffix'])
144
+ ->setCompany($sales_order_arr['billing_address']['company'])
145
+ ->setStreet($sales_order_arr['billing_address']['street'])
146
+ ->setCity($sales_order_arr['billing_address']['city'])
147
+ ->setCountryId($sales_order_arr['billing_address']['country_id'])
148
+ ->setRegion($sales_order_arr['billing_address']['region'])
149
+ ->setPostcode($sales_order_arr['billing_address']['postcode'])
150
+ ->setTelephone($sales_order_arr['billing_address']['telephone'])
151
+ ->setFax($sales_order_arr['billing_address']['fax']);
152
+ $order->setBillingAddress($billingAddress);
153
+
154
+ // Set Shipping Address
155
+ $shippingAddress = Mage::getModel('sales/order_address')
156
+ ->setStoreId($this->store_id)
157
+ ->setAddressType(Mage_Sales_Model_Quote_Address::TYPE_SHIPPING)
158
+ ->setCustomerAddressId($sales_order_arr['shipping_address']['customer_address_id'])
159
+ ->setPrefix($sales_order_arr['shipping_address']['prefix'])
160
+ ->setFirstname($sales_order_arr['shipping_address']['firstname'])
161
+ ->setMiddlename($sales_order_arr['shipping_address']['middlename'])
162
+ ->setLastname($sales_order_arr['shipping_address']['lastname'])
163
+ ->setSuffix($sales_order_arr['shipping_address']['suffix'])
164
+ ->setCompany($sales_order_arr['shipping_address']['company'])
165
+ ->setStreet($sales_order_arr['shipping_address']['street'])
166
+ ->setCity($sales_order_arr['shipping_address']['city'])
167
+ ->setCountry_id($sales_order_arr['shipping_address']['country_id'])
168
+ ->setRegion($sales_order_arr['shipping_address']['region'])
169
+ ->setPostcode($sales_order_arr['shipping_address']['postcode'])
170
+ ->setTelephone($sales_order_arr['shipping_address']['telephone'])
171
+ ->setFax($sales_order_arr['shipping_address']['fax']) ;
172
+
173
+ if(!$sales_order_arr['is_virtual']){
174
+ $order->setShippingAddress($shippingAddress)
175
+ ->setShippingMethod($sales_order_arr['shipping_method'])
176
+ ->setShippingDescription($sales_order_arr['shipping_method']);
177
+ }
178
+
179
+ $orderPayment = Mage::getModel('sales/order_payment')
180
+ ->setStoreId($this->store_id)
181
+ ->setCustomerPaymentId(0)
182
+ ->setMethod('checkmo')
183
+ ->setPoNumber(' - ');
184
+ $order->setPayment($orderPayment);
185
+
186
+ $flag = 1;
187
+ foreach($sales_order_item_arr as $product)
188
+ {
189
+ $orderItem = Mage::getModel('sales/order_item')
190
+ ->setStoreId($this->store_id)
191
+ ->setQuoteItemId(0)
192
+ ->setQuoteParentItemId(NULL)
193
+ ->setSku($product['product_sku'])
194
+ ->setProductType($product['product_type'])
195
+ ->setProductOptions(unserialize($product['product_option']))
196
+ ->setQtyBackordered(NULL)
197
+ ->setTotalQtyOrdered($product['qty_ordered'])
198
+ ->setQtyOrdered($product['qty_ordered'])
199
+ ->setName($product['product_name'])
200
+ ->setPrice($product['original_price'])
201
+ ->setBasePrice($product['base_original_price'])
202
+ ->setOriginalPrice($product['original_price'])
203
+ ->setBaseOriginalPrice($product['base_original_price'])
204
+ ->setRowWeight($product['row_weight'])
205
+ ->setPriceInclTax($product['price_incl_tax'])
206
+ ->setBasePriceInclTax($product['base_price_incl_tax'])
207
+ ->setTaxAmount($product['product_tax_amount'])
208
+ ->setBaseTaxAmount($product['product_base_tax_amount'])
209
+ ->setTaxPercent($product['product_tax_percent'])
210
+ ->setDiscountAmount($product['product_discount'])
211
+ ->setBaseDiscountAmount($product['product_base_discount'])
212
+ ->setDiscountPercent($product['product_discount_percent'])
213
+ ->setRowTotal($product['row_total'])
214
+ ->setBaseRowTotal($product['base_row_total']);
215
+
216
+ if($product['is_child']=='yes')
217
+ $orderItem->setParentItemId($this->parent_id);
218
+
219
+ else if($product['is_child']=='no')
220
+ $this->parent_id = $this->parent_id_flag+$flag;
221
+
222
+ $order->addItem($orderItem);
223
+
224
+ $flag++;
225
+ }
226
+
227
+
228
+ $order->setShippingAmount($sales_order_arr['shipping_amount']);
229
+ $order->setBaseShippingAmount($sales_order_arr['base_shipping_amount']);
230
+
231
+ //Apply Discount
232
+ $order->setBaseDiscountAmount($sales_order_arr['base_discount_amount']);
233
+ $order->setDiscountAmount($sales_order_arr['discount_amount']);
234
+
235
+ //Apply Tax
236
+ $order->setBaseTaxAmount($sales_order_arr['base_tax_amount']);
237
+ $order->setTaxAmount($sales_order_arr['tax_amount']);
238
+
239
+ $order->setSubtotal($sales_order_arr['subtotal'])
240
+ ->setBaseSubtotal($sales_order_arr['base_subtotal'])
241
+ ->setGrandTotal($sales_order_arr['grand_total'])
242
+ ->setBaseGrandTotal($sales_order_arr['base_grand_total'])
243
+ ->setShippingTaxAmount($sales_order_arr['shipping_tax_amount'])
244
+ ->setBaseShippingTaxAmount($sales_order_arr['base_shipping_tax_amount'])
245
+ ->setBaseToGlobalRate($sales_order_arr['base_to_global_rate'])
246
+ ->setBaseToOrderRate($sales_order_arr['base_to_order_rate'])
247
+ ->setStoreToBaseRate($sales_order_arr['store_to_base_rate'])
248
+ ->setStoreToOrderRate($sales_order_arr['store_to_order_rate'])
249
+ ->setSubtotalInclTax($sales_order_arr['subtotal_incl_tax'])
250
+ ->setBaseSubtotalInclTax($sales_order_arr['base_subtotal_incl_tax'])
251
+ ->setCouponCode($sales_order_arr['coupon_code'])
252
+ ->setDiscountDescription($sales_order_arr['coupon_code'])
253
+ ->setShippingInclTax($sales_order_arr['shipping_incl_tax'])
254
+ ->setBaseShippingInclTax($sales_order_arr['base_shipping_incl_tax'])
255
+ ->setTotalQtyOrdered($sales_order_arr['total_qty_ordered'])
256
+ ->setRemoteIp($sales_order_arr['remote_ip']);
257
+
258
+ $transaction->addObject($order);
259
+ $transaction->addCommitCallback(array($order, 'place'));
260
+ $transaction->addCommitCallback(array($order, 'save'));
261
+
262
+ if($transaction->save())
263
+ {
264
+ $this->setLastOrderItemId();
265
+ $last_order_increment_id = Mage::getSingleton("sales/order")->getCollection()->getLastItem()->getIncrementId();
266
+
267
+ $this->setGlobalData($last_order_increment_id,$sales_order_item_arr,$sales_order_arr);
268
+
269
+ if($sales_order_arr['order_state']=='processing' || $sales_order_arr['order_state']=='complete')
270
+ return $this->setProcessing();
271
+
272
+ if($sales_order_arr['order_state']=='canceled')
273
+ return $this->setCanceled();
274
+
275
+ if($sales_order_arr['order_state']=='closed')
276
+ return $this->setClosed();
277
+
278
+ if($sales_order_arr['order_state']=='holded')
279
+ return $this->setHolded();
280
+
281
+ if($sales_order_arr['order_state']=='payment_review')
282
+ return $this->setPaymentReview();
283
+
284
+ return 1;
285
+ }
286
+ else
287
+ return 3;
288
+
289
+ }
290
+
291
+
292
+ public function setProcessing()
293
+ {
294
+ if($this->partial_invoiced)
295
+ $resp = $this->getInvoiceObj()->createInvoice($this->last_order_increment_id,$this->invoiced_item,$this->invoice_created_at);
296
+
297
+ if($this->partial_shipped)
298
+ $resp = $this->getShipmentObj()->createShipment($this->last_order_increment_id,$this->shipped_item,$this->shipment_created_at);
299
+
300
+ if($this->partial_credited)
301
+ $resp = $this->getCreditmemoObj()->createCreditMemo($this->last_order_increment_id,$this->credit_item,$this->order_detai_arr);
302
+
303
+ $this->unsetAllData();
304
+ return 1;
305
+ }
306
+
307
+ public function setHolded()
308
+ {
309
+ try
310
+ {
311
+ if($this->setProcessing()== 1)
312
+ {
313
+ $order = $this->getOrderModel($this->last_order_increment_id);
314
+ $order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true)->save();
315
+ $order->unsetData();
316
+ return 1;
317
+ }
318
+ } catch (Exception $e) {
319
+ Mage::helper('exporter')->logException($e,$order->getIncrementId(),'order');
320
+ Mage::helper('exporter')->footer();return 1;}
321
+ }
322
+
323
+ public function setPaymentReview()
324
+ {
325
+ try
326
+ {
327
+ if($this->setProcessing()== 1)
328
+ {
329
+ $order = $this->getOrderModel($this->last_order_increment_id);
330
+ $order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true)->save();
331
+ $order->unsetData();
332
+ return 1;
333
+ }
334
+ } catch (Exception $e) {
335
+ Mage::helper('exporter')->logException($e,$order->getIncrementId(),'order');
336
+ Mage::helper('exporter')->footer();return 1;}
337
+ }
338
+
339
+
340
+ public function setCanceled()
341
+ {
342
+ try
343
+ {
344
+ if($this->setProcessing()== 1)
345
+ {
346
+ $this->updateCanceledQTY();
347
+ $order = $this->getOrderModel($this->last_order_increment_id);
348
+ $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
349
+ $order->unsetData();
350
+ return 1;
351
+ }
352
+ } catch (Exception $e) {
353
+ Mage::helper('exporter')->logException($e,$order->getIncrementId(),'order');
354
+ Mage::helper('exporter')->footer();return 1;}
355
+ }
356
+
357
+ public function setClosed()
358
+ {
359
+ try
360
+ {
361
+ if($this->setProcessing()== 1)
362
+ {
363
+ $order = $this->getOrderModel($this->last_order_increment_id);
364
+ $order->setStatus(Mage_Sales_Model_Order::STATE_CLOSED, true)->save();
365
+ $order->unsetData();
366
+ return 1;
367
+ }
368
+ } catch (Exception $e) {
369
+ Mage::helper('exporter')->logException($e,$order->getIncrementId(),'order');
370
+ Mage::helper('exporter')->footer();return 1;}
371
+ }
372
+
373
+
374
+ public function updateCanceledQTY()
375
+ {
376
+ $items = $this->canceled_item;
377
+ foreach($items as $itemid => $itemqty)
378
+ {
379
+ $orderItem = Mage::getModel('sales/order_item')->load($itemid);
380
+ $orderItem->setQtyCanceled($itemqty)->save();
381
+ $orderItem->unsetData();
382
+ }
383
+ }
384
+
385
+ public function getOrderModel($last_order_increment_id)
386
+ {
387
+ $order = Mage::getModel('sales/order')->loadByIncrementId($last_order_increment_id);
388
+ return $order;
389
+ }
390
+
391
+ public function orderIdStatus($last_order_increment_id)
392
+ {
393
+ $order = Mage::getModel('sales/order')->loadByIncrementId($last_order_increment_id);
394
+
395
+ if($order->getId())
396
+ return false;
397
+ else
398
+ return true;
399
+ }
400
+
401
+ public function unsetAllData()
402
+ {
403
+ $this->shipped_item = array() ;
404
+ $this->invoiced_item = array() ;
405
+ $this->credit_item = array() ;
406
+ $this->canceled_item = array() ;
407
+ $this->partial_shipped = false;
408
+ $this->partial_credited = false;
409
+ $this->partial_invoiced = false;
410
+ $this->order_detai_arr = false;
411
+ }
412
+
413
+ public function getInvoiceObj()
414
+ {
415
+ return Mage::getModel('exporter/operations_invoice');
416
+ }
417
+
418
+ public function getShipmentObj()
419
+ {
420
+ return Mage::getModel('exporter/operations_shipment');
421
+ }
422
+
423
+ public function getCreditmemoObj()
424
+ {
425
+ return Mage::getModel('exporter/operations_creditmemo');
426
+ }
427
+
428
+ public function getCustomerInfo($email)
429
+ {
430
+ $customer = Mage::getModel("customer/customer");
431
+ $customer->setWebsiteId(Mage::getModel('core/store')->load($this->store_id)->getWebsiteId());
432
+ if($customer->loadByEmail($email))
433
+ return $customer->getData();
434
+ else
435
+ return false;
436
+ }
437
+
438
+ public function removeOrderStatusHistory()
439
+ {
440
+ $coll = Mage::getModel('sales/order_status_history')->getCollection()->addFieldToFilter('parent_id',Mage::getSingleton("sales/order")->getCollection()->getLastItem()->getId());
441
+ foreach($coll as $history)
442
+ Mage::getModel('sales/order_status_history')->load($history->getId())->delete()->save()->unsetData();
443
+ }
444
+ }
app/code/community/Raveinfosys/Exporter/Model/Exporter.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Model_Exporter extends Mage_Core_Model_Abstract
4
+ {
5
+ public function getPaymentMethod($order)
6
+ {
7
+ return $order->getPayment()->getMethod();
8
+ }
9
+
10
+ public function getChildInfo($item)
11
+ {
12
+
13
+ if($item->getParentItemId())
14
+ return 'yes';
15
+ else
16
+ return 'no';
17
+
18
+ }
19
+
20
+ public function getShippingMethod($order)
21
+ {
22
+ if (!$order->getIsVirtual() && $order->getShippingDescription()) {
23
+ return $order->getShippingDescription();
24
+ }
25
+ else if (!$order->getIsVirtual() && $order->getShippingMethod()) {
26
+ return $order->getShippingMethod();
27
+ }
28
+ return '';
29
+ }
30
+
31
+ public function getItemSku($item)
32
+ {
33
+ if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
34
+ return $item->getProductOptionByCode('simple_sku');
35
+ }
36
+ return $item->getSku();
37
+ }
38
+
39
+ public function formatText($string)
40
+ {
41
+ $string = str_replace(',', ' ', $string);
42
+ return $string;
43
+ }
44
+
45
+ public function getStoreIds()
46
+ {
47
+ $collection = Mage::getModel('core/store')->getCollection();
48
+ $store_ids = array();
49
+ $i = 0;
50
+ foreach($collection as $data)
51
+ {
52
+ $store_ids[$i]['label'] = $data['name'];
53
+ $store_ids[$i]['value'] = $data['store_id'];
54
+ $i++;
55
+ }
56
+ return $store_ids;
57
+ }
58
+
59
+ public function getCreditMemoDetail($order)
60
+ {
61
+ $credit_detail['adjustment_positive'] = 0;
62
+ $credit_detail['adjustment_negative'] = 0;
63
+ $credit_detail['shipping_amount'] = 0;
64
+ $credit_detail['base_shipping_amount'] = 0;
65
+ $credit_detail['subtotal'] = 0;
66
+ $credit_detail['base_subtotal'] = 0;
67
+ $credit_detail['tax_amount'] = 0;
68
+ $credit_detail['base_tax_amount'] = 0;
69
+ $credit_detail['discount_amount'] = 0;
70
+ $credit_detail['base_discount_amount'] = 0;
71
+ $collection = $order->getCreditmemosCollection();
72
+ if(count($collection))
73
+ {
74
+ foreach($collection as $data)
75
+ {
76
+ $credit_detail['adjustment_positive'] += $data->getData('adjustment_positive');
77
+ $credit_detail['adjustment_negative'] += $data->getData('adjustment_negative');
78
+ $credit_detail['shipping_amount'] += $data->getData('shipping_amount');
79
+ $credit_detail['base_shipping_amount'] += $data->getData('base_shipping_amount');
80
+ $credit_detail['subtotal'] += $data->getData('subtotal');
81
+ $credit_detail['base_subtotal'] += $data->getData('base_subtotal');
82
+ $credit_detail['tax_amount'] += $data->getData('tax_amount');
83
+ $credit_detail['base_tax_amount'] += $data->getData('base_tax_amount');
84
+ $credit_detail['discount_amount'] += $data->getData('discount_amount');
85
+ $credit_detail['base_discount_amount'] += $data->getData('base_discount_amount');
86
+ }
87
+ }
88
+
89
+ return $credit_detail;
90
+
91
+ }
92
+
93
+ public function getInvoiceDate($order)
94
+ {
95
+ $date = '';
96
+ $collection = $order->getInvoiceCollection();
97
+ if(count($collection))
98
+ {
99
+ foreach($collection as $data)
100
+ $date = $data->getData('created_at');
101
+ }
102
+
103
+ return $date;
104
+
105
+ }
106
+
107
+ public function getShipmentDate($order)
108
+ {
109
+ $date = '';
110
+ $collection = $order->getShipmentsCollection();
111
+ if(count($collection))
112
+ {
113
+ foreach($collection as $data)
114
+ $date = $data->getData('created_at');
115
+ }
116
+
117
+ return $date;
118
+
119
+ }
120
+
121
+ public function getCreditmemoDate($order)
122
+ {
123
+ $date = '';
124
+ $collection = $order->getCreditmemosCollection();
125
+ if(count($collection))
126
+ {
127
+ foreach($collection as $data)
128
+ $date = $data->getData('created_at');
129
+ }
130
+
131
+ return $date;
132
+
133
+ }
134
+
135
+
136
+ }
app/code/community/Raveinfosys/Exporter/Model/Exportorders.php ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Model_Exportorders extends Raveinfosys_Exporter_Model_Exporter
4
+ {
5
+ const ENCLOSURE = '"';
6
+ const DELIMITER = ',';
7
+
8
+
9
+ public function exportOrders($orders)
10
+ {
11
+ $fileName = 'order_export_'.date("Ymd_His").'.csv';
12
+ $fp = fopen(Mage::getBaseDir('export').'/'.$fileName, 'w');
13
+
14
+ $this->writeHeadRow($fp);
15
+ foreach ($orders as $order) {
16
+ $order = Mage::getModel('sales/order')->load($order);
17
+ $this->writeOrder($order, $fp);
18
+ }
19
+
20
+ fclose($fp);
21
+
22
+ return $fileName;
23
+ }
24
+
25
+
26
+ protected function writeHeadRow($fp)
27
+ {
28
+ fputcsv($fp, $this->getHeadRowValues(), self::DELIMITER, self::ENCLOSURE);
29
+ }
30
+
31
+
32
+ protected function writeOrder($order, $fp)
33
+ {
34
+ $common = $this->getCommonOrderValues($order);
35
+ $blank = $this->getBlankOrderValues($order);
36
+ $orderItems = $order->getItemsCollection();
37
+ $itemInc = 0;
38
+ $data = array();
39
+ $count = 0;
40
+ foreach ($orderItems as $item)
41
+ {
42
+ if($count==0)
43
+ {
44
+ $record = array_merge($common, $this->getOrderItemValues($item, $order, ++$itemInc));
45
+ fputcsv($fp, $record, self::DELIMITER, self::ENCLOSURE);
46
+ }
47
+ else
48
+ {
49
+ $record = array_merge($blank, $this->getOrderItemValues($item, $order, ++$itemInc));
50
+ fputcsv($fp, $record, self::DELIMITER, self::ENCLOSURE);
51
+ }
52
+ $count++;
53
+ }
54
+
55
+ }
56
+
57
+ protected function getHeadRowValues()
58
+ {
59
+ return array(
60
+ "order_id",
61
+ "email",
62
+ "firstname",
63
+ "lastname",
64
+ "prefix",
65
+ "middlename",
66
+ "suffix",
67
+ "taxvat",
68
+ "created_at",
69
+ "updated_at",
70
+ "invoice_created_at",
71
+ "shipment_created_at",
72
+ "creditmemo_created_at",
73
+ "tax_amount",
74
+ "base_tax_amount",
75
+ "discount_amount",
76
+ "base_discount_amount",
77
+ "shipping_tax_amount",
78
+ "base_shipping_tax_amount",
79
+ "base_to_global_rate",
80
+ "base_to_order_rate",
81
+ "store_to_base_rate",
82
+ "store_to_order_rate",
83
+ "subtotal_incl_tax",
84
+ "base_subtotal_incl_tax",
85
+ "coupon_code",
86
+ "shipping_incl_tax",
87
+ "base_shipping_incl_tax",
88
+ "shipping_method",
89
+ "shipping_amount",
90
+ "subtotal",
91
+ "base_subtotal",
92
+ "grand_total",
93
+ "base_grand_total",
94
+ "base_shipping_amount",
95
+ "adjustment_positive",
96
+ "adjustment_negative",
97
+ "refunded_shipping_amount",
98
+ "base_refunded_shipping_amount",
99
+ "refunded_subtotal",
100
+ "base_refunded_subtotal",
101
+ "refunded_tax_amount",
102
+ "base_refunded_tax_amount",
103
+ "refunded_discount_amount",
104
+ "base_refunded_discount_amount",
105
+ "store_id",
106
+ "order_status",
107
+ "order_state",
108
+ "hold_before_state",
109
+ "hold_before_status",
110
+ "store_currency_code",
111
+ "base_currency_code",
112
+ "order_currency_code",
113
+ "total_paid",
114
+ "base_total_paid",
115
+ "is_virtual",
116
+ "total_qty_ordered",
117
+ "remote_ip",
118
+ "total_refunded",
119
+ "base_total_refunded",
120
+ "total_canceled",
121
+ "total_invoiced",
122
+ "customer_id",
123
+ "billing_prefix",
124
+ "billing_firstname",
125
+ "billing_middlename",
126
+ "billing_lastname",
127
+ "billing_suffix",
128
+ "billing_street_full",
129
+ "billing_city",
130
+ "billing_region",
131
+ "billing_country",
132
+ "billing_postcode",
133
+ "billing_telephone",
134
+ "billing_company",
135
+ "billing_fax",
136
+ "customer_id",
137
+ "shipping_prefix",
138
+ "shipping_firstname",
139
+ "shipping_middlename",
140
+ "shipping_lastname",
141
+ "shipping_suffix",
142
+ "shipping_street_full",
143
+ "shipping_city",
144
+ "shipping_region",
145
+ "shipping_country",
146
+ "shipping_postcode",
147
+ "shipping_telephone",
148
+ "shipping_company",
149
+ "shipping_fax",
150
+ "payment_method",
151
+ "product_sku",
152
+ "product_name",
153
+ "qty_ordered",
154
+ "qty_invoiced",
155
+ "qty_shipped",
156
+ "qty_refunded",
157
+ "qty_canceled",
158
+ "product_type",
159
+ "original_price",
160
+ "base_original_price",
161
+ "row_total",
162
+ "base_row_total",
163
+ "row_weight",
164
+ "price_incl_tax",
165
+ "base_price_incl_tax",
166
+ "product_tax_amount",
167
+ "product_base_tax_amount",
168
+ "product_tax_percent",
169
+ "product_discount",
170
+ "product_base_discount",
171
+ "product_discount_percent",
172
+ "is_child",
173
+ "product_option"
174
+
175
+ );
176
+ }
177
+
178
+ //Common orders value
179
+
180
+ protected function getCommonOrderValues($order)
181
+ {
182
+ $shippingAddress = !$order->getIsVirtual() ? $order->getShippingAddress() : null;
183
+ $billingAddress = $order->getBillingAddress();
184
+ if(!$shippingAddress)
185
+ $shippingAddress = $billingAddress;
186
+
187
+ $credit_detail = $this->getCreditMemoDetail($order);
188
+ return array(
189
+ $order->getIncrementId(),
190
+ $order->getData('customer_email'),
191
+ $this->formatText($order->getData('customer_firstname')),
192
+ $this->formatText($order->getData('customer_lastname')),
193
+ $this->formatText($order->getData('customer_prefix')),
194
+ $this->formatText($order->getData('customer_middlename')),
195
+ $this->formatText($order->getData('customer_suffix')),
196
+ $order->getData('customer_taxvat'),
197
+ $order->getData('created_at'),
198
+ $order->getData('updated_at'),
199
+ $this->getInvoiceDate($order),
200
+ $this->getShipmentDate($order),
201
+ $this->getCreditmemoDate($order),
202
+ $order->getData('tax_amount'),
203
+ $order->getData('base_tax_amount'),
204
+ $order->getData('discount_amount'),
205
+ $order->getData('base_discount_amount'),
206
+ $order->getData('shipping_tax_amount'),
207
+ $order->getData('base_shipping_tax_amount'),
208
+ $order->getData('base_to_global_rate'),
209
+ $order->getData('base_to_order_rate'),
210
+ $order->getData('store_to_base_rate'),
211
+ $order->getData('store_to_order_rate'),
212
+ $order->getData('subtotal_incl_tax'),
213
+ $order->getData('base_subtotal_incl_tax'),
214
+ $order->getData('coupon_code'),
215
+ $order->getData('shipping_incl_tax'),
216
+ $order->getData('base_shipping_incl_tax'),
217
+ $this->getShippingMethod($order),
218
+ $order->getData('shipping_amount'),
219
+ $order->getData('subtotal'),
220
+ $order->getData('base_subtotal'),
221
+ $order->getData('grand_total'),
222
+ $order->getData('base_grand_total'),
223
+ $order->getData('base_shipping_amount'),
224
+ $credit_detail['adjustment_positive'],
225
+ $credit_detail['adjustment_negative'],
226
+ $credit_detail['shipping_amount'],
227
+ $credit_detail['base_shipping_amount'],
228
+ $credit_detail['subtotal'],
229
+ $credit_detail['base_subtotal'],
230
+ $credit_detail['tax_amount'],
231
+ $credit_detail['base_tax_amount'],
232
+ $credit_detail['discount_amount'],
233
+ $credit_detail['base_discount_amount'],
234
+ $order->getData('store_id'),
235
+ $order->getStatus(),
236
+ $order->getState(),
237
+ $order->getHoldBeforeState(),
238
+ $order->getHoldBeforeStatus(),
239
+ $order->getData('store_currency_code'),
240
+ $order->getData('base_currency_code'),
241
+ $order->getData('order_currency_code'),
242
+ $order->getData('total_paid'),
243
+ $order->getData('base_total_paid'),
244
+ $order->getData('is_virtual'),
245
+ $order->getData('total_qty_ordered'),
246
+ $order->getData('remote_ip'),
247
+ $order->getData('total_refunded'),
248
+ $order->getData('base_total_refunded'),
249
+ $order->getData('total_canceled'),
250
+ $order->getData('total_invoiced'),
251
+ $order->getData('customer_id'),
252
+ $this->formatText($order->getBillingAddress()->getData('prefix')),
253
+ $this->formatText($order->getBillingAddress()->getData('firstname')),
254
+ $this->formatText($order->getBillingAddress()->getData('middlename')),
255
+ $this->formatText($order->getBillingAddress()->getData('lastname')),
256
+ $this->formatText($order->getBillingAddress()->getData('suffix')),
257
+ $this->formatText($order->getBillingAddress()->getData('street')),
258
+ $this->formatText($order->getBillingAddress()->getData('city')),
259
+ $this->formatText($order->getBillingAddress()->getData('region')),
260
+ $this->formatText($order->getBillingAddress()->getData('country_id')),
261
+ $order->getBillingAddress()->getData('postcode'),
262
+ $order->getBillingAddress()->getData('telephone'),
263
+ $this->formatText($order->getBillingAddress()->getData('company')),
264
+ $order->getBillingAddress()->getData('fax'),
265
+ $order->getData('customer_id'),
266
+ $shippingAddress->getData('prefix'),
267
+ $this->formatText($shippingAddress->getData('firstname')),
268
+ $this->formatText($shippingAddress->getData('middlename')),
269
+ $this->formatText($shippingAddress->getData('lastname')),
270
+ $this->formatText($shippingAddress->getData('suffix')),
271
+ $this->formatText($shippingAddress->getData('street')),
272
+ $this->formatText($shippingAddress->getData('city')),
273
+ $this->formatText($shippingAddress->getData('region')),
274
+ $shippingAddress->getData('country_id'),
275
+ $shippingAddress->getData('postcode'),
276
+ $shippingAddress->getData('telephone'),
277
+ $this->formatText($shippingAddress->getData('company')),
278
+ $shippingAddress->getData('fax'),
279
+ $this->getPaymentMethod($order)
280
+ );
281
+ }
282
+
283
+ protected function getBlankOrderValues($order)
284
+ {
285
+ return array(
286
+ '','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',
287
+ '','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',
288
+ '','','','','','','','','','','','','','','','','','','','','','','','','');
289
+ }
290
+
291
+ //To return the array of ordered items
292
+ protected function getOrderItemValues($item, $order, $itemInc=1)
293
+ {
294
+ return array(
295
+ $this->getItemSku($item),
296
+ $this->formatText($item->getName()),
297
+ (int)$item->getQtyOrdered(),
298
+ (int)$item->getQtyInvoiced(),
299
+ (int)$item->getQtyShipped(),
300
+ (int)$item->getQtyRefunded(),
301
+ (int)$item->getQtyCanceled(),
302
+ $item->getProductType(),
303
+ $item->getOriginalPrice(),
304
+ $item->getBaseOriginalPrice(),
305
+ $item->getRowTotal(),
306
+ $item->getBaseRowTotal(),
307
+ $item->getRowWeight(),
308
+ $item->getPriceInclTax(),
309
+ $item->getBasePriceInclTax(),
310
+ $item->getTaxAmount(),
311
+ $item->getBaseTaxAmount(),
312
+ $item->getTaxPercent(),
313
+ $item->getDiscountAmount(),
314
+ $item->getBaseDiscountAmount(),
315
+ $item->getDiscountPercent(),
316
+ $this->getChildInfo($item),
317
+ $item->getdata('product_options')
318
+ );
319
+ }
320
+
321
+ }
app/code/community/Raveinfosys/Exporter/Model/Importorders.php ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Model_Importorders extends Mage_Core_Model_Abstract
4
+ {
5
+ public $order_info = array();
6
+ public $order_item_info = array();
7
+ public $order_item_flag = 0;
8
+ public $store_id = 0;
9
+ public $import_limit = 0;
10
+
11
+
12
+ public function readCSV($csvFile,$data)
13
+ {
14
+ $this->import_limit = $data['import_limit'];
15
+ $this->store_id = $data['store_id'];
16
+ $file_handle = fopen($csvFile, 'r');
17
+ $i=0;
18
+ $decline = array();
19
+ $available = array();
20
+ $success = 0;
21
+ $parent_flag = 0;
22
+ $invalid = 0;
23
+ $line_number = 2;
24
+ $total_order = 0;
25
+ Mage::helper('exporter')->unlinkFile();
26
+ Mage::helper('exporter')->header();
27
+ while (!feof($file_handle) )
28
+ {
29
+ $line_of_text[] = fgetcsv($file_handle);
30
+
31
+ if($i!=0)
32
+ {
33
+ if($line_of_text[$i][0]!='' && $parent_flag==0)
34
+ {
35
+ $this->insertOrderData($line_of_text[$i]);
36
+ $parent_flag = 1;
37
+ $total_order++;
38
+ }
39
+ else if($line_of_text[$i][91]!='' && $parent_flag == 1 && $line_of_text[$i][0]=='')
40
+ {
41
+ $this->insertOrderItem($line_of_text[$i]);
42
+ }
43
+ else if($parent_flag==1)
44
+ {
45
+ try
46
+ {
47
+ $message = Mage::getModel('exporter/createorder')->createOrder($this->order_info,$this->order_item_info,$this->store_id);
48
+ Mage::getModel('exporter/createorder')->removeOrderStatusHistory();
49
+ } catch (Exception $e) {
50
+ Mage::helper('exporter')->logException($e,$this->order_info['increment_id'],'order',$line_number);
51
+ Mage::helper('exporter')->footer();
52
+ $decline[] = $this->order_info['increment_id'];
53
+ $message = 0;
54
+ }
55
+
56
+ if($message== 1)
57
+ $success++;
58
+
59
+ if($message== 2){
60
+ Mage::helper('exporter')->logAvailable($this->order_info['increment_id'],'order',$line_number);
61
+ Mage::helper('exporter')->footer();
62
+ $decline[] = $this->order_info['increment_id'];
63
+ }
64
+
65
+ $this->order_info = array();
66
+ $this->order_item_info = array();
67
+ $this->order_item_flag = 0;
68
+
69
+ $this->insertOrderData($line_of_text[$i]);
70
+ $parent_flag = 1;
71
+ $line_number = $i+1;
72
+ $total_order++;
73
+ }
74
+
75
+ }
76
+
77
+ $i++;
78
+
79
+ if($this->import_limit < $total_order)
80
+ break;
81
+ }
82
+ $isPrintable = Mage::helper('exporter')->isPrintable();
83
+ if($success)
84
+ Mage::getModel('core/session')->addSuccess(Mage::helper('exporter')->__('Total '.$success.' order(s) imported successfully!'));
85
+
86
+ if($decline || $isPrintable)
87
+ Mage::getModel('core/session')->addError(Mage::helper('exporter')->__('Click <a href="'.Mage::helper("adminhtml")->getUrl("exporter/adminhtml_exporter/exportLog").'">here</a> to view the error log'));
88
+
89
+ fclose($file_handle);
90
+
91
+ return array($success,$decline);
92
+ }
93
+
94
+ public function insertOrderData($orders_data)
95
+ {
96
+ $sales_order_arr = array();
97
+ $sales_order_item_arr = array();
98
+ $sales_order = $this->getSalesTable();
99
+ $sales_payment = $this->getSalesPayment();
100
+ $sales_shipping = $this->getSalesBilling();
101
+ $sales_billing = $this->getSalesBilling();
102
+ $sales_order_item = $this->getSalesItem();
103
+ $model = Mage::getModel('sales/order');
104
+ $i = 0;
105
+ $j = 0;
106
+ $k = 0;
107
+ $l = 0;
108
+ $m = 0;
109
+ foreach($orders_data as $order)
110
+ {
111
+ if(count($sales_order)>$i)
112
+ $sales_order_arr[$sales_order[$i]]= $order;
113
+
114
+ else if(count($sales_billing)>$j)
115
+ {
116
+ $sales_billing[$j].$sales_order_arr['billing_address'][$sales_billing[$j]]= $order;
117
+ $j++;
118
+ }
119
+ else if(count($sales_shipping)>$k)
120
+ {
121
+ $sales_order_arr['shipping_address'][$sales_shipping[$k]]= $order;
122
+ $k++;
123
+ }
124
+ else if(count($sales_payment)>$l)
125
+ {
126
+ $sales_order_arr['payment'][$sales_payment[$l]]= $order;
127
+ $l++;
128
+ }
129
+ else if(count($sales_order_item)>$m)
130
+ {
131
+ $sales_order_item_arr[$sales_order_item[$m]]= $order;
132
+ $m++;
133
+ }
134
+ $i++;
135
+ }
136
+
137
+ $this->order_info = $sales_order_arr;
138
+ $this->order_item_info[$this->order_item_flag] = $sales_order_item_arr;
139
+ $this->order_item_flag++;
140
+ }
141
+
142
+ public function insertOrderItem($orders_data)
143
+ {
144
+ $sales_order_item_arr = array();
145
+ $sales_order_item = $this->getSalesItem();
146
+ $i=0;
147
+ for($j=91;$j<count($orders_data); $j++)
148
+ {
149
+ if(count($sales_order_item)>$i)
150
+ $sales_order_item_arr[$sales_order_item[$i]]= $orders_data[$j];
151
+ $i++;
152
+ }
153
+ $this->order_item_info[$this->order_item_flag] = $sales_order_item_arr;
154
+ $this->order_item_flag++;
155
+ }
156
+
157
+
158
+ public function getSalesTable()
159
+ {
160
+ return array(
161
+ 'increment_id',
162
+ 'customer_email',
163
+ 'customer_firstname',
164
+ 'customer_lasttname',
165
+ 'customer_prefix',
166
+ 'customer_middlename',
167
+ 'customer_suffix',
168
+ 'taxvat',
169
+ 'created_at',
170
+ 'updated_at',
171
+ 'invoice_created_at',
172
+ 'shipment_created_at',
173
+ 'creditmemo_created_at',
174
+ 'tax_amount',
175
+ 'base_tax_amount',
176
+ 'discount_amount',
177
+ 'base_discount_amount',
178
+ 'shipping_tax_amount',
179
+ 'base_shipping_tax_amount',
180
+ 'base_to_global_rate',
181
+ 'base_to_order_rate',
182
+ 'store_to_base_rate',
183
+ 'store_to_order_rate',
184
+ 'subtotal_incl_tax',
185
+ 'base_subtotal_incl_tax',
186
+ 'coupon_code',
187
+ 'shipping_incl_tax',
188
+ 'base_shipping_incl_tax',
189
+ 'shipping_method',
190
+ 'shipping_amount',
191
+ 'subtotal',
192
+ 'base_subtotal',
193
+ 'grand_total',
194
+ 'base_grand_total',
195
+ 'base_shipping_amount',
196
+ 'adjustment_positive',
197
+ 'adjustment_negative',
198
+ 'refunded_shipping_amount',
199
+ 'base_refunded_shipping_amount',
200
+ 'refunded_subtotal',
201
+ 'base_refunded_subtotal',
202
+ 'refunded_tax_amount',
203
+ 'base_refunded_tax_amount',
204
+ 'refunded_discount_amount',
205
+ 'base_refunded_discount_amount',
206
+ 'store_id',
207
+ 'order_status',
208
+ 'order_state',
209
+ 'hold_before_state',
210
+ 'hold_before_status',
211
+ 'store_currency_code',
212
+ 'base_currency_code',
213
+ 'order_currency_code',
214
+ 'total_paid',
215
+ 'base_total_paid',
216
+ 'is_virtual',
217
+ 'total_qty_ordered',
218
+ 'remote_ip',
219
+ 'total_refunded',
220
+ 'base_total_refunded',
221
+ 'total_canceled',
222
+ 'total_invoiced');
223
+ }
224
+
225
+ public function getSalesBilling()
226
+ {
227
+ return array(
228
+ 'customer_address_id',
229
+ 'prefix',
230
+ 'firstname',
231
+ 'middlename',
232
+ 'lastname' ,
233
+ 'suffix',
234
+ 'street',
235
+ 'city',
236
+ 'region',
237
+ 'country_id',
238
+ 'postcode',
239
+ 'telephone' ,
240
+ 'company',
241
+ 'fax');
242
+ }
243
+
244
+
245
+ public function getSalesPayment()
246
+ {
247
+ return array('method');
248
+ }
249
+
250
+
251
+ public function getSalesItem()
252
+ {
253
+ return array(
254
+ 'product_sku',
255
+ 'product_name',
256
+ 'qty_ordered',
257
+ 'qty_invoiced',
258
+ 'qty_shipped',
259
+ 'qty_refunded',
260
+ 'qty_canceled',
261
+ 'product_type',
262
+ 'original_price',
263
+ 'base_original_price',
264
+ 'row_total',
265
+ 'base_row_total',
266
+ 'row_weight',
267
+ 'price_incl_tax',
268
+ 'base_price_incl_tax',
269
+ 'product_tax_amount',
270
+ 'product_base_tax_amount',
271
+ 'product_tax_percent',
272
+ 'product_discount',
273
+ 'product_base_discount',
274
+ 'product_discount_percent',
275
+ 'is_child',
276
+ 'product_option' );
277
+ }
278
+
279
+
280
+ }
app/code/community/Raveinfosys/Exporter/Model/Operations/Creditmemo.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Model_Operations_Creditmemo extends Mage_Core_Model_Abstract
4
+ {
5
+ public function createCreditMemo($order_id,$credit_item,$creditDetail)
6
+ {
7
+ $order = $this->getOrderModel($order_id);
8
+ try{
9
+ $data = array('qtys' => $credit_item ,'shipping_amount'=>$creditDetail['refunded_shipping_amount'],
10
+ 'adjustment_positive'=>$creditDetail['adjustment_positive'],'adjustment_negative'=>$creditDetail['adjustment_negative']);
11
+ if(Mage::helper('exporter')->getVersion())
12
+ {
13
+ $service = Mage::getModel('sales/service_order', $order);
14
+ $creditMemo = $service->prepareCreditmemo($data);
15
+ $creditMemo = $creditMemo->setState(2)->save();
16
+ $this->updateStatus($order_id,$creditDetail);
17
+ }
18
+ else
19
+ {
20
+ $creditMemo = Mage::getModel('sales/order_creditmemo_api')
21
+ ->create($order_id, $data ,null ,0,0);
22
+ }
23
+
24
+ $model = Mage::getSingleton("sales/order_creditmemo");
25
+ $credit_id = $model->getCollection()->getLastItem()->getId();
26
+ $model->load($credit_id)
27
+ ->setCreatedAt($creditDetail['creditmemo_created_at'])
28
+ ->setUpdatedAt($creditDetail['creditmemo_created_at'])
29
+ ->save()
30
+ ->unsetData();
31
+
32
+ $this->updateCreditQTY($credit_item);
33
+
34
+ }catch (Exception $e) {
35
+
36
+ Mage::helper('exporter')->logException($e,$order->getIncrementId(),'creditmemo');
37
+ Mage::helper('exporter')->footer();
38
+ return true;
39
+ }
40
+ $order->unsetData();
41
+ return true;
42
+ }
43
+
44
+
45
+
46
+ public function updateCreditQTY($credit_item)
47
+ {
48
+ foreach($credit_item as $itemid => $itemqty)
49
+ {
50
+ $orderItem = Mage::getModel('sales/order_item')->load($itemid);
51
+ $orderItem->setQtyRefunded($itemqty)->save();
52
+ $orderItem->unsetData();
53
+ }
54
+ }
55
+
56
+ public function updateStatus($order_id,$refunded)
57
+ {
58
+ $order = $this->getOrderModel($order_id);
59
+
60
+ //set creditmemo data
61
+ $order->setSubtotalRefunded($refunded['refunded_subtotal'])
62
+ ->setBaseSubtotalRefunded($refunded['refunded_subtotal'])
63
+ ->setTaxRefunded($refunded['refunded_tax_amount'])
64
+ ->setBaseTaxRefunded($refunded['base_refunded_tax_amount'])
65
+ ->setDiscountRefunded($refunded['refunded_discount_amount'])
66
+ ->setBaseDiscountRefunded($refunded['base_refunded_discount_amount'])
67
+ ->setShippingRefunded($refunded['refunded_shipping_amount'])
68
+ ->setBaseShippingRefunded($refunded['base_refunded_shipping_amount'])
69
+ ->setTotalRefunded($refunded['total_refunded'])
70
+ ->setBaseTotalRefunded($refunded['base_total_refunded'])
71
+ ->setTotalOfflineRefunded($refunded['total_refunded'])
72
+ ->setBaseTotalOfflineRefunded($refunded['base_total_refunded'])
73
+ ->setAdjustmentNegative($refunded['adjustment_positive'])
74
+ ->setBaseAdjustmentNegative($refunded['adjustment_positive'])
75
+ ->setAdjustmentPositive($refunded['adjustment_negative'])
76
+ ->setBaseAdjustmentPositive($refunded['adjustment_negative'])
77
+ ->save();
78
+ $order->unsetData();
79
+ }
80
+
81
+ public function getOrderModel($last_order_increment_id)
82
+ {
83
+ $order = Mage::getModel('sales/order')->loadByIncrementId($last_order_increment_id);
84
+ return $order;
85
+ }
86
+ }
app/code/community/Raveinfosys/Exporter/Model/Operations/Invoice.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Model_Operations_Invoice extends Mage_Core_Model_Abstract
4
+ {
5
+ public function createInvoice($order_id,$invoice_item,$date)
6
+ {
7
+ $order = $this->getOrderModel($order_id);
8
+ try{
9
+ if($order->canInvoice())
10
+ {
11
+ $invoiceId = Mage::getModel('sales/order_invoice_api')
12
+ ->create($order->getIncrementId(), $invoice_item ,null ,0,0);
13
+
14
+ if($invoiceId)
15
+ {
16
+ Mage::getSingleton("sales/order_invoice")->loadByIncrementId($invoiceId)
17
+ ->setCreatedAt($date)
18
+ ->setUpdatedAt($date)
19
+ ->save()
20
+ ->unsetData();
21
+ $this->updateInvoiceQTY($invoice_item);
22
+ }
23
+ }
24
+ } catch (Exception $e) {
25
+ Mage::helper('exporter')->logException($e,$order->getIncrementId(),'invoice');
26
+ Mage::helper('exporter')->footer();
27
+ return true;
28
+ }
29
+ $order->unsetData();
30
+ return $invoiceId;
31
+ }
32
+
33
+ public function updateInvoiceQTY($invoice_item)
34
+ {
35
+ foreach($invoice_item as $itemid => $itemqty)
36
+ {
37
+ $orderItem = Mage::getModel('sales/order_item')->load($itemid);
38
+ $orderItem->setQtyInvoiced($itemqty)->save();
39
+ $orderItem->unsetData();
40
+ }
41
+ }
42
+
43
+ public function getOrderModel($last_order_increment_id)
44
+ {
45
+ $order = Mage::getModel('sales/order')->loadByIncrementId($last_order_increment_id);
46
+ return $order;
47
+ }
48
+ }
app/code/community/Raveinfosys/Exporter/Model/Operations/Shipment.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Model_Operations_Shipment extends Mage_Core_Model_Abstract
4
+ {
5
+
6
+ public function createShipment($order_id,$shipped_item,$date)
7
+ {
8
+ $order = $this->getOrderModel($order_id);
9
+ try
10
+ {
11
+ if($order->canShip())
12
+ {
13
+ $shipId = Mage::getModel('sales/order_shipment_api')
14
+ ->create($order_id, $shipped_item ,null ,0,0);
15
+
16
+ if($shipId)
17
+ {
18
+ Mage::getSingleton("sales/order_shipment")->loadByIncrementId($shipId)
19
+ ->setCreatedAt($date)
20
+ ->setUpdatedAt($date)
21
+ ->save()
22
+ ->unsetData();
23
+ $this->updateShipmentQTY($shipped_item);
24
+ }
25
+ }
26
+ } catch (Exception $e) {
27
+ Mage::helper('exporter')->logException($e,$order->getIncrementId(),'shipment');
28
+ Mage::helper('exporter')->footer();
29
+ return true;
30
+ }
31
+ $order->unsetData();
32
+ return $shipment;
33
+ }
34
+
35
+ public function updateShipmentQTY($shipped_item)
36
+ {
37
+ foreach($shipped_item as $itemid => $itemqty)
38
+ {
39
+ $orderItem = Mage::getModel('sales/order_item')->load($itemid);
40
+ $orderItem->setQtyShipped($itemqty)->save();
41
+ $orderItem->unsetData();
42
+ }
43
+ }
44
+
45
+ public function getOrderModel($last_order_increment_id)
46
+ {
47
+ $order = Mage::getModel('sales/order')->loadByIncrementId($last_order_increment_id);
48
+ return $order;
49
+ }
50
+ }
app/code/community/Raveinfosys/Exporter/controllers/Adminhtml/ExporterController.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Adminhtml_ExporterController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ protected function _initAction()
6
+ {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('exporter/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction()
15
+ {
16
+ $this->_initAction()
17
+ ->renderLayout();
18
+ }
19
+
20
+ public function gridAction()
21
+ {
22
+ $this->_initAction()
23
+ ->renderLayout();
24
+ }
25
+
26
+
27
+ public function newAction()
28
+ {
29
+ $this->_forward('exportall');
30
+
31
+ }
32
+
33
+ public function exportallAction()
34
+ {
35
+ $orders = Mage::getModel('sales/order')->getCollection()
36
+ ->addAttributeToSelect('entity_id');
37
+ $order_arr = array();
38
+ foreach ($orders as $order) {
39
+ $order_arr[] = $order->getId();
40
+ }
41
+ $file = Mage::getModel('exporter/exportorders')->exportOrders($order_arr);
42
+ $this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('export').'/'.$file));
43
+ }
44
+
45
+ public function exportCsvAction()
46
+ {
47
+ $orders = $this->getRequest()->getPost('order_ids', array());
48
+ $file = Mage::getModel('exporter/exportorders')->exportOrders($orders);
49
+ $this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('export').'/'.$file));
50
+ }
51
+
52
+ public function exportLogAction()
53
+ {
54
+ $file = 'order_exception_log.htm';
55
+ $this->_prepareDownloadResponse($file, file_get_contents(Mage::getBaseDir('var') .'/raveinfosys/exporter/'.$file));
56
+ }
57
+ }
app/code/community/Raveinfosys/Exporter/controllers/Adminhtml/ImporterController.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Raveinfosys_Exporter_Adminhtml_ImporterController extends Mage_Adminhtml_Controller_Action
4
+ {
5
+ protected function _initAction()
6
+ {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('exporter/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Orders Import'), Mage::helper('adminhtml')->__('Orders Import'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction()
15
+ {
16
+ $this->_initAction()
17
+ ->renderLayout();
18
+ }
19
+
20
+ public function importOrdersAction()
21
+ {
22
+ if($_FILES['order_csv']['name'] != '') {
23
+ $data = $this->getRequest()->getPost();
24
+ try {
25
+ $uploader = new Varien_File_Uploader('order_csv');
26
+ $uploader->setAllowedExtensions(array('csv'));
27
+ $uploader->setAllowRenameFiles(false);
28
+ $uploader->setFilesDispersion(false);
29
+ $path = Mage::getBaseDir('media') . DS.'raveinfosys/exporter/import/';
30
+ $uploader->save($path, $_FILES['order_csv']['name'] );
31
+ $csv = Mage::getModel('exporter/importorders')->readCSV($path.$_FILES['order_csv']['name'],$data);
32
+
33
+ } catch (Exception $e) {
34
+ Mage::getModel('core/session')->addError(Mage::helper('exporter')->__('Invalid file type!!'));
35
+
36
+ }
37
+
38
+ $this->_redirect('*/*/');
39
+ }
40
+ else {
41
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('exporter')->__('Unable to find the import file'));
42
+ $this->_redirect('*/*/');
43
+ }
44
+
45
+ }
46
+ }
app/code/community/Raveinfosys/Exporter/etc/config.xml ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Raveinfosys_Exporter>
5
+ <version>0.1.0</version>
6
+ </Raveinfosys_Exporter>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <exporter>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Raveinfosys_Exporter</module>
14
+ <frontName>exporter</frontName>
15
+ </args>
16
+ </exporter>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <exporter>
21
+ <file>exporter.xml</file>
22
+ </exporter>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <exporter>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Raveinfosys_Exporter</module>
32
+ <frontName>exporter</frontName>
33
+ </args>
34
+ </exporter>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <menu>
39
+ <exporter module="exporter">
40
+ <title>Exporter</title>
41
+ <sort_order>71</sort_order>
42
+ <children>
43
+ <export module="exporter">
44
+ <title>Export Orders</title>
45
+ <sort_order>1</sort_order>
46
+ <action>exporter/adminhtml_exporter</action>
47
+ </export>
48
+ <import module="exporter">
49
+ <title>Import Orders</title>
50
+ <sort_order>2</sort_order>
51
+ <action>exporter/adminhtml_importer</action>
52
+ </import>
53
+ </children>
54
+ </exporter>
55
+ </menu>
56
+ <acl>
57
+ <resources>
58
+ <all>
59
+ <title>Allow Everything</title>
60
+ </all>
61
+ <admin>
62
+ <children>
63
+ <Raveinfosys_Exporter>
64
+ <title>Exporter Module</title>
65
+ <sort_order>10</sort_order>
66
+ </Raveinfosys_Exporter>
67
+ </children>
68
+ </admin>
69
+ </resources>
70
+ </acl>
71
+ <layout>
72
+ <updates>
73
+ <exporter>
74
+ <file>exporter.xml</file>
75
+ </exporter>
76
+ </updates>
77
+ </layout>
78
+ </adminhtml>
79
+ <global>
80
+ <models>
81
+ <exporter>
82
+ <class>Raveinfosys_Exporter_Model</class>
83
+ <resourceModel>exporter_mysql4</resourceModel>
84
+ </exporter>
85
+ <exporter_mysql4>
86
+ <class>Raveinfosys_Exporter_Model_Mysql4</class>
87
+ <entities>
88
+ <exporter>
89
+ <table>exporter</table>
90
+ </exporter>
91
+ </entities>
92
+ </exporter_mysql4>
93
+ </models>
94
+ <resources>
95
+ <exporter_setup>
96
+ <setup>
97
+ <module>Raveinfosys_Exporter</module>
98
+ </setup>
99
+ <connection>
100
+ <use>core_setup</use>
101
+ </connection>
102
+ </exporter_setup>
103
+ <exporter_write>
104
+ <connection>
105
+ <use>core_write</use>
106
+ </connection>
107
+ </exporter_write>
108
+ <exporter_read>
109
+ <connection>
110
+ <use>core_read</use>
111
+ </connection>
112
+ </exporter_read>
113
+ </resources>
114
+ <blocks>
115
+ <exporter>
116
+ <class>Raveinfosys_Exporter_Block</class>
117
+ </exporter>
118
+
119
+ <adminhtml>
120
+ <rewrite>
121
+ <sales_order_shipment_view_form>Raveinfosys_Exporter_Block_Sales_Order_Form_Form</sales_order_shipment_view_form>
122
+ </rewrite>
123
+ </adminhtml>
124
+
125
+ <adminhtml>
126
+ <rewrite>
127
+ <sales_order_shipment_create_items>Raveinfosys_Exporter_Block_Sales_Order_Items</sales_order_shipment_create_items>
128
+ </rewrite>
129
+ </adminhtml>
130
+
131
+ </blocks>
132
+ <helpers>
133
+ <exporter>
134
+ <class>Raveinfosys_Exporter_Helper</class>
135
+ </exporter>
136
+ </helpers>
137
+ </global>
138
+ </config>
app/design/adminhtml/default/default/layout/exporter.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <exporter_adminhtml_exporter_index>
4
+ <reference name="content">
5
+ <block type="exporter/adminhtml_exporter" name="exporter" />
6
+ </reference>
7
+ </exporter_adminhtml_exporter_index>
8
+
9
+ <exporter_adminhtml_exporter_grid>
10
+ <reference name="root">
11
+ <block type="exporter/adminhtml_exporter_grid" name="root" output="toHtml"/>
12
+ </reference>
13
+ </exporter_adminhtml_exporter_grid>
14
+
15
+ <exporter_adminhtml_importer_index>
16
+ <reference name="content">
17
+ <block type="exporter/adminhtml_exporter_edit_tab_form" name="importer" />
18
+ </reference>
19
+ </exporter_adminhtml_importer_index>
20
+ </layout>
app/etc/modules/Raveinfosys_Exporter.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Raveinfosys_Exporter>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Raveinfosys_Exporter>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Raveinfosys_OrderExporter</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Magento sales order import and export.</summary>
10
+ <description>Magento sales order import and export.</description>
11
+ <notes>This is stable version of this extension and has been tested on various version of community editions. &amp;#xD;&#xD;
12
+ In this particular version we are supporting it to run on PHP V 5.4.X</notes>
13
+ <authors><author><name>Rave Infosys</name><user>raveinfo</user><email>magento@raveinfosys.com</email></author></authors>
14
+ <date>2014-06-04</date>
15
+ <time>13:38:54</time>
16
+ <contents><target name="magecommunity"><dir name="Raveinfosys"><dir name="Exporter"><dir name="Block"><dir name="Adminhtml"><dir name="Exporter"><dir name="Edit"><file name="Form.php" hash="400092e0356c9ec79632ea296a9e72cc"/><dir name="Tab"><file name="Form.php" hash="ae63a5095a4f929555fa6038cce9c18d"/></dir><file name="Tabs.php" hash="0babeb85a2db29aa4b6854c8baec177b"/></dir><file name="Edit.php" hash="79a1d66ea5482a539dfb2a0174b469a6"/><file name="Grid.php" hash="0286e705b323fa71460bf5ed1f29a0bf"/></dir><file name="Exporter.php" hash="0c077445a7bb4f33bf383e34f0fa1260"/></dir><file name="Exporter.php" hash="7bf9256c575b080fad7c4c3cab5017e8"/><dir name="Sales"><dir name="Order"><dir name="Form"><file name="Form.php" hash="54bb9eb64d173ad92229c229c2bc9366"/></dir><file name="Items.php" hash="e87d8e6a38786fe390e7030764458d9e"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="836d093b921ddced4eaedc9ea206f55b"/></dir><dir name="Model"><file name="Createorder.php" hash="a24ebe9696ff7a7cf8bfb157f9b8fefa"/><file name="Exporter.php" hash="5de2fd59c4f5a4fa7e2d32a5503fbdae"/><file name="Exportorders.php" hash="aa636bdcd02880f49e11d44cabd24ead"/><file name="Importorders.php" hash="526c16a774f1c7fd830c06514571d927"/><dir name="Operations"><file name="Creditmemo.php" hash="ad12cb5cbceebf9ab9fb41e42f940557"/><file name="Invoice.php" hash="17225a359399ff1dbe2c1dc3ea2b0137"/><file name="Shipment.php" hash="d83ed179805c3c0b71a29bd48c117edd"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ExporterController.php" hash="fcac4d1fb1ab1488f7b9d7ed980f2775"/><file name="ImporterController.php" hash="53228d4d1204d104cf9563e1fd8e3caf"/></dir></dir><dir name="etc"><file name="config.xml" hash="ab20453fa38d51966ea69b7a1e296960"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Raveinfosys_Exporter.xml" hash="af376451e72fdac6ac3d8999d2d78c6c"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="exporter.xml" hash="4a85ad0274334473e6cfd620df3e819f"/></dir></dir></dir></dir></target><target name="mage"><dir name="var"><dir name="raveinfosys"><dir name="exporter"><file name="order_exception_log.htm" hash="aa58e7a9f46530c3b77fca324a6598cc"/></dir></dir></dir></target></contents>
17
+ <compatible/>
18
+ <dependencies><required><php><min>5.2.0</min><max>5.4.27</max></php></required></dependencies>
19
+ </package>
var/raveinfosys/exporter/order_exception_log.htm ADDED
@@ -0,0 +1 @@
 
1
+ <h3 style="text-align:center;">Error information:</h3><hr /><br />