Saleswarp_Oms - Version 0.1.2

Version Notes

Production version

Download this release

Release Info

Developer David Potts
Extension Saleswarp_Oms
Version 0.1.2
Comparing to
See all releases


Version 0.1.2

Files changed (24) hide show
  1. app/code/local/Saleswarp/Oms/Block/Adminhtml/System/Config/Form/Button.php +80 -0
  2. app/code/local/Saleswarp/Oms/Block/Adminhtml/System/Config/Form/Key.php +28 -0
  3. app/code/local/Saleswarp/Oms/Block/Form/Saleswarp.php +22 -0
  4. app/code/local/Saleswarp/Oms/Block/Info/Saleswarp.php +30 -0
  5. app/code/local/Saleswarp/Oms/Helper/Data.php +4 -0
  6. app/code/local/Saleswarp/Oms/Model/Category/Api.php +17 -0
  7. app/code/local/Saleswarp/Oms/Model/Config/Api.php +53 -0
  8. app/code/local/Saleswarp/Oms/Model/Customer/Api.php +35 -0
  9. app/code/local/Saleswarp/Oms/Model/Order/Api.php +563 -0
  10. app/code/local/Saleswarp/Oms/Model/Product/Api.php +355 -0
  11. app/code/local/Saleswarp/Oms/Model/Product/Attribute/Api.php +5 -0
  12. app/code/local/Saleswarp/Oms/Model/Product/Attribute/Media/Api.php +5 -0
  13. app/code/local/Saleswarp/Oms/Model/Saleswarp.php +53 -0
  14. app/code/local/Saleswarp/Oms/controllers/Adminhtml/GetkeyController.php +64 -0
  15. app/code/local/Saleswarp/Oms/controllers/FastapiController.php +137 -0
  16. app/code/local/Saleswarp/Oms/etc/adminhtml.xml +23 -0
  17. app/code/local/Saleswarp/Oms/etc/config.xml +93 -0
  18. app/code/local/Saleswarp/Oms/etc/system.xml +97 -0
  19. app/code/local/Saleswarp/Oms/sql/oms_setup/mysql4-install-0.1.1.php +265 -0
  20. app/code/local/Saleswarp/Oms/sql/oms_setup/mysql4-upgrade-0.1.2.php +28 -0
  21. app/design/adminhtml/default/default/template/oms/form/saleswarp.phtml +17 -0
  22. app/design/adminhtml/default/default/template/oms/system/config/button.phtml +36 -0
  23. app/etc/modules/Saleswarp_Oms.xml +10 -0
  24. package.xml +18 -0
