Drupal - Version 1.2

Version Notes

Release

Download this release

Release Info

Developer Magento Core Team
Extension Drupal
Version 1.2
Comparing to
See all releases


Version 1.2

app/code/local/Drupal/ApiExtend/Model/Catalog/Api.php ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Drupal_ApiExtend_Model_Catalog_Api extends Mage_Api_Model_Resource_Abstract
3
+ {
4
+ /**
5
+ * Retrieve products list
6
+ *
7
+ * @param array $filters
8
+ * @param int $storeId
9
+ * @return array
10
+ */
11
+ public function productsList($filters, $storeId)
12
+ {
13
+ try {
14
+ $store = Mage::app()->getStore($storeId)->getId();
15
+ } catch (Mage_Core_Model_Store_Exception $e) {
16
+ $this->_fault('store_not_exists');
17
+ }
18
+
19
+ $collection = Mage::getModel('catalog/product')->getCollection()
20
+ ->setStoreId($store)
21
+ // getting most common attributes for saving on Drupal side
22
+ ->addAttributeToSelect('name')
23
+ ->addAttributeToSelect('price')
24
+ ->addAttributeToSelect('status')
25
+ ->addAttributeToSelect('special_price')
26
+ ->addAttributeToSelect('special_from_date')
27
+ ->addAttributeToSelect('special_to_date')
28
+ ->addAttributeToSelect('weight')
29
+ ->addAttributeToSelect('visibility')
30
+ ->addAttributeToSelect('news_from_date')
31
+ ->addAttributeToSelect('news_to_date')
32
+ ->addAttributeToSelect('description')
33
+ ->addAttributeToSelect('short_description');
34
+
35
+ if (is_array($filters)) {
36
+ try {
37
+ foreach ($filters as $field => $value) {
38
+ if (isset($this->_filtersMap[$field])) {
39
+ $field = $this->_filtersMap[$field];
40
+ }
41
+
42
+ $collection->addFieldToFilter($field, $value);
43
+ }
44
+ } catch (Mage_Core_Exception $e) {
45
+ $this->_fault('filters_invalid', $e->getMessage());
46
+ }
47
+ }
48
+
49
+ $result = array();
50
+
51
+ foreach ($collection as $product) {
52
+
53
+ $all_images = Mage::getModel('catalog/product_attribute_media_api')->items($product->getId(), $store);
54
+
55
+ $true_images = array();
56
+
57
+ foreach ($all_images as $image) {
58
+ if (in_array('image', $image['types'])) {
59
+ $true_images[] = $image;
60
+ }
61
+ }
62
+ $wId = Mage::app()->getStore($store)->getWebsiteId();
63
+
64
+ $rules = Mage::getResourceModel('ApiExtend/rule')->getAllRulesForProduct(now(), $wId, $product->getId());
65
+
66
+
67
+ // after call this method tier price appear in toArray() result.
68
+ $product->getTierPrice();
69
+ // if call like this, category ids returns in array, not as string if keep toArray() style.
70
+ $product->getCategoryIds();
71
+
72
+ $product_array = $product->toArray();
73
+
74
+ $product_array['images'] = $true_images;
75
+ $product_array['rules'] = $rules;
76
+
77
+ $result[] = $product_array;
78
+ }
79
+
80
+ return $result;
81
+ }
82
+ /**
83
+ * Retrieve actual product price
84
+ *
85
+ * @param int $productId
86
+ * @param int $qty
87
+ * @param int $groupId
88
+ * @param int $store
89
+ * @return array
90
+ */
91
+ public function productActualPrice($productId, $qty, $gId, $store = null)
92
+ {
93
+ $product = Mage::getModel('catalog/product');
94
+ /* @var $product Mage_Catalog_Model_Product */
95
+
96
+ if (is_string($productId)) {
97
+ $idBySku = $product->getIdBySku($productId);
98
+ if ($idBySku) {
99
+ $productId = $idBySku;
100
+ }
101
+ }
102
+
103
+ $store = is_null($store) ? 0 : $store;
104
+ try {
105
+ $product->setStoreId($store);
106
+ } catch (Mage_Core_Model_Store_Exception $e) {
107
+ $this->_fault('store_not_exists');
108
+ }
109
+
110
+ $product->load($productId);
111
+
112
+ if (!$product->getId()) {
113
+ $this->_fault('not_exists');
114
+ }
115
+ $price = $product->getPrice();
116
+ $tier_price = $product->getTierPrice($qty);
117
+ if ($tier_price) {
118
+ if ($tier_price < $price) $price = $tier_price;
119
+ }
120
+
121
+ $time = time();
122
+ $special_price = $product = Mage::getModel('catalog/product_api')->getSpecialPrice($productId, $store = null);
123
+ if ($special_price) {
124
+ if ($special_price['special_price'] < $price && $time >= strtotime($special_price['special_from_date']) && $time <= strtotime($special_price['special_to_date'])) $price = $special_price['special_price'];
125
+ }
126
+ $wId = Mage::app()->getStore($store)->getWebsiteId();
127
+ $rule_price = Mage::getResourceModel('catalogrule/rule')->getRulePrice($time, $wId, $gId, $productId);
128
+ if ($rule_price) {
129
+ if ($rule_price < $price) $price = $rule_price;
130
+ }
131
+ return $price;
132
+ }
133
+
134
+ /**
135
+ * Retrieve product full info (full attribute list with values)
136
+ *
137
+ * @param int $productId
138
+ * @param int $store
139
+ * @return array
140
+ */
141
+ public function productFullInfo($productId, $store = null)
142
+ {
143
+ $product = Mage::getModel('catalog/product');
144
+
145
+ /* @var $product Mage_Catalog_Model_Product */
146
+
147
+ if (is_string($productId)) {
148
+ $idBySku = $product->getIdBySku($productId);
149
+ if ($idBySku) {
150
+ $productId = $idBySku;
151
+ }
152
+ }
153
+
154
+ $store = is_null($store) ? 0 : $store;
155
+ try {
156
+ $product->setStoreId($store);
157
+ } catch (Mage_Core_Model_Store_Exception $e) {
158
+ $this->_fault('store_not_exists');
159
+ }
160
+
161
+ $product->load($productId);
162
+
163
+ // error_log("sdsd", 3, "err.log");
164
+
165
+ if (!$product->getId()) {
166
+ $this->_fault('not_exists');
167
+ }
168
+
169
+ $setId = $product->getAttributeSetId();
170
+
171
+ $result = array( // Basic product data
172
+ 'product_id' => $product->getId(),
173
+ 'sku' => $product->getSku(),
174
+ 'set' => $product->getAttributeSetId(),
175
+ 'type' => $product->getTypeId(),
176
+ 'categories' => $product->getCategoryIds(),
177
+ 'websites' => $product->getWebsiteIds()
178
+ );
179
+
180
+ $attributes = Mage::getModel('catalog/product')->getResource()
181
+ ->loadAllAttributes()
182
+ ->getSortedAttributes($setId);
183
+
184
+ foreach ($attributes as $attribute) {
185
+ $result[$attribute->getAttributeCode()] = $product->getData(
186
+ $attribute->getAttributeCode());
187
+ }
188
+
189
+ return $result;
190
+ }
191
+
192
+
193
+ } // Class Drupal_ApiExtend_Model_Catalog_Api End
194
+
app/code/local/Drupal/ApiExtend/Model/Config/Api.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Drupal_ApiExtend_Model_Config_Api extends Mage_Api_Model_Resource_Abstract
3
+ {
4
+ /**
5
+ * Retrieve Magento config value
6
+ *
7
+ * @return array
8
+ */
9
+ public function info($path, $storeId) {
10
+ try {
11
+ $result = Mage::getStoreConfig($path, $storeId);
12
+ return $result;
13
+ } catch (Mage_Core_Exception $e) {
14
+ $this->_fault("can't get config info", $e->getMessage());
15
+ }
16
+ }
17
+
18
+ /**
19
+ * Retrieve Magento Websites list
20
+ *
21
+ * @return array
22
+ */
23
+ public function websites() {
24
+ $result = array();
25
+ foreach (Mage::getModel('core/website')->getCollection() as $website) {
26
+ $result[] = $website->toArray();
27
+ }
28
+ return $result;
29
+ }
30
+
31
+ /**
32
+ * Retrieve Magento Stores list
33
+ *
34
+ * @return array
35
+ */
36
+ public function stores() {
37
+ $result = array();
38
+ foreach (Mage::getModel('core/store_group')->getCollection() as $store) {
39
+ $result[] = $store->toArray();
40
+ }
41
+ return $result;
42
+ }
43
+
44
+ /**
45
+ * Retrieve Magento Store Views list
46
+ *
47
+ * @return array
48
+ */
49
+ public function storeViews() {
50
+ $result = array();
51
+ foreach (Mage::getModel('core/store')->getCollection() as $storeView) {
52
+ $result[] = $storeView->toArray();
53
+ }
54
+ return $result;
55
+ }
56
+
57
+ } // Class Drupal_ApiExtend_Model_Config_Api End
58
+
app/code/local/Drupal/ApiExtend/Model/Mysql4/Rule.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Extended Catalog rules resource model
4
+ */
5
+ class Drupal_ApiExtend_Model_Mysql4_Rule extends Mage_Core_Model_Mysql4_Abstract
6
+ {
7
+ /**
8
+ * Initialize main table and table id field
9
+ */
10
+ protected function _construct()
11
+ {
12
+ $this->_init('catalogrule/rule', 'rule_id');
13
+ }
14
+
15
+ /**
16
+ * Get data about rules for all customer groups
17
+ *
18
+ * @param int|string $date
19
+ * @param int $wId
20
+ * @param int $pId
21
+ * @return array
22
+ */
23
+ public function getAllRulesForProduct($date, $wId, $pId)
24
+ {
25
+ $read = $this->_getReadAdapter();
26
+ $select = $read->select()
27
+ ->from(
28
+ array('tbl_prices' => $this->getTable('catalogrule/rule_product_price')),
29
+ array('rule_price', 'customer_group_id', 'website_id', 'product_id'))
30
+ ->join(
31
+ array('tbl_rules' => $this->getTable('catalogrule/rule_product')),
32
+ '`tbl_rules`.`product_id` = `tbl_prices`.`product_id` and'.
33
+ '`tbl_rules`.`website_id` = `tbl_prices`.`website_id` and'.
34
+ '`tbl_rules`.`customer_group_id` = `tbl_prices`.`customer_group_id`',
35
+ array('rule_id')
36
+ )
37
+ ->where('`tbl_prices`.`rule_date`=?', $this->formatDate($date, false))
38
+ ->where('`tbl_prices`.`website_id`=?', $wId)
39
+ ->where('`tbl_prices`.`product_id`=?', $pId);
40
+ return $read->fetchAll($select);
41
+
42
+ }
43
+ }
app/code/local/Drupal/ApiExtend/Model/Observer.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //require_once('../app/Mage.php');
3
+ require_once 'Zend/XmlRpc/Client.php';
4
+
5
+ class Drupal_ApiExtend_Model_Observer
6
+ {
7
+
8
+ const EVENT_NOTIFICATION_ENABLED = 'extended_api/config/enable_event_notification';
9
+ const EVENT_NOTIFICATION_REMOTE_HOST = 'extended_api/config/remote_xmlrpc_host';
10
+ const EVENT_NOTIFICATION_REMOTE_USERNAME = 'extended_api/config/remote_xmlrpc_username';
11
+ const EVENT_NOTIFICATION_REMOTE_PASSWORD = 'extended_api/config/remote_xmlrpc_password';
12
+
13
+ /**
14
+ * Process catalog category after delete
15
+ *
16
+ * @param Varien_Event_Observer $observer
17
+ * @return Drupal_ApiExtend_Model_Observer
18
+ */
19
+ public function catalogCategoryDeleteAfter(Varien_Event_Observer $observer)
20
+ {
21
+ if (Mage::getStoreConfig(self::EVENT_NOTIFICATION_ENABLED,000)) {
22
+ // $eventCategory = $observer->getEvent()->getCategory();
23
+ // $categoryId = $eventCategory->getId();
24
+
25
+ $tree = Mage::getModel('catalog/category_api')->tree();
26
+
27
+ $host = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_HOST,000);
28
+ $username = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_USERNAME, 000);
29
+ $password = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_PASSWORD, 000);
30
+ if ($host) {
31
+ $client = new Zend_XmlRpc_Client($host);
32
+ $sessId = $client->call('system.connect', array());
33
+ if ($sessId) {
34
+ $sessId = $client->call('user.login', array($sessId['sessid'], $username, $password));
35
+ if ($sessId) {
36
+ $result = $client->call('magento_api.catalogCategoryDeleteEventHandler', array($sessId['sessid'], $tree));
37
+ }
38
+ }
39
+ }
40
+ }
41
+ return $this;
42
+ }
43
+
44
+ /**
45
+ * Process catalog category after delete
46
+ *
47
+ * @param Varien_Event_Observer $observer
48
+ * @return Drupal_ApiExtend_Model_Observer
49
+ */
50
+ public function catalogCategorySaveAfter(Varien_Event_Observer $observer)
51
+ {
52
+ if (Mage::getStoreConfig(self::EVENT_NOTIFICATION_ENABLED,000)) {
53
+
54
+ // $eventCategory = $observer->getEvent()->getCategory();
55
+ // $categoryId = $eventCategory->getId();
56
+
57
+ $tree = Mage::getModel('catalog/category_api')->tree();
58
+
59
+ $host = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_HOST,000);
60
+ $username = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_USERNAME, 000);
61
+ $password = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_PASSWORD, 000);
62
+ if ($host) {
63
+ $client = new Zend_XmlRpc_Client($host);
64
+ $sessId = $client->call('system.connect', array());
65
+ if ($sessId) {
66
+ $sessId = $client->call('user.login', array($sessId['sessid'], $username, $password));
67
+ if ($sessId) {
68
+ $result = $client->call('magento_api.catalogCategorySaveEventHandler', array($sessId['sessid'], $tree));
69
+ }
70
+ }
71
+ }
72
+ }
73
+ return $this;
74
+ }
75
+
76
+ /**
77
+ * Process catalog product after save
78
+ *
79
+ * @param Varien_Event_Observer $observer
80
+ * @return Drupal_ApiExtend_Model_Observer
81
+ */
82
+ public function catalogProductSaveAfter(Varien_Event_Observer $observer)
83
+ {
84
+ if (Mage::getStoreConfig(self::EVENT_NOTIFICATION_ENABLED,000)) {
85
+ $eventProduct = $observer->getEvent()->getProduct();
86
+ $productId = $eventProduct->getId();
87
+
88
+ $host = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_HOST,000);
89
+ $username = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_USERNAME, 000);
90
+ $password = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_PASSWORD, 000);
91
+ if ($host) {
92
+ $client = new Zend_XmlRpc_Client($host);
93
+ $sessId = $client->call('system.connect', array());
94
+ if ($sessId) {
95
+ $sessId = $client->call('user.login', array($sessId['sessid'], $username, $password));
96
+ if ($sessId) {
97
+ $result = $client->call('magento_api.productSaveEventHandler', array($sessId['sessid'], $productId));
98
+ }
99
+ }
100
+ }
101
+ }
102
+ return $this;
103
+ }
104
+
105
+ /**
106
+ * Process catalog product after delete
107
+ *
108
+ * @param Varien_Event_Observer $observer
109
+ * @return Drupal_ApiExtend_Model_Observer
110
+ */
111
+ public function catalogProductDeleteAfter(Varien_Event_Observer $observer)
112
+ {
113
+ if (Mage::getStoreConfig(self::EVENT_NOTIFICATION_ENABLED,000)) {
114
+ $eventProduct = $observer->getEvent()->getProduct();
115
+ $productId = $eventProduct->getId();
116
+
117
+ $host = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_HOST,000);
118
+ $username = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_USERNAME, 000);
119
+ $password = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_PASSWORD, 000);
120
+ if ($host) {
121
+ $client = new Zend_XmlRpc_Client($host);
122
+ $sessId = $client->call('system.connect', array());
123
+ if ($sessId) {
124
+ $sessId = $client->call('user.login', array($sessId['sessid'], $username, $password));
125
+ if ($sessId) {
126
+ $result = $client->call('magento_api.productDeleteEventHandler', array($sessId['sessid'], $productId));
127
+ }
128
+ }
129
+ }
130
+ }
131
+ return $this;
132
+ }
133
+
134
+ /**
135
+ * Update Only product status observer
136
+ *
137
+ * @param Varien_Event_Observer $observer
138
+ * @return Drupal_ApiExtend_Model_Observer
139
+ */
140
+ public function productStatusUpdate(Varien_Event_Observer $observer)
141
+ {
142
+ if (Mage::getStoreConfig(self::EVENT_NOTIFICATION_ENABLED,000)) {
143
+ $productId = $observer->getEvent()->getProductId();
144
+
145
+ $host = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_HOST,000);
146
+ $username = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_USERNAME, 000);
147
+ $password = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_PASSWORD, 000);
148
+ if ($host) {
149
+ $client = new Zend_XmlRpc_Client($host);
150
+ $sessId = $client->call('system.connect', array());
151
+ if ($sessId) {
152
+ $sessId = $client->call('user.login', array($sessId['sessid'], $username, $password));
153
+ if ($sessId) {
154
+ $result = $client->call('magento_api.productStatusUpdateEventHandler', array($sessId['sessid'], $productId));
155
+ }
156
+ }
157
+ }
158
+ }
159
+ return $this;
160
+ }
161
+
162
+ /**
163
+ * Process catalog rule after apply
164
+ *
165
+ * @param Varien_Event_Observer $observer
166
+ * @return Drupal_ApiExtend_Model_Observer
167
+ */
168
+ public function catalogRuleApplyAfter(Varien_Event_Observer $observer)
169
+ {
170
+ if (Mage::getStoreConfig(self::EVENT_NOTIFICATION_ENABLED,000)) {
171
+ try {
172
+ $host = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_HOST,000);
173
+ $username = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_USERNAME, 000);
174
+ $password = Mage::getStoreConfig(self::EVENT_NOTIFICATION_REMOTE_PASSWORD, 000);
175
+ if ($host) {
176
+ $client = new Zend_XmlRpc_Client($host);
177
+ $sessId = $client->call('system.connect', array());
178
+ if ($sessId) {
179
+ $sessId = $client->call('user.login', array($sessId['sessid'], $username, $password));
180
+ if ($sessId) {
181
+ $result = $client->call('magento_api.catalogRuleApplyAfterEventHandler', array($sessId['sessid']));
182
+ }
183
+ }
184
+ }
185
+ }
186
+ catch (Exception $e){
187
+ Mage::log(sprintf('Catalog rule after apply event notification error: %s', $e->getMessage()), Zend_Log::ERR);
188
+ }
189
+ }
190
+ return $this;
191
+ }
192
+ }
app/code/local/Drupal/ApiExtend/Model/Order/Api.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Drupal_ApiExtend_Model_Order_Api extends Mage_Api_Model_Resource_Abstract
3
+ {
4
+ /**
5
+ * Retrieve order create model
6
+ *
7
+ * @return Mage_Adminhtml_Model_Sales_Order_Create
8
+ */
9
+ protected function _getOrderCreateModel()
10
+ {
11
+ return Mage::getSingleton('adminhtml/sales_order_create');
12
+ }
13
+
14
+ /**
15
+ * Retrieve session object
16
+ *
17
+ * @return Mage_Adminhtml_Model_Session_Quote
18
+ */
19
+ protected function _getSession()
20
+ {
21
+ return Mage::getSingleton('adminhtml/session_quote');
22
+ }
23
+
24
+ /**
25
+ * Initialize order creation session data
26
+ *
27
+ * @param array $data
28
+ * @return Mage_Adminhtml_Sales_Order_CreateController
29
+ */
30
+ protected function _initSession($data)
31
+ {
32
+ /**
33
+ * Identify customer
34
+ */
35
+ if (!empty($data['customer_id'])) {
36
+ $this->_getSession()->setCustomerId((int) $data['customer_id']);
37
+ }
38
+
39
+ /**
40
+ * Identify store
41
+ */
42
+ if (!empty($data['store_id'])) {
43
+ $this->_getSession()->setStoreId((int) $data['store_id']);
44
+ }
45
+
46
+ return $this;
47
+ }
48
+
49
+ /**
50
+ * Get checkout session namespace
51
+ *
52
+ * @return Mage_Checkout_Model_Session
53
+ */
54
+ protected function _initCheckout($data)
55
+ {
56
+ $session = Mage::getSingleton('checkout/session');
57
+ $session->setCustomerId((int) $data['customer_id']);
58
+ $session->setStoreId((int) $data['store_id']);
59
+ $session->getQuote()->save();
60
+ return $session;
61
+ }
62
+
63
+ /**
64
+ * Processing quote data
65
+ *
66
+ * @param array $data
67
+ * @return Yournamespace_Yourmodule_IndexController
68
+ */
69
+ protected function _processQuote($data = array())
70
+ {
71
+ /**
72
+ * Saving order data
73
+ */
74
+ if (!empty($data['order'])) {
75
+ $this->_getOrderCreateModel()->importPostData($data['order']);
76
+ }
77
+
78
+ /**
79
+ * init first billing address, need for virtual products
80
+ */
81
+ $this->_getOrderCreateModel()->getBillingAddress();
82
+ $this->_getOrderCreateModel()->setShippingAsBilling(true);
83
+
84
+ /**
85
+ * Adding products to quote from special grid and
86
+ */
87
+ if (!empty($data['add_products'])) {
88
+ $this->_getOrderCreateModel()->addProducts($data['add_products']);
89
+ }
90
+
91
+ /**
92
+ * Collecting shipping rates
93
+ */
94
+ $this->_getOrderCreateModel()->collectShippingRates();
95
+
96
+ /**
97
+ * Adding payment data
98
+ */
99
+ if (!empty($data['payment'])) {
100
+ $this->_getOrderCreateModel()->getQuote()->getPayment()->addData($data['payment']);
101
+ }
102
+
103
+ $this->_getOrderCreateModel()
104
+ ->initRuleData()
105
+ ->saveQuote();
106
+
107
+ if (!empty($data['payment'])) {
108
+ $this->_getOrderCreateModel()->getQuote()->getPayment()->addData($data['payment']);
109
+ }
110
+
111
+ return $this;
112
+ }
113
+
114
+ /**
115
+ * Prepare order data
116
+ *
117
+ * @param array $orderData
118
+ * @return array
119
+ */
120
+ protected function _prepareOrderData($orderData) {
121
+ $customer = Mage::getModel('customer/customer')->load($orderData['magento_user']);
122
+ // error_log("_prepareOrderData: \n", 3, "errr.log");
123
+ // $customer = Mage::getModel('customer/customer')->load(2);
124
+
125
+ $result = array();
126
+ $result['session'] = array(
127
+ 'customer_id' => $orderData['magento_user'],
128
+ 'store_id' => Mage::app()->getStore()->getStoreId(),
129
+ );
130
+ $result['payment'] = array(
131
+ 'method' => $orderData['payment_method'],
132
+ 'po_number' => '',
133
+ 'cc_type'=> '',
134
+ 'cc_number'=> '',
135
+ 'cc_last4' => '',
136
+ 'cc_owner' => '',
137
+ 'cc_exp_month' => '',
138
+ 'cc_exp_year' => '',
139
+ 'cc_ss_start_month' => '',
140
+ 'cc_ss_start_year' => '',
141
+ );
142
+ $result['order']['currency'] = Mage::app()->getStore()->getBaseCurrencyCode();
143
+ $result['order']['account'] = array(
144
+ 'group_id' => $customer->getGroupId(),
145
+ 'email' => (string) $customer->getEmail(),
146
+ );
147
+ $result['order']['comment'] = array('customer_note' => 'API ORDER');
148
+ $result['order']['send_confirmation'] = 1;
149
+ $result['order']['shipping_method'] = $orderData['shipment_method'];
150
+ $result['order']['billing_address'] = $orderData['billing_information'];
151
+ $result['order']['shipping_address'] = $orderData['shipping_information'];
152
+
153
+ foreach ($orderData['products'] as $product) {
154
+ $result['add_products'][$product['id']] = array('qty' => $product['qty']);
155
+ }
156
+ return $result;
157
+ }
158
+
159
+ /**
160
+ * Create new order
161
+ *
162
+ * @return array
163
+ */
164
+ public function create($orderData = null)
165
+ {
166
+ $orderData = $this->_prepareOrderData($orderData);
167
+ if (!empty($orderData)) {
168
+ // we have valid order data
169
+ $this->_initSession($orderData['session']);
170
+ try {
171
+ $this->_processQuote($orderData);
172
+
173
+ $this->_initCheckout($orderData['session']);
174
+
175
+ if (!empty($orderData['payment'])) {
176
+ $this->_getOrderCreateModel()->setPaymentData($orderData['payment']);
177
+ $this->_getOrderCreateModel()->getQuote()->getPayment()->addData($orderData['payment']);
178
+ }
179
+
180
+ $order = $this->_getOrderCreateModel()
181
+ ->importPostData($orderData['order'])
182
+ ->createOrder();
183
+
184
+ $order_id = $order->getIncrementId();
185
+
186
+ $result = array();
187
+ $result['order_increment_id'] = $order_id;
188
+ $result['shipping_amount'] = $order->getData('shipping_amount');
189
+ $result['subtotal'] = $order->getData('subtotal');
190
+ $result['grand_total'] = $order->getData('total_due');
191
+ $result['tax_amount'] = $order->getData('tax_amount');
192
+ $result['discount_amount'] = $order->getData('discount_amount');
193
+
194
+ $this->_getSession()->clear();
195
+ Mage::unregister('rule_data');
196
+ Mage::log('Order Successfull', Zend_Log::INFO);
197
+
198
+ // error_log("return: \n".var_export($result, true), 3, "errr.log");
199
+ return $result;
200
+ }
201
+ catch (Exception $e){
202
+ // error_log(sprintf('Order saving error: %s', $e->getMessage()), 3, "errr.log");
203
+ Mage::log(sprintf('Order saving error: %s', $e->getMessage()), Zend_Log::ERR);
204
+ }
205
+ }
206
+ }
207
+ } // Class Drupal_ApiExtend_Model_Order_Api End
208
+
app/code/local/Drupal/ApiExtend/Model/Payment/Api.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Drupal_ApiExtend_Model_Payment_Api extends Mage_Api_Model_Resource_Abstract
3
+ {
4
+ /**
5
+ * Retrieve active payment methods
6
+ *
7
+ * @return array
8
+ */
9
+ public function items()
10
+ {
11
+ $payments = Mage::getSingleton('payment/config')->getActiveMethods();
12
+ $methods = array();
13
+ foreach ($payments as $paymentCode=>$paymentModel) {
14
+ if (strtoupper($paymentCode) != 'GOOGLECHECKOUT') {
15
+ $paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
16
+ $methods[$paymentCode] = $paymentTitle;
17
+ }
18
+ }
19
+ return $methods;
20
+ }
21
+
22
+ public function PayPalWPSAccount() {
23
+ $result = array();
24
+ $result['account'] = Mage::getStoreConfig('paypal/wps/business_account');
25
+ $result['name'] = Mage::getStoreConfig('paypal/wps/business_name');
26
+ return $result;
27
+ }
28
+ } // Class Drupal_ApiExtend_Model_Payment_Api End
29
+
app/code/local/Drupal/ApiExtend/Model/Quote/Api.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Drupal_ApiExtend_Model_Quote_Api extends Mage_Api_Model_Resource_Abstract
3
+ {
4
+ /**
5
+ * Create new quote
6
+ *
7
+ * @return array
8
+ */
9
+ public function create($orderData = null)
10
+ {
11
+ $checkout = Mage::getSingleton('checkout/session');
12
+ $quote = $checkout->getQuote();
13
+
14
+ // look up customer
15
+ $customer = Mage::getModel('customer/customer')
16
+ ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
17
+ ->load($orderData['magento_user']);
18
+
19
+ $quote->assignCustomer($customer);
20
+ $quote->setIsMultiShipping(false);
21
+ $quote->save();
22
+
23
+ $address = $quote->getShippingAddress();
24
+ $address->setCollectShippingRates(true);
25
+
26
+ $quote->setShippingAddress($address);
27
+ $quote->collectTotals()->save();
28
+
29
+ // set shipping method
30
+ $quote->getShippingAddress()->setShippingMethod(null);
31
+ $quote->collectTotals()->save();
32
+
33
+ // set payment
34
+ $payment = $quote->getPayment();
35
+ $payment->importData(array(
36
+ 'method' => 'free',
37
+ // 'po_number' => $xml->getPoNumber()
38
+ ));
39
+ $quote->getShippingAddress()->setPaymentMethod($payment->getMethod());
40
+ $quote->collectTotals()->save();
41
+
42
+ $result = array();
43
+
44
+ // add products
45
+ foreach ($orderData['products'] as $orderProduct) {
46
+ $product = Mage::getModel('catalog/product');
47
+ /* @var $product Mage_Catalog_Model_Product */
48
+
49
+ $store = Mage::app()->getStore()->getStoreId();
50
+ $product->setStoreId($store);
51
+ $product->load($orderProduct['id']);
52
+ $quote->addProduct($product, intval($orderProduct['qty']));
53
+ $result['products'][$product->getId()] = array(
54
+ 'price' => $product->getFinalPrice($orderProduct['qty']),
55
+ 'qty' => $orderProduct['qty'],
56
+ );
57
+ }
58
+
59
+ // save quote
60
+ $quote->collectTotals()->save();
61
+
62
+ $result['subtotal'] = $quote->getSubtotal();
63
+ $result['discount_amount'] = $quote->getShippingAddress()->getDiscountAmount();
64
+ $result['grand_total'] = $quote->getBaseGrandTotal();
65
+ $result['taxes'] = $quote->getShippingAddress()->getAppliedTaxes();
66
+
67
+ return $result;
68
+ }
69
+ } // Class Drupal_ApiExtend_Model_Quote_Api End
70
+
app/code/local/Drupal/ApiExtend/Model/Rule/Api.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Drupal_ApiExtend_Model_Rule_Api extends Mage_Api_Model_Resource_Abstract
3
+ {
4
+ /**
5
+ * Retrieve rules list
6
+ *
7
+ * @return array
8
+ */
9
+ public function rulesList()
10
+ {
11
+ $rules = Mage::getModel('catalogrule/rule')->getCollection();
12
+ $result = $rules->toArray();
13
+
14
+ return $result;
15
+ }
16
+
17
+ } // Class Drupal_ApiExtend_Model_Rule_Api End
18
+
app/code/local/Drupal/ApiExtend/Model/Shipment/Api.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Drupal_ApiExtend_Model_Shipment_Api extends Mage_Api_Model_Resource_Abstract
3
+ {
4
+ /**
5
+ * Retrieve shipment methods
6
+ *
7
+ * @return array
8
+ */
9
+ public function items()
10
+ {
11
+ $methods = Mage::getModel('adminhtml/system_config_source_shipping_allmethods')
12
+ ->toOptionArray(true);
13
+ return $methods;
14
+ }
15
+ } // Class Drupal_ApiExtend_Model_Shipment_Api End
16
+
app/code/local/Drupal/ApiExtend/etc/api.xml ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <api>
4
+ <resources>
5
+ <shipment translate="title" module="ApiExtend">
6
+ <model>ApiExtend/shipment_api</model>
7
+ <title>Shipment methods Api</title>
8
+ <methods>
9
+ <list translate="title" module="ApiExtend">
10
+ <title>Retrieve shipment methods</title>
11
+ <method>items</method>
12
+ <acl>ApiExtend/shipment</acl>
13
+ </list>
14
+ </methods>
15
+ </shipment>
16
+ <payment translate="title" module="ApiExtend">
17
+ <model>ApiExtend/payment_api</model>
18
+ <title>Active Payment methods Api</title>
19
+ <methods>
20
+ <list translate="title" module="ApiExtend">
21
+ <title>Retrieve active payment methods</title>
22
+ <method>items</method>
23
+ <acl>ApiExtend/payment</acl>
24
+ </list>
25
+ <paypal_wps_account_info>
26
+ <title>Retrieve PayPal Website Payments Standard account info</title>
27
+ <method>PayPalWPSAccount</method>
28
+ <acl>ApiExtend/payment</acl>
29
+ </paypal_wps_account_info>
30
+ </methods>
31
+ </payment>
32
+ <quote translate="title" module="ApiExtend">
33
+ <model>ApiExtend/quote_api</model>
34
+ <title>Quote Api</title>
35
+ <methods>
36
+ <create translate="title" module="ApiExtend">
37
+ <title>Create Quote</title>
38
+ <method>create</method>
39
+ <acl>ApiExtend/quote</acl>
40
+ </create>
41
+ </methods>
42
+ </quote>
43
+ <ext_order translate="title" module="ApiExtend">
44
+ <model>ApiExtend/order_api</model>
45
+ <title>Order Api</title>
46
+ <methods>
47
+ <create translate="title" module="ApiExtend">
48
+ <title>Create Order</title>
49
+ <method>create</method>
50
+ <acl>ApiExtend/order</acl>
51
+ </create>
52
+ </methods>
53
+ </ext_order>
54
+ <config translate="title" module="ApiExtend">
55
+ <model>ApiExtend/config_api</model>
56
+ <title>Config API</title>
57
+ <methods>
58
+ <info translate="title" module="ApiExtend">
59
+ <title>Retrieve Magento config value</title>
60
+ <method>info</method>
61
+ <acl>ApiExtend/config</acl>
62
+ </info>
63
+ <websites translate="title" module="ApiExtend">
64
+ <title>Retrieve Magento Websites list</title>
65
+ <method>websites</method>
66
+ <acl>ApiExtend/config</acl>
67
+ </websites>
68
+ <stores translate="title" module="ApiExtend">
69
+ <title>Retrieve Magento Stores list</title>
70
+ <method>stores</method>
71
+ <acl>ApiExtend/config</acl>
72
+ </stores>
73
+ <storeViews translate="title" module="ApiExtend">
74
+ <title>Retrieve Magento Store Views list</title>
75
+ <method>storeViews</method>
76
+ <acl>ApiExtend/config</acl>
77
+ </storeViews>
78
+ </methods>
79
+ </config>
80
+ <catalog translate="title" module="ApiExtend">
81
+ <model>ApiExtend/catalog_api</model>
82
+ <title>Catalog API</title>
83
+ <methods>
84
+ <productsList translate="title" module="ApiExtend">
85
+ <title>Retrieve Magento products list</title>
86
+ <method>productsList</method>
87
+ <acl>ApiExtend/catalog</acl>
88
+ </productsList>
89
+ <productFullInfo translate="title" module="ApiExtend">
90
+ <title>Retrieve Magento product full info</title>
91
+ <method>productFullInfo</method>
92
+ <acl>ApiExtend/catalog</acl>
93
+ </productFullInfo>
94
+ <productActualPrice translate="title" module="ApiExtend">
95
+ <title>Retrieve Magento product actual price</title>
96
+ <method>productActualPrice</method>
97
+ <acl>ApiExtend/catalog</acl>
98
+ </productActualPrice>
99
+ </methods>
100
+ <faults module="ApiExtend">
101
+ <store_not_exists>
102
+ <code>100</code>
103
+ <message>Requested store view not found.</message>
104
+ </store_not_exists>
105
+ <filters_invalid>
106
+ <code>101</code>
107
+ <message>Invalid filters specified. Details in error message.</message>
108
+ </filters_invalid>
109
+ <not_exists>
110
+ <code>102</code>
111
+ <message>Product not exists.</message>
112
+ </not_exists>
113
+ </faults>
114
+ </catalog>
115
+ <rule translate="title" module="ApiExtend">
116
+ <model>ApiExtend/rule_api</model>
117
+ <title>Rule API</title>
118
+ <methods>
119
+ <rulesList translate="title" module="ApiExtend">
120
+ <title>Retrieve Magento rules list</title>
121
+ <method>rulesList</method>
122
+ <acl>ApiExtend/rule</acl>
123
+ </rulesList>
124
+ </methods>
125
+ <faults module="ApiExtend">
126
+ <store_not_exists>
127
+ <code>100</code>
128
+ <message>Requested store view not found.</message>
129
+ </store_not_exists>
130
+ </faults>
131
+ </rule>
132
+ </resources>
133
+ <acl>
134
+ <resources>
135
+ <ApiExtend translate="title" module="ApiExtend">
136
+ <title>API Extend</title>
137
+ <sort_order>3</sort_order>
138
+ <shipment translate="title" module="ApiExtend">
139
+ <title>Shipment</title>
140
+ </shipment>
141
+ <payment translate="title" module="ApiExtend">
142
+ <title>Payment</title>
143
+ </payment>
144
+ <quote translate="title" module="ApiExtend">
145
+ <title>Quote</title>
146
+ </quote>
147
+ <order translate="title" module="ApiExtend">
148
+ <title>Order</title>
149
+ </order>
150
+ <config translate="title" module="ApiExtend">
151
+ <title>Config</title>
152
+ </config>
153
+ <catalog translate="title" module="ApiExtend">
154
+ <title>Catalog</title>
155
+ </catalog>
156
+ <rule translate="title" module="ApiExtend">
157
+ <title>Rules</title>
158
+ </rule>
159
+ </ApiExtend>
160
+ </resources>
161
+ </acl>
162
+ </api>
163
+ </config>
app/code/local/Drupal/ApiExtend/etc/config.xml ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <global>
4
+ <models>
5
+ <ApiExtend>
6
+ <class>Drupal_ApiExtend_Model</class>
7
+ <resourceModel>ApiExtend_Mysql4</resourceModel>
8
+ </ApiExtend>
9
+
10
+ <ApiExtend_Mysql4>
11
+ <class>Drupal_ApiExtend_Model_Mysql4</class>
12
+ <entities>
13
+ <rule>
14
+ <table>catalogrule</table>
15
+ </rule>
16
+ </entities>
17
+ </ApiExtend_Mysql4>
18
+ </models>
19
+ <resources>
20
+ <ApiExtend_read>
21
+ <connection>
22
+ <use>core_read</use>
23
+ </connection>
24
+ </ApiExtend_read>
25
+ </resources>
26
+ </global>
27
+
28
+ <default>
29
+ <extended_api>
30
+ <config>
31
+ <enabled>1</enabled>
32
+ <template>extended_api_config_template</template>
33
+ <identity>extended_api</identity>
34
+ </config>
35
+ </extended_api>
36
+ </default>
37
+
38
+ <adminhtml>
39
+ <acl>
40
+ <resources>
41
+ <admin>
42
+ <children>
43
+ <system>
44
+ <children>
45
+ <config>
46
+ <children>
47
+ <extended_api translate="title" module="api">
48
+ <title>Magento Extended API</title>
49
+ </extended_api>
50
+ </children>
51
+ </config>
52
+ </children>
53
+ </system>
54
+ </children>
55
+ </admin>
56
+ </resources>
57
+ </acl>
58
+
59
+ <events>
60
+ <catalog_category_delete_after>
61
+ <observers>
62
+ <ApiExtend>
63
+ <type>singleton</type>
64
+ <class>ApiExtend/observer</class>
65
+ <method>catalogCategoryDeleteAfter</method>
66
+ </ApiExtend>
67
+ </observers>
68
+ </catalog_category_delete_after>
69
+ <catalog_category_save_after>
70
+ <observers>
71
+ <ApiExtend>
72
+ <type>singleton</type>
73
+ <class>ApiExtend/observer</class>
74
+ <method>catalogCategorySaveAfter</method>
75
+ </ApiExtend>
76
+ </observers>
77
+ </catalog_category_save_after>
78
+ <catalog_product_save_after>
79
+ <observers>
80
+ <ApiExtend>
81
+ <type>singleton</type>
82
+ <class>ApiExtend/observer</class>
83
+ <method>catalogProductSaveAfter</method>
84
+ </ApiExtend>
85
+ </observers>
86
+ </catalog_product_save_after>
87
+ <catalog_product_delete_after>
88
+ <observers>
89
+ <ApiExtend>
90
+ <type>singleton</type>
91
+ <class>ApiExtend/observer</class>
92
+ <method>catalogProductDeleteAfter</method>
93
+ </ApiExtend>
94
+ </observers>
95
+ </catalog_product_delete_after>
96
+ <catalog_product_status_update>
97
+ <observers>
98
+ <ApiExtend>
99
+ <type>singleton</type>
100
+ <class>ApiExtend/observer</class>
101
+ <method>productStatusUpdate</method>
102
+ </ApiExtend>
103
+ </observers>
104
+ </catalog_product_status_update>
105
+ <catalogrule_after_apply>
106
+ <observers>
107
+ <ApiExtend>
108
+ <type>singleton</type>
109
+ <class>ApiExtend/observer</class>
110
+ <method>catalogRuleApplyAfter</method>
111
+ </ApiExtend>
112
+ </observers>
113
+ </catalogrule_after_apply>
114
+ </events>
115
+ </adminhtml>
116
+ </config>
app/code/local/Drupal/ApiExtend/etc/system.xml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <sections>
5
+ <extended_api translate="label" module="api">
6
+ <label>Magento Extended API</label>
7
+ <tab>service</tab>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>301</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <groups>
14
+ <config translate="label">
15
+ <label>Magento Events Notification Settings</label>
16
+ <frontend_type>text</frontend_type>
17
+ <sort_order>1</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>1</show_in_store>
21
+ <fields>
22
+ <enable_event_notification translate="label">
23
+ <label>Enable event notification</label>
24
+ <frontend_type>select</frontend_type>
25
+ <source_model>adminhtml/system_config_source_yesno</source_model>
26
+ <sort_order>0</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </enable_event_notification>
31
+ <remote_xmlrpc_host translate="label">
32
+ <label>Remote XML-RPC host url</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>1</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </remote_xmlrpc_host>
39
+ <remote_xmlrpc_username translate="label">
40
+ <label>Remote XML-RPC username</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>2</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </remote_xmlrpc_username>
47
+ <remote_xmlrpc_password translate="label">
48
+ <label>Remote XML-RPC password</label>
49
+ <frontend_type>password</frontend_type>
50
+ <sort_order>3</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
+ </remote_xmlrpc_password>
55
+ </fields>
56
+ </config>
57
+ </groups>
58
+ </extended_api>
59
+ </sections>
60
+ </config>
app/etc/modules/Drupal_ApiExtend.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Drupal_ApiExtend>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <version>0.0.1</version>
8
+ </Drupal_ApiExtend>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Drupal</name>
4
+ <version>1.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.gnu.org/copyleft/gpl.html">GNU General Public License (GPL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Drupal CMS full integration</summary>
10
+ <description>Drupal extension is a set of Core API extensions that offers a full access for Drupal modules (magento_* that can be downloaded here : ....) to Orders, Catalog and so on.
11
+
12
+ This extension, will offer you to TOTALLY bypass Magento front office, using Drupal instead.
13
+
14
+ When a new user is created a Magento user is automatically created also.
15
+ Orders can be created from Drupal, cart is managed from Drupal.
16
+ Catalog is syncrhonized, so each Magento Product is a Drupal node that you can push into Views, etc....
17
+ We're actually porting some paiement gateways (Paypal) so paiement process remains in Drupal also.</description>
18
+ <notes>Release</notes>
19
+ <authors><author><name>Maxime Topolov</name><user>auto-converted</user><email>mtopolov@adyax.com</email></author></authors>
20
+ <date>2009-06-04</date>
21
+ <time>10:42:44</time>
22
+ <contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Drupal_ApiExtend.xml" hash="6a8e6e15bb4460cb5ae0cb1e465b0231"/></dir></dir></dir></target><target name="magelocal"><dir name="Drupal"><dir name="ApiExtend"><dir name="etc"><file name="api.xml" hash="554e289ada571e902f6f6d6c1a8b7c66"/><file name="config.xml" hash="2ed5c4693f9772b6ed504097e87905e4"/><file name="system.xml" hash="4902f86ff5e699e132dd186c8b71b1bd"/></dir><dir name="Model"><dir name="Catalog"><file name="Api.php" hash="c7999af52f7f618cbf36caa853eb5062"/></dir><dir name="Config"><file name="Api.php" hash="98211f226eac5be82d3ec878af10bcdf"/></dir><dir name="Mysql4"><file name="Rule.php" hash="839815f11690e17c6464531bae2cdd8c"/></dir><dir name="Order"><file name="Api.php" hash="22272264b39098d343f5a3a0c6d56ea0"/></dir><dir name="Payment"><file name="Api.php" hash="c3bc41714b8617e195b3643e61bc8c27"/></dir><dir name="Quote"><file name="Api.php" hash="14509619244622238b41fbc01c0ff10f"/></dir><dir name="Rule"><file name="Api.php" hash="4708b97baba86bb993c0c4da9966b5a8"/></dir><dir name="Shipment"><file name="Api.php" hash="a17d2e6e6baf11046be2b8834b8e6b19"/></dir><file name="Observer.php" hash="200578174a90852968a494e6903cc71e"/></dir></dir></dir></target></contents>
23
+ <compatible/>
24
+ <dependencies/>
25
+ </package>