Infoplus_Connector - Version 3.0.3

Version Notes

No Notes

Download this release

Release Info

Developer Infoplus
Extension Infoplus_Connector
Version 3.0.3
Comparing to
See all releases


Version 3.0.3

Files changed (21) hide show
  1. app/code/community/Infoplus/Connector/Block/Adminhtml/Catalog/Product/Edit/Tab/Infoplusitem.php +93 -0
  2. app/code/community/Infoplus/Connector/Block/Adminhtml/Sales/Order/View/Tab/Infoplusorder.php +94 -0
  3. app/code/community/Infoplus/Connector/Catalog/Model/Product/Api.php +99 -0
  4. app/code/community/Infoplus/Connector/Helper/Data.php +11 -0
  5. app/code/community/Infoplus/Connector/Model/Infoplus/Product.php +17 -0
  6. app/code/community/Infoplus/Connector/Model/Mysql4/Infoplus/Product.php +16 -0
  7. app/code/community/Infoplus/Connector/Model/Mysql4/Infoplus/Product/Collection.php +17 -0
  8. app/code/community/Infoplus/Connector/Model/Observer.php +253 -0
  9. app/code/community/Infoplus/Connector/Sales/Model/Order.php +38 -0
  10. app/code/community/Infoplus/Connector/Sales/Model/Order/Invoice/Api.php +82 -0
  11. app/code/community/Infoplus/Connector/Sales/Model/Order/Shipment/Api.php +37 -0
  12. app/code/community/Infoplus/Connector/Sales/Model/Quote/Address.php +127 -0
  13. app/code/community/Infoplus/Connector/etc/api.xml +29 -0
  14. app/code/community/Infoplus/Connector/etc/config.xml +153 -0
  15. app/code/community/Infoplus/Connector/etc/system.xml +70 -0
  16. app/code/community/Infoplus/Connector/sql/infoplus_setup/install-2.0.0.php +25 -0
  17. app/design/adminhtml/default/default/layout/infoplus_connector.xml +27 -0
  18. app/design/adminhtml/default/default/template/infoplus_connector/catalog/product/edit/tab/infoplus_item.phtml +82 -0
  19. app/design/adminhtml/default/default/template/infoplus_connector/sales/order/view/tab/infoplus_order.phtml +77 -0
  20. app/etc/modules/Infoplus_Connector.xml +17 -0
  21. package.xml +19 -0