app/code/local/Saleswarp/Oms/Block/Adminhtml/System/Config/Form/Button.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+
15
+ class Saleswarp_Oms_Block_Adminhtml_System_Config_Form_Button extends Mage_Adminhtml_Block_System_Config_Form_Field
16
+ {
17
+ /*
18
+ * Set template
19
+ */
20
+ protected function _construct()
21
+ {
22
+ parent::_construct();
23
+ $this->setTemplate('oms/system/config/button.phtml');
24
+ }
25
+
26
+ /**
27
+ * Return element html
28
+ *
29
+ * @param Varien_Data_Form_Element_Abstract $element
30
+ * @return string
31
+ */
32
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
33
+ {
34
+ return $this->_toHtml();
35
+ }
36
+
37
+ /**
38
+ * Return ajax url for button
39
+ *
40
+ * @return string
41
+ */
42
+ public function getAjaxCheckUrl()
43
+ {
44
+ return Mage::helper('adminhtml')->getUrl('admin_oms/adminhtml_getkey');
45
+ }
46
+
47
+ /**
48
+ * Generate button html
49
+ *
50
+ * @return string
51
+ */
52
+ public function getButtonHtml()
53
+ {
54
+ $button = $this->getLayout()->createBlock('adminhtml/widget_button')
55
+ ->setData(array(
56
+ 'id' => 'saleswarp_oms_button',
57
+ 'label' => $this->helper('adminhtml')->__('Get Key'),
58
+ 'onclick' => 'javascript:getKey(); return false;'
59
+ ));
60
+ return $button->toHtml();
61
+ }
62
+
63
+ public function isKeyAvailable() {
64
+ $key = Mage::getStoreConfig('oms/registration/key');
65
+ if($key && trim($key)) {
66
+ return true;
67
+ } else {
68
+ return false;
69
+ }
70
+ }
71
+
72
+ public function getKeyData() {
73
+ $data = array();
74
+ $data['key'] = Mage::getStoreConfig('oms/registration/key');
75
+ $coreVariable = Mage::getModel('core/variable');
76
+ $data['create_url'] = $coreVariable->loadByCode('saleswarp_create_url')->getValue('plain');
77
+ $data['login_url'] = $coreVariable->loadByCode('saleswarp_login_url')->getValue('plain');
78
+ return $data;
79
+ }
80
+ }
app/code/local/Saleswarp/Oms/Block/Adminhtml/System/Config/Form/Key.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+
15
+ class Saleswarp_Oms_Block_Adminhtml_System_Config_Form_Key extends Mage_Adminhtml_Block_System_Config_Form_Field
16
+ {
17
+ /**
18
+ * Return element html
19
+ *
20
+ * @param Varien_Data_Form_Element_Abstract $element
21
+ * @return string
22
+ */
23
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
24
+ {
25
+ $element->setDisabled('disabled');
26
+ return parent::_getElementHtml($element);
27
+ }
28
+ }
app/code/local/Saleswarp/Oms/Block/Form/Saleswarp.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+
15
+ class Saleswarp_Oms_Block_Form_Saleswarp extends Mage_Payment_Block_Form
16
+ {
17
+ protected function _construct()
18
+ {
19
+ parent::_construct();
20
+ $this->setTemplate('oms/form/saleswarp.phtml');
21
+ }
22
+ }
app/code/local/Saleswarp/Oms/Block/Info/Saleswarp.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+ class Saleswarp_Oms_Block_Info_Saleswarp extends Mage_Payment_Block_Info
15
+ {
16
+ protected function _prepareSpecificInformation($transport = null)
17
+ {
18
+ if (null !== $this->_paymentSpecificInformation) {
19
+ return $this->_paymentSpecificInformation;
20
+ }
21
+ $info = $this->getInfo();
22
+ $transport = new Varien_Object();
23
+ $transport = parent::_prepareSpecificInformation($transport);
24
+ $transport->addData(array(
25
+ Mage::helper('payment')->__('Transaction No#') => $info->getTransctionNo(),
26
+ Mage::helper('payment')->__('Payment Method') => $info->getPaymentMethod()
27
+ ));
28
+ return $transport;
29
+ }
30
+ }
app/code/local/Saleswarp/Oms/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Saleswarp_Oms_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
app/code/local/Saleswarp/Oms/Model/Category/Api.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+ class Saleswarp_Oms_Model_Category_Api extends Mage_Catalog_Model_Category_Api {
15
+
16
+ }
17
+ ?>
app/code/local/Saleswarp/Oms/Model/Config/Api.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+ /**
15
+ * Use this API to get/set key config data for the storefronts
16
+ */
17
+ class Saleswarp_Oms_Model_Config_Api
18
+ {
19
+ /**
20
+ * get Attribute id by attribute name
21
+ * @params attribute name
22
+ * @return attribute id
23
+ */
24
+ public function getProductAttributesId($attribute_code)
25
+ {
26
+ $resource = Mage::getSingleton('core/resource');
27
+ $entity_type_id = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId();
28
+
29
+ $sql = "SELECT attribute_id from " . $resource->getTableName('eav_attribute') . "
30
+ WHERE entity_type_id = :entityTypeId
31
+ AND attribute_code = :attributeCode ";
32
+
33
+ $binds = array(
34
+ 'entityTypeId' => $entity_type_id,
35
+ 'attributeCode' => $attribute_code
36
+ );
37
+ $att = $resource->getConnection('core_read')->fetchAll($sql, $binds);
38
+ return $att;
39
+ }
40
+
41
+ /**
42
+ * get website and store Id
43
+ */
44
+ public function getStoreIds()
45
+ {
46
+ $resource = Mage::getSingleton('core/resource');
47
+ $sql = "SELECT str.*, web.* from " . $resource->getTableName('core_store') . " as str
48
+ JOIN " . $resource->getTableName('core_website') . " as web ON str.website_id = web.website_id ";
49
+ $stores = $resource->getConnection('core_read')->fetchAll($sql);
50
+ return $stores;
51
+ }
52
+ }
53
+ ?>
app/code/local/Saleswarp/Oms/Model/Customer/Api.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+
15
+ /**
16
+ * Use this API to get/set key config data for the storefronts
17
+ */
18
+ class Saleswarp_Oms_Model_Customer_Api extends Mage_Customer_Model_Customer_Api
19
+ {
20
+ /**
21
+ * Get Customer Group name
22
+ * @params group id
23
+ * @return Group name
24
+ */
25
+ function get_customer_group_name_by_id($groupId)
26
+ {
27
+ $group = Mage::getModel('customer/group')->load($groupId);
28
+ if ($group->getId()) {
29
+ return $group->getCode();
30
+ } else {
31
+ return "Guest";
32
+ }
33
+ }
34
+ }
35
+ ?>
app/code/local/Saleswarp/Oms/Model/Order/Api.php ADDED
@@ -0,0 +1,563 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+ class Saleswarp_Oms_Model_Order_Api extends Mage_Sales_Model_Order_Api
15
+ {
16
+ const STATE_RETURN_REQUESTED = 'return_requested';
17
+ const STATE_EXCHANGE = 'exchange';
18
+ const STATE_ADVANCED_EXCHANGE = 'advanced_exchange';
19
+ const STATE_RETURN_RECEIVED = 'return_received';
20
+
21
+ /**
22
+ * return a recent order list
23
+ * if any parameter is set to zero then that will not be considered for order pull.
24
+ */
25
+
26
+ public function get_recent_order_list($limit = 0, $lastdays = 5, $offset = 0)
27
+ {
28
+ $daysOldQuery = '';
29
+
30
+ // return a list of orders in the last X days
31
+ if ($lastdays != 0) {
32
+ $daysOldQuery = " WHERE created_at > '" . strftime('%Y-%m-%d %H:%M:%S', (time() - (24 * 60 * 60 * $lastdays))) . "'";
33
+ }
34
+
35
+ $limitQuery = '';
36
+
37
+ // set limit for orders
38
+ if ($limit != 0) {
39
+ $limitQuery = " LIMIT $offset, $limit";
40
+ }
41
+
42
+ $salesFlatTable = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
43
+ $sql = "select * from " . $salesFlatTable . $daysOldQuery . $limitQuery;
44
+
45
+ $orders = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($sql);
46
+ return $orders;
47
+ }
48
+
49
+ /**
50
+ * get active shipping methods
51
+ */
52
+ public function getActShipMethods()
53
+ {
54
+ $methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
55
+ $shipping = array();
56
+ foreach ($methods as $_ccode => $_carrier) {
57
+ if ($_methods = $_carrier->getAllowedMethods()) {
58
+ if (!$_title = Mage::getStoreConfig("carriers/$_ccode/title")) {
59
+ $_title = $_ccode;
60
+ }
61
+ foreach ($_methods as $_mcode => $_method) {
62
+ $_code = $_ccode . '_' . $_mcode;
63
+ $shipping[$_code] = array(
64
+ 'title' => $_method,
65
+ 'carrier' => $_title
66
+ );
67
+ }
68
+ }
69
+ }
70
+ return $shipping;
71
+ }
72
+
73
+ /**
74
+ * get active Payment methods
75
+ * */
76
+ function getActPayment()
77
+ {
78
+ $payments = Mage::getSingleton('payment/config')->getActiveMethods();
79
+ foreach ($payments as $paymentCode => $paymentModel) {
80
+ $paymentTitle[] = $paymentCode;
81
+ }
82
+ return $paymentTitle;
83
+ }
84
+
85
+ /**
86
+ * Create order in magento
87
+ */
88
+ function create_order($data)
89
+ {
90
+ $logFileName = 'create_order.log';
91
+ $customer = Mage::getModel('customer/customer');
92
+ $quote = Mage::getModel('sales/quote')->setStoreId(Mage::app()->getStore('default')->getId());
93
+
94
+ $password = Mage::getModel('customer/customer')->generatePassword();
95
+ if (!empty($data['BaseCustomer']['email'])) {
96
+ $email = $data['BaseCustomer']['email'];
97
+ } else {
98
+ $email = 'customer_' . $data['BaseCustomer']['id'] . '@saleswarp.com';
99
+ }
100
+
101
+ if (!empty($data['ShippingAddress']['street'])) {
102
+ $sStreet = $data['ShippingAddress']['street'];
103
+ } else {
104
+ $sStreet = '';
105
+ }
106
+
107
+ if (!empty($data['ShippingAddress']['street1'])) {
108
+ $sStreet1 = $data['ShippingAddress']['street1'];
109
+ } else {
110
+ $sStreet1 = '';
111
+ }
112
+
113
+ if (!empty($data['BillingAddress']['street'])) {
114
+ $bStreet = $data['BillingAddress']['street'];
115
+ } else {
116
+ $bStreet = '';
117
+ }
118
+ if (!empty($data['BillingAddress']['street1'])) {
119
+ $bStreet1 = $data['BillingAddress']['street1'];
120
+ } else {
121
+ $bStreet1 = '';
122
+ }
123
+
124
+ if (!empty($data['ShippingAddress']['region_code']) && $data['ShippingAddress']['region_code'] != 'na') {
125
+ $sregion_id = $data['ShippingAddress']['region_code'];
126
+ } else {
127
+ $sregion_id = '';
128
+ }
129
+
130
+ if (!empty($data['BillingAddress']['region_code']) && $data['BillingAddress']['region_code'] != 'na') {
131
+ $bregion_id = $data['BillingAddress']['region_code'];
132
+ } else {
133
+ $bregion_id = '';
134
+ }
135
+
136
+ // customer address//
137
+ if (!empty($data['BaseCustomer']['street'])) {
138
+ $cStreet = $data['BaseCustomer']['street'];
139
+ } else {
140
+ $cStreet = '';
141
+ }
142
+ if (!empty($data['BaseCustomer']['street1'])) {
143
+ $cStreet1 = $data['BaseCustomer']['street1'];
144
+ } else {
145
+ $cStreet1 = '';
146
+ }
147
+
148
+ if (!empty($data['BaseCustomer']['region_code']) && $data['BaseCustomer']['region_code'] != 'na') {
149
+ $cregion_id = $data['BaseCustomer']['region_code'];
150
+ } else {
151
+ $cregion_id = '';
152
+ }
153
+
154
+ $shipAddressData = array(
155
+ 'firstname' => (!empty($data['ShippingAddress']['first_name'])) ? $data['ShippingAddress']['first_name'] : '',
156
+ 'lastname' => (!empty($data['ShippingAddress']['last_name'])) ? $data['ShippingAddress']['last_name'] : '',
157
+ 'street' => array(
158
+ '0' => $sStreet,
159
+ '1' => $sStreet1
160
+ ),
161
+ 'city' => (!empty($data['ShippingAddress']['city'])) ? $data['ShippingAddress']['city'] : '',
162
+ 'postcode' => (!empty($data['ShippingAddress']['post_code'])) ? $data['ShippingAddress']['post_code'] : '',
163
+ 'telephone' => ($data['ShippingAddress']['phone']) ? $data['ShippingAddress']['phone'] : '111-111-1111',
164
+ 'country_id' => (!empty($data['ShippingAddress']['country_code'])) ? $data['ShippingAddress']['country_code'] : 'US',
165
+ 'region_id' => $sregion_id,
166
+ 'region' => (!empty($data['ShippingAddress']['state'])) ? $data['ShippingAddress']['state'] : ''
167
+ );
168
+
169
+ $billAddressData = array(
170
+ 'firstname' => (!empty($data['BillingAddress']['first_name'])) ? $data['BillingAddress']['first_name'] : '',
171
+ 'lastname' => (!empty($data['BillingAddress']['last_name'])) ? $data['BillingAddress']['last_name'] : '',
172
+ 'street' => array(
173
+ '0' => $bStreet,
174
+ '1' => $bStreet1
175
+ ),
176
+ 'city' => (!empty($data['BillingAddress']['city'])) ? $data['BillingAddress']['city'] : '',
177
+ 'postcode' => (!empty($data['BillingAddress']['post_code'])) ? $data['BillingAddress']['post_code'] : '',
178
+ 'telephone' => ($data['BillingAddress']['phone']) ? $data['BillingAddress']['phone'] : '111-111-1111',
179
+ 'country_id' => (!empty($data['BillingAddress']['country_code'])) ? $data['BillingAddress']['country_code'] : 'US',
180
+ 'region_id' => $bregion_id,
181
+ 'region' => (!empty($data['BillingAddress']['state'])) ? $data['BillingAddress']['state'] : ''
182
+ );
183
+
184
+ $customerAddressData = array(
185
+ 'firstname' => (!empty($data['BaseCustomer']['first_name'])) ? $data['BaseCustomer']['first_name'] : '',
186
+ 'lastname' => (!empty($data['BaseCustomer']['last_name'])) ? $data['BaseCustomer']['last_name'] : '',
187
+ 'street' => array(
188
+ '0' => $cStreet,
189
+ '1' => $cStreet1
190
+ ),
191
+ 'city' => (!empty($data['BaseCustomer']['city'])) ? $data['BaseCustomer']['city'] : '',
192
+ 'postcode' => (!empty($data['BaseCustomer']['post_code'])) ? $data['BaseCustomer']['post_code'] : '',
193
+ 'telephone' => ($data['BaseCustomer']['phone']) ? $data['BaseCustomer']['phone'] : '111-111-1111',
194
+ 'country_id' => (!empty($data['BaseCustomer']['country_code'])) ? $data['BaseCustomer']['country_code'] : 'US',
195
+ 'region_id' => $bregion_id,
196
+ 'region' => (!empty($data['BaseCustomer']['state'])) ? $data['BaseCustomer']['state'] : ''
197
+ );
198
+
199
+ $customer_group_id = $this->get_customer_group_id_by_name($data['BaseCustomer']['group']);
200
+ $customer->setWebsiteId(1);
201
+ $customer->loadByEmail($email);
202
+
203
+ if (!$customer->getId()) {
204
+ $customer->setEmail($email);
205
+ $customer->setWebsiteId(1);
206
+ $customer->setFirstname($data['BaseCustomer']['first_name']);
207
+ $customer->setLastname($data['BaseCustomer']['last_name']);
208
+ $customer->setPassword($password);
209
+ $customer->setGroupId($customer_group_id);
210
+ try {
211
+ $customer->save();
212
+ $customer->setConfirmation(null);
213
+ $customer->save();
214
+ // save billing address//
215
+ $address = Mage::getModel("customer/address");
216
+ $address->setData($billAddressData)->setCustomerId($customer->getId())->setIsDefaultBilling('1')->setIsDefaultShipping('1')->setSaveInAddressBook('1');
217
+
218
+ try {
219
+ $address->save();
220
+ }catch (Exception $ex) {
221
+ Mage::log($ex->getMessage(), null, $logFileName);
222
+ return false;
223
+ }
224
+
225
+ //Make a "login" of new customer
226
+ Mage::getSingleton('customer/session')->loginById($customer->getId());
227
+ $quote->assignCustomer($customer);
228
+ }
229
+ catch (Exception $ex) {
230
+ Mage::log($ex->getMessage(), null, $logFileName);
231
+ return false;
232
+ }
233
+ } else {
234
+ $quote->assignCustomer($customer);
235
+ }
236
+
237
+ $store_id = $data['BaseOrder']['base_store_id'];
238
+ $lineitem = $data['Lineitem'];
239
+ foreach ($lineitem as $item) {
240
+ // check whether item/product published or not
241
+ $prod_id = $item['base_product_id'];
242
+ $mage_prod_id = $item['mageProdId'];
243
+ $prodId[$prod_id] = $item['mageProdId'];
244
+ $qty_ordered = (int) $item['qty_ordered'];
245
+ $buyInfo = array('qty' => $qty_ordered);
246
+ $prod = Mage::getModel('catalog/product')->load($mage_prod_id);
247
+ $prod->setPrice($item['price_after_discount']);
248
+ $prod->setSpecialPrice($item['price_after_discount']);
249
+ try {
250
+ $quote->addProduct($prod, new Varien_Object($buyInfo));
251
+ }
252
+ catch (Exception $e) {
253
+ Mage::log($e->getMessage(), null, $logFileName);
254
+ continue;
255
+ }
256
+ }
257
+
258
+ $shipMethod = 'flatrate_flatrate';
259
+
260
+ try {
261
+ $billingAddress = $quote->getBillingAddress()->addData($billAddressData);
262
+ }
263
+ catch (Exception $e) {
264
+ Mage::log($e->getMessage(), null, $logFileName);
265
+ }
266
+ $shippingAddress = $quote->getShippingAddress()->addData($shipAddressData);
267
+ $shippingAddress->setCollectShippingRates(true)->collectShippingRates()->setShippingMethod($shipMethod);
268
+
269
+ $paymentMethod = array(
270
+ 'method' => 'saleswarp',
271
+ 'transction_no' => $data['Saleswarp']['transactionId'],
272
+ 'payment_method' => $data['Saleswarp']['payMethodName']
273
+ );
274
+
275
+ try {
276
+ $quote->getPayment()->importData($paymentMethod);
277
+ }
278
+ catch (Exception $e) {
279
+ Mage::log($e->getMessage(), null, $logFileName);
280
+ return false;
281
+ }
282
+ $quote->collectTotals()->save();
283
+
284
+ $service = Mage::getModel('sales/service_quote', $quote);
285
+
286
+ try {
287
+ $service->submitAll();
288
+ }
289
+ catch (Exception $e) {
290
+ Mage::log($e->getMessage(), null, $logFileName);
291
+ return false;
292
+ }
293
+
294
+ try {
295
+ $order = $service->getOrder();
296
+ if ($order) {
297
+ $morder_id = $order->getIncrementId();
298
+ Mage::log("Created order: " . $morder_id, null, $logFileName);
299
+ return $morder_id;
300
+ }
301
+ }
302
+ catch (Exception $e) {
303
+ Mage::log($e->getMessage(), null, $logFileName);
304
+ return false;
305
+ }
306
+ }
307
+
308
+ /**
309
+ * Get Customer Group id by group name
310
+ */
311
+ function get_customer_group_id_by_name($name)
312
+ {
313
+ $write = Mage::getSingleton('core/resource')->getConnection('core_write');
314
+ $type = addslashes($name);
315
+
316
+ //check for existig group
317
+ $customerGrpTable = Mage::getSingleton('core/resource')->getTableName('customer_group');
318
+
319
+ $chk = $write->query("SELECT customer_group_id FROM " . $customerGrpTable . " WHERE customer_group_code = '" . $type . "'");
320
+ $row = $chk->fetch(PDO::FETCH_ASSOC);
321
+ if ($row) {
322
+ return $row['customer_group_id'];
323
+ }
324
+ return false;
325
+ }
326
+
327
+ /**
328
+ * * Cancel Order
329
+ */
330
+ function cancel_order($magento_orderId)
331
+ {
332
+ $orderModel = Mage::getModel('sales/order')->loadByIncrementId($magento_orderId);
333
+ if ($orderModel->canCancel()) {
334
+ $orderModel->setState(Mage_Sales_Model_Order::STATE_CANCELED, true)->save();
335
+ return true;
336
+ } else if($this->creditmemo_order($magento_orderId)) {
337
+ return true;
338
+ } else {
339
+ return false;
340
+ }
341
+ }
342
+
343
+ /**
344
+ * Hold order
345
+ */
346
+ function hold_order($magento_orderId)
347
+ {
348
+ $orderModel = Mage::getModel('sales/order')->loadByIncrementId($magento_orderId);
349
+ if ($orderModel->canHold()) {
350
+ $orderModel->setState(Mage_Sales_Model_Order::STATE_HOLDED, true)->save();
351
+ return true;
352
+ } else {
353
+ return false;
354
+ }
355
+ }
356
+
357
+ /**
358
+ * Create Credit memo
359
+ */
360
+ function creditmemo_order($magento_orderId)
361
+ {
362
+ Mage::getModel('sales/order_creditmemo_api')->create($magento_orderId);
363
+ Mage::getModel('sales/order')->loadByIncrementId($magento_orderId)->setState(Mage_Sales_Model_Order::STATE_CLOSED, true)->save();
364
+ return true;
365
+ }
366
+
367
+ /**
368
+ * Add tracking information to a order
369
+ */
370
+ function create_ship_track($shipment_id, $carrier, $msg, $track_id)
371
+ {
372
+ $this->order_shipment = Mage::getSingleton('sales/order_shipment_api');
373
+ return $this->order_shipment->addTrack($shipment_id, $carrier, $msg, $track_id);
374
+ }
375
+
376
+ /**
377
+ * Send Shipment email to customer
378
+ */
379
+ function send_ship_email($newShipmentId, $comment)
380
+ {
381
+ $this->order_shipment = Mage::getSingleton('sales/order_shipment_api');
382
+ return $this->order_shipment->sendInfo($newShipmentId, $comment);
383
+ }
384
+
385
+ /**
386
+ * Add comment to a shipment
387
+ */
388
+
389
+ function create_ship_comment($shipment_id, $comment, $send_email, $include_comment)
390
+ {
391
+ $this->order_shipment = Mage::getSingleton('sales/order_shipment_api');
392
+ return $this->order_shipment->addComment($shipment_id, $comment, $send_email, $include_comment);
393
+ }
394
+
395
+ /**
396
+ * Add comment to Order
397
+ */
398
+ function create_order_comment($order_id, $comment, $status = "complete", $notify = true)
399
+ {
400
+ $this->order = Mage::getSingleton('sales/order_api');
401
+ return $this->order->addComment($order_id, $comment, $status, $notify);
402
+ }
403
+
404
+ /**
405
+ * Create order shipment
406
+ */
407
+ function create_order_shipment($order_id, $info, $message = "Shipped", $send_email = true, $include_comment = true)
408
+ {
409
+ $this->order_shipment = Mage::getSingleton('sales/order_shipment_api');
410
+ return $this->order_shipment->create($order_id, $info, $message, $send_email, $include_comment);
411
+ }
412
+
413
+ /**
414
+ * Retrieve full order information
415
+ *
416
+ * @param string $orderIncrementId
417
+ * @return array
418
+ */
419
+ public function info($orderIncrementId)
420
+ {
421
+ $order = $this->_initOrder($orderIncrementId);
422
+
423
+ if ($order->getGiftMessageId() > 0) {
424
+ $order->setGiftMessage(Mage::getSingleton('giftmessage/message')->load($order->getGiftMessageId())->getMessage());
425
+ }
426
+
427
+ $result = $this->_getAttributes($order, 'order');
428
+
429
+ $result['shipping_address'] = $this->_getAttributes($order->getShippingAddress(), 'order_address');
430
+ $result['billing_address'] = $this->_getAttributes($order->getBillingAddress(), 'order_address');
431
+ $result['items'] = array();
432
+
433
+ foreach ($order->getAllItems() as $item) {
434
+ if ($item->getGiftMessageId() > 0) {
435
+ $item->setGiftMessage(Mage::getSingleton('giftmessage/message')->load($item->getGiftMessageId())->getMessage());
436
+ }
437
+
438
+ // We need to grab some saleswarp data from the related product
439
+ $product = Mage::getModel('catalog/product')->load((int) $item['product_id']);
440
+
441
+ foreach ($product->getData() as $k => $v) {
442
+ if (strpos($k, 'saleswarp') !== false)
443
+ $item[$k] = $v;
444
+ }
445
+ $item['prod_url'] = $product->getProductUrl();
446
+
447
+ $result['items'][] = $this->_getAttributes($item, 'order_item');
448
+ }
449
+
450
+ $result['payment'] = $this->_getAttributes($order->getPayment(), 'order_payment');
451
+ $result['status_history'] = array();
452
+
453
+ foreach ($order->getAllStatusHistory() as $history) {
454
+ $result['status_history'][] = $this->_getAttributes($history, 'order_status_history');
455
+ }
456
+
457
+ return $result;
458
+ }
459
+
460
+ /**
461
+ * Genearate Refund for a order
462
+ */
463
+ function refund_invoice($magento_orderId, $data)
464
+ {
465
+ $order = Mage::getModel('sales/order')->loadByIncrementId($magento_orderId);
466
+
467
+ $inv = true;
468
+ if (isset($data['inv'])) {
469
+ $inv = false;
470
+ unset($data['inv']);
471
+ }
472
+ $creditmemo = $this->_initCreditmemo($data, $magento_orderId, $inv);
473
+
474
+ if (isset($data['do_refund'])) {
475
+ $creditmemo->setRefundRequested(true);
476
+ }
477
+ if (isset($data['do_offline'])) {
478
+ $creditmemo->setOfflineRequested((bool) (int) $data['do_offline']);
479
+ }
480
+ $creditmemo->register();
481
+ if (!empty($data['send_email'])) {
482
+ $creditmemo->setEmailSent(true);
483
+ }
484
+ $creditmemo->getOrder()->setCustomerNoteNotify(!empty($data['send_email']));
485
+ $this->_saveCreditmemo($creditmemo);
486
+ return true;
487
+ }
488
+
489
+ protected function _saveCreditmemo($creditmemo)
490
+ {
491
+ $transactionSave = Mage::getModel('core/resource_transaction')->addObject($creditmemo)->addObject($creditmemo->getOrder());
492
+ if ($creditmemo->getInvoice()) {
493
+ $transactionSave->addObject($creditmemo->getInvoice());
494
+ }
495
+ $transactionSave->save();
496
+ return $this;
497
+ }
498
+
499
+ protected function _initInvoice($order, $invoiceId)
500
+ {
501
+ if ($invoiceId) {
502
+ $invoice = Mage::getModel('sales/order_invoice')->load($invoiceId)->setOrder($order);
503
+ if ($invoice->getId()) {
504
+ return $invoice;
505
+ }
506
+ }
507
+ return false;
508
+ }
509
+
510
+ protected function _getItemData($data)
511
+ {
512
+ if (isset($data['items'])) {
513
+ $qtys = $data['items'];
514
+ } else {
515
+ $qtys = array();
516
+ }
517
+ return $qtys;
518
+ }
519
+
520
+ protected function _initCreditmemo($data, $orderId, $inv = true)
521
+ {
522
+ $creditmemo = false;
523
+ $creditmemoId = null;
524
+ if ($creditmemoId) {
525
+ $creditmemo = Mage::getModel('sales/order_creditmemo')->load($creditmemoId);
526
+ } elseif ($orderId) {
527
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
528
+ if ($inv === true) {
529
+ foreach ($order->getInvoiceCollection() as $invoice) {
530
+ if ($invoice->canRefund()) {
531
+ $invoiceId = $invoice->getId();
532
+ break;
533
+ }
534
+ }
535
+ $invoice = $this->_initInvoice($order, $invoiceId);
536
+ } else {
537
+ $invoice = false;
538
+ }
539
+ $savedData = $this->_getItemData($data);
540
+ $qtys = array();
541
+ $backToStock = array();
542
+ foreach ($savedData as $orderItemId => $itemData) {
543
+ if (isset($itemData['qty'])) {
544
+ $qtys[$orderItemId] = $itemData['qty'];
545
+ }
546
+ if (isset($itemData['back_to_stock'])) {
547
+ $backToStock[$orderItemId] = true;
548
+ }
549
+ }
550
+ $data['qtys'] = $qtys;
551
+
552
+
553
+ $service = Mage::getModel('sales/service_order', $order);
554
+ if ($invoice) {
555
+ $creditmemo = $service->prepareInvoiceCreditmemo($invoice, $data);
556
+ } else {
557
+ $creditmemo = $service->prepareCreditmemo($data);
558
+ }
559
+ }
560
+ Mage::register('current_creditmemo', $creditmemo);
561
+ return $creditmemo;
562
+ }
563
+ } // Class end
app/code/local/Saleswarp/Oms/Model/Product/Api.php ADDED
@@ -0,0 +1,355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+ class Saleswarp_Oms_Model_Product_Api extends Mage_Catalog_Model_Product_Api
15
+ {
16
+ /**
17
+ * function to update configurable swatches
18
+ */
19
+ function enableConfigurableSwatches()
20
+ {
21
+ $eavAttrTable = Mage::getSingleton('core/resource')->getTableName('eav_attribute');
22
+ $catalogAttrTable = Mage::getSingleton('core/resource')->getTableName('catalog_eav_attribute');
23
+ $read = Mage::getSingleton('core/resource')->getConnection('core_read');
24
+
25
+ $sql = "SELECT `e`.`attribute_id` FROM `" . $eavAttrTable . "` as `e`
26
+ JOIN `" . $catalogAttrTable . "` as `c` ON `e`.`attribute_id` = `c`.`attribute_id`
27
+ WHERE `e`.`entity_type_id` = '4'
28
+ AND `e`.`frontend_input` = 'select'
29
+ AND `e`.`is_user_defined` = '1'
30
+ AND `c`.`is_configurable` = 1 ";
31
+ $result = $read->fetchAll($sql);
32
+ if ($result) {
33
+ $arr = array();
34
+ foreach ($result as $id) {
35
+ array_push($arr, $id['attribute_id']);
36
+ }
37
+ $ids = implode(',', $arr);
38
+ if ($ids) {
39
+ $configModel = new Mage_Core_Model_Config();
40
+ $configModel->saveConfig('configswatches/general/enabled', "1", 'default', 0);
41
+ $configModel->saveConfig('configswatches/general/swatch_attributes', $ids, 'default', 0);
42
+ }
43
+ }
44
+ return $ids;
45
+ }
46
+
47
+ /**
48
+ * function to disble configurable swatches
49
+ */
50
+ function disableConfigurableSwatches()
51
+ {
52
+ $configModel = new Mage_Core_Model_Config();
53
+ $configModel->saveConfig('configswatches/general/enabled', "0", 'default', 0);
54
+ $configModel->saveConfig('configswatches/general/swatch_attributes', "", 'default', 0);
55
+ }
56
+
57
+ /**
58
+ * * Capture Offline payment
59
+ * */
60
+ public function capture_offline($orderId, $invoiceId)
61
+ {
62
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
63
+ if (!$order->canCreditmemo()) {
64
+ if ($invoiceId) {
65
+ $invoice = Mage::getModel('sales/order_invoice')->loadByIncrementId($invoiceId)->setOrder($order);
66
+
67
+ $capture_case = 'offline';
68
+ $invoice->setRequestedCaptureCase($capture_case)->setCanVoidFlag(false)->pay();
69
+
70
+ $transactionSave = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder());
71
+ $transactionSave->save();
72
+ $this->order = Mage::getSingleton('sales/order_api');
73
+ $this->order->addComment($order_id, 'processing', 'Captured Offlined successfully', false);
74
+ return true;
75
+ }
76
+ } else {
77
+ return false;
78
+ }
79
+ }
80
+
81
+ /**
82
+ * * Check invoice exists or not
83
+ * * @param = order id
84
+ * * return true or false
85
+ * */
86
+ public function check_invoice_exists($orderId)
87
+ {
88
+ $invoiceTable = Mage::getSingleton('core/resource')->getTableName('sales_flat_invoice');
89
+ $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
90
+ $Id = $order->getId();
91
+ $sql = "select entity_id from " . $invoiceTable . "
92
+ where order_id = '" . (int) $Id . "'";
93
+
94
+ $invoice = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchRow($sql);
95
+
96
+ if (!empty($invoice)) {
97
+ return true;
98
+ } else {
99
+ return false;
100
+ }
101
+ }
102
+
103
+ /**
104
+ * * Create Order invoice *
105
+ * **/
106
+ public function create_invoice($order_id, $info, $message, $send_email, $include_comment)
107
+ {
108
+ $this->invoice = Mage::getSingleton('sales/order_invoice_api');
109
+ $invoice = $this->invoice->create($order_id, $info, $message, $send_email, $include_comment);
110
+ if ($invoice) {
111
+ $this->order = Mage::getSingleton('sales/order_api');
112
+ $this->order->addComment($order_id, 'processing', 'Invoice Created Successfully', false);
113
+ }
114
+ return $invoice;
115
+ }
116
+
117
+ /**
118
+ * * function to get total product count ( type wise eg: simple, configured )
119
+ *
120
+ * * @params $type string Magento Product type eg: simple, configured
121
+ * @params $modifiedAfter date product last modified date filter
122
+ * * @return int number of products
123
+ * */
124
+ function get_total_prod_count($type, $modifiedAfter = null)
125
+ {
126
+ $collection = Mage::getModel('catalog/product')
127
+ ->getCollection()
128
+ ->addFieldToFilter('type_id', $type);
129
+
130
+ if (!empty($modifiedAfter)) {
131
+ $collection->addAttributeToFilter('updated_at', array('gteq' => $modifiedAfter));
132
+ }
133
+ return $collection->getSize();
134
+ }
135
+
136
+ /**
137
+ * * function to get product collection with limit
138
+ *
139
+ * * @params $type int Magento Product type Id
140
+ * * @params $offset int set current page
141
+ * * @params $limit int products per page
142
+ * * @params $modifiedAfter date product last modified date filter
143
+ * * @return array products or bool(false)
144
+ * */
145
+ function get_product_collection($type, $offset = 1, $limit = 10, $modifiedAfter = null, $createdAfter = null)
146
+ {
147
+ $data = array();
148
+ Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
149
+
150
+ $collection = Mage::getModel('catalog/product')
151
+ ->getCollection()
152
+ ->addAttributeToSelect('*') // select all attributes
153
+ ->addFieldToFilter('type_id', $type);
154
+
155
+ if (!empty($modifiedAfter)) {
156
+ $collection->addAttributeToFilter('updated_at', array('gteq' => $modifiedAfter));
157
+ }
158
+
159
+ if (!empty($createdAfter)) {
160
+ $collection->addAttributeToFilter('updated_at', array('gteq' => $createdAfter));
161
+ }
162
+
163
+ $collection->setPageSize($limit) // limit number of results returned //
164
+ ->setOrder('entity_id', 'DESC')
165
+ ->setCurPage($offset);
166
+
167
+ foreach ($collection as $product) {
168
+ $stocklevel = Mage::getSingleton('cataloginventory/stock_item')
169
+ ->loadByProduct($product)->getData();
170
+
171
+ $data[] = array_merge(
172
+ $product->getData(),
173
+ array('prod_url' => $product->getProductUrl()),
174
+ array('stock' => $stocklevel)
175
+ );
176
+ }
177
+ return $data;
178
+ }
179
+
180
+ /**
181
+ * * Get attribute name By ID
182
+ * * @param attribute id
183
+ * * @return attribute name
184
+ * */
185
+ function get_attr_name_by_id($id)
186
+ {
187
+ $entityTypeId = Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId();
188
+ $attributeSetId = Mage::getModel('eav/entity_attribute_set')->getCollection()
189
+ ->setEntityTypeFilter($entityTypeId)
190
+ ->addFieldToFilter('attribute_set_id', $id)
191
+ ->getFirstItem()
192
+ ->getAttributeSetName();
193
+ if ($attributeSetId) {
194
+ return $attributeSetId;
195
+ } else {
196
+ return false;
197
+ }
198
+ }
199
+
200
+ /**
201
+ * * return allchildren product of magento product id
202
+ * * @params Magento Product Id
203
+ * * @return product data or bool(false)
204
+ * */
205
+ function get_child_product($entity_id)
206
+ {
207
+ $relTable = Mage::getSingleton('core/resource')->getTableName('catalog_product_relation');
208
+ $sql = "SELECT child_id FROM `" . $relTable . "`
209
+ WHERE parent_id = '" . (int) $entity_id . "'";
210
+ $prods = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchAll($sql);
211
+ if ($prods) {
212
+ return $prods;
213
+ } else {
214
+ return false;
215
+ }
216
+ }
217
+
218
+ /**
219
+ * check product exists in target store using saleswarp_product_id in magento catalog_product_entity_in
220
+ *
221
+ * use this check_product_exists to query store by warehouse fields that are
222
+ * known to not change (sku changes)
223
+ *
224
+ * @param mixed $attr_id - attribute id, get this after config lookup
225
+ * @param mixed $base_product_id
226
+ *
227
+ * @todo seperate these functions into extension API once we debug issue with override extensions in Magento
228
+ */
229
+ public function check_product_exists($attr_id, $base_product_id)
230
+ {
231
+ $productIntTable = Mage::getSingleton('core/resource')->getTableName('catalog_product_entity_int');
232
+ $sql = "select entity_id from " . $productIntTable . "
233
+ where attribute_id = '" . (int) $attr_id . "'
234
+ and value = '" . (int) $base_product_id . "'";
235
+ $prod = Mage::getSingleton('core/resource')->getConnection('core_read')->fetchRow($sql);
236
+ if (!empty($prod)) {
237
+ $pid = $prod['entity_id'];
238
+ unset($prod);
239
+ return $pid;
240
+ } else {
241
+ return false;
242
+ }
243
+ }
244
+
245
+ /**
246
+ * light weight inventory update when product is detected out of stock or discontinued and full
247
+ * update info (cogs, weight, price) not longer apply
248
+ *
249
+ * @param mixed $store_prod_id
250
+ * @param mixed $store_qty
251
+ * @param mixed $discontinued
252
+ * @param mixed $status
253
+ * @return mixed
254
+ * */
255
+ function update_inventory($store_prod_id, $store_qty, $discontinued, $attribute_id, $status = 1, $website_id = 1, $stock_id = 1)
256
+ {
257
+ $resource = Mage::getSingleton('core/resource');
258
+ $invStockItemTable = $resource->getTableName('cataloginventory_stock_item');
259
+ $invStockStatusTable = $resource->getTableName('cataloginventory_stock_status');
260
+ $prodDateTimeTable = $resource->getTableName('catalog_product_entity_datetime');
261
+
262
+ $write = $resource->getConnection('core_write');
263
+ $read = $resource->getConnection('core_read');
264
+
265
+ if ($store_qty <= 0 || $discontinued == 1) {
266
+ $status = 0;
267
+ } else {
268
+ $status = 1;
269
+ }
270
+
271
+ if (is_null($store_qty)) {
272
+ $store_qty = 0;
273
+ $status = 0;
274
+ }
275
+
276
+ $sql = "UPDATE " . $invStockItemTable . "
277
+ SET qty = :qty,
278
+ is_in_stock = :is_in_stock
279
+ WHERE product_id = :product_id ";
280
+ $binds = array(
281
+ 'qty' => $store_qty,
282
+ 'is_in_stock' => $status,
283
+ 'product_id' => $store_prod_id,
284
+ );
285
+ $result = $write->query($sql, $binds);
286
+
287
+ $sql = "SELECT * FROM " . $invStockStatusTable . "
288
+ WHERE product_id = :product_id
289
+ AND website_id = :website_id
290
+ AND stock_id = :stock_id ";
291
+ $binds = array(
292
+ 'product_id' => $store_prod_id,
293
+ 'website_id' => $website_id,
294
+ 'stock_id' => $stock_id,
295
+ );
296
+ $chk = $read->fetchRow($sql, $binds);
297
+ if (empty($chk)) {
298
+ $sql = "INSERT INTO " . $invStockStatusTable . "
299
+ SET qty = :qty,
300
+ stock_status = :stock_status,
301
+ stock_id = :stock_id,
302
+ website_id = :website_id,
303
+ product_id = :product_id ";
304
+
305
+ $binds = array(
306
+ 'qty' => $store_qty,
307
+ 'stock_status' => $status,
308
+ 'stock_id' => $stock_id,
309
+ 'website_id' => $website_id,
310
+ 'product_id' => $store_prod_id,
311
+ );
312
+ $result2 = $write->query($sql, $binds);
313
+ } else { // do update
314
+ $sql = "UPDATE " . $invStockStatusTable . "
315
+ SET qty = :qty, stock_status = :stock_status
316
+ WHERE product_id = :product_id ";
317
+ $binds = array(
318
+ 'qty' => $store_qty,
319
+ 'stock_status' => $status,
320
+ 'product_id' => $store_prod_id,
321
+ );
322
+ $result2 = $write->query($sql, $binds);
323
+ }
324
+
325
+ // Update saleswarp_last_inventory_update fields
326
+ $sql = "SELECT * FROM " . $prodDateTimeTable . "
327
+ WHERE entity_type_id = 4
328
+ AND entity_id = $store_prod_id
329
+ AND attribute_id = $attribute_id";
330
+ $chk = $read->fetchAll($sql);
331
+
332
+ if (empty($chk)) { // insert it
333
+ $sql = "INSERT INTO " . $prodDateTimeTable . "
334
+ SET value = NOW(),
335
+ entity_type_id = 4,
336
+ store_id = 0,
337
+ entity_id = $store_prod_id,
338
+ attribute_id = $attribute_id";
339
+ $insert_result = $write->query($sql);
340
+ } else { // update it
341
+ $sql = "UPDATE " . $prodDateTimeTable . "
342
+ SET value = NOW()
343
+ WHERE entity_type_id = 4
344
+ AND entity_id = $store_prod_id
345
+ AND attribute_id = $attribute_id";
346
+ $update_result = $write->query($sql);
347
+ }
348
+
349
+ if ($result && $result2) {
350
+ return "Saved inventory record";
351
+ } else {
352
+ return "FAILED save() inventory update";
353
+ }
354
+ }
355
+ }
app/code/local/Saleswarp/Oms/Model/Product/Attribute/Api.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Saleswarp_Oms_Model_Product_Attribute_Api extends Mage_Catalog_Model_Product_Attribute_Api
3
+ {
4
+
5
+ }
app/code/local/Saleswarp/Oms/Model/Product/Attribute/Media/Api.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Saleswarp_Oms_Model_Product_Attribute_Media_Api extends Mage_Catalog_Model_Product_Attribute_Media_Api
3
+ {
4
+
5
+ }
app/code/local/Saleswarp/Oms/Model/Saleswarp.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+ class Saleswarp_Oms_Model_Saleswarp extends Mage_Payment_Model_Method_Abstract
15
+ {
16
+ protected $_code = 'saleswarp';
17
+ protected $_formBlockType = 'oms/form_saleswarp';
18
+ protected $_infoBlockType = 'oms/info_saleswarp';
19
+ protected $_canUseInternal = true;
20
+ protected $_canUseCheckout = false;
21
+
22
+ public function assignData($data)
23
+ {
24
+ if (!($data instanceof Varien_Object)) {
25
+ $data = new Varien_Object($data);
26
+ }
27
+ $info = $this->getInfoInstance();
28
+ $info->setTransctionNo($data->getTransctionNo())
29
+ ->setPaymentMethod($data->getPaymentMethod());
30
+ return $this;
31
+ }
32
+
33
+ public function validate()
34
+ {
35
+ parent::validate();
36
+
37
+ $info = $this->getInfoInstance();
38
+
39
+ $no = $info->getTransctionNo();
40
+ $method = $info->getPaymentMethod();
41
+ if(empty($no) || empty($method)){
42
+ $errorCode = 'invalid_data';
43
+ $errorMsg = $this->_getHelper()->__('Transaction No and Payment Method are required fields');
44
+ }
45
+
46
+ if($errorMsg){
47
+ Mage::throwException($errorMsg);
48
+ }
49
+
50
+ return $this;
51
+ }
52
+ }
53
+ ?>
app/code/local/Saleswarp/Oms/controllers/Adminhtml/GetkeyController.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+ class Saleswarp_Oms_Adminhtml_GetkeyController extends Mage_Adminhtml_Controller_Action
15
+ {
16
+ public function indexAction()
17
+ {
18
+ $return = array();
19
+ $value = $this->makeKeyRequest();
20
+ if($value) {
21
+ $key = new Mage_Core_Model_Config();
22
+ $key->saveConfig('oms/registration/key', $value);
23
+
24
+ $return['success'] = 1;
25
+ $return['key'] = $value;
26
+ } else {
27
+ $return['success'] = 0;
28
+ }
29
+ $return = Mage::helper('core')->jsonEncode($return);
30
+ $this->getResponse()->setHeader('Content-type', 'application/json');
31
+ $this->getResponse()->setBody($return);
32
+ }
33
+
34
+ public function makeKeyRequest() {
35
+
36
+ $data = array();
37
+ $data['BaseUrl'] = Mage::getBaseUrl();
38
+
39
+ $admin = Mage::getSingleton('admin/session')->getUser()->getData();
40
+ $data['admin']['username'] = $admin['username'];
41
+ $data['admin']['email'] = $admin['email'];
42
+
43
+ $url = Mage::getModel('core/variable')->loadByCode('saleswarp_api_url')->getValue('plain');
44
+
45
+ $dataString = http_build_query($data);
46
+ $ch = curl_init($url);
47
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
48
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
49
+ curl_setopt($ch, CURLOPT_TIMEOUT, 6000);
50
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
51
+ curl_setopt($ch, CURLOPT_POST, true);
52
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);
53
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
54
+
55
+ $return = curl_exec($ch);
56
+
57
+ $info = curl_getinfo($ch);
58
+ if($info['http_code'] == '200') {
59
+ return $return;
60
+ } else {
61
+ return false;
62
+ }
63
+ }
64
+ }
app/code/local/Saleswarp/Oms/controllers/FastapiController.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+ class Saleswarp_Oms_FastapiController extends Mage_Core_Controller_Front_Action {
15
+
16
+ public $authError = '';
17
+
18
+ /**
19
+ * * Receive API call and process API
20
+ * *
21
+ * * @param json encoded data
22
+ * * @return json encode data
23
+ * */
24
+ public function IndexAction()
25
+ {
26
+ $response = array();
27
+ $data = json_decode(@file_get_contents('php://input'), true);
28
+
29
+ if (empty($data)) {
30
+ $this->_redirect('/');
31
+ return;
32
+ }
33
+
34
+ if (isset($data['hash']['key'])) {
35
+ // authenticate
36
+ if(!$this->ApiAuthentication($data['hash']['key'])) {
37
+ $response['error_msg'] = $this->authError;
38
+ $response['error_code'] = '2';
39
+ echo json_encode($response);
40
+ exit;
41
+ }
42
+ // call method api
43
+ $response['data'] = $this->callFastApi($data);
44
+ if(!$response['data']) {
45
+ $response['error_msg'] = 'Invalid data';
46
+ $response['error_code'] = '3';
47
+ } else {
48
+ $response['error_msg'] = '';
49
+ $response['error_code'] = '0';
50
+ }
51
+ } else {
52
+ $response['error_msg'] = 'Invalid data';
53
+ $response['error_code'] = '1';
54
+ }
55
+ echo json_encode($response);
56
+ exit;
57
+ }
58
+
59
+ /**
60
+ * * Load fast api and call methods
61
+ * *
62
+ * * @param array of data
63
+ * * @return array of data
64
+ * */
65
+ public function callFastApi($data = array())
66
+ {
67
+ if (empty($data)) {
68
+ return false;
69
+ } else {
70
+ if (isset($data['api']) && strstr($data['api'], 'saleswarp_fastapi') !== false) {
71
+ // load api
72
+ $className = $data['api'];
73
+
74
+ switch ($className) {
75
+ case 'saleswarp_fastapi_model_order_api':
76
+ $className = 'oms/order_api';
77
+ break;
78
+ case 'saleswarp_fastapi_model_product_api':
79
+ $className = 'oms/product_api';
80
+ break;
81
+ case 'saleswarp_fastapi_model_category_api':
82
+ $className = 'oms/category_api';
83
+ break;
84
+ case 'saleswarp_fastapi_model_config_api':
85
+ $className = 'oms/config_api';
86
+ break;
87
+ case 'saleswarp_fastapi_model_product_attribute_media_api':
88
+ $className = 'oms/product_attribute_media_api';
89
+ break;
90
+ case 'saleswarp_fastapi_model_customer_api':
91
+ $className = 'oms/customer_api';
92
+ break;
93
+ }
94
+
95
+ try {
96
+ $mage = Mage::getModel($className);
97
+ if(!method_exists($mage, $data['methodName'])) {
98
+ throw new Exception('Class or Function does not exists');
99
+ } else {
100
+ $fastData = call_user_func_array(array($mage, $data['methodName']), $data['methodParams']);
101
+ }
102
+ } catch(Exception $e) {
103
+ return [$e->getMessage()];
104
+ }
105
+
106
+ return $fastData;
107
+ } else {
108
+ return false;
109
+ }
110
+ }
111
+ }
112
+
113
+ /**
114
+ * * Authentication API request
115
+ * *
116
+ * * @params string hash key
117
+ * * @return bool(trur or false)
118
+ * */
119
+ public function ApiAuthentication($hash = null)
120
+ {
121
+ if(empty($hash)) {
122
+ $this->authError = 'No hash key supplied';
123
+ return false;
124
+ } else {
125
+ $mageHash = Mage::getStoreConfig('oms/registration/key');
126
+
127
+ // get user ip address
128
+ $remoteIP = Mage::helper('core/http')->getRemoteAddr(false);
129
+ if (!empty($mageHash) && $hash == $mageHash) {
130
+ return true;
131
+ } else {
132
+ $this->authError = 'Incorrect Hash key';
133
+ return false;
134
+ }
135
+ }
136
+ }
137
+ }
app/code/local/Saleswarp/Oms/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <oms translate="title" module="oms">
12
+ <title>Saleswarp Oms Section</title>
13
+ <sort_order>0</sort_order>
14
+ </oms>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/local/Saleswarp/Oms/etc/config.xml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Saleswarp_Oms>
5
+ <version>0.1.2</version>
6
+ </Saleswarp_Oms>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <oms>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Saleswarp_Oms</module>
14
+ <frontName>customapi</frontName>
15
+ </args>
16
+ </oms>
17
+ </routers>
18
+ </frontend>
19
+ <global>
20
+ <helpers>
21
+ <oms>
22
+ <class>Saleswarp_Oms_Helper</class>
23
+ </oms>
24
+ </helpers>
25
+ <blocks>
26
+ <oms>
27
+ <class>Saleswarp_Oms_Block</class>
28
+ </oms>
29
+ </blocks>
30
+ <resources>
31
+ <oms_setup>
32
+ <setup>
33
+ <module>Saleswarp_Oms</module>
34
+ </setup>
35
+ <connection>
36
+ <use>core_setup</use>
37
+ </connection>
38
+ </oms_setup>
39
+ <oms_write>
40
+ <connection>
41
+ <use>core_write</use>
42
+ </connection>
43
+ </oms_write>
44
+ <oms_read>
45
+ <connection>
46
+ <use>core_read</use>
47
+ </connection>
48
+ </oms_read>
49
+ </resources>
50
+ <models>
51
+ <oms>
52
+ <class>Saleswarp_Oms_Model</class>
53
+ </oms>
54
+ <catalog>
55
+ <rewrite>
56
+ <product_api>Saleswarp_Oms_Model_Catalog_Product_Api</product_api>
57
+ </rewrite>
58
+ </catalog>
59
+ </models>
60
+ <fieldsets>
61
+ <sales_convert_quote_payment>
62
+ <transction_no>
63
+ <to_order_payment>*</to_order_payment>
64
+ </transction_no>
65
+ <payment_method>
66
+ <to_order_payment>*</to_order_payment>
67
+ </payment_method>
68
+ </sales_convert_quote_payment>
69
+ </fieldsets>
70
+ </global>
71
+ <default>
72
+ <payment>
73
+ <saleswarp>
74
+ <active>1</active>
75
+ <model>oms/saleswarp</model>
76
+ <order_status>processing</order_status>
77
+ <title>Saleswarp Payment</title>
78
+ <message>Used for Orders created in Saleswarp.</message>
79
+ </saleswarp>
80
+ </payment>
81
+ </default>
82
+ <admin>
83
+ <routers>
84
+ <oms>
85
+ <use>admin</use>
86
+ <args>
87
+ <module>Saleswarp_Oms</module>
88
+ <frontName>admin_oms</frontName>
89
+ </args>
90
+ </oms>
91
+ </routers>
92
+ </admin>
93
+ </config>
app/code/local/Saleswarp/Oms/etc/system.xml ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <saleswarp translate="label" module="oms">
5
+ <label>Saleswarp</label>
6
+ <sort_order>10</sort_order>
7
+ </saleswarp>
8
+ </tabs>
9
+ <sections>
10
+ <oms translate="label" module="oms">
11
+ <label>Settings</label>
12
+ <tab>saleswarp</tab>
13
+ <frontend_type>text</frontend_type>
14
+ <sort_order>0</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <registration translate="label">
20
+ <label>Generate Unique SalesWarp Registration Key</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>0</show_in_website>
25
+ <show_in_store>0</show_in_store>
26
+ <fields>
27
+ <key translate="label">
28
+ <label>SalesWarp Registration Unique Key</label>
29
+ <frontend_type>text</frontend_type>
30
+ <frontend_model>Saleswarp_Oms_Block_Adminhtml_System_Config_Form_Key</frontend_model>
31
+ <sort_order>10</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>0</show_in_website>
34
+ <show_in_store>0</show_in_store>
35
+ </key>
36
+ <check translate="label">
37
+                 <label> </label>
38
+                 <frontend_type>button</frontend_type>
39
+                 <frontend_model>Saleswarp_Oms_Block_Adminhtml_System_Config_Form_Button</frontend_model>
40
+                 <sort_order>20</sort_order>
41
+                 <show_in_default>1</show_in_default>
42
+                 <show_in_website>0</show_in_website>
43
+                 <show_in_store>0</show_in_store>
44
+             </check>
45
+ </fields>
46
+ </registration>
47
+ </groups>
48
+ </oms>
49
+ <payment>
50
+ <groups>
51
+ <saleswarp translate="label">
52
+ <label>Saleswarp Payment Module</label>
53
+ <sort_order>670</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>0</show_in_store>
57
+ <fields>
58
+ <active translate="label">
59
+ <label>Enabled</label>
60
+ <frontend_type>select</frontend_type>
61
+ <source_model>adminhtml/system_config_source_yesno</source_model>
62
+ <sort_order>1</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>0</show_in_store>
66
+ </active>
67
+ <order_status translate="label">
68
+ <label>New order status</label>
69
+ <frontend_type>select</frontend_type>
70
+ <source_model>adminhtml/system_config_source_order_status_processing</source_model>
71
+ <sort_order>2</sort_order>
72
+ <show_in_default>1</show_in_default>
73
+ <show_in_website>1</show_in_website>
74
+ <show_in_store>0</show_in_store>
75
+ </order_status>
76
+ <title translate="label">
77
+ <label>Title</label>
78
+ <frontend_type>text</frontend_type>
79
+ <sort_order>3</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>1</show_in_website>
82
+ <show_in_store>0</show_in_store>
83
+ </title>
84
+ <message translate="label">
85
+ <label>Displayed Message</label>
86
+ <frontend_type>textarea</frontend_type>
87
+ <sort_order>4</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ </message>
92
+ </fields>
93
+ </saleswarp>
94
+ </groups>
95
+ </payment>
96
+ </sections>
97
+ </config>
app/code/local/Saleswarp/Oms/sql/oms_setup/mysql4-install-0.1.1.php ADDED
@@ -0,0 +1,265 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+
15
+ $installer = $this;
16
+ $setup = new Mage_Eav_Model_Entity_Setup('core_setup');
17
+ $installer->startSetup();
18
+
19
+ $constants = array(
20
+ 'saleswarp_api_url' => 'http://accounts.saleswarp.com/key/get',
21
+ 'saleswarp_create_url' => 'https://www.saleswarp.com/30-day-free-trial-sign-up/',
22
+ 'saleswarp_login_url' => 'https://www.saleswarp.com/SMB_login',
23
+ );
24
+
25
+ foreach($constants as $code => $value) {
26
+ Mage::getModel('core/variable')
27
+ ->setCode($code)
28
+ ->setName($code)
29
+ ->setPlainValue($value)
30
+ ->save();
31
+ }
32
+
33
+ $setup->addAttribute('catalog_product', 'saleswarp_prod_id', array(
34
+ 'group' => 'SalesWarp',
35
+ 'type' => 'int',
36
+ 'input' => 'text',
37
+ 'label' => 'SalesWarp ID',
38
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
39
+ 'visible' => 1,
40
+ 'required' => 0,
41
+ 'visible_on_front' => 0,
42
+ 'is_html_allowed_on_front' => 0,
43
+ 'is_configurable' => 0,
44
+ 'searchable' => 0,
45
+ 'filterable' => 0,
46
+ 'comparable' => 0,
47
+ 'unique' => true,
48
+ 'user_defined' => true,
49
+ 'is_user_defined' => false,
50
+ 'used_in_product_listing' => false
51
+ ));
52
+
53
+ $setup->addAttribute('catalog_product', 'saleswarp_prod_add_date', array(
54
+ 'group' => 'SalesWarp',
55
+ 'type' => 'datetime',
56
+ 'input' => 'date',
57
+ 'label' => 'SalesWarp Add Date',
58
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
59
+ 'visible' => 1,
60
+ 'required' => 0,
61
+ 'visible_on_front' => 0,
62
+ 'is_html_allowed_on_front' => 0,
63
+ 'is_configurable' => 0,
64
+ 'backend' => 'eav/entity_attribute_backend_datetime',
65
+ 'searchable' => 0,
66
+ 'filterable' => 0,
67
+ 'comparable' => 0,
68
+ 'unique' => false,
69
+ 'user_defined' => true,
70
+ 'is_user_defined' => false,
71
+ 'used_in_product_listing' => false
72
+ ));
73
+
74
+ $setup->addAttribute('catalog_product', 'saleswarp_prod_code', array(
75
+ 'group' => 'SalesWarp',
76
+ 'type' => 'varchar',
77
+ 'input' => 'text',
78
+ 'label' => 'SalesWarp Code',
79
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
80
+ 'visible' => 1,
81
+ 'required' => 0,
82
+ 'visible_on_front' => 0,
83
+ 'is_html_allowed_on_front' => 0,
84
+ 'is_configurable' => 0,
85
+ 'searchable' => 0,
86
+ 'filterable' => 0,
87
+ 'comparable' => 0,
88
+ 'unique' => false,
89
+ 'user_defined' => true,
90
+ 'is_user_defined' => false,
91
+ 'used_in_product_listing' => false
92
+ ));
93
+
94
+ $setup->addAttribute('catalog_product', 'saleswarp_prod_sync_date', array(
95
+ 'group' => 'SalesWarp',
96
+ 'type' => 'datetime',
97
+ 'input' => 'date',
98
+ 'label' => 'SalesWarp Sync Date',
99
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
100
+ 'visible' => 1,
101
+ 'required' => 0,
102
+ 'visible_on_front' => 0,
103
+ 'is_html_allowed_on_front' => 0,
104
+ 'is_configurable' => 0,
105
+ 'backend' => 'eav/entity_attribute_backend_datetime',
106
+ 'searchable' => 0,
107
+ 'filterable' => 0,
108
+ 'comparable' => 0,
109
+ 'unique' => false,
110
+ 'user_defined' => false,
111
+ 'is_user_defined' => false,
112
+ 'used_in_product_listing' => false
113
+ ));
114
+
115
+ $setup->addAttribute('catalog_product', 'saleswarp_prod_last_inv_upd', array(
116
+ 'group' => 'SalesWarp',
117
+ 'type' => 'datetime',
118
+ 'input' => 'date',
119
+ 'label' => 'SalesWarp Last Inventory Update',
120
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
121
+ 'visible' => 1,
122
+ 'required' => 0,
123
+ 'visible_on_front' => 0,
124
+ 'is_html_allowed_on_front' => 0,
125
+ 'is_configurable' => 0,
126
+ 'backend' => 'eav/entity_attribute_backend_datetime',
127
+ 'searchable' => 0,
128
+ 'filterable' => 0,
129
+ 'comparable' => 0,
130
+ 'unique' => false,
131
+ 'user_defined' => false,
132
+ 'is_user_defined' => false,
133
+ 'used_in_product_listing' => false
134
+ ));
135
+
136
+ $setup->addAttribute('catalog_category', 'saleswarp_cat_id', array(
137
+ 'group' => 'SalesWarp',
138
+ 'type' => 'int',
139
+ 'input' => 'text',
140
+ 'label' => 'SalesWarp ID',
141
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
142
+ 'visible' => 1,
143
+ 'required' => 0,
144
+ 'visible_on_front' => 0,
145
+ 'is_html_allowed_on_front' => 0,
146
+ 'is_configurable' => 0,
147
+ 'searchable' => 0,
148
+ 'filterable' => 0,
149
+ 'comparable' => 0,
150
+ 'unique' => false,
151
+ 'user_defined' => false,
152
+ 'is_user_defined' => false,
153
+ 'used_in_product_listing' => false
154
+ ));
155
+
156
+ $setup->addAttribute('catalog_category', 'saleswarp_cat_name', array(
157
+ 'group' => 'SalesWarp',
158
+ 'type' => 'varchar',
159
+ 'input' => 'text',
160
+ 'label' => 'SalesWarp Name',
161
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
162
+ 'visible' => 1,
163
+ 'required' => 0,
164
+ 'visible_on_front' => 0,
165
+ 'is_html_allowed_on_front' => 0,
166
+ 'is_configurable' => 0,
167
+ 'searchable' => 0,
168
+ 'filterable' => 0,
169
+ 'comparable' => 0,
170
+ 'unique' => false,
171
+ 'user_defined' => false,
172
+ 'is_user_defined' => false,
173
+ 'used_in_product_listing' => false
174
+ ));
175
+
176
+ $setup->addAttribute('catalog_category', 'saleswarp_cat_code', array(
177
+ 'group' => 'SalesWarp',
178
+ 'type' => 'int',
179
+ 'input' => 'text',
180
+ 'label' => 'SalesWarp Code',
181
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
182
+ 'visible' => 1,
183
+ 'required' => 0,
184
+ 'visible_on_front' => 0,
185
+ 'is_html_allowed_on_front' => 0,
186
+ 'is_configurable' => 0,
187
+ 'searchable' => 0,
188
+ 'filterable' => 0,
189
+ 'comparable' => 0,
190
+ 'unique' => false,
191
+ 'user_defined' => false,
192
+ 'is_user_defined' => false,
193
+ 'used_in_product_listing' => false
194
+ ));
195
+
196
+ $setup->addAttribute('catalog_category', 'saleswarp_cat_add_date', array(
197
+ 'group' => 'SalesWarp',
198
+ 'type' => 'datetime',
199
+ 'input' => 'date',
200
+ 'label' => 'SalesWarp Add Date',
201
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
202
+ 'visible' => 1,
203
+ 'required' => 0,
204
+ 'visible_on_front' => 0,
205
+ 'is_html_allowed_on_front' => 0,
206
+ 'is_configurable' => 0,
207
+ 'backend' => 'eav/entity_attribute_backend_datetime',
208
+ 'searchable' => 0,
209
+ 'filterable' => 0,
210
+ 'comparable' => 0,
211
+ 'unique' => false,
212
+ 'user_defined' => false,
213
+ 'is_user_defined' => false,
214
+ 'used_in_product_listing' => false
215
+ ));
216
+
217
+ $setup->addAttribute('catalog_category', 'saleswarp_cat_sync_date', array(
218
+ 'group' => 'SalesWarp',
219
+ 'type' => 'datetime',
220
+ 'input' => 'date',
221
+ 'label' => 'SalesWarp Sync Date',
222
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
223
+ 'visible' => 1,
224
+ 'required' => 0,
225
+ 'visible_on_front' => 0,
226
+ 'is_html_allowed_on_front' => 0,
227
+ 'is_configurable' => 0,
228
+ 'backend' => 'eav/entity_attribute_backend_datetime',
229
+ 'searchable' => 0,
230
+ 'filterable' => 0,
231
+ 'comparable' => 0,
232
+ 'unique' => false,
233
+ 'user_defined' => false,
234
+ 'is_user_defined' => false,
235
+ 'used_in_product_listing' => false
236
+ ));
237
+
238
+
239
+ $productTable = $this->getTable('catalog_product_entity');
240
+ // Add new text fields product tables
241
+ $installer->getConnection()->addColumn($productTable, 'saleswarp_category_ids', 'varchar(64) NULL');
242
+
243
+ // ADD SALESWARP ATTRIBUTES FOR PRODUCTS
244
+ $setup->addAttribute('catalog_product', 'managed_by_saleswarp', array(
245
+ 'group' => 'General',
246
+ 'type' => 'int',
247
+ 'input' => 'boolean',
248
+ 'label' => 'Manage Product with SalesWarp',
249
+ 'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
250
+ 'visible' => 1,
251
+ 'default' => '0',
252
+ 'required' => 1,
253
+ 'visible_on_front' => 0,
254
+ 'is_html_allowed_on_front' => 0,
255
+ 'is_configurable' => 0,
256
+ 'searchable' => 0,
257
+ 'filterable' => 0,
258
+ 'comparable' => 0,
259
+ 'unique' => false,
260
+ 'user_defined' => false,
261
+ 'is_user_defined' => false,
262
+ 'used_in_product_listing' => false
263
+ ));
264
+
265
+ $installer->endSetup();
app/code/local/Saleswarp/Oms/sql/oms_setup/mysql4-upgrade-0.1.2.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This module connects Magento to the SalesWarp Advanced Order Management System.
4
+ *
5
+ * @copyright Copyright (c) 2015 6th Street Inc, dba SalesWarp.
6
+ * @version 0.1.2
7
+ * @author David Potts
8
+ * @license http://www.saleswarp.com/license-saas
9
+ * @category SalesWarp
10
+ * @since File available since Release 0.1.2
11
+ * @link https://www.SalesWarp.com
12
+ *
13
+ */
14
+
15
+ $installer = $this;
16
+ /* @var $installer Mage_Customer_Model_Entity_Setup */
17
+
18
+ $installer->startSetup();
19
+ $installer->run("
20
+
21
+ ALTER TABLE `{$installer->getTable('sales/quote_payment')}` ADD `transction_no` VARCHAR( 255 ) NOT NULL ;
22
+ ALTER TABLE `{$installer->getTable('sales/quote_payment')}` ADD `payment_method` VARCHAR( 255 ) NOT NULL ;
23
+
24
+ ALTER TABLE `{$installer->getTable('sales/order_payment')}` ADD `transction_no` VARCHAR( 255 ) NOT NULL ;
25
+ ALTER TABLE `{$installer->getTable('sales/order_payment')}` ADD `payment_method` VARCHAR( 255 ) NOT NULL ;
26
+
27
+ ");
28
+ $installer->endSetup();
app/design/adminhtml/default/default/template/oms/form/saleswarp.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="form-list" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
2
+ <div>
3
+ <label><?php echo $this->__('Transction No') ?>*</label>
4
+ <span>
5
+ <input type="text" title="<?php echo $this->__('Transction No') ?>" name="payment[transction_no]" value="<?php echo $this->htmlEscape($this->getInfoData('transction_no')) ?>" />
6
+ </span>
7
+ </div>
8
+ <div>
9
+ <label><?php echo $this->__('Payment Method') ?>*</label>
10
+ <span>
11
+ <input type="text" title="<?php echo $this->__('Payment Method') ?>" name="payment[payment_method]" value="<?php echo $this->htmlEscape($this->getInfoData('payment_method')) ?>" />
12
+ </span>
13
+ </div>
14
+ </div>
15
+ <div>
16
+ <?php echo $this->getMethod()->getConfigData('message');?>
17
+ </div>
app/design/adminhtml/default/default/template/oms/system/config/button.phtml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if($this->isKeyAvailable()) { ?>
2
+ <?php $data = $this->getKeyData(); ?>
3
+ <a href="<?php echo $data['create_url']; ?>" target="_blank">Create New Account</a>
4
+ &nbsp;|&nbsp;
5
+ <a href="<?php echo $data['login_url']; ?>" target="_blank">Login to existing Account</a>
6
+ <?php } else { ?>
7
+ <script type="text/javascript">
8
+ //<![CDATA[
9
+ function getKey() {
10
+ new Ajax.Request('<?php echo $this->getAjaxCheckUrl() ?>', {
11
+ method: 'get',
12
+ onSuccess: function(transport){
13
+ var data = transport.responseText.evalJSON(true);
14
+ if (data.success == 1) {
15
+ $('layer_get_key').innerHTML = "";
16
+ $('layer_get_key_links').style.display = 'block';
17
+ $('oms_registration_key').value = data.key;
18
+ configForm.submit();
19
+ } else {
20
+ alert('Error while making the key request, kindly confirm that the api URL and other details under custom variables.');
21
+ }
22
+ }
23
+ });
24
+ }
25
+ //]]>
26
+ </script>
27
+ <div id="layer_get_key">
28
+ <?php echo $this->getButtonHtml() ?>
29
+ </div>
30
+ <div id="layer_get_key_links" style="display:none;">
31
+ <?php $data = $this->getKeyData(); ?>
32
+ <a href="<?php echo $data['create_url']; ?>" target="_blank">Create New Account</a>
33
+ &nbsp;|&nbsp;
34
+ <a href="<?php echo $data['login_url']; ?>" target="_blank">Login to existing Account</a>
35
+ </div>
36
+ <?php } ?>
app/etc/modules/Saleswarp_Oms.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Saleswarp_Oms>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <version>0.1.0</version>
8
+ </Saleswarp_Oms>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Saleswarp_Oms</name>
4
+ <version>0.1.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://www.saleswarp.com/license-saas/">Commercial</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Saleswarp Order Management System</summary>
10
+ <description>This module connects Magento to the Saleswarp Advanced Order Management Software for omnichannel management. See our website for more details.</description>
11
+ <notes>Production version</notes>
12
+ <authors><author><name>David Potts</name><user>David</user><email>sales@saleswarp.com</email></author></authors>
13
+ <date>2016-02-03</date>
14
+ <time>21:37:43</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Saleswarp_Oms.xml" hash="d7517f57c7067f8dbe22fd1dcab808f0"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="oms"><dir name="form"><file name="saleswarp.phtml" hash="bbad1f2cd7a051e94ccedd746dea792f"/></dir><dir name="system"><dir name="config"><file name="button.phtml" hash="a56213475969648e407ebcaa7876b543"/></dir></dir></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Saleswarp"><dir name="Oms"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Button.php" hash="98b0800abe8bfc2e134a8c6a3105f456"/><file name="Key.php" hash="9c214ab80440d4f8616e3be453c68648"/></dir></dir></dir></dir><dir name="Form"><file name="Saleswarp.php" hash="b30ec57de4d6b99ddaeada14f9336ffe"/></dir><dir name="Info"><file name="Saleswarp.php" hash="c45c80aa79fcc26a64740ae0fa68de6e"/></dir></dir><dir name="Helper"><file name="Data.php" hash="56d7205458e363668c92f6c854c1148a"/></dir><dir name="Model"><dir name="Category"><file name="Api.php" hash="e95fff09bbb0db173ca2a00bd9aba7af"/></dir><dir name="Config"><file name="Api.php" hash="0c8aadaf4c9a35e00c0c77027e3e9087"/></dir><dir name="Customer"><file name="Api.php" hash="f6964b711ee3ff52e4ad5171923c3fa1"/></dir><dir name="Order"><file name="Api.php" hash="746a7a2625781718cd8bb903b42912b4"/></dir><dir name="Product"><file name="Api.php" hash="94e8ff8435f41fd5a49356c0ee97fee6"/><dir name="Attribute"><file name="Api.php" hash="7c14c8799326c044cfed0106633e3818"/><dir name="Media"><file name="Api.php" hash="2deb5295ebd54133195d21497d23e2a2"/></dir></dir></dir><file name="Saleswarp.php" hash="f571feaf9cb2f9f1cee17da426bc9181"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="GetkeyController.php" hash="5df8d8b4ab7fd86519bb145d2ead3687"/></dir><file name="FastapiController.php" hash="1e1bc36e9043b4a12ba6f74c5b6e1602"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8fe0febceef7c236000fd538d6061a8e"/><file name="config.xml" hash="292f1aacb300ab70cc771ba2d7fd6859"/><file name="system.xml" hash="f09a337b4731e8b569eb5720aff4e8b2"/></dir><dir name="sql"><dir name="oms_setup"><file name="mysql4-install-0.1.1.php" hash="fe7c9448c3e5f0e1ca853c77faa7478f"/><file name="mysql4-upgrade-0.1.2.php" hash="5441c7565508f4f5ad7310635b1edd37"/></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>