OptiMonkM1 - Version 1.0.1

Version Notes

Minor Copyright Information changes
Extension set to Disabled by default

Download this release

Release Info

Developer János Gál
Extension OptiMonkM1
Version 1.0.1
Comparing to
See all releases


Version 1.0.1

app/code/community/Wse/OptiMonk/Block/Cart.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * OptiMonk plugin for Magento 1.7+
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ * @package Wse_OptiMonk
19
+ * @copyright Copyright (c) 2016 Webshop Marketing Kft (www.optimonk.com)
20
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GPL 3.0)
21
+ * @author Tibor Berna
22
+ *
23
+ * Class Wse_OptiMonk_Block_Cart
24
+ */
25
+ class Wse_OptiMonk_Block_Cart extends Wse_OptiMonk_Block_Entrycode
26
+ {
27
+ /**
28
+ * Return all cart/quote items as array
29
+ *
30
+ * @return string
31
+ */
32
+ public function getProducts()
33
+ {
34
+ /** @var Mage_Sales_Model_Quote $quote */
35
+ $quote = $this->getQuote();
36
+ if (empty($quote)) {
37
+ return array();
38
+ }
39
+
40
+ $data = array();
41
+ foreach($quote->getAllVisibleItems() as $item) {
42
+ /** @var Mage_Sales_Model_Quote_Item $item */
43
+ $product = $item->getProduct();
44
+
45
+ $data[$item->getSku()] = array(
46
+ "product_id" => $product->getId(),
47
+ "name" => $product->getName(),
48
+ "price" => $item->getPrice(),
49
+ "row_total" => $item->getRowTotal(),
50
+ "quantity" => $item->getQty(),
51
+ "category_ids" => "|" . implode("|", $product->getCategoryIds()) . "|"
52
+ );
53
+ }
54
+
55
+ return $data;
56
+ }
57
+
58
+ /**
59
+ * Return all quote items as JSON
60
+ *
61
+ * @return string
62
+ */
63
+ public function getItemsAsJson()
64
+ {
65
+ return json_encode($this->getProducts());
66
+ }
67
+ }
app/code/community/Wse/OptiMonk/Block/Entrycode.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OptiMonk plugin for Magento 1.7+
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
16
+ *
17
+ * @package Wse_OptiMonk
18
+ * @copyright Copyright (c) 2016 Webshop Marketing Kft (www.optimonk.com)
19
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GPL 3.0)
20
+ * @author Tibor Berna
21
+ *
22
+ * Class Wse_OptiMonk_Block_Entrycode
23
+ */
24
+ class Wse_OptiMonk_Block_Entrycode extends Mage_Core_Block_Template
25
+ {
26
+ /**
27
+ * Return whether this module is enabled or not
28
+ *
29
+ * @return bool
30
+ */
31
+ public function isEnabled()
32
+ {
33
+ return $this->getModuleHelper()->isEnabled();
34
+ }
35
+
36
+ /**
37
+ * Get the OptiMonk account ID
38
+ *
39
+ * @return mixed
40
+ */
41
+ public function getId()
42
+ {
43
+ return $this->getModuleHelper()->getId();
44
+ }
45
+
46
+ /**
47
+ * Return a configuration value
48
+ *
49
+ * @param null $key
50
+ * @param null $default_value
51
+ *
52
+ * @return mixed
53
+ */
54
+ public function getConfig($key = null, $default_value = null)
55
+ {
56
+ return $this->getModuleHelper()->getConfigValue($key, $default_value);
57
+ }
58
+
59
+ /**
60
+ * Get the OptiMonk helper
61
+ *
62
+ * @return Wse_Optimonk_Helper_Data
63
+ */
64
+ public function getModuleHelper()
65
+ {
66
+ return Mage::helper('optimonk');
67
+ }
68
+
69
+ /**
70
+ * Get the OptiMonk container
71
+ *
72
+ * @return Wse_OptiMonk_Model_Container
73
+ */
74
+ public function getContainer()
75
+ {
76
+ return Mage::getSingleton('optimonk/container');
77
+ }
78
+
79
+ /**
80
+ * @return bool
81
+ */
82
+ public function hasAttributes()
83
+ {
84
+ $attributes = $this->getAttributes();
85
+ if(!empty($attributes)) {
86
+ return true;
87
+ }
88
+ return false;
89
+ }
90
+
91
+ /**
92
+ * Return all attributes as JSON
93
+ *
94
+ * @return string
95
+ */
96
+ public function getAttributesAsJson()
97
+ {
98
+ $attributes = $this->getAttributes();
99
+ return json_encode($attributes);
100
+ }
101
+
102
+ /**
103
+ * Add a new attribute to the OM container
104
+ *
105
+ * @param $name
106
+ * @param $value
107
+ *
108
+ * @return Varien_Object
109
+ */
110
+ public function addAttribute($name, $value)
111
+ {
112
+ return $this->getContainer()->setData($name, $value);
113
+ }
114
+
115
+ /**
116
+ * Get the configured attributes for the OM container
117
+ *
118
+ * @return mixed
119
+ */
120
+ public function getAttributes()
121
+ {
122
+ return $this->getContainer()->getData();
123
+ }
124
+
125
+ /**
126
+ * Return a product collection
127
+ *
128
+ * @return bool|object
129
+ */
130
+ public function getProductCollection()
131
+ {
132
+ return false;
133
+ }
134
+
135
+ /**
136
+ * @param $data
137
+ *
138
+ * @return string
139
+ */
140
+ public function jsonEncode($data)
141
+ {
142
+ $string = json_encode($data);
143
+ $string = str_replace('"', "'", $string);
144
+ return $string;
145
+ }
146
+
147
+ /**
148
+ * @param $childScript
149
+ */
150
+ public function setChildScript($childScript)
151
+ {
152
+ $this->childScript = $childScript;
153
+ }
154
+
155
+ /**
156
+ * @return string
157
+ */
158
+ public function _toHtml()
159
+ {
160
+ $html = parent::_toHtml();
161
+ if (empty($html)) {
162
+ $html = ' ';
163
+ }
164
+
165
+ return $html;
166
+ }
167
+ }
app/code/community/Wse/OptiMonk/Helper/Data.php ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * OptiMonk plugin for Magento 1.7+
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ * @package Wse_OptiMonk
19
+ * @copyright Copyright (c) 2016 Webshop Marketing Kft (www.optimonk.com)
20
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GPL 3.0)
21
+ * @author Tibor Berna
22
+ *
23
+ * Class Wse_Optimonk_Helper_Data
24
+ */
25
+ class Wse_Optimonk_Helper_Data extends Mage_Core_Helper_Abstract
26
+ {
27
+ /**
28
+ * Check whether the module is enabled
29
+ *
30
+ * @return bool
31
+ */
32
+ public function isEnabled()
33
+ {
34
+ if ((bool)Mage::getStoreConfig('advanced/modules_disable_output/Wse_OptiMonk')) {
35
+ return false;
36
+ }
37
+
38
+ return (bool)$this->getConfigValue('active', false);
39
+ }
40
+
41
+ /**
42
+ * Return the OptiMonk ID
43
+ *
44
+ * @return string
45
+ */
46
+ public function getId()
47
+ {
48
+ return $this->getConfigValue('id');
49
+ }
50
+
51
+ /**
52
+ * Return a configuration value
53
+ *
54
+ * @param null $key
55
+ * @param null $default_value
56
+ *
57
+ * @return mixed|null
58
+ */
59
+ public function getConfigValue($key = null, $default_value = null)
60
+ {
61
+ $value = Mage::getStoreConfig('optimonk/settings/' . $key);
62
+ if (empty($value)) {
63
+ $value = $default_value;
64
+ }
65
+
66
+ return $value;
67
+ }
68
+
69
+ /**
70
+ * Fetch a specific block
71
+ *
72
+ * @param $name
73
+ * @param $type
74
+ * @param $template
75
+ *
76
+ * @return bool|Mage_Core_Block_Template
77
+ */
78
+ public function fetchBlock($name, $type, $template)
79
+ {
80
+ /** @var Mage_Core_Model_Layout $layout */
81
+ if (!($layout = Mage::app()->getFrontController()->getAction()->getLayout())) {
82
+ return false;
83
+ }
84
+
85
+ /** @var Mage_Core_Block_Template $block */
86
+ if ($block = $layout->getBlock('optimonk_' . $name)) {
87
+ $block->setTemplate('optimonk/' . $template);
88
+
89
+ return $block;
90
+ }
91
+
92
+ if ($block = $layout->createBlock('optimonk/' . $type)) {
93
+ $block->setTemplate('optimonk/' . $template);
94
+
95
+ return $block;
96
+ }
97
+
98
+ return false;
99
+ }
100
+
101
+ /**
102
+ * @return string
103
+ */
104
+ public function getHeaderScript()
105
+ {
106
+ $cartScript = '';
107
+ $block = $this->fetchBlock('entrycode', 'entrycode', 'entrycode.phtml');
108
+
109
+ if (!$block) {
110
+ return $cartScript;
111
+ }
112
+
113
+ $cartScript .= $this->getCartScript();
114
+
115
+ $block->setChildScript($cartScript);
116
+ $html = $block->toHtml();
117
+
118
+ return $html;
119
+ }
120
+
121
+ /**
122
+ * @return string
123
+ */
124
+ public function getCartScript()
125
+ {
126
+ /** @var Mage_Sales_Model_Quote $quote */
127
+ $quote = Mage::getModel('checkout/cart')->getQuote();
128
+
129
+ if ($quote->getId() > 0) {
130
+ $cartBlock = $this->fetchBlock('cart', 'cart', 'cart.phtml');
131
+
132
+ if ($cartBlock) {
133
+ $cartBlock->setQuote($quote);
134
+ $html = $cartBlock->toHtml();
135
+
136
+ return $html;
137
+ }
138
+ }
139
+
140
+ return "";
141
+ }
142
+ }
app/code/community/Wse/OptiMonk/Model/Container.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * OptiMonk plugin for Magento 1.7+
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ * @package Wse_OptiMonk
19
+ * @copyright Copyright (c) 2016 Webshop Marketing Kft (www.optimonk.com)
20
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GPL 3.0)
21
+ * @author Tibor Berna
22
+ *
23
+ * Class Wse_OptiMonk_Model_Container
24
+ */
25
+ class Wse_OptiMonk_Model_Container extends Mage_Core_Model_Abstract
26
+ {
27
+ }
app/code/community/Wse/OptiMonk/Model/Observer.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OptiMonk plugin for Magento 1.7+
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
16
+ *
17
+ * @package Wse_OptiMonk
18
+ * @copyright Copyright (c) 2016 Webshop Marketing Kft (www.optimonk.com)
19
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GPL 3.0)
20
+ * @author Tibor Berna
21
+ */
22
+ class Wse_OptiMonk_Model_Observer
23
+ {
24
+ /**
25
+ * Listen to the event core_block_abstract_to_html_after
26
+ *
27
+ * @parameter Varien_Event_Observer $observer
28
+ * @return $this
29
+ */
30
+ public function coreBlockAbstractToHtmlAfter($observer)
31
+ {
32
+ if ($this->getModuleHelper()->isEnabled() == false) {
33
+ return $this;
34
+ }
35
+
36
+ $block = $observer->getEvent()->getBlock();
37
+ if($block->getNameInLayout() == 'root') {
38
+
39
+ $transport = $observer->getEvent()->getTransport();
40
+ $html = $transport->getHtml();
41
+
42
+ $script = Mage::helper('optimonk')->getHeaderScript();
43
+
44
+ if (empty($script)) {
45
+ return $this;
46
+ }
47
+
48
+ $html = preg_replace('/\<body([^\>]+)\>/', '\0'.$script, $html);
49
+
50
+ $transport->setHtml($html);
51
+ }
52
+
53
+ return $this;
54
+ }
55
+
56
+ /**
57
+ * @return Wse_Optimonk_Helper_Data
58
+ */
59
+ protected function getModuleHelper()
60
+ {
61
+ return Mage::helper('optimonk');
62
+ }
63
+ }
app/code/community/Wse/OptiMonk/etc/config.xml ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Optimonk plugin for Magento 1.7+
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ * @package Wse_OptiMonk
19
+ * @copyright Copyright (c) 2016 Webshop Marketing Kft (www.optimonk.com)
20
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GPL 3.0)
21
+ * @author Tibor Berna
22
+ */
23
+ -->
24
+ <config>
25
+ <modules>
26
+ <Wse_OptiMonk>
27
+ <version>0.1.0</version>
28
+ </Wse_OptiMonk>
29
+ </modules>
30
+
31
+ <global>
32
+ <blocks>
33
+ <optimonk>
34
+ <class>Wse_OptiMonk_Block</class>
35
+ </optimonk>
36
+ </blocks>
37
+ <helpers>
38
+ <optimonk>
39
+ <class>Wse_OptiMonk_Helper</class>
40
+ </optimonk>
41
+ </helpers>
42
+ <models>
43
+ <optimonk>
44
+ <class>Wse_OptiMonk_Model</class>
45
+ </optimonk>
46
+ </models>
47
+ </global>
48
+
49
+ <frontend>
50
+ <layout>
51
+ <updates>
52
+ <optimonk>
53
+ <file>optimonk.xml</file>
54
+ </optimonk>
55
+ </updates>
56
+ </layout>
57
+ <events>
58
+ <core_block_abstract_to_html_after>
59
+ <observers>
60
+ <optimonk_observer>
61
+ <type>singleton</type>
62
+ <class>Wse_OptiMonk_Model_Observer</class>
63
+ <method>coreBlockAbstractToHtmlAfter</method>
64
+ </optimonk_observer>
65
+ </observers>
66
+ </core_block_abstract_to_html_after>
67
+ </events>
68
+
69
+ </frontend>
70
+
71
+ <adminhtml>
72
+ <acl>
73
+ <resources>
74
+ <admin>
75
+ <children>
76
+ <system>
77
+ <children>
78
+ <config>
79
+ <children>
80
+ <optimonk translate="title" module="optimonk">
81
+ <title>optimonk</title>
82
+ </optimonk>
83
+ </children>
84
+ </config>
85
+ </children>
86
+ </system>
87
+ </children>
88
+ </admin>
89
+ </resources>
90
+ </acl>
91
+ </adminhtml>
92
+
93
+ <default>
94
+ <optimonk>
95
+ <settings>
96
+ <active>0</active>
97
+ </settings>
98
+ </optimonk>
99
+ </default>
100
+ </config>
app/code/community/Wse/OptiMonk/etc/system.xml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * OptiMonk plugin for Magento
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ * @package Wse_OptiMonk
19
+ * @copyright Copyright (c) 2016 Webshop Marketing Kft (www.optimonk.com)
20
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GPL 3.0)
21
+ * @author Tibor Berna
22
+ */
23
+ -->
24
+ <config>
25
+ <tabs>
26
+ <optimonk translate="label" module="optimonk">
27
+ <label>OptiMonk</label>
28
+ <sort_order>900</sort_order>
29
+ </optimonk>
30
+ </tabs>
31
+ <sections>
32
+ <optimonk translate="label" module="optimonk">
33
+ <label>OptiMonk</label>
34
+ <tab>optimonk</tab>
35
+ <frontend_type>text</frontend_type>
36
+ <sort_order>342</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ <groups>
41
+ <settings translate="label">
42
+ <label>Settings</label>
43
+ <frontend_type>text</frontend_type>
44
+ <sort_order>1</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ <fields>
49
+ <active translate="label">
50
+ <label>Enabled</label>
51
+ <frontend_type>select</frontend_type>
52
+ <source_model>adminhtml/system_config_source_yesno</source_model>
53
+ <sort_order>1</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
+ </active>
58
+ <id translate="label">
59
+ <label>OptiMonk Account ID</label>
60
+ <comment><![CDATA[Your OptiMonk ID]]></comment>
61
+ <frontend_type>text</frontend_type>
62
+ <sort_order>2</sort_order>
63
+ <show_in_default>1</show_in_default>
64
+ <show_in_website>1</show_in_website>
65
+ <show_in_store>1</show_in_store>
66
+ </id>
67
+ </fields>
68
+ </settings>
69
+ </groups>
70
+ </optimonk>
71
+ </sections>
72
+ </config>
app/design/frontend/base/default/layout/optimonk.xml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * OptiMonk extension for Magento
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ * @package Wse_OptiMonk
19
+ * @copyright Copyright (c) 2016 Webshop Marketing Kft (www.optimonk.com)
20
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GPL 3.0)
21
+ * @author Tibor Berna
22
+ */
23
+ -->
24
+ <layout>
25
+ <default>
26
+ <block type="optimonk/cart" name="optimonk_cart" template="optimonk/cart.phtml" />
27
+ <block type="optimonk/entrycode" name="optimonk" template="optimonk/entrycode.phtml" />
28
+
29
+ <reference name="after_body_start">
30
+ <action method="append">
31
+ <block>optimonk_script</block>
32
+ </action>
33
+ </reference>
34
+ </default>
35
+ </layout>
app/design/frontend/base/default/template/optimonk/cart.phtml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OptiMonk plugin for Magento 1.7+
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
16
+ *
17
+ * @package Wse_OptiMonk
18
+ * @copyright Copyright (c) 2016 Webshop Marketing Kft (www.optimonk.com)
19
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GPL 3.0)
20
+ * @author Tibor Berna
21
+ */
22
+ ?>
23
+ <!-- OptiMonk Cart Data -->
24
+ <?php if ($this->isEnabled()) : ?>
25
+ <?php $cartProducts = $this->getProducts(); ?>
26
+ <script>
27
+ document.querySelector('html').addEventListener('optimonk#ready', function () {
28
+ var adapter = OptiMonk.Visitor.createAdapter();
29
+ adapter.Cart.clear();
30
+ <?php if(!empty($cartProducts)): ?>
31
+ <?php foreach ($cartProducts as $sku => $productDetails) { ?>
32
+ adapter.Cart.add(<?php echo json_encode($sku); ?>, <?php echo json_encode($productDetails); ?>);
33
+ <?php } ?>
34
+ <?php endif; ?>
35
+ });
36
+ </script>
37
+ <?php endif; ?>
app/design/frontend/base/default/template/optimonk/entrycode.phtml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * OptiMonk plugin for Magento 1.7+
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
16
+ *
17
+ * @package Wse_OptiMonk
18
+ * @copyright Copyright (c) 2016 Webshop Marketing Kft (www.optimonk.com)
19
+ * @license https://www.gnu.org/licenses/gpl-3.0.html GNU GENERAL PUBLIC LICENSE (GPL 3.0)
20
+ * @author Tibor Berna
21
+ */
22
+ $moduleName = $this->getRequest()->getModuleName();
23
+ $controllerName = $this->getRequest()->getControllerName();
24
+ $actionName = $this->getRequest()->getActionName();
25
+ $route = $moduleName . '/' . $controllerName . '/' . $actionName;
26
+ ?>
27
+ <?php if ($this->isEnabled()) : ?>
28
+ <?php $this->addAttribute('pageType', $route); ?>
29
+ <?php $childScript = $this->getChildScript(); ?>
30
+ <?php if (!empty($childScript)) : ?>
31
+ <?= $childScript; ?>
32
+ <?php endif; ?>
33
+ <!-- OptiMonk Entry Code -->
34
+ <script>
35
+ (function(e,a){
36
+ var t,r=e.getElementsByTagName("head")[0],c=e.location.protocol;
37
+ t=e.createElement("script");t.type="text/javascript";
38
+ t.charset="utf-8";t.async=!0;t.defer=!0;
39
+ t.src=c+"//optimonk.bernatibor/public/"+a+"/js/preload.js";r.appendChild(t);
40
+ })(document,"<?php echo $this->getId(); ?>");
41
+ </script>
42
+ <?php endif; ?>
app/etc/modules/Wse_OptiMonk.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Wse_OptiMonk>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Wse_OptiMonk>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>OptiMonkM1</name>
4
+ <version>1.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://www.gnu.org/licenses/gpl-3.0.html">GPL</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>This extension allows you to integrate OptiMonk with your Site</summary>
10
+ <description>OptiMonk is the most powerful Onsite Retargeting platform, that helps you increase the conversion rate of your site, and get more leads by recovering lost visitors.&#xD;
11
+ &#xD;
12
+ Exit offers provides you a powerful and simple way to convert more visitors to buyers and build your email list. Your messages show up with a special offer at the exact moment a visitor is about to leave your site &#x2013; down to the millisecond. Basically you get a second chance to convince your visitors.&#xD;
13
+ &#xD;
14
+ Why is OptiMonk more advanced than other exit offer tools?&#xD;
15
+ &#xD;
16
+ Other exit offer tools will just allow you to show your visitors a coupon code or discount once, and then you can just hope, that the visitors will remember these coupon codes.&#xD;
17
+ &#xD;
18
+ OptiMonk allows you to build 2-step campaigns:&#xD;
19
+ Exit offer: First you can get the visitor&#x2019;s attention (and email) with an exit offer&#xD;
20
+ Nanobar: Then you can display a nanobar at once, reminding the visitor of the coupon code without distracting her shopping.&#xD;
21
+ With this 2-step campaign you can increase the number of purchases by up to 100% compared to simple exit offer tools.&#xD;
22
+ Basic features:&#xD;
23
+ Create Unlimited Offers&#xD;
24
+ Lots of Premium Templates to Choose From&#xD;
25
+ Easy Customization with WYSWYG editor&#xD;
26
+ Display Offers on Exit-Intent, On Scroll, On Entry or After X Seconds&#xD;
27
+ Integration with MailChimp, GetResponse, iContact, AWeber, InfusionSoft, etc.&#xD;
28
+ No coding required&#xD;
29
+ Advanced features:&#xD;
30
+ Multi-Page Popups&#xD;
31
+ Mobile-Optimized and Responsives Popups&#xD;
32
+ Nanobar&#xD;
33
+ Campaign Scheduling&#xD;
34
+ Geo-Targeting&#xD;
35
+ A/B Testing&#xD;
36
+ Here are a few case studies you might be interested in:&#xD;
37
+ An ebike store was able to increase their subscription rate by 329%&#xD;
38
+ A toy retailer was able to increase its revenue by 26,8%&#xD;
39
+ A marketing guru was able to increase its subscription rate by 48%&#xD;
40
+ An adult store was able to decrease its cart-abandonment rate by 27.6%&#xD;
41
+ A marketing agency was able to increase the number of leads by 45%&#xD;
42
+ A B2B Security Startup was able to increase the number of free trials by 65%</description>
43
+ <notes>Minor Copyright Information changes&#xD;
44
+ Extension set to Disabled by default</notes>
45
+ <authors><author><name>J&#xE1;nos G&#xE1;l</name><user>galjanos</user><email>janos.gal@optimonk.com</email></author><author><name>Tibor Berna</name><user>optimonk_tberna</user><email>bernatibor@webshopexperts.hu</email></author></authors>
46
+ <date>2016-06-28</date>
47
+ <time>11:53:03</time>
48
+ <contents><target name="magecommunity"><dir name="Wse"><dir name="OptiMonk"><dir name="Block"><file name="Cart.php" hash="e9c6c7b3c1f008c9d30a2af0563bd327"/><file name="Entrycode.php" hash="e9372c7e7928a9f52365380a413821d1"/></dir><dir name="Helper"><file name="Data.php" hash="e2aca25679b0b2a0a3d5379d13b1c1ba"/></dir><dir name="Model"><file name="Container.php" hash="f49913afdf86a3e939bb5b175131761f"/><file name="Observer.php" hash="4012a959b2f496df91ac263fa55448dd"/></dir><dir name="etc"><file name="config.xml" hash="bc26b949fcf8921e07ea21a3a0fc1d7a"/><file name="system.xml" hash="16b146b2ce4d56ec0e213c3cf116815a"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="optimonk.xml" hash="df83174e9a32cb5067c5be6cdae55807"/><file name="optimonk.xml" hash="df83174e9a32cb5067c5be6cdae55807"/></dir><dir name="template"><dir name="optimonk"><file name="cart.phtml" hash="0133d4b7c3165d2cc1340f889d2d5a2b"/><file name="entrycode.phtml" hash="bb5c9d3081d2bf407f662e959844e7a3"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wse_OptiMonk.xml" hash="79495d9c78d2e99a4095f18173528d11"/></dir></target></contents>
49
+ <compatible/>
50
+ <dependencies><required><php><min>5.5.0</min><max>7.0.0</max></php></required></dependencies>
51
+ </package>