Swift_Swiftplugin - Version 1.4.0

Version Notes

Added a way to get past orders more effectively. General performance and efficiency improvements.

Download this release

Release Info

Developer Simon Cooper
Extension Swift_Swiftplugin
Version 1.4.0
Comparing to
See all releases


Code changes from version 1.3.3 to 1.4.0

app/code/community/Swift/Swiftplugin/Helper/Data.php CHANGED
@@ -54,11 +54,16 @@ class Swift_Swiftplugin_Helper_Data extends Mage_Core_Helper_Abstract {
54
  * For Debugging
55
  */
56
  public function getExtensionInformation() {
57
- $str = '';
 
58
  if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
59
- $str = 'working over https';
60
  }
61
- return (string) Mage::getConfig()->getNode()->modules->Swift_Swiftplugin->version .'<br/>'. $_SERVER['HTTP_HOST'] .'<br/>'.$str;
 
 
 
 
62
  }
63
  }
64
 
54
  * For Debugging
55
  */
56
  public function getExtensionInformation() {
57
+ $arr = array();
58
+ $arr['https'] = false;
59
  if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
60
+ $arr['https'] = true;
61
  }
62
+ $arr['plugin_version'] = (string)Mage::getConfig()->getNode()->modules->Swift_Swiftplugin->version;
63
+ $arr['host'] = $_SERVER['HTTP_HOST'];
64
+ $arr['magento_version'] = Mage::getVersion();
65
+
66
+ return json_encode($arr);
67
  }
68
  }
69
 
app/code/community/Swift/Swiftplugin/Model/XmlProduct.php CHANGED
@@ -96,14 +96,9 @@ class Swift_Swiftplugin_Model_XmlProduct {
96
  }
97
  }
98
 
99
- if (isset($_GET['version'])) {
100
- echo (string) Mage::helper('swift/Data')->getExtensionInformation();
101
- }
102
- else {
103
- header('Content-Type: application/xml; charset=utf-8');
104
- echo '<?xml version="1.0" encoding="UTF-8"?>'. "\n" . xml::urlset(xml::products(implode('',$xmlRow)), array('xmlns:g' => "http://base.google.com/ns/1.0"));
105
- die();
106
- }
107
  }
108
  }
109
 
96
  }
97
  }
98
 
99
+ header('Content-Type: application/xml; charset=utf-8');
100
+ echo '<?xml version="1.0" encoding="UTF-8"?>'. "\n" . xml::urlset(xml::products(implode('',$xmlRow)), array('xmlns:g' => "http://base.google.com/ns/1.0"));
101
+ die();
 
 
 
 
 
102
  }
103
  }
104
 
app/code/community/Swift/Swiftplugin/controllers/Adminhtml/IndexController.php CHANGED
@@ -60,13 +60,9 @@ class Swift_Swiftplugin_Adminhtml_IndexController extends Mage_Adminhtml_Control
60
  $existingModels = Mage::getModel('swift/swift')->getCollection();
