Raveinfosys_OrderExporter - Version 1.0.6

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.5.X.

Download this release

Release Info

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


Code changes from version 1.0.5 to 1.0.6

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