KRYD - Version 1.0.0

Version Notes

First release

Download this release

Release Info

Developer KRYD GmbH
Extension KRYD
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/KRYD/Observer/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class KRYD_Observer_Helper_Data extends Mage_Core_Helper_Abstract {
3
+
4
+ }
app/code/community/KRYD/Observer/Model/Observer.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(dirname(__FILE__)."/../../kryd_include.php");
3
+
4
+ class KRYD_Observer_Model_Observer {
5
+
6
+ public function catalog_controller_product_view(Varien_Event_Observer $observer) {
7
+ KRYD::event('itemview',Array("itemid"=>$observer->event->product->sku));
8
+ }
9
+
10
+ public function customer_register_success(Varien_Event_Observer $observer) {
11
+ KRYD::event('register');
12
+ }
13
+
14
+ public function checkout_type_onepage_save_order_after(Varien_Event_Observer $observer) {
15
+ KRYD::event('complete');
16
+ }
17
+
18
+ public function checkout_cart_product_add_after(Varien_Event_Observer $observer) {
19
+ $quote=Mage::getSingleton('checkout/session')->getQuote();
20
+ $items=$quote->getAllVisibleItems();
21
+ $itemids=Array();
22
+ foreach ($items as $item) $itemids[]=$item->sku;
23
+ $itemids=array_unique($itemids);
24
+ KRYD::event("basket",Array("itemids"=>implode(";",$itemids)));
25
+ }
26
+
27
+ public function customer_login(Varien_Event_Observer $observer) {
28
+ $customer=$observer->event->customer;
29
+ KRYD::event("identify",Array("email"=>$customer->email,"firstname"=>$customer->firstname,"lastname"=>$customer->lastname));
30
+ KRYD::event('login');
31
+ }
32
+
33
+
34
+ }
app/code/community/KRYD/Observer/etc/adminhtml.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <KRYD_Options translate="title">
15
+ <title>KRYD Options</title>
16
+ <sort_order>100</sort_order>
17
+ </KRYD_Options>
18
+ </children>
19
+ </config>
20
+ </children>
21
+ </system>
22
+ </children>
23
+ </admin>
24
+ </resources>
25
+ </acl>
26
+ </config>
app/code/community/KRYD/Observer/etc/config.xml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <KRYD_Observer>
5
+ <version>1.0</version>
6
+ </KRYD_Observer>
7
+ </modules>
8
+ <models>
9
+ <KRYD_Observer_Model_Observer>
10
+ <class>KRYD_Observer_Model_Observer</class>
11
+ </KRYD_Observer_Model_Observer>
12
+ </models>
13
+ <global>
14
+
15
+ <models>
16
+ <Observer>
17
+ <class>KRYD_Observer_Config_Model</class>
18
+ </Observer>
19
+ </models>
20
+
21
+ <helpers>
22
+ <Observer>
23
+ <class>KRYD_Observer_Helper</class>
24
+ </Observer>
25
+ </helpers>
26
+
27
+ <events>
28
+
29
+ <catalog_controller_product_view>
30
+ <observers>
31
+ <kryd_observer>
32
+ <type>singleton</type>
33
+ <class>KRYD_Observer_Model_Observer</class>
34
+ <method>catalog_controller_product_view</method>
35
+ </kryd_observer>
36
+ </observers>
37
+ </catalog_controller_product_view>
38
+
39
+ <customer_register_success>
40
+ <observers>
41
+ <kryd_observer>
42
+ <type>singleton</type>
43
+ <class>KRYD_Observer_Model_Observer</class>
44
+ <method>customer_register_success</method>
45
+ </kryd_observer>
46
+ </observers>
47
+ </customer_register_success>
48
+
49
+ <customer_login>
50
+ <observers>
51
+ <kryd_observer>
52
+ <type>singleton</type>
53
+ <class>KRYD_Observer_Model_Observer</class>
54
+ <method>customer_login</method>
55
+ </kryd_observer>
56
+ </observers>
57
+ </customer_login>
58
+
59
+ <checkout_cart_product_add_after>
60
+ <observers>
61
+ <kryd_observer>
62
+ <type>singleton</type>
63
+ <class>KRYD_Observer_Model_Observer</class>
64
+ <method>checkout_cart_product_add_after</method>
65
+ </kryd_observer>
66
+ </observers>
67
+ </checkout_cart_product_add_after>
68
+
69
+ <checkout_type_onepage_save_order_after>
70
+ <observers>
71
+ <kryd_observer>
72
+ <type>singleton</type>
73
+ <class>KRYD_Observer_Model_Observer</class>
74
+ <method>checkout_type_onepage_save_order_after</method>
75
+ </kryd_observer>
76
+ </observers>
77
+ </checkout_type_onepage_save_order_after>
78
+
79
+ </events>
80
+ </global>
81
+ </config>
app/code/community/KRYD/Observer/etc/system.xml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <tabs>
4
+ <KRYD_Config translate="label" module="Observer">
5
+ <label>KRYD</label>
6
+ <sort_order>99999</sort_order>
7
+ </KRYD_Config>
8
+ </tabs>
9
+ <sections>
10
+ <KRYD_Options translate="label" module="Observer">
11
+ <label>Options</label>
12
+ <tab>KRYD_Config</tab>
13
+ <sort_order>1000</sort_order>
14
+ <show_in_default>1</show_in_default>
15
+ <show_in_website>1</show_in_website>
16
+ <show_in_store>1</show_in_store>
17
+ <groups>
18
+ <KRYD_Options_group translate="label" module="Observer">
19
+ <label>KRYD Options</label>
20
+ <frontend_type>text</frontend_type>
21
+ <sort_order>1000</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <KRYD_Options_id translate="label">
27
+ <label>KRYD Account-ID:</label>
28
+ <comment>Enter you KRYD Account-ID here</comment>
29
+ <frontend_type>text</frontend_type>
30
+ <sort_order>10</sort_order>
31
+ <show_in_default>1</show_in_default>
32
+ <show_in_website>1</show_in_website>
33
+ <show_in_store>1</show_in_store>
34
+ </KRYD_Options_id>
35
+ <KRYD_Options_key translate="label">
36
+ <label>KRYD API-Key:</label>
37
+ <comment>Enter you KRYD API-Key here</comment>
38
+ <frontend_type>text</frontend_type>
39
+ <sort_order>20</sort_order>
40
+ <show_in_default>1</show_in_default>
41
+ <show_in_website>1</show_in_website>
42
+ <show_in_store>1</show_in_store>
43
+ </KRYD_Options_key>
44
+ </fields>
45
+ </KRYD_Options_group>
46
+ </groups>
47
+ </KRYD_Options>
48
+ </sections>
49
+ </config>
app/code/community/KRYD/api.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class KRYD {
3
+
4
+ private static $script_included=false;
5
+ private static $id;
6
+ private static $key;
7
+ private static $last_error;
8
+
9
+ public static function last_error() {
10
+ return self::$last_error;
11
+ }
12
+
13
+ public static function id($id) {
14
+ self::$id=$id;
15
+ }
16
+
17
+ public static function key($key) {
18
+ self::$key=$key;
19
+ }
20
+
21
+ public static function has_settings() {
22
+ return is_file(dirname(__FILE__)."/settings.php");
23
+ }
24
+
25
+ public static function event($eventtype,$options=Array()) {
26
+
27
+ if (!self::$id) {self::$last_error=Array('code'=>'accountid_missing','message'=>'KRYD account id missing.');return false;}
28
+ if (!self::$key) {self::$key_missing=Array('code'=>'key_missing','message'=>'KRYD API key missing.');return false;}
29
+
30
+ $sessionid=md5(session_id());
31
+
32
+ $post=Array(
33
+ 'accountid'=>self::$id,
34
+ 'sessionid'=>$sessionid,
35
+ 'eventtype'=>$eventtype,
36
+ 'options'=>json_encode($options),
37
+ 'key'=>self::$key
38
+ );
39
+
40
+ $query='';
41
+ foreach ($post as $key=>$value) {
42
+ if ($query!=='') $query.="&";
43
+ $query.=$key."=".rawurlencode($value);
44
+ }
45
+
46
+ $ch=curl_init('https://api.kryd.com/event.lua');
47
+ curl_setopt($ch,CURLOPT_POST,true);
48
+ curl_setopt($ch,CURLOPT_POSTFIELDS,$query);
49
+ curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
50
+ $response=curl_exec($ch);
51
+ $status=curl_getinfo($ch,CURLINFO_HTTP_CODE);
52
+
53
+ if ($status!=200) {
54
+ self::$last_error=json_decode($response,true);
55
+ return false;
56
+ }
57
+
58
+ return true;
59
+ }
60
+
61
+ }
62
+
63
+ if (KRYD::has_settings()) include(dirname(__FILE__)."/settings.php");
64
+ ?>
app/code/community/KRYD/kryd_include.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?
2
+ require_once(dirname(__FILE__)."/api.php");
3
+
4
+ if (!KRYD::has_settings()) {
5
+ function kryd_load_magento_settings() {
6
+
7
+ $config_path='KRYD_Options/KRYD_Options_group/KRYD_Options_';
8
+ $store=Mage::app()->getStore();
9
+
10
+ KRYD::id(Mage::getStoreConfig($config_path."id",$store));
11
+ KRYD::key(Mage::getStoreConfig($config_path."key",$store));
12
+ }
13
+ kryd_load_magento_settings();
14
+ }
15
+ ?>
app/etc/modules/KRYD_Observer.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <modules>
4
+ <KRYD_Observer>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </KRYD_Observer>
8
+ </modules>
9
+ </config>
kryd_export/items.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require('../app/Mage.php');
3
+ @set_time_limit(0);
4
+ Mage::app();
5
+
6
+ function xmlentities($string) {
7
+ return str_replace(array('&','"',"'",'<', '>'),array('&amp;','&quot;','&apos;','&lt;','&gt;'),$string);
8
+ }
9
+
10
+ function createItem($args) {
11
+ $product=Mage::getModel('catalog/product');
12
+ $product->setData($args['row']);
13
+
14
+ echo " <item>\n";
15
+ echo " <id>".xmlentities($product->getSku())."</id>\n";
16
+ echo " <name>".xmlentities($product->getName())."</name>\n";
17
+ echo " <price>".xmlentities($product->getPrice())."</price>\n";
18
+
19
+ $imageurl=(string)Mage::helper('catalog/image')->init($product,'small_image')->resize(135);
20
+
21
+ echo " <thumb>".xmlentities($imageurl)."</thumb>\n";
22
+ echo " </item>\n";
23
+ flush();
24
+ }
25
+
26
+ header("Content-type:text/xml");
27
+ echo '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
28
+ echo "<items>\n";
29
+
30
+ $products=Mage::getModel('catalog/product')->getCollection();
31
+ $products->addAttributeToSelect(Array('sku'),'inner');
32
+ $products->addAttributeToSelect(Array('name'),'inner');
33
+ $products->addAttributeToSelect(Array('price'),'inner');
34
+ $products->addAttributeToSelect(Array('small_image'),'inner');
35
+
36
+ Mage::getSingleton('core/resource_iterator')->walk($products->getSelect(),array('createItem'));
37
+
38
+ echo '</items>';
package.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>KRYD</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.kryd.com/partner/license.php">Proprietary</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>KRYD analyzes customer behavior and activates customers automatically with tailored e-mail campaigns</summary>
10
+ <description>Reach out to every customer individually. Automatically&lt;br /&gt;
11
+ &lt;br /&gt;
12
+ Don't just put your focus on expensive acquisitions of new customers. There is a huge sales potential with your existing customers.&lt;br /&gt;
13
+ &lt;br /&gt;
14
+ With KRYD, you utilize it optimally. KRYD analyzes your customers' behavior and helps you to react with tailored e-mails for each customer - for example when the following events occur:&lt;br /&gt;
15
+ &lt;br /&gt;
16
+ * Checkout abort&lt;br /&gt;
17
+ * Registration&lt;br /&gt;
18
+ * Initial purchase&lt;br /&gt;
19
+ * Threshold of a total purchase&lt;br /&gt;
20
+ * Absence of a customer&lt;br /&gt;
21
+ * Newsletter subscription&lt;br /&gt;</description>
22
+ <notes>First release</notes>
23
+ <authors>
24
+ <author>
25
+ <name>KRYD GmbH</name>
26
+ <user>krydgmbh</user>
27
+ <email>info@kryd.com</email>
28
+ </author>
29
+ </authors>
30
+ <date>2013-06-21</date>
31
+ <time>12:03:18</time>
32
+ <contents>
33
+ <target name="magecommunity">
34
+ <dir name="KRYD">
35
+ <dir name="Observer">
36
+ <dir name="Model">
37
+ <file name="Observer.php" hash="f68f4953b1bdc263f41b7a6e95b87bca"/>
38
+ </dir>
39
+ <dir name="Helper">
40
+ <file name="Data.php" hash="8cdfd25ace7de949d068d500d6dd730f"/>
41
+ </dir>
42
+ <dir name="etc">
43
+ <file name="config.xml" hash="4764fa9d9c2fbd6f3dfc1d56048b988a"/>
44
+ <file name="adminhtml.xml" hash="3bdbeb1348a24faf29710ed344f93a2b"/>
45
+ <file name="system.xml" hash="47e63f155a100fe269038e9cc998e760"/>
46
+ </dir>
47
+ </dir>
48
+ <file name="kryd_include.php" hash="423fd3f4590f09fbff09ec973dddb689"/>
49
+ </dir>
50
+ </target>
51
+ </contents>
52
+ <compatible/>
53
+ <dependencies>
54
+ <required>
55
+ <php>
56
+ <min>5.1.0</min>
57
+ <max>6.0.0</max>
58
+ </php>
59
+ </required>
60
+ </dependencies>
61
+ </package>