Yireo_CheckoutTester - Version 0.0.4

Version Notes

No notes

Download this release

Release Info

Developer Yireo
Extension Yireo_CheckoutTester
Version 0.0.4
Comparing to
See all releases


Version 0.0.4

app/code/community/Yireo/CheckoutTester/Block/Success.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Yireo CheckoutTester for Magento
4
+ *
5
+ * @package Yireo_CheckoutTester
6
+ * @author Yireo (http://www.yireo.com/)
7
+ * @copyright Copyright (C) 2014 Yireo (http://www.yireo.com/)
8
+ * @license Open Source License (OSL v3)
9
+ */
10
+
11
+ class Yireo_CheckoutTester_Block_Success extends Mage_Checkout_Block_Onepage_Success
12
+ {
13
+ }
app/code/community/Yireo/CheckoutTester/Helper/Data.php ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Yireo CheckoutTester for Magento
4
+ *
5
+ * @package Yireo_CheckoutTester
6
+ * @author Yireo (http://www.yireo.com/)
7
+ * @copyright Copyright (C) 2014 Yireo (http://www.yireo.com/)
8
+ * @license Open Source License (OSL v3)
9
+ */
10
+
11
+ /**
12
+ * CheckoutTester helper
13
+ */
14
+ class Yireo_CheckoutTester_Helper_Data extends Mage_Core_Helper_Abstract
15
+ {
16
+ /*
17
+ * Switch to determine whether this extension is enabled or not
18
+ *
19
+ * @access public
20
+ * @param null
21
+ * @return string
22
+ */
23
+ public function enabled()
24
+ {
25
+ return true;
26
+ }
27
+
28
+ /*
29
+ * Method to determine whether the current user has access to this page
30
+ *
31
+ * @access public
32
+ * @param null
33
+ * @return string
34
+ */
35
+ public function hasAccess()
36
+ {
37
+ $ip = Mage::getStoreConfig('checkouttester/settings/ip');
38
+ $ip = trim($ip);
39
+ if(!empty($ip)) {
40
+ $ips = explode(',', $ip);
41
+ foreach($ips as $ip) {
42
+ $ip = trim($ip);
43
+ if(empty($ip)) continue;
44
+ if($ip == $_SERVER['REMOTE_ADDR']) {
45
+ return true;
46
+ }
47
+ }
48
+ return false;
49
+ }
50
+
51
+ return true;
52
+ }
53
+
54
+ /*
55
+ * Return the order ID
56
+ *
57
+ * @access public
58
+ * @param null
59
+ * @return string
60
+ */
61
+ public function getOrderId()
62
+ {
63
+ return (int)Mage::getStoreConfig('checkouttester/settings/order_id');
64
+ }
65
+ }
app/code/community/Yireo/CheckoutTester/Model/Feed.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Yireo Common
4
+ *
5
+ * @author Yireo
6
+ * @package Yireo_Common
7
+ * @copyright Copyright 2014
8
+ * @license Open Source License (OSL v3) (OSL)
9
+ * @link http://www.yireo.com
10
+ */
11
+
12
+ /*
13
+ * Feed Model
14
+ */
15
+ class Yireo_CheckoutTester_Model_Feed extends Mage_AdminNotification_Model_Feed
16
+ {
17
+ /**
18
+ * Return the feed URL
19
+ */
20
+ protected $customFeedUrl = 'www.yireo.com/extfeed?format=feed&platform=magento&extension=checkouttester';
21
+
22
+ /**
23
+ * Return the feed URL
24
+ *
25
+ * @return string
26
+ */
27
+ public function getFeedUrl()
28
+ {
29
+ return Mage::getStoreConfigFlag(self::XML_USE_HTTPS_PATH) ? 'https://' : 'http://'.$this->customFeedUrl;
30
+ }
31
+
32
+ /**
33
+ * Try to update feed
34
+ *
35
+ * @return mixed
36
+ */
37
+ public function updateIfAllowed()
38
+ {
39
+ // Is this the backend
40
+ if (Mage::app()->getStore()->isAdmin() == false) {
41
+ return false;
42
+ }
43
+
44
+ // Is the backend-user logged-in
45
+ if (Mage::getSingleton('admin/session')->isLoggedIn() == false) {
46
+ return false;
47
+ }
48
+
49
+ // Is the feed disabled?
50
+ if((bool)Mage::getStoreConfig('yireo/common/disabled')) {
51
+ return false;
52
+ }
53
+
54
+ // Update the feed
55
+ $this->checkUpdate();
56
+ }
57
+
58
+ /**
59
+ * Override the original method
60
+ *
61
+ * @return SimpleXMLElement
62
+ */
63
+ public function getFeedData()
64
+ {
65
+ // Get the original data
66
+ $feedXml = parent::getFeedData();
67
+
68
+ if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
69
+ foreach ($feedXml->channel->item as $item) {
70
+
71
+ // Add the severity to each item
72
+ $feedXml->channel->item->severity = Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE;
73
+ }
74
+ }
75
+
76
+ return $feedXml;
77
+ }
78
+ }
app/code/community/Yireo/CheckoutTester/Model/Observer.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Yireo CheckoutTester
4
+ *
5
+ * @author Yireo
6
+ * @package CheckoutTester
7
+ * @copyright Copyright 2014
8
+ * @license Open Source License (OSL v3)
9
+ * @link http://www.yireo.com
10
+ */
11
+
12
+ /*
13
+ * CheckoutTester observer to various Magento events
14
+ */
15
+ class Yireo_CheckoutTester_Model_Observer extends Mage_Core_Model_Abstract
16
+ {
17
+ /*
18
+ * Method fired on the event <controller_action_predispatch>
19
+ *
20
+ * @access public
21
+ * @param Varien_Event_Observer $observer
22
+ * @return Yireo_CheckoutTester_Model_Observer
23
+ */
24
+ public function controllerActionPredispatch($observer)
25
+ {
26
+ // Run the feed
27
+ Mage::getModel('checkouttester/feed')->updateIfAllowed();
28
+ }
29
+ }
app/code/community/Yireo/CheckoutTester/controllers/IndexController.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Yireo CheckoutTester for Magento
4
+ *
5
+ * @package Yireo_CheckoutTester
6
+ * @author Yireo (http://www.yireo.com/)
7
+ * @copyright Copyright (C) 2014 Yireo (http://www.yireo.com/)
8
+ * @license Open Source License (OSL v3)
9
+ */
10
+
11
+ /**
12
+ * CheckoutTester frontend controller
13
+ *
14
+ * @category CheckoutTester
15
+ * @package Yireo_CheckoutTester
16
+ */
17
+ class Yireo_CheckoutTester_IndexController extends Mage_Core_Controller_Front_Action
18
+ {
19
+ /**
20
+ * Empty page
21
+ *
22
+ */
23
+ public function indexAction()
24
+ {
25
+ echo 'not implemented';exit;
26
+ }
27
+
28
+ /**
29
+ * Success page
30
+ *
31
+ */
32
+ public function successAction()
33
+ {
34
+ // Check access
35
+ if(Mage::helper('checkouttester')->hasAccess() == false) {
36
+ die('Access denied');
37
+ }
38
+
39
+ // Load the order ID
40
+ $orderId = (int)Mage::helper('checkouttester')->getOrderId();
41
+ $urlId = (int)$this->getRequest()->getParam('order_id');
42
+ if(!empty($urlId)) {
43
+ $orderId = $urlId;
44
+ }
45
+
46
+ // Load the order
47
+ $order = Mage::getModel('sales/order')->load($orderId);
48
+ Mage::getModel('checkout/session')->setLastOrderId($order->getId())
49
+ ->setLastRealOrderId($order->getIncrementId());
50
+
51
+ // Load the layout
52
+ $this->loadLayout();
53
+ $this->renderLayout();
54
+ }
55
+ }
app/code/community/Yireo/CheckoutTester/etc/adminhtml.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Yireo CheckoutTester for Magento
5
+ *
6
+ * @package Yireo_CheckoutTester
7
+ * @author Yireo (http://www.yireo.com/)
8
+ * @copyright Copyright (C) 2014 Yireo (http://www.yireo.com/)
9
+ * @license Open Source License (OSL v3)
10
+ */
11
+ -->
12
+ <config>
13
+ <translate>
14
+ <modules>
15
+ <Yireo_CheckoutTester>
16
+ <files>
17
+ <default>Yireo_CheckoutTester.csv</default>
18
+ </files>
19
+ </Yireo_CheckoutTester>
20
+ </modules>
21
+ </translate>
22
+
23
+ <acl>
24
+ <resources>
25
+ <admin>
26
+ <children>
27
+ <system>
28
+ <children>
29
+ <config>
30
+ <children>
31
+ <checkouttester>
32
+ <title>Yireo_CheckoutTester Settings</title>
33
+ </checkouttester>
34
+ </children>
35
+ </config>
36
+ </children>
37
+ </system>
38
+ </children>
39
+ </admin>
40
+ </resources>
41
+ </acl>
42
+ </config>
app/code/community/Yireo/CheckoutTester/etc/config.xml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Yireo CheckoutTester for Magento
5
+ *
6
+ * @package Yireo_CheckoutTester
7
+ * @author Yireo (http://www.yireo.com/)
8
+ * @copyright Copyright (C) 2014 Yireo (http://www.yireo.com/)
9
+ * @license Open Source License (OSL v3)
10
+ */
11
+ -->
12
+ <config>
13
+
14
+ <modules>
15
+ <Yireo_CheckoutTester>
16
+ <version>0.0.4</version>
17
+ </Yireo_CheckoutTester>
18
+ </modules>
19
+
20
+ <global>
21
+ <blocks>
22
+ <checkouttester>
23
+ <class>Yireo_CheckoutTester_Block</class>
24
+ </checkouttester>
25
+ </blocks>
26
+
27
+ <helpers>
28
+ <checkouttester>
29
+ <class>Yireo_CheckoutTester_Helper</class>
30
+ </checkouttester>
31
+ </helpers>
32
+
33
+ <models>
34
+ <checkouttester>
35
+ <class>Yireo_CheckoutTester_Model</class>
36
+ </checkouttester>
37
+ </models>
38
+
39
+ <events>
40
+ <controller_action_predispatch>
41
+ <observers>
42
+ <checkouttester_controller_action_predispatch>
43
+ <type>singleton</type>
44
+ <class>Yireo_CheckoutTester_Model_Observer</class>
45
+ <method>controllerActionPredispatch</method>
46
+ </checkouttester_controller_action_predispatch>
47
+ </observers>
48
+ </controller_action_predispatch>
49
+ </events>
50
+ </global>
51
+
52
+ <frontend>
53
+ <routers>
54
+ <checkouttester>
55
+ <use>standard</use>
56
+ <args>
57
+ <module>Yireo_CheckoutTester</module>
58
+ <frontName>checkouttester</frontName>
59
+ </args>
60
+ </checkouttester>
61
+ </routers>
62
+ <layout>
63
+ <updates>
64
+ <checkouttester>
65
+ <file>checkouttester.xml</file>
66
+ </checkouttester>
67
+ </updates>
68
+ </layout>
69
+ </frontend>
70
+
71
+ <default>
72
+ <checkouttester>
73
+ <settings>
74
+ <order_id>0</order_id>
75
+ <ip></ip>
76
+ </settings>
77
+ </checkouttester>
78
+ </default>
79
+ </config>
app/code/community/Yireo/CheckoutTester/etc/system.xml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Yireo CheckoutTester for Magento
5
+ *
6
+ * @package Yireo_CheckoutTester
7
+ * @author Yireo (http://www.yireo.com/)
8
+ * @copyright Copyright (C) 2014 Yireo (http://www.yireo.com/)
9
+ * @license Open Source License (OSL v3)
10
+ */
11
+ -->
12
+ <config>
13
+ <tabs>
14
+ <yireo translate="label" module="checkouttester">
15
+ <label>Yireo</label>
16
+ <sort_order>900</sort_order>
17
+ </yireo>
18
+ </tabs>
19
+ <sections>
20
+ <checkouttester translate="label" module="checkouttester">
21
+ <label>Checkout Tester</label>
22
+ <tab>yireo</tab>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>0</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
+ <groups>
29
+ <settings translate="label">
30
+ <label>Default Settings</label>
31
+ <frontend_type>text</frontend_type>
32
+ <sort_order>1</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>0</show_in_website>
35
+ <show_in_store>0</show_in_store>
36
+ <fields>
37
+ <order_id translate="label">
38
+ <label>Sales Order ID</label>
39
+ <comment><![CDATA[Numerical ID of sales-order entity]]></comment>
40
+ <frontend_type>text</frontend_type>
41
+ <sort_order>1</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ </order_id>
46
+ <ip translate="label">
47
+ <label>Development IP</label>
48
+ <comment><![CDATA[CSV-list of IP-addresses allowed access]]></comment>
49
+ <frontend_type>text</frontend_type>
50
+ <sort_order>2</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </ip>
55
+ </fields>
56
+ </settings>
57
+ </groups>
58
+ </checkouttester>
59
+ </sections>
60
+ </config>
app/design/frontend/base/default/layout/checkouttester.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ * Yireo CheckoutTester for Magento
4
+ *
5
+ * @package Yireo_CheckoutTester
6
+ * @author Yireo (http://www.yireo.com/)
7
+ * @copyright Copyright (c) 2014 Yireo (http://www.yireo.com/)
8
+ * @license Open Software License
9
+ */
10
+ -->
11
+ <layout version="0.1.0">
12
+ <checkouttester_index_success translate="label">
13
+ <label>One Page Checkout Success</label>
14
+ <reference name="root">
15
+ <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
16
+ </reference>
17
+ <reference name="content">
18
+ <block type="checkouttester/success" name="checkout.success" template="checkout/success.phtml"/>
19
+ </reference>
20
+ </checkouttester_index_success>
21
+ </layout>
app/etc/modules/Yireo_CheckoutTester.xml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Yireo CheckoutTester-module for Magento
5
+ *
6
+ * @package Yireo_CheckoutTester
7
+ * @author Yireo (http://www.yireo.com/)
8
+ * @copyright Copyright (c) 2013 Yireo (http://www.yireo.com/)
9
+ * @license Open Software License
10
+ */
11
+ -->
12
+ <config>
13
+ <modules>
14
+ <Yireo_CheckoutTester>
15
+ <active>true</active>
16
+ <codePool>community</codePool>
17
+ </Yireo_CheckoutTester>
18
+ </modules>
19
+ </config>
package.xml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0"?>
2
+ <package><name>Yireo_CheckoutTester</name><version>0.0.4</version><stability>stable</stability><license>Open Source License</license><channel>community</channel><extends></extends><summary>No summary</summary><description>No description</description><notes>No notes</notes><authors><author><name>Yireo</name><user>yireo</user><email>info@yireo.com</email></author></authors><date>2014-03-17</date><time>9:10:00</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Yireo_CheckoutTester.xml" hash="5c25ce11fa9c85fa23a32225a674951a"/></dir></dir><dir name="code"><dir name="community"><dir name="Yireo"><dir name="CheckoutTester"><dir name="controllers"><file name="IndexController.php" hash="b512100cd882760df9f1ccd2035b2923"/></dir><dir name="Block"><file name="Success.php" hash="a069a62e023e121238126212ca24601e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e55f7023e0538a0cd564dd5c9327465d"/><file name="config.xml" hash="6925f0f94eb884df44d8f196b62896b9"/><file name="system.xml" hash="1371c7eec4d052995d16b53c98b413f5"/></dir><dir name="Helper"><file name="Data.php" hash="4b908f748d9f003b5f3cc23f7dbcb9b3"/></dir><dir name="Model"><file name="Feed.php" hash="da5af719014c1cb94daad9cbe5a340b4"/><file name="Observer.php" hash="00c05b283b67c57442aaf0216764e7f3"/></dir></dir></dir></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="checkouttester.xml" hash="b58246dad975b460010e9fd7a86e8d3a"/></dir></dir></dir></dir></dir></dir></target></contents></package>