app/code/community/Infoplus/Connector/Block/Adminhtml/Catalog/Product/Edit/Tab/Infoplusitem.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Block_Adminhtml_Catalog_Product_Edit_Tab_Infoplusitem extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
9
+ {
10
+
11
+ /*********************************************
12
+ ** _construct **
13
+ ** **
14
+ ** constructor, set the template **
15
+ ** **
16
+ ** @return void **
17
+ *********************************************/
18
+ protected function _construct()
19
+ {
20
+ parent::_construct();
21
+ $this->setTemplate('infoplus_connector/catalog/product/edit/tab/infoplus_item.phtml');
22
+ }
23
+
24
+
25
+
26
+ /*********************************************
27
+ ** getTabLabel **
28
+ ** **
29
+ ** specifies tab label for template **
30
+ ** **
31
+ ** @return string **
32
+ *********************************************/
33
+ public function getTabLabel()
34
+ {
35
+ return $this->__('Infoplus Product Info');
36
+ }
37
+
38
+
39
+
40
+ /*********************************************
41
+ ** getTabTitle **
42
+ ** **
43
+ ** specifies tab title for template **
44
+ ** **
45
+ ** @return string **
46
+ *********************************************/
47
+ public function getTabTitle()
48
+ {
49
+ return $this->__('Infoplus Product Info');
50
+ }
51
+
52
+
53
+
54
+ /*********************************************
55
+ ** canShowTab **
56
+ ** **
57
+ ** Determinies if tab can be shown **
58
+ ** **
59
+ ** @return boolean **
60
+ *********************************************/
61
+ public function canShowTab()
62
+ {
63
+ return true;
64
+ }
65
+
66
+
67
+
68
+ /*********************************************
69
+ ** isHidden **
70
+ ** **
71
+ ** Determinies if tab is hidden **
72
+ ** **
73
+ ** @return boolean **
74
+ *********************************************/
75
+ public function isHidden()
76
+ {
77
+ return false;
78
+ }
79
+
80
+
81
+ /*********************************************
82
+ ** getProduct **
83
+ ** **
84
+ ** Fetches current product from registry **
85
+ ** **
86
+ ** @return boolean **
87
+ *********************************************/
88
+ public function getProduct()
89
+ {
90
+ return Mage::registry('product');
91
+ }
92
+
93
+ }
app/code/community/Infoplus/Connector/Block/Adminhtml/Sales/Order/View/Tab/Infoplusorder.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Block_Adminhtml_Sales_Order_View_Tab_Infoplusorder extends Mage_Adminhtml_Block_Template implements Mage_Adminhtml_Block_Widget_Tab_Interface
9
+ {
10
+
11
+ /*********************************************
12
+ ** _construct **
13
+ ** **
14
+ ** constructor, set the template **
15
+ ** **
16
+ ** @return void **
17
+ *********************************************/
18
+ protected function _construct()
19
+ {
20
+ parent::_construct();
21
+ $this->setTemplate('infoplus_connector/sales/order/view/tab/infoplus_order.phtml');
22
+ }
23
+
24
+
25
+
26
+ /*********************************************
27
+ ** getTabLabel **
28
+ ** **
29
+ ** specifies tab label for template **
30
+ ** **
31
+ ** @return string **
32
+ *********************************************/
33
+ public function getTabLabel()
34
+ {
35
+ return $this->__('Infoplus Order Information');
36
+ }
37
+
38
+
39
+
40
+ /*********************************************
41
+ ** getTabTitle **
42
+ ** **
43
+ ** specifies tab title for template **
44
+ ** **
45
+ ** @return string **
46
+ *********************************************/
47
+ public function getTabTitle()
48
+ {
49
+ return $this->__('Infoplus Order Information');
50
+ }
51
+
52
+
53
+
54
+ /*********************************************
55
+ ** canShowTab **
56
+ ** **
57
+ ** Determinies if tab can be shown **
58
+ ** **
59
+ ** @return boolean **
60
+ *********************************************/
61
+ public function canShowTab()
62
+ {
63
+ return true;
64
+ }
65
+
66
+
67
+
68
+ /*********************************************
69
+ ** isHidden **
70
+ ** **
71
+ ** Determinies if tab is hidden **
72
+ ** **
73
+ ** @return boolean **
74
+ *********************************************/
75
+ public function isHidden()
76
+ {
77
+ return false;
78
+ }
79
+
80
+
81
+
82
+ /*********************************************
83
+ ** getOrder **
84
+ ** **
85
+ ** Fetches current order from registry **
86
+ ** **
87
+ ** @return boolean **
88
+ *********************************************/
89
+ public function getOrder()
90
+ {
91
+ return Mage::registry('current_order');
92
+ }
93
+
94
+ }
app/code/community/Infoplus/Connector/Catalog/Model/Product/Api.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Catalog_Model_Product_Api extends Mage_Catalog_Model_Product_Api
9
+ {
10
+
11
+ /***************************************
12
+ ** Retrieve product info **
13
+ ** **
14
+ ** @param int|string $productId **
15
+ ** @param string|int $store **
16
+ ** @param stdClass $attributes **
17
+ ** @return array **
18
+ ***************************************/
19
+ public function info($productId, $store = null, $attributes = null, $identifierType = null)
20
+ {
21
+ ###################################
22
+ ## get array from call to parent ##
23
+ ###################################
24
+ $productInfo = parent::info($productId, $store, $attributes, $identifierType);
25
+
26
+ ####################################################
27
+ ## look for existing infoplus_record for this sku ##
28
+ ####################################################
29
+ $collection = Mage::getModel('infoplus/infoplus_product')->getCollection()->addFieldToFilter('magento_sku', $productInfo["sku"]);
30
+ if(count($collection) > 0)
31
+ {
32
+ ######################################
33
+ ## get infoplus product information ##
34
+ ######################################
35
+ $infoplusProduct = $collection->getFirstItem();
36
+ $wmsSku = $infoplusProduct->getWmsSku();
37
+
38
+ ############################################################
39
+ ## if value is set for sku add to the product information ##
40
+ ############################################################
41
+ if(isset($wmsSku) && $wmsSku != "")
42
+ {
43
+ $productInfo["infoplus_wms_sku"] = $infoplusProduct->getWmsSku();
44
+ }
45
+ }
46
+
47
+ return $productInfo;
48
+ }
49
+
50
+
51
+
52
+ /**********************************************
53
+ ** Retrieve product info for given wms sku **
54
+ ** **
55
+ ** @param string $wmsSku **
56
+ ** @param stdClass $attributes **
57
+ ** @return array **
58
+ **********************************************/
59
+ public function getProductInfoByWmsSku($wmsSku)
60
+ {
61
+ $result = array();
62
+
63
+ ###############################################
64
+ ## look for infoplus_record for this wms sku ##
65
+ ###############################################
66
+ $infoplusProductCollection = Mage::getModel('infoplus/infoplus_product')->getCollection()->addFieldToFilter('wms_sku', $wmsSku);
67
+
68
+ #####################################################################
69
+ ## if any found, iterate over here, adding product data to results ##
70
+ #####################################################################
71
+ foreach($infoplusProductCollection as $infoplusProduct)
72
+ {
73
+ #############################
74
+ ## load product from model ##
75
+ #############################
76
+ $productCollection = Mage::getModel('catalog/product')->getCollection()->addFieldToFilter('sku', $infoplusProduct->getMagentoSku());
77
+
78
+ ##############################
79
+ ## add to our results array ##
80
+ ##############################
81
+ foreach($productCollection as $product)
82
+ {
83
+ $result[] = array
84
+ (
85
+ 'product_id' => $product->getId(),
86
+ 'sku' => $product->getSku(),
87
+ 'name' => $product->getName(),
88
+ 'set' => $product->getAttributeSetId(),
89
+ 'type' => $product->getTypeId(),
90
+ 'category_ids' => $product->getCategoryIds(),
91
+ 'website_ids' => $product->getWebsiteIds()
92
+ );
93
+ }
94
+ }
95
+
96
+ return $result;
97
+ }
98
+
99
+ }
app/code/community/Infoplus/Connector/Helper/Data.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Helper_Data extends Mage_Core_Helper_Abstract
9
+ {
10
+
11
+ }
app/code/community/Infoplus/Connector/Model/Infoplus/Product.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Model_Infoplus_Product extends Mage_Core_Model_Abstract
9
+ {
10
+
11
+ public function _construct()
12
+ {
13
+ parent::_construct();
14
+ $this->_init('infoplus/infoplus_product');
15
+ }
16
+
17
+ }
app/code/community/Infoplus/Connector/Model/Mysql4/Infoplus/Product.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Model_Mysql4_Infoplus_Product extends Mage_Core_Model_Mysql4_Abstract
9
+ {
10
+
11
+ public function _construct()
12
+ {
13
+ $this->_init('infoplus/infoplus_product', 'id');
14
+ }
15
+
16
+ }
app/code/community/Infoplus/Connector/Model/Mysql4/Infoplus/Product/Collection.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Model_Mysql4_Infoplus_Product_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
9
+ {
10
+
11
+ public function _construct()
12
+ {
13
+ parent::_construct();
14
+ $this->_init('infoplus/infoplus_product');
15
+ }
16
+
17
+ }
app/code/community/Infoplus/Connector/Model/Observer.php ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Model_Observer
9
+ {
10
+
11
+ /*********************************************
12
+ ** save_product_tab_data **
13
+ ** **
14
+ ** called when product is saved **
15
+ ** **
16
+ ** @param class $observer **
17
+ ** @return void **
18
+ *********************************************/
19
+ public function save_product_tab_data($observer)
20
+ {
21
+ Mage::log('Inside Infoplus_Connector_Model_Observer:save_product_tab_data()...');
22
+
23
+ #################################
24
+ ## get the product being saved ##
25
+ #################################
26
+ $product = $observer->getEvent()->getProduct();
27
+
28
+ ####################################
29
+ ## get the field values passed in ##
30
+ ####################################
31
+ $request = Mage::app()->getRequest();
32
+ $wmsSku = $request->getPost('infoplus_wms_sku');
33
+
34
+ ####################################################
35
+ ## look for existing infoplus_record for this sku ##
36
+ ####################################################
37
+ $collection = Mage::getModel('infoplus/infoplus_product')->getCollection()->addFieldToFilter('magento_sku', $product->getSku());
38
+
39
+ ######################################
40
+ ## if any records found, do updates ##
41
+ ######################################
42
+ if(count($collection) > 0)
43
+ {
44
+ foreach($collection as $infoplusProduct)
45
+ {
46
+ #############################
47
+ ## load product from model ##
48
+ #############################
49
+ $_product = Mage::getModel('infoplus/infoplus_product')->load($infoplusProduct->getId());
50
+ $_product->setWmsSku ($wmsSku);
51
+ $_product->setUpdateTime (now());
52
+ $_product->save();
53
+ }
54
+ }
55
+ else
56
+ {
57
+ ###############################################
58
+ ## if no records found, and we were provided ##
59
+ ## a value to store, insert a record ##
60
+ ###############################################
61
+ if(isset($wmsSku) && $wmsSku != "")
62
+ {
63
+ $infoplusProduct = Mage::getModel('infoplus/infoplus_product');
64
+ $infoplusProduct->setMagentoSku ($product->getSku());
65
+ $infoplusProduct->setWmsSku ($wmsSku);
66
+ $infoplusProduct->setCreatedTime (now());
67
+ $infoplusProduct->setUpdateTime (now());
68
+ $infoplusProduct->save();
69
+ }
70
+ }
71
+
72
+ Mage::app()->getCacheInstance()->cleanType('block_html');
73
+ }
74
+
75
+
76
+
77
+ /*********************************************
78
+ ** post_new_order_queue_message **
79
+ ** **
80
+ ** called when new order event occurs **
81
+ ** **
82
+ ** @param class $observer **
83
+ ** @return void **
84
+ *********************************************/
85
+ public function post_new_order_queue_message($observer)
86
+ {
87
+ Mage::log('Inside Infoplus_Connector_Model_Observer:post_new_order_queue_message()...');
88
+
89
+ $orderId = $observer->getEvent()->getOrder()->getIncrementId();
90
+ $message = 'orderId=' . $orderId;
91
+
92
+ ############################################
93
+ ## post order id to proper infoplus queue ##
94
+ ############################################
95
+ $newOrderQueueName = Mage::getStoreConfig('infoplus/connector/new_order_queue_name');
96
+ $this->post_queue_message($newOrderQueueName, $message);
97
+ }
98
+
99
+
100
+
101
+ /*********************************************
102
+ ** post_cancel_order_queue_message **
103
+ ** **
104
+ ** called when order cancelled event occurs **
105
+ ** **
106
+ ** @param class $observer **
107
+ ** @return void **
108
+ *********************************************/
109
+ public function post_cancel_order_queue_message($observer)
110
+ {
111
+ Mage::log('Inside Infoplus_Connector_Model_Observer:post_cancel_order_queue_message()...');
112
+
113
+ $orderId = $observer->getEvent()->getOrder()->getIncrementId();
114
+ $message = 'orderId=' . $orderId;
115
+
116
+ ############################################
117
+ ## post order id to proper infoplus queue ##
118
+ ############################################
119
+ $cancelledOrderQueueName = Mage::getStoreConfig('infoplus/connector/cancelled_order_queue_name');
120
+ $this->post_queue_message($cancelledOrderQueueName, $message);
121
+ }
122
+
123
+
124
+
125
+ /*********************************************
126
+ ** post_queue_message **
127
+ ** **
128
+ ** Posts message to given queue name **
129
+ ** **
130
+ ** @param string $queueName **
131
+ ** @param string $message **
132
+ ** @return void **
133
+ *********************************************/
134
+ private function post_queue_message($queueName, $message)
135
+ {
136
+ Mage::log('Inside Infoplus_Connector_Model_Observer:post_queue_message()...');
137
+
138
+ ################################################################
139
+ ## first check if in test mode, which will determine root url ##
140
+ ################################################################
141
+ $isTestMode = Mage::getStoreConfig('infoplus_options/infoplus_options_general/infoplus_test_mode');
142
+ if($isTestMode)
143
+ {
144
+ $baseURL = Mage::getStoreConfig('infoplus/connector/test_url') . '?template=services.RequestDispatcher&service=jmsbridge.PostQueueMapMessage&command=handleRequest&protocol=text&fieldDelimiter=^&providerName=magento';
145
+ }
146
+ else
147
+ {
148
+ $baseURL = Mage::getStoreConfig('infoplus/connector/live_url') . '?template=services.RequestDispatcher&service=jmsbridge.PostQueueMapMessage&command=handleRequest&protocol=text&fieldDelimiter=^&providerName=magento';
149
+ }
150
+
151
+ ###################################################
152
+ ## always append the deployment to queue message ##
153
+ ###################################################
154
+ $deploymentIdentifier = Mage::getStoreConfig('infoplus_options/infoplus_options_general/infoplus_deployment_identifier');
155
+ $message .= '&deployment=' . $deploymentIdentifier;
156
+
157
+ ############################
158
+ ## get the module version ##
159
+ ############################
160
+ $version = Mage::getConfig()->getNode()->modules->Infoplus_Connector->version;
161
+ $message .= '&version=' . $version;
162
+
163
+ ######################################################################
164
+ ## create the full url to post to making sure to encode the message #d
165
+ #####################################################################
166
+ $url = $baseURL . '&queueName=' . $queueName . '&message=' . urlencode($message);
167
+
168
+ Mage::log('Attempting to post message=['.$message.'] to url=['.$url.'].');
169
+ $curlHandle = curl_init();
170
+ curl_setopt($curlHandle, CURLOPT_URL, $url);
171
+ curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
172
+ $output = curl_exec($curlHandle);
173
+ Mage::log('Post complete!');
174
+
175
+ #################################
176
+ ## check if any error occurred ##
177
+ #################################
178
+ if(curl_errno($curlHandle))
179
+ {
180
+ ##############################################
181
+ ## send message with error and close handle ##
182
+ ##############################################
183
+ $this->send_error_email('Curl error: ['.curl_error($curlHandle).'] when posting message=['.$message.'] to url=['.$url.'], received output=['.$output.']');
184
+ curl_close($curlHandle);
185
+ return;
186
+ }
187
+ else
188
+ {
189
+ ####################################
190
+ ## retrieve info and close handle ##
191
+ ####################################
192
+ $curlInfo = curl_getinfo($curlHandle);
193
+ curl_close($curlHandle);
194
+
195
+ #######################################
196
+ ## get the http code for the request ##
197
+ #######################################
198
+ $httpCode = $curlInfo['http_code'];
199
+
200
+ ###########################################################
201
+ ## if none returned send email, or if not 200 send email ##
202
+ ###########################################################
203
+ if(empty($httpCode))
204
+ {
205
+ $this->send_error_email('No HTTP code was returned when posting message=['.$message.'] to url=['.$url.'], received output=['.$output.']');
206
+ return;
207
+ }
208
+ else if($httpCode != "200")
209
+ {
210
+ $this->send_error_email('Unexpected HTTP code=['.$httpCode.'] was returned when posting message=['.$message.'] to url=['.$url.'], received output=['.$output.']');
211
+ return;
212
+ }
213
+
214
+ #############################################################
215
+ ## ensure we received the expected response text from call ##
216
+ #############################################################
217
+ if(strpos($output, 'SUCCESS') === false)
218
+ {
219
+ $this->send_error_email('Did not receive expected output when posting message=['.$message.'] to url=['.$url.'], received output=['.$output.']');
220
+ return;
221
+ }
222
+ }
223
+ }
224
+
225
+
226
+
227
+ /*********************************************
228
+ ** send_error_email **
229
+ ** **
230
+ ** Sends an error message **
231
+ ** **
232
+ ** @param string $errorMessage **
233
+ ** @return void **
234
+ *********************************************/
235
+ private function send_error_email($errorMessage)
236
+ {
237
+ Mage::log('ERROR: ' . $errorMessage);
238
+
239
+ $errorEmailFromAddress = Mage::getStoreConfig('infoplus/connector/error_email_from_address');
240
+ $errorEmailToAddress = Mage::getStoreConfig('infoplus/connector/error_email_to_address');
241
+
242
+ if($errorEmailFromAddress && $errorEmailToAddress)
243
+ {
244
+ $mail = new Zend_Mail();
245
+ $mail->setBodyText ($errorMessage);
246
+ $mail->setFrom ($errorEmailFromAddress);
247
+ $mail->addTo ($errorEmailToAddress);
248
+ $mail->setSubject ('Magento Module Exception : Infoplus_Connector_Model_Observer');
249
+ $mail->send();
250
+ }
251
+ }
252
+
253
+ }
app/code/community/Infoplus/Connector/Sales/Model/Order.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Sales_Model_Order extends Mage_Sales_Model_Order
9
+ {
10
+
11
+ /*********************************************
12
+ ** cancel **
13
+ ** **
14
+ ** Calls parent cancel method, and if ok **
15
+ ** dispatches a custom event which our **
16
+ ** Observer class can handle **
17
+ ** **
18
+ ** @return $this **
19
+ *********************************************/
20
+ public function cancel()
21
+ {
22
+ ###################################
23
+ ## call parent to attempt cancel ##
24
+ ###################################
25
+ parent::cancel();
26
+
27
+ #################################################
28
+ ## if cancel successful, dispatch custom event ##
29
+ #################################################
30
+ if($this->getState() === self::STATE_CANCELED)
31
+ {
32
+ Mage::dispatchEvent('sales_order_cancel', array('order'=>$this));
33
+ }
34
+
35
+ return $this;
36
+ }
37
+
38
+ }
app/code/community/Infoplus/Connector/Sales/Model/Order/Invoice/Api.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Sales_Model_Order_Invoice_Api extends Mage_Sales_Model_Order_Invoice_Api
9
+ {
10
+
11
+ /*********************************************
12
+ ** create **
13
+ ** **
14
+ ** creates a new invoice for an order **
15
+ ** **
16
+ ** @param string $orderIncrementId **
17
+ ** @param array $itemsQty **
18
+ ** @param string $comment **
19
+ ** @param booleam $email **
20
+ ** @param boolean $includeComment **
21
+ ** @param boolean $capturedOffline **
22
+ ** @return string **
23
+ *********************************************/
24
+ public function create($orderIncrementId, $itemsQty, $comment = null, $email = false, $includeComment = false, $capturedOffline = false)
25
+ {
26
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
27
+
28
+ ################################
29
+ ## make sure the order exists ##
30
+ ################################
31
+ if (!$order->getId())
32
+ {
33
+ $this->_fault('order_not_exists');
34
+ }
35
+
36
+ #######################################
37
+ ## ensure the invoice can be created ##
38
+ #######################################
39
+ if (!$order->canInvoice())
40
+ {
41
+ $this->_fault('data_invalid', Mage::helper('sales')->__('Can not do invoice for order.'));
42
+ }
43
+
44
+ $invoice = $order->prepareInvoice($itemsQty);
45
+
46
+ if($capturedOffline)
47
+ {
48
+ $invoice->setRequestedCaptureCase("offline");
49
+ }
50
+
51
+ $invoice->register();
52
+
53
+ if ($comment !== null)
54
+ {
55
+ $invoice->addComment($comment, $email);
56
+ }
57
+
58
+ if ($email)
59
+ {
60
+ $invoice->setEmailSent(true);
61
+ }
62
+
63
+ $invoice->getOrder()->setIsInProcess(true);
64
+
65
+ try
66
+ {
67
+ $transactionSave = Mage::getModel('core/resource_transaction')
68
+ ->addObject($invoice)
69
+ ->addObject($invoice->getOrder())
70
+ ->save();
71
+
72
+ $invoice->sendEmail($email, ($includeComment ? $comment : ''));
73
+ }
74
+ catch (Mage_Core_Exception $e)
75
+ {
76
+ $this->_fault('data_invalid', $e->getMessage());
77
+ }
78
+
79
+ return $invoice->getIncrementId();
80
+ }
81
+
82
+ }
app/code/community/Infoplus/Connector/Sales/Model/Order/Shipment/Api.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Sales_Model_Order_Shipment_Api extends Mage_Sales_Model_Order_Shipment_Api
9
+ {
10
+
11
+ /*********************************************
12
+ ** sendEmailToCustomer **
13
+ ** **
14
+ ** Override of validate method to allow **
15
+ ** optional address validation by ML **
16
+ ** **
17
+ ** @param string $shipmentIncrementId **
18
+ ** @return boolean **
19
+ *********************************************/
20
+ public function sendEmailToCustomer($shipmentIncrementId)
21
+ {
22
+ $shipment = Mage::getModel('sales/order_shipment')->loadByIncrementId($shipmentIncrementId);
23
+
24
+ ###################################
25
+ ## make sure the shipment exists ##
26
+ ###################################
27
+ if (!$shipment->getId())
28
+ {
29
+ $this->_fault('not_exists');
30
+ }
31
+
32
+ $shipment->sendEmail(true, '');
33
+
34
+ return null;
35
+ }
36
+
37
+ }
app/code/community/Infoplus/Connector/Sales/Model/Quote/Address.php ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category Infoplus
6
+ * @package Infoplus_Connector
7
+ */
8
+ class Infoplus_Connector_Sales_Model_Quote_Address extends Mage_Sales_Model_Quote_Address
9
+ {
10
+
11
+ /*********************************************
12
+ ** validate **
13
+ ** **
14
+ ** Override of validate method to allow **
15
+ ** optional address validation by ML **
16
+ ** **
17
+ ** @return boolean **
18
+ *********************************************/
19
+ public function validate()
20
+ {
21
+ ##################################
22
+ ## get result of call to parent ##
23
+ ##################################
24
+ $errors = parent::validate();
25
+ $helper = Mage::helper('customer');
26
+
27
+ if(is_bool($errors) === true)
28
+ {
29
+ $errors = array();
30
+ }
31
+
32
+ ############################################################
33
+ ## check config to see if we should also do a web service ##
34
+ ## call to Infoplus to validate the address data ##
35
+ ############################################################
36
+ $enableAddressValidation = Mage::getStoreConfig('infoplus_options/infoplus_options_general/infoplus_enable_address_validation');
37
+ if(! $enableAddressValidation)
38
+ {
39
+ Mage::log('Infoplus Enable Address Validation set to false, bypassing web service call...');
40
+ }
41
+ else
42
+ {
43
+ ##############################################################
44
+ ## if the soap extensioin has not been loaded, return error ##
45
+ ##############################################################
46
+ if(! extension_loaded('soap'))
47
+ {
48
+ $errors[] = $helper->__("SOAP extension not installed for address validation.");
49
+ return $errors;
50
+ }
51
+
52
+ #####################
53
+ ## dont cache wsdl ##
54
+ #####################
55
+ ini_set("soap.wsdl_cache_enabled", "0");
56
+
57
+ ##################################################
58
+ ## create a soap client to validate the address ##
59
+ ##################################################
60
+ $soapClient = new SoapClient("https://www.materialogic.com/sas.axis2/services/ValidateAddressHandler?wsdl");
61
+
62
+ ###########################################
63
+ ## setup params for our web service call ##
64
+ ###########################################
65
+ $params = array
66
+ (
67
+ "city" => $this->getCity(),
68
+ "country" => $this->getCountry(),
69
+ "inventoryNo" => 9999,
70
+ "state" => $this->getRegionCode(),
71
+ "zip" => $this->getPostcode()
72
+ );
73
+
74
+ try
75
+ {
76
+ $result = $soapClient->validateAddress($params);
77
+ }
78
+ catch(SoapFault $fault)
79
+ {
80
+ ##############################################################
81
+ ## if any fault occurs trying to validate, send error email ##
82
+ ##############################################################
83
+ $errorMessage = "Error trying to validate customer address : " . $fault;
84
+
85
+ Mage::log($errorMessage);
86
+
87
+ $errorEmailFromAddress = Mage::getStoreConfig('infoplus/connector/error_email_from_address');
88
+ $errorEmailToAddress = Mage::getStoreConfig('infoplus/connector/error_email_to_address');
89
+
90
+ if($errorEmailFromAddress && $errorEmailToAddress)
91
+ {
92
+ $mail = new Zend_Mail();
93
+ $mail->setBodyText ($errorMessage);
94
+ $mail->setFrom ($errorEmailFromAddress);
95
+ $mail->addTo ($errorEmailToAddress);
96
+ $mail->setSubject ('Magento Module Exception : Infoplus_Connector_Sales_Model_Quote_Address');
97
+ $mail->addHeader ('X-priority', 1);
98
+ $mail->send();
99
+ }
100
+ }
101
+
102
+ ##################################################
103
+ ## check the response and send error if invalid ##
104
+ ##################################################
105
+ if(! $result->return->isValid)
106
+ {
107
+ $errors[] = $helper->__('City, state, and zip code do not belong together.');
108
+ }
109
+
110
+ #########################
111
+ ## clean up the client ##
112
+ #########################
113
+ unset($soapClient);
114
+ }
115
+
116
+ #########################################################################
117
+ ## successful if our array is empty or we should ignore the validation ##
118
+ #########################################################################
119
+ if(empty($errors) || $this->getShouldIgnoreValidation())
120
+ {
121
+ return true;
122
+ }
123
+
124
+ return $errors;
125
+ }
126
+
127
+ }
app/code/community/Infoplus/Connector/etc/api.xml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * @category Infoplus
7
+ * @package Infoplus_Connector
8
+ */
9
+ -->
10
+ <config>
11
+ <api>
12
+ <resources>
13
+ <sales_order_shipment>
14
+ <methods>
15
+ <sendEmailToCustomer>
16
+ <title>Send a Shipment email to the customer on an order</title>
17
+ </sendEmailToCustomer>
18
+ </methods>
19
+ </sales_order_shipment>
20
+ <catalog_product>
21
+ <methods>
22
+ <getProductInfoByWmsSku>
23
+ <title>Get product information based on wms sku</title>
24
+ </getProductInfoByWmsSku>
25
+ </methods>
26
+ </catalog_product>
27
+ </resources>
28
+ </api>
29
+ </config>
app/code/community/Infoplus/Connector/etc/config.xml ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * @category Infoplus
7
+ * @package Infoplus_Connector
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Infoplus_Connector>
13
+ <version>3.0.3</version>
14
+ </Infoplus_Connector>
15
+ </modules>
16
+ <global>
17
+ <models>
18
+ <infoplus>
19
+ <class>Infoplus_Connector_Model</class>
20
+ <resourceModel>infoplus_mysql4</resourceModel>
21
+ </infoplus>
22
+ <infoplus_mysql4>
23
+ <class>Infoplus_Connector_Model_Mysql4</class>
24
+ <entities>
25
+ <infoplus_product>
26
+ <table>infoplus_product</table>
27
+ </infoplus_product>
28
+ </entities>
29
+ </infoplus_mysql4>
30
+ </models>
31
+ <helpers>
32
+ <infoplus>
33
+ <class>Infoplus_Connector_Helper</class>
34
+ </infoplus>
35
+ </helpers>
36
+ <resources>
37
+ <infoplus_setup>
38
+ <setup>
39
+ <module>Infoplus_Connector</module>
40
+ </setup>
41
+ <connection>
42
+ <use>core_setup</use>
43
+ </connection>
44
+ </infoplus_setup>
45
+ <infoplus_read>
46
+ <connection>
47
+ <use>core_read</use>
48
+ </connection>
49
+ </infoplus_read>
50
+ <infoplus_write>
51
+ <connection>
52
+ <use>core_write</use>
53
+ </connection>
54
+ </infoplus_write>
55
+ </resources>
56
+ <blocks>
57
+ <infoplus>
58
+ <class>Infoplus_Connector_Block</class>
59
+ </infoplus>
60
+ </blocks>
61
+ <events>
62
+ <sales_order_place_after>
63
+ <observers>
64
+ <infoplus_observer>
65
+ <type>singleton</type>
66
+ <class>Infoplus_Connector_Model_Observer</class>
67
+ <method>post_new_order_queue_message</method>
68
+ </infoplus_observer>
69
+ </observers>
70
+ </sales_order_place_after>
71
+ <sales_order_cancel>
72
+ <observers>
73
+ <infoplus_observer>
74
+ <type>singleton</type>
75
+ <class>Infoplus_Connector_Model_Observer</class>
76
+ <method>post_cancel_order_queue_message</method>
77
+ </infoplus_observer>
78
+ </observers>
79
+ </sales_order_cancel>
80
+ <catalog_product_save_after>
81
+ <observers>
82
+ <infoplus_observer>
83
+ <type>singleton</type>
84
+ <class>Infoplus_Connector_Model_Observer</class>
85
+ <method>save_product_tab_data</method>
86
+ </infoplus_observer>
87
+ </observers>
88
+ </catalog_product_save_after>
89
+ </events>
90
+ <models>
91
+ <sales>
92
+ <rewrite>
93
+ <order>Infoplus_Connector_Sales_Model_Order</order>
94
+ <quote_address>Infoplus_Connector_Sales_Model_Quote_Address</quote_address>
95
+ <order_invoice_api>Infoplus_Connector_Sales_Model_Order_Invoice_Api</order_invoice_api>
96
+ <order_shipment_api>Infoplus_Connector_Sales_Model_Order_Shipment_Api</order_shipment_api>
97
+ </rewrite>
98
+ </sales>
99
+ <catalog>
100
+ <rewrite>
101
+ <product_api>Infoplus_Connector_Catalog_Model_Product_Api</product_api>
102
+ </rewrite>
103
+ </catalog>
104
+ </models>
105
+ </global>
106
+ <adminhtml>
107
+ <acl>
108
+ <resources>
109
+ <admin>
110
+ <children>
111
+ <system>
112
+ <children>
113
+ <config>
114
+ <children>
115
+ <infoplus_options>
116
+ <title>Infoplus Section</title>
117
+ </infoplus_options>
118
+ </children>
119
+ </config>
120
+ </children>
121
+ </system>
122
+ </children>
123
+ </admin>
124
+ </resources>
125
+ </acl>
126
+ <layout>
127
+ <updates>
128
+ <infoplus>
129
+ <file>infoplus_connector.xml</file>
130
+ </infoplus>
131
+ </updates>
132
+ </layout>
133
+ </adminhtml>
134
+ <default>
135
+ <infoplus_options>
136
+ <infoplus_options_general>
137
+ <infoplus_deployment_identifier>ecom9999gatewayinsurance</infoplus_deployment_identifier>
138
+ <infoplus_test_mode>1</infoplus_test_mode>
139
+ <infoplus_enable_address_validation>1</infoplus_enable_address_validation>
140
+ </infoplus_options_general>
141
+ </infoplus_options>
142
+ <infoplus>
143
+ <connector>
144
+ <test_url>https://www.materialogic.com/~magentodev/sas.engine</test_url>
145
+ <live_url>https://www.materialogic.com/sas.engine</live_url>
146
+ <new_order_queue_name>materialogic.magentoManager.fromMagento.newOrders</new_order_queue_name>
147
+ <cancelled_order_queue_name>materialogic.magentoManager.fromMagento.cancelledOrders</cancelled_order_queue_name>
148
+ <error_email_from_address>noreply@infopluscommerce.com</error_email_from_address>
149
+ <error_email_to_address>developers@infopluscommerce.com</error_email_to_address>
150
+ </connector>
151
+ </infoplus>
152
+ </default>
153
+ </config>
app/code/community/Infoplus/Connector/etc/system.xml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * @category Infoplus
7
+ * @package Infoplus_Connector
8
+ */
9
+ -->
10
+ <config>
11
+ <tabs>
12
+ <infoplus_config translate="label" module="infoplus">
13
+ <label>Infoplus</label>
14
+ <sort_order>99999</sort_order>
15
+ </infoplus_config>
16
+ </tabs>
17
+ <sections>
18
+ <infoplus_options translate="label" module="infoplus">
19
+ <label>Infoplus Options</label>
20
+ <tab>infoplus_config</tab>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>1000</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <groups>
27
+ <infoplus_options_general translate="label">
28
+ <label>General</label>
29
+ <expanded>1</expanded>
30
+ <frontend_type>text</frontend_type>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <fields>
36
+ <infoplus_deployment_identifier>
37
+ <label>Deployment Identifier</label>
38
+ <comment>This will be provided by Infoplus customer service</comment>
39
+ <frontend_type>text</frontend_type>
40
+ <sort_order>1</sort_order>
41
+ <show_in_default>1</show_in_default>
42
+ <show_in_website>1</show_in_website>
43
+ <show_in_store>1</show_in_store>
44
+ </infoplus_deployment_identifier>
45
+ <infoplus_test_mode>
46
+ <label>Test Mode</label>
47
+ <comment>'Yes' while testing, 'No' when ready for production</comment>
48
+ <frontend_type>select</frontend_type>
49
+ <source_model>adminhtml/system_config_source_yesno</source_model>
50
+ <sort_order>2</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </infoplus_test_mode>
55
+ <infoplus_enable_address_validation>
56
+ <label>Enable Address Validation</label>
57
+ <comment>'No' to disable address validation in checkout</comment>
58
+ <frontend_type>select</frontend_type>
59
+ <source_model>adminhtml/system_config_source_yesno</source_model>
60
+ <sort_order>3</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </infoplus_enable_address_validation>
65
+ </fields>
66
+ </infoplus_options_general>
67
+ </groups>
68
+ </infoplus_options>
69
+ </sections>
70
+ </config>
app/code/community/Infoplus/Connector/sql/infoplus_setup/install-2.0.0.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ ###################################
3
+ ## file mysql4-install-2.0.0.php ##
4
+ ###################################
5
+
6
+ $installer = $this;
7
+ $installer->startSetup();
8
+
9
+ $installer->run
10
+ ("
11
+ DROP TABLE IF EXISTS {$this->getTable('infoplus_product')};
12
+ CREATE TABLE {$this->getTable('infoplus_product')}
13
+ (
14
+ `id` int(11) unsigned NOT NULL auto_increment,
15
+ `magento_sku` varchar(64) NOT NULL default '',
16
+ `wms_sku` varchar(20) NOT NULL default '',
17
+ `created_time` datetime NULL,
18
+ `update_time` datetime NULL,
19
+ PRIMARY KEY (`id`)
20
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
21
+ ");
22
+
23
+ $installer->endSetup();
24
+
25
+ ?>
app/design/adminhtml/default/default/layout/infoplus_connector.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * @category design
7
+ * @package default_default
8
+ */
9
+ -->
10
+ <layout>
11
+ <adminhtml_sales_order_view>
12
+ <reference name="sales_order_tabs">
13
+ <action method="addTab">
14
+ <name>infoplus_order_tab</name>
15
+ <block>infoplus/adminhtml_sales_order_view_tab_infoplusorder</block>
16
+ </action>
17
+ </reference>
18
+ </adminhtml_sales_order_view>
19
+ <adminhtml_catalog_product_edit>
20
+ <reference name="product_tabs">
21
+ <action method="addTab">
22
+ <name>infoplus_product_tab</name>
23
+ <block>infoplus/adminhtml_catalog_product_edit_tab_infoplusitem</block>
24
+ </action>
25
+ </reference>
26
+ </adminhtml_catalog_product_edit>
27
+ </layout>
app/design/adminhtml/default/default/template/infoplus_connector/catalog/product/edit/tab/infoplus_item.phtml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category design
6
+ * @package default_default
7
+ */
8
+ ?>
9
+
10
+ <?php
11
+
12
+ $existingValue = "";
13
+
14
+ ####################################################
15
+ ## look for existing infoplus_record for this sku ##
16
+ ####################################################
17
+ $collection = Mage::getModel('infoplus/infoplus_product')->getCollection()->addFieldToFilter('magento_sku', $this->getProduct()->getSku());
18
+
19
+ ######################################
20
+ ## if any records found, do updates ##
21
+ ######################################
22
+ if(count($collection) > 0)
23
+ {
24
+ foreach($collection as $infoplusProduct)
25
+ {
26
+ $existingValue = $infoplusProduct->getWmsSku();
27
+ break;
28
+ }
29
+ }
30
+ ?>
31
+
32
+ <script>
33
+
34
+ var wmsSkus = new Array();
35
+
36
+ <?php
37
+
38
+ ####################################################
39
+ ## look for existing infoplus_record for this sku ##
40
+ ####################################################
41
+ $collection = Mage::getModel('infoplus/infoplus_product')->getCollection();
42
+
43
+ ######################################
44
+ ## if any records found, do updates ##
45
+ ######################################
46
+ if(count($collection) > 0)
47
+ {
48
+ foreach($collection as $infoplusProduct)
49
+ {
50
+ if($infoplusProduct->getMagentoSku() != $this->getProduct()->getSku())
51
+ {
52
+ echo "wmsSkus['" . $infoplusProduct->getWmsSku() . "'] = '" . $infoplusProduct->getMagentoSku() . "'";
53
+ }
54
+ }
55
+ }
56
+ ?>
57
+
58
+
59
+ function onWmsSkuBlur(element)
60
+ {
61
+ element.value = element.value.toUpperCase();
62
+ element.value = element.value.replace(/['"]/g,'');
63
+
64
+ if(wmsSkus[element.value])
65
+ {
66
+ alert("A WMS sku of value of [" + element.value + "] already exists for product with sku [" + wmsSkus[element.value] + "].");
67
+ element.value = "";
68
+ element.select();
69
+ }
70
+ }
71
+
72
+ </script>
73
+
74
+ <div class="entry-edit">
75
+ <div class="entry-edit-head">
76
+ <h4><?php echo $this->__('Infoplus Product Info'); ?></h4>
77
+ </div>
78
+ <div class="fieldset fieldset-wide">
79
+ <label for="infoplus_wms_sku">WMS SKU:&nbsp;</label>
80
+ <input maxlength="20" type="text" class="input-text" name="infoplus_wms_sku" id="infoplus_wms_sku" onblur="onWmsSkuBlur(this);" value="<?php echo $existingValue ?>"/>
81
+ </div>
82
+ </div>
app/design/adminhtml/default/default/template/infoplus_connector/sales/order/view/tab/infoplus_order.phtml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * @category design
6
+ * @package default_default
7
+ */
8
+ ?>
9
+ <?php
10
+
11
+ #################################################################
12
+ ## get the order id, and some configs to determine if in test ##
13
+ ## mode or not, and for which client we are getting order info ##
14
+ #################################################################
15
+ $incrementId = $this->getOrder()->getIncrementId();
16
+ $isTestMode = Mage::getStoreConfig('infoplus_options/infoplus_options_general/infoplus_test_mode');
17
+ $deploymentIdentifier = Mage::getStoreConfig('infoplus_options/infoplus_options_general/infoplus_deployment_identifier');
18
+
19
+ #######################################
20
+ ## if test mode, use a different url ##
21
+ #######################################
22
+ if($isTestMode)
23
+ {
24
+ $baseURL = Mage::getStoreConfig('infoplus/connector/test_url') . '?template=applications.infoplus.InfoPlusOrderInformation&command=home';
25
+ }
26
+ else
27
+ {
28
+ $baseURL = Mage::getStoreConfig('infoplus/connector/live_url') . '?template=applications.infoplus.InfoPlusOrderInformation&command=home';
29
+ }
30
+ ?>
31
+
32
+ <div class="entry-edit">
33
+ <div class="entry-edit-head">
34
+ <h4><?php echo $this->__('Infoplus Order Information'); ?></h4>
35
+ </div>
36
+ <div style="padding: 10px 0px 0px 0px;" class="fieldset fieldset-wide">
37
+
38
+ <?php
39
+
40
+ ##################################
41
+ ## in test mode, show a warning ##
42
+ ##################################
43
+ if($isTestMode)
44
+ {
45
+ ?>
46
+ <div>
47
+ <div style="font-size: 14px; text-align: right; color: #990000; margin-right: 15px;">Infoplus is in <b>TEST MODE</b></div>
48
+ </div>
49
+ <p>
50
+
51
+ <?php
52
+ }
53
+ ?>
54
+
55
+ <?php
56
+
57
+ ############################################
58
+ ## if cancelled, do not show infoplus box ##
59
+ ############################################
60
+ if($this->getOrder()->getStatus() == "canceled")
61
+ {
62
+ ?>
63
+
64
+ <div style="font-size: 24px; text-align: center; margin: 45px;">Order has been cancelled.</div>
65
+
66
+ <?php
67
+ } else {
68
+ ?>
69
+
70
+ <iframe style="height: 600px; width: 100%;" frameborder=0 src="<?php echo $baseURL ?>&deployment=<?php echo $deploymentIdentifier ?>&customerOrderNo=<?php echo $incrementId ?>"></iframe>
71
+
72
+ <?php
73
+ }
74
+ ?>
75
+
76
+ </div>
77
+ </div>
app/etc/modules/Infoplus_Connector.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magento
5
+ *
6
+ * @category Infoplus
7
+ * @package Infoplus_Connector
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Infoplus_Connector>
13
+ <active>true</active>
14
+ <codePool>community</codePool>
15
+ </Infoplus_Connector>
16
+ </modules>
17
+ </config>
package.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Infoplus_Connector</name>
4
+ <version>3.0.3</version>
5
+ <stability>stable</stability>
6
+ <license>Apache License, Version 2.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Module to integrate Magento with Infoplus</summary>
10
+ <description>Module to integrate Magento with Infoplus</description>
11
+ <notes>No Notes</notes>
12
+ <authors><author><name>Infoplus</name><user>infoplus</user><email>infoplusconnect@infopluscommerce.com</email></author></authors>
13
+ <date>2016-05-17</date>
14
+ <time>20:57:36</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Infoplus_Connector.xml" hash=""/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="infoplus_connector.xml" hash=""/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>100.9.99</max></php></required></dependencies>
18
+ </package>
19
+