Aschroder_Orderpipe - Version 0.0.2

Version Notes

0.0.1 Initial release
0.0.2 Public release to Magento Connect

Download this release

Release Info

Developer ASchroder
Extension Aschroder_Orderpipe
Version 0.0.2
Comparing to
See all releases


Version 0.0.2

app/code/community/Aschroder/Orderpipe/Helper/Data.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /**
5
+ * OrderPipe Magento integration by World Wide Access.
6
+ *
7
+ * @package Aschroder_Orderpipe
8
+ * @author Ashley Schroder (aschroder.com)
9
+ * @copyright Copyright 2012 World Wide Access
10
+ */
11
+ class Aschroder_Orderpipe_Helper_Data extends Mage_Core_Helper_Abstract {
12
+ }
13
+
app/code/community/Aschroder/Orderpipe/Model/Observer.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * OrderPipe Magento integration by World Wide Access.
5
+ *
6
+ * @package Aschroder_Orderpipe
7
+ * @author Ashley Schroder (aschroder.com)
8
+ * @copyright @copyright Copyright 2012 World Wide Access
9
+ */
10
+ class Aschroder_Orderpipe_Model_Observer {
11
+
12
+
13
+ const PING_URL = 'orderpipe/settings/pingurl';
14
+ const ORDERPIPE_URL = 'sales/orderpipe/url';
15
+ const ORDERPIPE_USER = 'sales/orderpipe/user';
16
+
17
+ public function saveAfter($observer) {
18
+
19
+ // Older Magento versions have no commit event.
20
+ if (version_compare(Mage::getVersion(), '1.4.0.0', '<')) {
21
+ $this->saveAfterCommit($observer);
22
+ }
23
+ }
24
+
25
+ public function saveAfterCommit($observer) {
26
+
27
+ $url = Mage::getStoreConfig(self::ORDERPIPE_URL);
28
+ $user = Mage::getStoreConfig(self::ORDERPIPE_USER);
29
+ $this->ping($url, $user);
30
+ }
31
+
32
+ public function ping($url, $user, $debugMode = false) {
33
+
34
+ if (!$url || !$user) {
35
+ Mage::log("No url or user, cannot ping OrderPipe.com");
36
+ return;
37
+ }
38
+
39
+ try {
40
+
41
+ $curl = new Varien_Http_Adapter_Curl();
42
+ $curl->setConfig(array(
43
+ 'timeout' => 2 // max 2 seconds
44
+ ));
45
+
46
+ $params = http_build_query(array(
47
+ 'url' => $url,
48
+ 'user' => $user
49
+ ));
50
+
51
+ $curl->write(Zend_Http_Client::GET,
52
+ Mage::getStoreConfig(self::PING_URL)."?$params");
53
+
54
+ $data = $curl->read();
55
+ $curl->close();
56
+
57
+ if ($debugMode) {
58
+ Mage::log("Ping result: \n" . print_r($data, true));
59
+ }
60
+
61
+ } catch (Exception $e) {
62
+ // if the ping fails, we just log it and exit
63
+ Mage::log("OrderPipe.com Ping failed: \n" . $e->getMessage());
64
+ }
65
+ }
66
+
67
+ }
app/code/community/Aschroder/Orderpipe/Test.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Simple little test wrapper, run via commandline to check things are working.
5
+ */
6
+
7
+
8
+ $url = "http://www.yourstore.com";
9
+ $user = "orderpipe_username";
10
+
11
+ set_include_path(get_include_path() . PATH_SEPARATOR . getcwd());
12
+ require_once 'app/Mage.php';
13
+
14
+ Varien_Profiler::enable();
15
+ Mage::setIsDeveloperMode(true);
16
+ ini_set('display_errors', 1);
17
+
18
+ umask(0);
19
+ Mage::app('default');
20
+
21
+ // Test directly
22
+ $observer = Mage::getModel('orderpipe/observer');
23
+ $observer->ping($url, $user, true); // debug = true, we get result logging
24
+
25
+ // Test via events
26
+ // Mage::dispatchEvent('sales_order_save_commit_after', array());
app/code/community/Aschroder/Orderpipe/etc/config.xml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <config>
2
+ <!--
3
+ /**
4
+ * OrderPipe Magento integration by World Wide Access.
5
+ *
6
+ * @package Aschroder_Orderpipe
7
+ * @author Ashley Schroder (aschroder.com)
8
+ * @copyright @copyright Copyright 2012 World Wide Access
9
+ */
10
+ -->
11
+ <modules>
12
+ <Aschroder_Orderpipe>
13
+ <version>0.0.2</version>
14
+ </Aschroder_Orderpipe>
15
+ </modules>
16
+ <global>
17
+ <models>
18
+ <orderpipe>
19
+ <class>Aschroder_Orderpipe_Model</class>
20
+ </orderpipe>
21
+ </models>
22
+ <helpers>
23
+ <orderpipe>
24
+ <class>Aschroder_Orderpipe_Helper</class>
25
+ </orderpipe>
26
+ </helpers>
27
+ </global>
28
+ <frontend>
29
+ <events>
30
+ <sales_order_save_after>
31
+ <observers>
32
+ <orderpipe_save>
33
+ <class>orderpipe/observer</class>
34
+ <method>saveAfter</method>
35
+ </orderpipe_save>
36
+ </observers>
37
+ </sales_order_save_after>
38
+ <sales_order_save_commit_after>
39
+ <observers>
40
+ <orderpipe_savecommit>
41
+ <class>orderpipe/observer</class>
42
+ <method>saveAfterCommit</method>
43
+ </orderpipe_savecommit>
44
+ </observers>
45
+ </sales_order_save_commit_after>
46
+ </events>
47
+ </frontend>
48
+ <adminhtml>
49
+ <events>
50
+ <sales_order_save_after>
51
+ <observers>
52
+ <orderpipe_save>
53
+ <class>orderpipe/observer</class>
54
+ <method>saveAfter</method>
55
+ </orderpipe_save>
56
+ </observers>
57
+ </sales_order_save_after>
58
+ <sales_order_save_commit_after>
59
+ <observers>
60
+ <orderpipe_savecommit>
61
+ <class>orderpipe/observer</class>
62
+ <method>saveAfterCommit</method>
63
+ </orderpipe_savecommit>
64
+ </observers>
65
+ </sales_order_save_commit_after>
66
+ </events>
67
+ </adminhtml>
68
+ <default>
69
+ <orderpipe>
70
+ <settings>
71
+ <pingurl>https://order-pipe.appspot.com/ping/magento/neworder</pingurl>
72
+ </settings>
73
+ </orderpipe>
74
+ </default>
75
+ </config>
app/code/community/Aschroder/Orderpipe/etc/system.xml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * OrderPipe Magento integration by World Wide Access.
5
+ *
6
+ * @package Aschroder_Orderpipe
7
+ * @author Ashley Schroder (aschroder.com)
8
+ * @copyright @copyright Copyright 2012 World Wide Access
9
+ */
10
+ -->
11
+ <config>
12
+ <sections>
13
+ <sales>
14
+ <groups>
15
+ <orderpipe translate="label" module="orderpipe">
16
+ <label>OrderPipe.com</label>
17
+ <comment>&lt;a href="http://www.orderpipe.com"&gt;&lt;img style="width: 500px; float: left; margin-top: 0px; margin-left: 0px; margin-right: -110px;" src="http://www.orderpipe.com/images/screenshots/slider_image_2-ipads-home.png" /&gt;&lt;/a&gt; &lt;br/&gt; &lt;a href="http://www.orderpipe.com"&gt;OrderPipe.com&lt;/a&gt; is a mobile sales dashboard for Magento, Amazon, and other shopping channels. This extension pings OrderPipe.com when you get a new order, so we can update your dashboard as soon as orders arrive, in real-time! &lt;br/&gt;&lt;br/&gt; To use the extension, please first &lt;a href="http://www.orderpipe.com"&gt;sign up for OrderPipe.com&lt;/a&gt;. Once you've signed up, please enter your store url and user from OrderPipe.com below (so we know who to match the pings up to).&lt;br/&gt;&lt;br/&gt; If you have any questions or want help setting up OrderPipe on your Magento store, please contact us by email on &lt;a href="mailto:contact@orderpipe.com"&gt;contact@orderpipe.com&lt;/a&gt; or twitter at &lt;a href="http://www.twitter.com/orderpipe"&gt;@orderpipe&lt;/a&gt; - we're standing by to assist!</comment>
18
+ <frontend_type>text</frontend_type>
19
+ <sort_order>999</sort_order>
20
+ <show_in_default>1</show_in_default>
21
+ <show_in_website>1</show_in_website>
22
+ <show_in_store>0</show_in_store>
23
+ <fields>
24
+ <url translate="label">
25
+ <label>Store Url</label>
26
+ <comment>This is the store url as it appears in OrderPipe.com</comment>
27
+ <frontend_type>text</frontend_type>
28
+ <sort_order>5</sort_order>
29
+ <show_in_default>1</show_in_default>
30
+ <show_in_website>0</show_in_website>
31
+ <show_in_store>0</show_in_store>
32
+ </url>
33
+ <user translate="label">
34
+ <label>User</label>
35
+ <comment>This is the web service user that you provided to OrderPipe.com.</comment>
36
+ <frontend_type>text</frontend_type>
37
+ <sort_order>20</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>0</show_in_website>
40
+ <show_in_store>0</show_in_store>
41
+ </user>
42
+ </fields>
43
+ </orderpipe>
44
+ </groups>
45
+ </sales>
46
+ </sections>
47
+ </config>
app/code/community/Aschroder/Orderpipe/modman ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ # modman module description
2
+ # see https://github.com/colinmollenhour/modman/ for more info
3
+ # author: Ashley
4
+
5
+ # OrderPipe.com Magento extension
6
+ * app/code/community/Aschroder/Orderpipe
7
+ modules/Aschroder_Orderpipe.xml app/etc/modules/Aschroder_Orderpipe.xml
app/code/community/Aschroder/Orderpipe/modules/Aschroder_Orderpipe.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Aschroder_Orderpipe>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Aschroder_Orderpipe>
8
+ </modules>
9
+ </config>
app/etc/modules/Aschroder_Orderpipe.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Aschroder_Orderpipe>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Aschroder_Orderpipe>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Aschroder_Orderpipe</name>
4
+ <version>0.0.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Notify the OrderPipe.com platform for real-time updates.</summary>
10
+ <description>OrderPipe.com is a mobile ecommerce dashboard. It will show you metrics, and orders on your mobile device.&#xD;
11
+ &#xD;
12
+ This extension pings the OrderPipe.com platform when you receive a new order, so that the platform can update your orders in near real-time.</description>
13
+ <notes>0.0.1 Initial release&#xD;
14
+ 0.0.2 Public release to Magento Connect</notes>
15
+ <authors><author><name>ASchroder</name><user>ashleys22</user><email>ashley.schroder@gmail.com</email></author></authors>
16
+ <date>2013-03-26</date>
17
+ <time>23:48:38</time>
18
+ <contents><target name="magecommunity"><dir name="Aschroder"><dir name="Orderpipe"><dir name="Helper"><file name="Data.php" hash="a9c5f0065aa5295edd2bb5019986f904"/></dir><dir name="Model"><file name="Observer.php" hash="dc506ce061b07540a86d4cf89369a15e"/></dir><file name="Test.php" hash="0c190c946b83f4af0e0f14404228b05d"/><dir name="etc"><file name="config.xml" hash="8bbc968b9d6472c3e0843ba63e6e1bdf"/><file name="system.xml" hash="f181ea81351c59dcb39a4a884870a3d0"/></dir><file name="modman" hash="3cb06eb8aed06e657933abff7eec12a7"/><dir name="modules"><file name="Aschroder_Orderpipe.xml" hash="4a4a8259bfefef3cc0d49b235c791814"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Aschroder_Orderpipe.xml" hash="4a4a8259bfefef3cc0d49b235c791814"/></dir></target></contents>
19
+ <compatible/>
20
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
21
+ </package>