Official_Netfeedback_Extension - Version 0.1.0

Version Notes

First Stable Version

Download this release

Release Info

Developer Magento Core Team
Extension Official_Netfeedback_Extension
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/local/Official/Netfeedback/Helper/Data.php ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ <?php
2
+ class Official_Netfeedback_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
5
+
app/code/local/Official/Netfeedback/Model/Mode.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Official_Netfeedback_Model_Mode
3
+ {
4
+ public function toOptionArray()
5
+ {
6
+ return array(
7
+ array('value' => 'success', 'label' => 'Order Placed'),
8
+ array('value' => 'shipping', 'label' =>'Order Shipped'),
9
+ );
10
+ }
11
+ }
app/code/local/Official/Netfeedback/Model/Observer.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Official_Netfeedback_Model_Observer
3
+ {
4
+ public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer)
5
+ {
6
+ $shipment = $observer->getEvent()->getShipment();
7
+ $order = $shipment->getOrder();
8
+ $code = $order->getStoreId();
9
+
10
+ $enable = (int) Mage::getStoreConfig('feedbacksection/settings/enabled', $code);
11
+ $mode = Mage::getStoreConfig('feedbacksection/settings/mode', $code);
12
+ if($enable == 1 && $mode == 'shipping')
13
+ {
14
+ $customerEmail = urlencode($order->getCustomerEmail());
15
+ $name = urlencode($order->getCustomerFirstname()." ".$order->getCustomerLastname());
16
+ $orderNumber = urlencode($order->getIncrementId());
17
+ $orderDate = urlencode($order->getCreatedAt());
18
+ $apikey = urlencode(Mage::getStoreConfig('feedbacksection/settings/apikey', $code));
19
+
20
+ $new_url = "http://www.netfeedback.com/p/?a=" . $apikey . "&d=" . $orderDate . "&e=" . $customerEmail . "&n=" . $name . "&o=" . $orderNumber;
21
+
22
+ $new_curl = curl_init($new_url);
23
+ curl_setopt($new_curl, CURLOPT_VERBOSE, 1);
24
+ curl_setopt($new_curl, CURLOPT_FAILONERROR, false);
25
+ curl_setopt($new_curl, CURLOPT_HEADER, 0);
26
+ curl_setopt($new_curl, CURLOPT_FOLLOWLOCATION, 1);
27
+ curl_setopt($new_curl, CURLOPT_RETURNTRANSFER, 1);
28
+ $new_res = curl_exec($new_curl);
29
+
30
+ curl_close($new_curl);
31
+ }
32
+ }
33
+
34
+
35
+ public function feedback(Varien_Event_Observer $observer)
36
+ {
37
+ $data = $observer->getData();
38
+ $orderId = $data['order_ids'][0];
39
+ $order = Mage::getModel('sales/order')->load($orderId);
40
+ $code = $order->getStoreId();
41
+
42
+ $enable = (int) Mage::getStoreConfig('feedbacksection/settings/enabled', $code);
43
+ $mode = Mage::getStoreConfig('feedbacksection/settings/mode', $code);
44
+ if($enable == 1 && $mode == 'success')
45
+ {
46
+ $customerEmail = urlencode($order->getCustomerEmail());
47
+ $name = urlencode($order->getCustomerFirstname()." ".$order->getCustomerLastname());
48
+ $orderNumber = urlencode($order->getIncrementId());
49
+ $orderDate = urlencode($order->getCreatedAt());
50
+ $apikey = urlencode(Mage::getStoreConfig('feedbacksection/settings/apikey', $code));
51
+
52
+ $new_url = "http://www.netfeedback.com/p/?a=" . $apikey . "&d=" . $orderDate . "&e=" . $customerEmail . "&n=" . $name . "&o=" . $orderNumber;
53
+
54
+ $new_curl = curl_init($new_url);
55
+ curl_setopt($new_curl, CURLOPT_VERBOSE, 1);
56
+ curl_setopt($new_curl, CURLOPT_FAILONERROR, false);
57
+ curl_setopt($new_curl, CURLOPT_HEADER, 0);
58
+ curl_setopt($new_curl, CURLOPT_FOLLOWLOCATION, 1);
59
+ curl_setopt($new_curl, CURLOPT_RETURNTRANSFER, 1);
60
+ $new_res = curl_exec($new_curl);
61
+
62
+ curl_close($new_curl);
63
+ }
64
+ }
65
+
66
+ }
app/code/local/Official/Netfeedback/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
+ <feedbacksection translate="title" module="netfeedback">
12
+ <title>Official Netfeedback Settings Section</title>
13
+ <sort_order>0</sort_order>
14
+ </feedbacksection>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/local/Official/Netfeedback/etc/config.xml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Official_Netfeedback>
5
+ <version>0.1.0</version>
6
+ </Official_Netfeedback>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <netfeedback>
11
+ <class>Official_Netfeedback_Helper</class>
12
+ </netfeedback>
13
+ </helpers>
14
+ <models>
15
+ <netfeedback>
16
+ <class>Official_Netfeedback_Model</class>
17
+ <resourceModel>netfeedback_mysql4</resourceModel>
18
+ </netfeedback>
19
+ </models>
20
+ <resources>
21
+ <netfeedback_setup>
22
+ <setup>
23
+ <module>Official_Netfeedback</module>
24
+ </setup>
25
+ <connection>
26
+ <use>core_setup</use>
27
+ </connection>
28
+ </netfeedback_setup>
29
+ <netfeedback_write>
30
+ <connection>
31
+ <use>core_write</use>
32
+ </connection>
33
+ </netfeedback_write>
34
+ <netfeedback_read>
35
+ <connection>
36
+ <use>core_read</use>
37
+ </connection>
38
+ </netfeedback_read>
39
+ </resources>
40
+ <events>
41
+ <sales_order_shipment_save_after>
42
+ <observers>
43
+ <sales_order_shipment_save_after_handler>
44
+ <type>model</type>
45
+ <class>netfeedback/observer</class>
46
+ <method>salesOrderShipmentSaveAfter</method>
47
+ </sales_order_shipment_save_after_handler>
48
+ </observers>
49
+ </sales_order_shipment_save_after>
50
+ <checkout_onepage_controller_success_action> <!-- identifier of the event we want to catch -->
51
+ <observers>
52
+ <checkout_onepage_controller_success_action_handler> <!-- identifier of the event handler -->
53
+ <type>model</type> <!-- class method call type; valid are model, object and singleton -->
54
+ <class>netfeedback/observer</class> <!-- observers class alias -->
55
+ <method>feedback</method> <!-- observer's method to be called -->
56
+ <args></args> <!-- additional arguments passed to observer -->
57
+ </checkout_onepage_controller_success_action_handler>
58
+ </observers>
59
+ </checkout_onepage_controller_success_action>
60
+ </events>
61
+ </global>
62
+ </config>
app/code/local/Official/Netfeedback/etc/system.xml ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <netfeedback translate="label" module="netfeedback">
5
+ <label>Netfeedback Extension</label>
6
+ <sort_order>0</sort_order>
7
+ </netfeedback>
8
+ </tabs>
9
+ <sections>
10
+ <feedbacksection translate="label" module="netfeedback">
11
+ <label>Netfeedback Settings</label>
12
+ <tab>netfeedback</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
+ <settings translate="label">
20
+ <label>General</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>0</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enabled translate="label">
28
+ <label>Enable Netfeedback</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>0</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </enabled>
36
+ </fields>
37
+ <fields>
38
+ <mode translate="label">
39
+ <label>Submission Mode</label>
40
+ <frontend_type>select</frontend_type>
41
+ <source_model>netfeedback/mode</source_model>
42
+ <sort_order>1</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
+ </mode>
47
+ </fields>
48
+ <fields>
49
+ <apikey translate="label">
50
+ <label>API Key</label>
51
+ <frontend_type>text</frontend_type>
52
+ <comment><![CDATA[Visit www.netfeedback.com/magento to register for your free Netfeedback API Key]]></comment>
53
+ <sort_order>2</sort_order>
54
+ <show_in_default>1</show_in_default>
55
+ <show_in_website>1</show_in_website>
56
+ <show_in_store>1</show_in_store>
57
+ </apikey>
58
+ </fields>
59
+ </settings>
60
+ </groups>
61
+ </feedbacksection>
62
+ </sections>
63
+ </config>
app/code/local/Official/Netfeedback/sql/netfeedback_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->setConfigData('feedbacksection/settings/enabled', 0);
5
+ $installer->setConfigData('feedbacksection/settings/mode', 'success');
6
+ $installer->setConfigData('feedbacksection/settings/apikey ', '');
7
+ $installer->endSetup();
8
+
app/etc/modules/Official_Netfeedback.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Official_Netfeedback>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ <version>0.1.0</version>
8
+ </Official_Netfeedback>
9
+ </modules>
10
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Official_Netfeedback_Extension</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension uses the Netfeedback service to collect customer feedback from your customer post-purchase or post-shipping.</summary>
10
+ <description>This extension integrates with the Netfeedback service which allows Magento store owners to get customer feedback from their customers either after purchase or shipping. Register at www.netfeedback.com/magento to get your unique free API key which is required to use the Netfeedback service.</description>
11
+ <notes>First Stable Version</notes>
12
+ <authors><author><name>Mark Reid</name><user>auto-converted</user><email>mark.reid@netfeedback.com</email></author></authors>
13
+ <date>2014-06-24</date>
14
+ <time>18:17:31</time>
15
+ <contents><target name="magelocal"><dir name="Official"><dir name="Netfeedback"><dir name="Helper"><file name="Data.php" hash="24dd0517cbe55c7131e9ba944ad42330"/></dir><dir name="Model"><file name="Mode.php" hash="bd4b347ac4363147baa981a4ffbd91c2"/><file name="Observer.php" hash="9f5cd7e588e9dd8f480984fae6544654"/></dir><dir name="etc"><file name="adminhtml.xml" hash="de2fc04d52efc349e664db8e251b182b"/><file name="config.xml" hash="3f63d76f0cf4c7bdbce3ef84fdc1a08d"/><file name="system.xml" hash="7afb772bb765df63c30303ec3e1f4bab"/></dir><dir name="sql"><dir name="netfeedback_setup"><file name="mysql4-install-0.1.0.php" hash="9e21d80daf5ed4673f15c8e28cbcf86f"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Official_Netfeedback.xml" hash="dd7a5c8457c79833a1eeffd39e504da4"/></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies/>
18
+ </package>