61
  if (count($existingModels) == 0 || $this->getRequest()->getParam('id')) {
62
  if (ctype_xdigit ($postData['swift_private_key']) && strlen($postData['swift_private_key']) == 64) {
63
- $postData['swift_send_history'] = isset($postData['swift_send_history']) ? '1' : '0';
64
  $testModel->addData($postData)->setId($this->getRequest()->getParam('id'))->save();
 
65
  Mage::getSingleton('adminhtml/session')->addSuccess('successfully saved');
66
- // if successful ping send past orders to swiftcrm
67
- if ($this->pingSwiftSystem($postData['swift_private_key']) == 1) {
68
- $this->_forward('pastproduct');
69
- }
70
  }
71
  else {
72
  throw new Exception('Invalid string input');
@@ -106,49 +102,6 @@ class Swift_Swiftplugin_Adminhtml_IndexController extends Mage_Adminhtml_Control
106
  $this->_redirect('*/*/');
107
  }
108
 
109
- /**
110
- * Send Past orders to Swiftcrm
111
- */
112
- public function pastproductAction() {
113
-
114
- $key = hex2bin(Mage::helper('swift/Data')->getSwiftPrivateKey());
115
- if (!is_bool($key) && !is_null($key)) {
116
- $version = Mage::getConfig()->getNode()->modules->Swift_Swiftplugin->version;
117
- $domain = $_SERVER['HTTP_HOST'];
118
- $user = Mage::helper('swift/Data')->generateUserId();
119
- $url = 'http:'.SwiftApi::SWIFTAPI_CRM_URL;
120
-
121
- $orderCollection = Mage::getModel('sales/order')->getCollection()
122
- ->addAttributeToFilter('created_at' , array('gt' => date('Y-m-d H:i:s', strtotime('-2 years'))));
123
- foreach($orderCollection as $order_key => $order) {
124
- $visibleItems = $order->getAllVisibleItems();
125
- $products = array();
126
- foreach($visibleItems as $order_item_key => $orderItem) {
127
- $products[] = array('product' => $orderItem->getId(), 'price' => $orderItem->getPrice(), 'quantity' => $orderItem->getData('qty_ordered'));
128
- }
129
- $request = new SwiftAPI_Request_PastOrder($domain, $user, $order->getCustomerEmail(),$order->getCustomerFirstname(), $order->getCustomerLastname(), $products);
130
-
131
- $options = array (
132
- 'http' => array(
133
- 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
134
- 'method' => 'POST',
135
- 'content' => SwiftAPI::Query($request, $key)
136
- )
137
- );
138
-
139
- $context = stream_context_create($options);
140
- $result = file_get_contents($url, false, $context);
141
- echo $result;
142
- }
143
- Mage::getSingleton('adminhtml/session')->addSuccess('Past orders successfully sent to swift');
144
- }
145
- else {
146
- Mage::getSingleton('adminhtml/session')->addError('You cannot perform this operation as you have not registered your private key with swift');
147
- }
148
- $this->_redirect('*/*/');
149
- }
150
-
151
-
152
  public function pingSwiftSystem($key) {
153
  $domain = $_SERVER['HTTP_HOST'];
154
  $user = Mage::helper('swift/Data')->generateUserId();
60
  $existingModels = Mage::getModel('swift/swift')->getCollection();
61
  if (count($existingModels) == 0 || $this->getRequest()->getParam('id')) {
62
  if (ctype_xdigit ($postData['swift_private_key']) && strlen($postData['swift_private_key']) == 64) {
 
63
  $testModel->addData($postData)->setId($this->getRequest()->getParam('id'))->save();
64
+ $this->pingSwiftSystem($postData['swift_private_key']);
65
  Mage::getSingleton('adminhtml/session')->addSuccess('successfully saved');
 
 
 
 
66
  }
67
  else {
68
  throw new Exception('Invalid string input');
102
  $this->_redirect('*/*/');
103
  }
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  public function pingSwiftSystem($key) {
106
  $domain = $_SERVER['HTTP_HOST'];
107
  $user = Mage::helper('swift/Data')->generateUserId();
app/code/community/Swift/Swiftplugin/controllers/IndexController.php DELETED
@@ -1,174 +0,0 @@
1
- <?php
2
-
3
- require_once(Mage::getBaseDir('lib') . '/SwiftAPI/SwiftAPI.php');
4
- require_once(Mage::getBaseDir('lib') . '/SwiftAPI/SwiftAPI_Request_Ping.php');
5
-
6
- /**
7
- * Administration of swift plugin
8
- */
9
- class Swift_Swiftplugin_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action {
10
-
11
- /**
12
- * Renders the form by default, if record exists in the database then retrieve that value and load it to the page
13
- */
14
- public function indexAction() {
15
- echo "it works";
16
- die();
17
- $data = Mage::helper('swift/Data')->getSwiftPrivateData();
18
- $swiftId = 0;
19
- if (!is_bool($data) && is_array($data)) {
20
- if (isset($data['swift_id'])) {
21
- $swiftId = $data['swift_id'];
22
- }
23
- }
24
- $swiftModel = Mage::getModel('swift/swift')->load($swiftId);
25
- if ($swiftModel->getId() > 0 || $swiftId == 0) {
26
- Mage::register('swift_data', $swiftModel);
27
- $this->loadLayout();
28
- $this->_addContent($this->getLayout()->createBlock('swift/adminhtml_swift_edit'))->_addLeft($this->getLayout()->createBlock('swift/adminhtml_swift_edit_tabs'));
29
- $this->renderLayout();
30
- }
31
- else {
32
- Mage::getSingleton('adminhtml/session')->addError('SwiftCRM key does not exist');
33
- $this->_redirect('*/*/');
34
- }
35
- }
36
-
37
- /**
38
- * Redirects to indexAction
39
- *
40
- */
41
- public function editAction() {
42
- $this->_forward('index');
43
- }
44
-
45
- /**
46
- * Redirects to indexAction
47
- *
48
- */
49
- public function newAction() {
50
- $this->_forward('edit');
51
- }
52
-
53
- /**
54
- * Perform validation and conversion on post variables before saving to database
55
- *
56
- */
57
- public function saveAction() {
58
- if ($this->getRequest()->getPost()) {
59
- try {
60
- $postData = $this->getRequest()->getPost();
61
- $testModel = Mage::getModel('swift/swift');
62
- $existingModels = Mage::getModel('swift/swift')->getCollection();
63
- if (count($existingModels) == 0 || $this->getRequest()->getParam('id')) {
64
- if (ctype_xdigit ($postData['swift_private_key']) && strlen($postData['swift_private_key']) == 64) {
65
- $postData['swift_send_history'] = isset($postData['swift_send_history']) ? '1' : '0';
66
- $testModel->addData($postData)->setId($this->getRequest()->getParam('id'))->save();
67
- Mage::getSingleton('adminhtml/session')->addSuccess('successfully saved');
68
- // if successful ping send past orders to swiftcrm
69
- if ($this->pingSwiftSystem($postData['swift_private_key']) == 1) {
70
- $this->_forward('pastproduct');
71
- }
72
- }
73
- else {
74
- throw new Exception('Invalid string input');
75
- }
76
- $this->_redirect('*/*/');
77
- }
78
- else {
79
- throw new Exception('Only one SwiftCRM key is allowed in the system.');
80
- }
81
- return;
82
- } catch (Exception $e){
83
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
84
- $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
85
- return;
86
- }
87
- }
88
- $this->_redirect('*/*/');
89
- }
90
-
91
- /**
92
- * Deletes the record from the database
93
- * NOTE: Unused
94
- */
95
- public function deleteAction() {
96
- if($this->getRequest()->getParam('id') > 0) {
97
- try {
98
- $testModel = Mage::getModel('swift/swift');
99
- $testModel->setId($this->getRequest()->getParam('id'))->delete();
100
- Mage::getSingleton('adminhtml/session')->addSuccess('successfully deleted');
101
- $this->_redirect('*/*/');
102
- }
103
- catch (Exception $e) {
104
- Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
105
- $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
106
- }
107
- }
108
- $this->_redirect('*/*/');
109
- }
110
-
111
- /**
112
- * Send Past orders to Swiftcrm
113
- */
114
- public function pastproductAction() {
115
-
116
- $key = hex2bin(Mage::helper('swift/Data')->getSwiftPrivateKey());
117
- if (!is_bool($key) && !is_null($key)) {
118
- $version = Mage::getConfig()->getNode()->modules->Swift_Swiftplugin->version;
119
- $domain = $_SERVER['HTTP_HOST'];
120
- $user = Mage::helper('swift/Data')->generateUserId();
121
- $url = 'http:'.SwiftApi::SWIFTAPI_CRM_URL;
122
-
123
- $orderCollection = Mage::getModel('sales/order')->getCollection()
124
- ->addAttributeToFilter('created_at' , array('gt' => date('Y-m-d H:i:s', strtotime('-2 years'))));
125
- foreach($orderCollection as $order_key => $order) {
126
- $visibleItems = $order->getAllVisibleItems();
127
- $products = array();
128
- foreach($visibleItems as $order_item_key => $orderItem) {
129
- $products[] = array('product' => $orderItem->getId(), 'price' => $orderItem->getPrice(), 'quantity' => $orderItem->getData('qty_ordered'));
130
- }
131
- $request = new SwiftAPI_Request_PastOrder($domain, $user, $order->getCustomerEmail(),$order->getCustomerFirstname(), $order->getCustomerLastname(), $products);
132
-
133
- $options = array (
134
- 'http' => array(
135
- 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
136
- 'method' => 'POST',
137
- 'content' => SwiftAPI::Query($request, $key)
138
- )
139
- );
140
-
141
- $context = stream_context_create($options);
142
- $result = file_get_contents($url, false, $context);
143
- echo $result;
144
- }
145
- Mage::getSingleton('adminhtml/session')->addSuccess('Past orders successfully sent to swift');
146
- }
147
- else {
148
- Mage::getSingleton('adminhtml/session')->addError('You cannot perform this operation as you have not registered your private key with swift');
149
- }
150
- $this->_redirect('*/*/');
151
- }
152
-
153
-
154
- public function pingSwiftSystem($key) {
155
- $domain = $_SERVER['HTTP_HOST'];
156
- $user = Mage::helper('swift/Data')->generateUserId();
157
- $url = 'http:'.SwiftApi::SWIFTAPI_CRM_URL;
158
- $request = new SwiftAPI_Request_Ping($domain, $user, $key);
159
- $options = array (
160
- 'http' => array(
161
- 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
162
- 'method' => 'POST',
163
- 'content' => SwiftAPI::Query($request, hex2bin($key))
164
- )
165
- );
166
-
167
- $context = stream_context_create($options);
168
- $result = file_get_contents($url, false, $context);
169
- return $result;
170
- // optional extra: send proper feedback to plugin in case something goes wrong with their setup
171
- }
172
- }
173
-
174
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Swift/Swiftplugin/controllers/OrdersController.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Description of OrdersController
5
+ *
6
+ * @author netready
7
+ */
8
+ class Swift_Swiftplugin_OrdersController extends Mage_Core_Controller_Front_Action {
9
+
10
+ public function pastordersAction() {
11
+
12
+ $key = hex2bin(Mage::helper('swift/Data')->getSwiftPrivateKey());
13
+
14
+ if (!is_bool($key) && !is_null($key)) {
15
+
16
+ $domain = $_SERVER['HTTP_HOST'];
17
+ $user = Mage::helper('swift/Data')->generateUserId();
18
+ $url = 'http:'.SwiftApi::SWIFTAPI_CRM_URL;
19
+ $limit = 1000;
20
+
21
+ $orderCollection = Mage::getModel('sales/order')->getCollection()
22
+ ->addFieldToSelect(array(
23
+ 'entity_id',
24
+ 'customer_email',
25
+ 'customer_firstname',
26
+ 'customer_lastName'
27
+ ))
28
+ ->addAttributeToFilter('created_at' , array('gt' => date('Y-m-d H:i:s', strtotime('-2 years'))))
29
+ ->setCurPage($this->getRequest()->getParam('offset'))
30
+ ->setPageSize($limit);
31
+
32
+ $orders_present = false;
33
+ foreach($orderCollection as $order) {
34
+
35
+ $visibleItems = $order->getAllVisibleItems();
36
+ $orders_present = true;
37
+
38
+ $products = array();
39
+ foreach($visibleItems as $order_item_key => $orderItem) {
40
+ $products[] = array('product' => $orderItem->getId(), 'price' => $orderItem->getPrice(), 'quantity' => $orderItem->getData('qty_ordered'));
41
+ }
42
+
43
+ $request = new SwiftAPI_Request_PastOrder($domain, $user, $order->getCustomerEmail(),$order->getCustomerFirstname(), $order->getCustomerLastname(), $products);
44
+
45
+ $options = array (
46
+ 'http' => array(
47
+ 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
48
+ 'method' => 'POST',
49
+ 'content' => SwiftAPI::Query($request, $key)
50
+ )
51
+ );
52
+
53
+ $context = stream_context_create($options);
54
+ file_get_contents($url, false, $context);
55
+
56
+ }
57
+
58
+ if ($limit > $orderCollection->count()) {
59
+ $response = array();
60
+ $response['status'] = 2;
61
+ $response['message'] = 'No more orders to send';
62
+ }
63
+ else {
64
+ $response = array();
65
+ $response['status'] = $orders_present ? 1 : 0;
66
+ $response['message'] = $orders_present ? 'Past orders successfully sent to swift' : 'No more orders to send';
67
+ }
68
+ }
69
+ else {
70
+ $response = array();
71
+ $response['status'] = 0;
72
+ $response['message'] = 'You cannot perform this operation as you have not registered your private key with swift';
73
+ }
74
+ echo json_encode($response);
75
+
76
+ }
77
+
78
+ }
app/code/community/Swift/Swiftplugin/controllers/VersionController.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Description of VersionController
5
+ *
6
+ * @author netready
7
+ */
8
+ class Swift_Swiftplugin_VersionController extends Mage_Core_Controller_Front_Action {
9
+
10
+ public function indexAction() {
11
+ echo Mage::helper('swift/Data')->getExtensionInformation();
12
+ die();
13
+ }
14
+
15
+
16
+ }
app/code/community/Swift/Swiftplugin/controllers/XmlController.php CHANGED
@@ -5,47 +5,7 @@ class Swift_Swiftplugin_XmlController extends Mage_Core_Controller_Front_Action
5
  public function feedAction() {
6
  $obj = new Swift_Swiftplugin_Model_XmlProduct();
7
  $obj->generate_xml();
8
- }
9
-
10
- public function sendpastproductAction() {
11
-
12
- $key = hex2bin(Mage::helper('swift/Data')->getSwiftPrivateKey());
13
- if (!is_bool($key) && !is_null($key)) {
14
- $version = Mage::getConfig()->getNode()->modules->Swift_Swiftplugin->version;
15
- $domain = $_SERVER['HTTP_HOST'];
16
- $user = Mage::helper('swift/Data')->generateUserId();
17
- $url = 'http:'.SwiftApi::SWIFTAPI_CRM_URL;
18
-
19
- $orderCollection = Mage::getModel('sales/order')->getCollection()
20
- ->addAttributeToFilter('created_at' , array('gt' => date('Y-m-d H:i:s', strtotime('-2 years'))));
21
- foreach($orderCollection as $order_key => $order) {
22
- $visibleItems = $order->getAllVisibleItems();
23
- $products = array();
24
- foreach($visibleItems as $order_item_key => $orderItem) {
25
- $products[] = array('product' => $orderItem->getId(), 'price' => $orderItem->getPrice(), 'quantity' => $orderItem->getData('qty_ordered'));
26
- }
27
- $request = new SwiftAPI_Request_PastOrder($domain, $user, $order->getCustomerEmail(),$order->getCustomerFirstname(), $order->getCustomerLastname(), $products);
28
-
29
- $options = array (
30
- 'http' => array(
31
- 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
32
- 'method' => 'POST',
33
- 'content' => SwiftAPI::Query($request, $key)
34
- )
35
- );
36
-
37
- $context = stream_context_create($options);
38
- $result = file_get_contents($url, false, $context);
39
- echo $result;
40
- }
41
- echo 'Past orders successfully sent to swift';
42
- }
43
- else {
44
- echo 'You cannot perform this operation as you have not registered your private key with swift';
45
- }
46
-
47
  }
48
-
49
  }
50
 
51
  ?>
5
  public function feedAction() {
6
  $obj = new Swift_Swiftplugin_Model_XmlProduct();
7
  $obj->generate_xml();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  }
 
9
  }
10
 
11
  ?>
app/code/community/Swift/Swiftplugin/etc/config.xml CHANGED
@@ -1,14 +1,10 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <!-- The root node for Magento module configuration -->
3
  <config>
4
- <!-- The module's node contains basic information about each Magento module -->
5
  <modules>
6
- <!-- This must exactly match the namespace and module's folder names, with directory separators replaced by underscores -->
7
  <Swift_Swiftplugin>
8
- <version>1.3.3</version>
9
  </Swift_Swiftplugin>
10
  </modules>
11
- <!-- Configure our module's behavior in the frontend scope -->
12
  <frontend>
13
  <routers>
14
  <swift>
@@ -27,7 +23,6 @@
27
  </updates>
28
  </layout>
29
  </frontend>
30
- <!-- Configure our module's behavior in the admin scope -->
31
  <admin>
32
  <routers>
33
  <swift>
@@ -39,7 +34,6 @@
39
  </swift>
40
  </routers>
41
  </admin>
42
- <!-- admin html -->
43
  <adminhtml>
44
  <layout>
45
  <updates>
@@ -86,30 +80,24 @@
86
  </entities>
87
  </swift_mysql4>
88
  </models>
89
- <!-- allow the plugin to read and write -->
90
  <resources>
91
- <!-- Sets up database table, when it is first installed this script is ran -->
92
  <swift_setup>
93
  <setup>
94
  <module>Swift_Swiftplugin</module>
95
  </setup>
96
  </swift_setup>
97
- <!-- connection to write -->
98
  <swift_write>
99
  <connection>
100
  <use>core_write</use>
101
  </connection>
102
  </swift_write>
103
- <!-- connection to read -->
104
  <swift_read>
105
  <connection>
106
  <use>core_read</use>
107
  </connection>
108
  </swift_read>
109
  </resources>
110
- <!-- Set observer methods -->
111
  <events>
112
- <!-- check out when a product is added to the cart -->
113
  <checkout_cart_add_product_complete>
114
  <observers>
115
  <swift>
@@ -119,7 +107,6 @@
119
  </swift>
120
  </observers>
121
  </checkout_cart_add_product_complete>
122
- <!-- check out when a user has subscribed -->
123
  <newsletter_subscriber_save_after>
124
  <observers>
125
  <swift>
@@ -129,7 +116,6 @@
129
  </swift>
130
  </observers>
131
  </newsletter_subscriber_save_after>
132
- <!-- check out when an order has been made -->
133
  <checkout_submit_all_after>
134
  <observers>
135
  <swift>
1
  <?xml version="1.0" encoding="UTF-8"?>
 
2
  <config>
 
3
  <modules>
 
4
  <Swift_Swiftplugin>
5
+ <version>1.4.0</version>
6
  </Swift_Swiftplugin>
7
  </modules>
 
8
  <frontend>
9
  <routers>
10
  <swift>
23
  </updates>
24
  </layout>
25
  </frontend>
 
26
  <admin>
27
  <routers>
28
  <swift>
34
  </swift>
35
  </routers>
36
  </admin>
 
37
  <adminhtml>
38
  <layout>
39
  <updates>
80
  </entities>
81
  </swift_mysql4>
82
  </models>
 
83
  <resources>
 
84
  <swift_setup>
85
  <setup>
86
  <module>Swift_Swiftplugin</module>
87
  </setup>
88
  </swift_setup>
 
89
  <swift_write>
90
  <connection>
91
  <use>core_write</use>
92
  </connection>
93
  </swift_write>
 
94
  <swift_read>
95
  <connection>
96
  <use>core_read</use>
97
  </connection>
98
  </swift_read>
99
  </resources>
 
100
  <events>
 
101
  <checkout_cart_add_product_complete>
102
  <observers>
103
  <swift>
107
  </swift>
108
  </observers>
109
  </checkout_cart_add_product_complete>
 
110
  <newsletter_subscriber_save_after>
111
  <observers>
112
  <swift>
116
  </swift>
117
  </observers>
118
  </newsletter_subscriber_save_after>
 
119
  <checkout_submit_all_after>
120
  <observers>
121
  <swift>
lib/SwiftAPI/SwiftAPI.php CHANGED
@@ -142,8 +142,6 @@ class SwiftAPI
142
  http.open("POST","'. self::SWIFTAPI_CRM_URL .'", true);
143
 
144
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
145
- http.setRequestHeader("Content-length", query.length);
146
- http.setRequestHeader("Connection", "close");
147
 
148
  http.onreadystatechange= function()
149
  {
142
  http.open("POST","'. self::SWIFTAPI_CRM_URL .'", true);
143
 
144
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
 
 
145
 
146
  http.onreadystatechange= function()
147
  {
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Swift_Swiftplugin</name>
4
- <version>1.3.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/LGPL-3.0">LGPL</license>
7
  <channel>community</channel>
@@ -18,11 +18,11 @@ The extension uses background JavaScript calls to collect and store the customer
18
  &lt;p&gt;&#xD;
19
  The extension is easy to set up and uses Magento&#x2019;s built in features to collect information and send emails to the customers. Visit swiftcrm.net for prices and free trails.&#xD;
20
  &lt;/p&gt;</description>
21
- <notes>Added a way to get past orders more effectively. </notes>
22
  <authors><author><name>Simon Cooper</name><user>Netready</user><email>simon@netready.biz</email></author></authors>
23
- <date>2016-03-17</date>
24
- <time>12:25:01</time>
25
- <contents><target name="magelib"><dir name="libXML"><file name="xml.php" hash="fc4d7c79c7b7ea2ac75f28c008cde8eb"/></dir><dir name="SwiftAPI"><file name="SwiftAPI.php" hash="1a2b4e86947847e5e524a1c53054f79e"/><file name="SwiftAPI_Exception.php" hash="879b899a7961f4de1212b7296ccafb16"/><file name="SwiftAPI_Product.php" hash="063922cccb485d81c6022de5c4e8e044"/><file name="SwiftAPI_Request.php" hash="da10370a1c8d9c1a8b5d4b1d3840d3b6"/><file name="SwiftAPI_Request_Cart.php" hash="f8955c78200ddb0512adb5214fd64bb2"/><file name="SwiftAPI_Request_EmailPackage.php" hash="221dd4bd936f022a9e07ad79d33c89a2"/><file name="SwiftAPI_Request_Home.php" hash="9268da121dd10db50d5c2675afd1c65e"/><file name="SwiftAPI_Request_Order.php" hash="cd8ce90614468bd4347df3c541482a4b"/><file name="SwiftAPI_Request_OrderPackage.php" hash="91724705e976182c0bb1d7d7d6fc786f"/><file name="SwiftAPI_Request_PastOrder.php" hash="be620e2e35d6634e6a616431f5312527"/><file name="SwiftAPI_Request_Ping.php" hash="e5e13b71682f8230711d5d2f28f9a534"/><file name="SwiftAPI_Request_Product.php" hash="e5fab27bb2dd45946ed8c143a18fe3c4"/><file name="SwiftAPI_Request_SendMail.php" hash="ba04382a3df6b3e179aed5fe3e809de7"/><file name="SwiftAPI_Request_Subscription.php" hash="5545738b941d8ca4dca69b6059a0cce4"/><file name="SwiftAPI_Request_Unsubscribe.php" hash="78aa37cc0ecb98d501674350a4a409c9"/><file name="SwiftAPI_Request_ViewMail.php" hash="773f0cc695838654b9056269622c217e"/><dir name="doc"><file name="SwiftAPI-Specification.html" hash="3be495e89f1555d138a9314052e2c627"/></dir><file name="index.php" hash="82886bb98883bd5868ea04c7d8c88ba5"/><file name="php.ini" hash="ef29c923925a1d1bbc8879c22297daa4"/></dir></target><target name="magecommunity"><dir name="Swift"><dir name="Swiftplugin"><dir name="Block"><dir name="Adminhtml"><dir name="Swift"><dir name="Edit"><file name="Form.php" hash="bd80ab8170f7f2286f13ac579e5249d9"/><dir name="Tab"><file name="Form.php" hash="3d15c45cb2205acabc20376f41a9bd5b"/><file name="Instruct.php" hash="9f34075cc9cdfa92b7876c33fda514de"/></dir><file name="Tabs.php" hash="993769f682fad7d28df79ff3acea97cc"/></dir><file name="Edit.php" hash="d93f75dbaaa7266d91e828b3208fbf2d"/></dir></dir><file name="Swiftblock.php" hash="ef4796eaf44aa8e4a9b144e5a9365166"/></dir><dir name="Helper"><file name="Data.php" hash="cad7e7ffcde09cdd3c089b42644e9d66"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Swift"><file name="Collection.php" hash="82de0fe56cd875d3e78c8fc690424ee1"/></dir><file name="Swift.php" hash="252d5f2ecb1119804b415758d2db6800"/></dir><file name="Observer.php" hash="139db0541de06e7bed17ad9d40fcd89b"/><file name="Swift.php" hash="1f9e49d4db7f8987cfd8858061fedc6a"/><file name="XmlProduct.php" hash="7d3f13464f4028820955130970d5754a"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="0d17d7a4d18d3a77fd1af945d016da74"/></dir><file name="IndexController.php" hash="e3b7ebb44a55187c9085d9f1c4e7d060"/><file name="MailController.php" hash="af10fe5d485b1742ba5095510f2deea4"/><file name="XmlController.php" hash="bb82a7313cf5d6e5fa8aa5c844ea4dd1"/></dir><dir name="etc"><file name="config.xml" hash="dc80bb17f102d6425b626fda8833e6b4"/></dir><dir name="sql"><dir name="swift_setup"><file name="install-1.1.13.php" hash="2447b5645fc36738373678473cec88dc"/><file name="install-1.1.2.php" hash="00832a00c34cb4c997a96330cb28cbfb"/><file name="upgrade-1.1.2-1.1.12.php" hash="cbe3c3fa07facb7b720d7dd518acbeca"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="swift.xml" hash="d80a5229e30cf4b76f5a5150ac1c27c3"/></dir><dir name="template"><dir name="swift"><file name="swiftplugin.phtml" hash="d4d25148e09529e457b6436d7655627b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Swift_all.xml" hash="0ae5a788c805a9fc79b402fe7a02e54d"/></dir></target></contents>
26
  <compatible/>
27
  <dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php><extension><name>mcrypt</name><min/><max/></extension></required></dependencies>
28
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Swift_Swiftplugin</name>
4
+ <version>1.4.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/LGPL-3.0">LGPL</license>
7
  <channel>community</channel>
18
  &lt;p&gt;&#xD;
19
  The extension is easy to set up and uses Magento&#x2019;s built in features to collect information and send emails to the customers. Visit swiftcrm.net for prices and free trails.&#xD;
20
  &lt;/p&gt;</description>
21
+ <notes>Added a way to get past orders more effectively. General performance and efficiency improvements.</notes>
22
  <authors><author><name>Simon Cooper</name><user>Netready</user><email>simon@netready.biz</email></author></authors>
23
+ <date>2016-04-06</date>
24
+ <time>10:22:58</time>
25
+ <contents><target name="magelib"><dir name="libXML"><file name="xml.php" hash="fc4d7c79c7b7ea2ac75f28c008cde8eb"/></dir><dir name="SwiftAPI"><file name="SwiftAPI.php" hash="48c84b3a67c2373b993e9d1ac7975285"/><file name="SwiftAPI_Exception.php" hash="879b899a7961f4de1212b7296ccafb16"/><file name="SwiftAPI_Product.php" hash="063922cccb485d81c6022de5c4e8e044"/><file name="SwiftAPI_Request.php" hash="da10370a1c8d9c1a8b5d4b1d3840d3b6"/><file name="SwiftAPI_Request_Cart.php" hash="f8955c78200ddb0512adb5214fd64bb2"/><file name="SwiftAPI_Request_EmailPackage.php" hash="221dd4bd936f022a9e07ad79d33c89a2"/><file name="SwiftAPI_Request_Home.php" hash="9268da121dd10db50d5c2675afd1c65e"/><file name="SwiftAPI_Request_Order.php" hash="cd8ce90614468bd4347df3c541482a4b"/><file name="SwiftAPI_Request_OrderPackage.php" hash="91724705e976182c0bb1d7d7d6fc786f"/><file name="SwiftAPI_Request_PastOrder.php" hash="be620e2e35d6634e6a616431f5312527"/><file name="SwiftAPI_Request_Ping.php" hash="e5e13b71682f8230711d5d2f28f9a534"/><file name="SwiftAPI_Request_Product.php" hash="e5fab27bb2dd45946ed8c143a18fe3c4"/><file name="SwiftAPI_Request_SendMail.php" hash="ba04382a3df6b3e179aed5fe3e809de7"/><file name="SwiftAPI_Request_Subscription.php" hash="5545738b941d8ca4dca69b6059a0cce4"/><file name="SwiftAPI_Request_Unsubscribe.php" hash="78aa37cc0ecb98d501674350a4a409c9"/><file name="SwiftAPI_Request_ViewMail.php" hash="773f0cc695838654b9056269622c217e"/><dir name="doc"><file name="SwiftAPI-Specification.html" hash="3be495e89f1555d138a9314052e2c627"/></dir><file name="index.php" hash="82886bb98883bd5868ea04c7d8c88ba5"/><file name="php.ini" hash="ef29c923925a1d1bbc8879c22297daa4"/></dir></target><target name="magecommunity"><dir name="Swift"><dir name="Swiftplugin"><dir name="Block"><dir name="Adminhtml"><dir name="Swift"><dir name="Edit"><file name="Form.php" hash="bd80ab8170f7f2286f13ac579e5249d9"/><dir name="Tab"><file name="Form.php" hash="3d15c45cb2205acabc20376f41a9bd5b"/><file name="Instruct.php" hash="9f34075cc9cdfa92b7876c33fda514de"/></dir><file name="Tabs.php" hash="993769f682fad7d28df79ff3acea97cc"/></dir><file name="Edit.php" hash="d93f75dbaaa7266d91e828b3208fbf2d"/></dir></dir><file name="Swiftblock.php" hash="ef4796eaf44aa8e4a9b144e5a9365166"/></dir><dir name="Helper"><file name="Data.php" hash="4281667b622843620ef59e990b551cec"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Swift"><file name="Collection.php" hash="82de0fe56cd875d3e78c8fc690424ee1"/></dir><file name="Swift.php" hash="252d5f2ecb1119804b415758d2db6800"/></dir><file name="Observer.php" hash="139db0541de06e7bed17ad9d40fcd89b"/><file name="Swift.php" hash="1f9e49d4db7f8987cfd8858061fedc6a"/><file name="XmlProduct.php" hash="bfccc7f91cb96f105a1e945e8304053f"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="92604a30880c89fbe7885780520096cc"/></dir><file name="MailController.php" hash="af10fe5d485b1742ba5095510f2deea4"/><file name="OrdersController.php" hash="9282ddf97debd0d3659f5591d0b01605"/><file name="VersionController.php" hash="b9bebb51f946430a2dc7bfc82f96bf36"/><file name="XmlController.php" hash="995d16b26f21a06eb01f258a20e015fc"/></dir><dir name="etc"><file name="config.xml" hash="883d8c9e155c46a9320a7ec96582e19d"/></dir><dir name="sql"><dir name="swift_setup"><file name="install-1.1.13.php" hash="2447b5645fc36738373678473cec88dc"/><file name="install-1.1.2.php" hash="00832a00c34cb4c997a96330cb28cbfb"/><file name="upgrade-1.1.2-1.1.12.php" hash="cbe3c3fa07facb7b720d7dd518acbeca"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="swift.xml" hash="d80a5229e30cf4b76f5a5150ac1c27c3"/></dir><dir name="template"><dir name="swift"><file name="swiftplugin.phtml" hash="d4d25148e09529e457b6436d7655627b"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Swift_all.xml" hash="0ae5a788c805a9fc79b402fe7a02e54d"/></dir></target></contents>
26
  <compatible/>
27
  <dependencies><required><php><min>5.4.0</min><max>6.0.0</max></php><extension><name>mcrypt</name><min/><max/></extension></required></dependencies>
28
  </package>