Ventata_Connector - Version 1.0.0.0

Version Notes

.

Download this release

Release Info

Developer Luke Davis
Extension Ventata_Connector
Version 1.0.0.0
Comparing to
See all releases


Version 1.0.0.0

app/code/local/Ventata/Connector/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Ventata_Connector_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/local/Ventata/Connector/Model/.DS_Store ADDED
Binary file
app/code/local/Ventata/Connector/Model/Order/Observer.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Ventata_Connector_Model_Order_Observer extends Varien_Event_Observer
3
+ {
4
+ public function __construct()
5
+ {
6
+ }
7
+
8
+ public function upload_order_to_ventata($observer)
9
+ {
10
+ $order = $observer->getOrder();
11
+
12
+ $data = array();
13
+ $data['DateCreated'] = "/Date(" . strtotime($order->getCreatedAt()) . ")/";
14
+ $data['ExternalOrderId'] = $order->getIncrementId();
15
+ $data['ShippingCost'] = $order->getShippingAmount();
16
+ $data['SubTotal'] = $order->getSubtotal();
17
+ $data['Taxes'] = $order->getTaxAmount();
18
+ $data['TotalPrice'] = $order->getGrandTotal();
19
+ $data['OrderDetails'] = array();
20
+ $items = $order->getAllItems();
21
+
22
+ if ($items) {
23
+ foreach ($items as $item) {
24
+ $product = $item->getProduct();
25
+ $store = Mage::getModel('core/store')->load($item->getStoreId());
26
+ $tempData = array(
27
+ 'CostPerItem' => $product->getPrice(),
28
+ 'ManuCode' => $item->getSku(),
29
+ 'Quantity' => $item->getQtyOrdered(),
30
+ 'PricePaid' => $item->getPrice(),
31
+ 'StoreCode' => $store->getCode(),
32
+ );
33
+ array_push($data['OrderDetails'], $tempData);
34
+ }
35
+ }
36
+
37
+ $data_string = json_encode($data);
38
+ $ch = curl_init();
39
+
40
+ $APIKey = Mage::getStoreConfig('ventata/orderhook_group/apikey',Mage::app()->getStore());;
41
+
42
+ $url = "https://api.ventata.com/orders?ApiKey=" . $APIKey;
43
+
44
+ curl_setopt($ch, CURLOPT_URL, $url);
45
+ curl_setopt($ch, CURLOPT_POST, true);
46
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
47
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
48
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
49
+ curl_setopt($ch, CURLOPT_VERBOSE, true);
50
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
51
+
52
+ $result = curl_exec($ch);
53
+ curl_close($ch);
54
+
55
+ return $this;
56
+ }
57
+ }
58
+ ?>
app/code/local/Ventata/Connector/etc/adminhtml.xml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
+ <admin>
9
+ <children>
10
+ <system>
11
+ <children>
12
+ <config>
13
+ <children>
14
+ <ventata>
15
+ <title>Ventata - All</title>
16
+ </ventata>
17
+ </children>
18
+ </config>
19
+ </children>
20
+ </system>
21
+ </children>
22
+ </admin>
23
+ </resources>
24
+ </acl>
25
+ </config>
app/code/local/Ventata/Connector/etc/config.xml ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Ventata_Connector>
5
+ <version>0.1.0</version>
6
+ </Ventata_Connector>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <connector>
11
+ <class>Ventata_Connector_Model</class>
12
+ </connector>
13
+ </models>
14
+ <events>
15
+ <checkout_type_onepage_save_order_after>
16
+ <observers>
17
+ <ventata_connector_order_observer>
18
+ <type>singleton</type>
19
+ <class>Ventata_Connector_Model_Order_Observer</class>
20
+ <method>upload_order_to_ventata</method>
21
+ </ventata_connector_order_observer>
22
+ </observers>
23
+ </checkout_type_onepage_save_order_after>
24
+ </events>
25
+ <helpers>
26
+ <connector>
27
+ <class>Ventata_Connector_Helper</class>
28
+ </connector>
29
+ </helpers>
30
+ </global>
31
+ </config>
app/code/local/Ventata/Connector/etc/system.xml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <sections>
4
+ <ventata translate="label" module="connector">
5
+ <label>Ventata connector</label>
6
+ <tab>general</tab>
7
+ <sort_order>1000</sort_order>
8
+ <show_in_default>1</show_in_default>
9
+ <show_in_website>1</show_in_website>
10
+ <show_in_store>1</show_in_store>
11
+
12
+ <groups>
13
+ <orderhook_group translate="label" module="connector">
14
+ <label>General Configuration</label>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>1000</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <fields>
21
+ <apikey translate="label">
22
+ <label>API key: </label>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>20</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ </apikey>
29
+ </fields>
30
+ </orderhook_group>
31
+ </groups>
32
+ </ventata>
33
+ </sections>
34
+ </config>
app/etc/modules/Ventata_Connector.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <Ventata_Connector>
6
+ <active>true</active>
7
+ <codePool>local</codePool>
8
+ </Ventata_Connector>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Ventata_Connector</name>
4
+ <version>1.0.0.0</version>
5
+ <stability>stable</stability>
6
+ <license>MIT</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Ventata Dynamic Pricing Software</summary>
10
+ <description>Ventata Dynamic Pricing Software</description>
11
+ <notes>.</notes>
12
+ <authors><author><name>Luke Davis</name><user>ventata</user><email>ldavis@ventata.com</email></author></authors>
13
+ <date>2012-06-03</date>
14
+ <time>00:32:52</time>
15
+ <contents><target name="magelocal"><dir name="Ventata"><dir name="Connector"><dir name="Helper"><file name="Data.php" hash="d2838df85bb8d15047db074dd6712ee1"/></dir><dir name="Model"><dir name="Order"><file name="Observer.php" hash="271d77bca79f23067c5e6b293ebbe69f"/></dir><file name=".DS_Store" hash="4fd0cefc93be2b011f8fe45626f49faf"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f8096b19be11130aebca410143f113b8"/><file name="config.xml" hash="aaf8535f1531ebca1c67f32c3bc1dbea"/><file name="system.xml" hash="ff3404073be3003636259b4bba99ebf6"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ventata_Connector.xml" hash="b88dfd737477ad81895d153fd3a41106"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.6.0.0</min><max>1.7</max></package></required></dependencies>
18
+ </package>