ConvertExperiments_ConvertExperiments - Version 1.0.0

Version Notes

Has been tested for bugs, compatibility, and performance on Magento Community Edition 1.6+ and Magento Enterprise Edition 1.11+. This extension has not been tested in a live environment, so please leave feedback if you run into any issues. The next release will be after Blue Acorn user testing on a live environment. You will need to set your Magento Connect Manager state settings to Beta in order to install this release.

*Magento does not officially support PHP versions higher than 5.5 and reference http://www.magentocommerce.com/system-requirements.

Download this release

Release Info

Developer Convert Experiments
Extension ConvertExperiments_ConvertExperiments
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (29) hide show
  1. app/code/community/ConvertExperiments/ConvertExperiments/.DS_Store +0 -0
  2. app/code/community/ConvertExperiments/ConvertExperiments/Block/.DS_Store +0 -0
  3. app/code/community/ConvertExperiments/ConvertExperiments/Block/ReedScripts.php +318 -0
  4. app/code/community/ConvertExperiments/ConvertExperiments/Block/System/.DS_Store +0 -0
  5. app/code/community/ConvertExperiments/ConvertExperiments/Block/System/Config/.DS_Store +0 -0
  6. app/code/community/ConvertExperiments/ConvertExperiments/Block/System/Config/Explanation.php +92 -0
  7. app/code/community/ConvertExperiments/ConvertExperiments/Block/System/Config/Loginlink.php +92 -0
  8. app/code/community/ConvertExperiments/ConvertExperiments/Helper/Data.php +109 -0
  9. app/code/community/ConvertExperiments/ConvertExperiments/Model/.DS_Store +0 -0
  10. app/code/community/ConvertExperiments/ConvertExperiments/Model/DisallowDuplicates.php +36 -0
  11. app/code/community/ConvertExperiments/ConvertExperiments/Model/Enabledcheck.php +24 -0
  12. app/code/community/ConvertExperiments/ConvertExperiments/Model/Entity/.DS_Store +0 -0
  13. app/code/community/ConvertExperiments/ConvertExperiments/Model/Entity/Attribute.php +46 -0
  14. app/code/community/ConvertExperiments/ConvertExperiments/Model/Entity/Attribute/.DS_Store +0 -0
  15. app/code/community/ConvertExperiments/ConvertExperiments/Model/Entity/Attribute/Integer.php +25 -0
  16. app/code/community/ConvertExperiments/ConvertExperiments/doc/.DS_Store +0 -0
  17. app/code/community/ConvertExperiments/ConvertExperiments/doc/changelog.txt +27 -0
  18. app/code/community/ConvertExperiments/ConvertExperiments/doc/design.txt +40 -0
  19. app/code/community/ConvertExperiments/ConvertExperiments/doc/makeTar.txt +6 -0
  20. app/code/community/ConvertExperiments/ConvertExperiments/etc/.DS_Store +0 -0
  21. app/code/community/ConvertExperiments/ConvertExperiments/etc/adminhtml.xml +22 -0
  22. app/code/community/ConvertExperiments/ConvertExperiments/etc/config.xml +47 -0
  23. app/code/community/ConvertExperiments/ConvertExperiments/etc/system.xml +120 -0
  24. app/design/frontend/base/default/layout/convertexperiments/convertexperiments.xml +23 -0
  25. app/design/frontend/base/default/template/convertexperiments/convertexperiments/.DS_Store +0 -0
  26. app/design/frontend/base/default/template/convertexperiments/convertexperiments/reedVariables.phtml +25 -0
  27. app/design/frontend/base/default/template/convertexperiments/convertexperiments/sitewideJs.phtml +14 -0
  28. app/etc/modules/ConvertExperiments_ConvertExperiments.xml +14 -0
  29. package.xml +20 -0
app/code/community/ConvertExperiments/ConvertExperiments/.DS_Store ADDED
Binary file
app/code/community/ConvertExperiments/ConvertExperiments/Block/.DS_Store ADDED
Binary file
app/code/community/ConvertExperiments/ConvertExperiments/Block/ReedScripts.php ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Block that outputs the REED variable definitions above the main Convert.com
4
+ * script contained within one script tag.
5
+ *
6
+ * @package ConvertExperiments
7
+ * @subpackage ConvertExperiments
8
+ * @version 1.0.7
9
+ * @author Robert Henderson
10
+ */
11
+ class ConvertExperiments_ConvertExperiments_Block_ReedScripts extends Mage_Core_Block_Template {
12
+
13
+ const NEW_LINE = "\n";
14
+ const TABBED_SPACE = "\t";
15
+
16
+ protected $_helper = null;
17
+ protected $_product = null;
18
+ protected $_customAttrName = null;
19
+ protected $_category = null;
20
+ protected $_cms = null;
21
+
22
+ /**
23
+ * Get module helper
24
+ *
25
+ * @return Mage_Core_Helper_Abstract
26
+ */
27
+ protected function _helper() {
28
+ return $this->_helper = Mage::helper('convert_experiments');
29
+ }
30
+
31
+ /**
32
+ * Get current product
33
+ *
34
+ * @return mixed
35
+ */
36
+ protected function _getProduct() {
37
+ return $this->_product = Mage::registry('current_product');
38
+ }
39
+
40
+ /**
41
+ * Get current category
42
+ *
43
+ * @return mixed
44
+ */
45
+ protected function _getCategory() {
46
+ return $this->_category = Mage::registry('current_category');
47
+ }
48
+
49
+ /**
50
+ * Check if current page is CMS
51
+ *
52
+ * @return bool
53
+ */
54
+ protected function _isCms() {
55
+ return $this->_cms = $this->getRequest()->getRequestedRouteName() == 'cms';
56
+ }
57
+
58
+ /**
59
+ * Create one script tag for all REED variables to be inserted to at the
60
+ * top of each page
61
+ *
62
+ * @return string
63
+ */
64
+ public function wrapReedVariables($variables) {
65
+ $product = $this->_getProduct();
66
+ $html = '<!-- Convert Experiments Page Script Variables -->' . self::NEW_LINE;
67
+ $html .= '<script type="text/javascript">' . self::NEW_LINE;
68
+ $html .= '//<![CDATA[' . self::NEW_LINE;
69
+ $html .= $variables;
70
+ if($product) {
71
+ $html .= $this->_getProductVariables();
72
+ }
73
+ if($this->_getCategory() && !$product) {
74
+ $html .= $this->_getCategoryVariables();
75
+ }
76
+ if($this->_isCms()) {
77
+ $html .= $this->_getCmsVariables();
78
+ }
79
+ $html .= '//]]>' . self::NEW_LINE;
80
+ $html .= '</script>' . self::NEW_LINE;
81
+ $html .= '<!-- End Convert Experiments Page Script Variables -->' . self::NEW_LINE;
82
+ return $html;
83
+ }
84
+
85
+ /**
86
+ * Outputs a script after the opening <body> tag on each product page that
87
+ * defines the product SKU, name, price (lowest number if bundled or grouped),
88
+ * and custom attribute values if current product has data assigned to that
89
+ * attribute.
90
+ *
91
+ * @return string
92
+ */
93
+ protected function _getProductVariables() {
94
+ $productVariables = "";
95
+ if($this->_helper()->isEnabled() == 1) {
96
+ $product = $this->_getProduct();
97
+ if($product) {
98
+ $productSku = $this->_editString($product->getSku());
99
+ $productName = $this->_editString($product->getName());
100
+ $productType = $this->_editString($product->getTypeId());
101
+ $attributeSetModel = Mage::getModel("eav/entity_attribute_set");
102
+ $attributeSetModel->load($product->getAttributeSetId());
103
+ $attributeSetName = $this->_editString($attributeSetModel->getAttributeSetName());
104
+ $productPrice = round($product->getMinimalPrice(),2);
105
+ if($productType == "grouped") {
106
+ $aProductIds = $product->getTypeInstance()->getChildrenIds($product->getId());
107
+ $prices = array();
108
+ foreach ($aProductIds as $ids) {
109
+ foreach ($ids as $id) {
110
+ $aProduct = Mage::getSingleton('catalog/product')->load($id);
111
+ array_push($prices, $aProduct->getData('minimal_price'));
112
+ }
113
+ }
114
+ sort($prices, SORT_NUMERIC);
115
+ $productPrice = round($prices[0],2);
116
+ }
117
+ elseif($productType == "bundle") {
118
+ $priceModel = $product->getPriceModel();
119
+ $productPrice = $priceModel->getTotalPrices($product, null, null, false);
120
+ $productPrice = $productPrice[0];
121
+ }
122
+ $this->_editString($productPrice);
123
+
124
+ $productVariables = self::TABBED_SPACE . 'var REED_page_type = "Product' . ';' . $productType . ';' . $attributeSetName . '";' . self::NEW_LINE;
125
+ $productVariables .= self::TABBED_SPACE . 'var REED_product_sku = "' . $productSku . '";' . self::NEW_LINE;
126
+ $productVariables .= self::TABBED_SPACE . 'var REED_product_name = "' . $productName . ';' . $productType . ';' . $attributeSetName . '";' . self::NEW_LINE;
127
+ $productVariables .= self::TABBED_SPACE . 'var REED_product_price = "' . $productPrice . '";' . self::NEW_LINE;
128
+ //Get the value from the custom attributes defined if they exist for current
129
+ //product
130
+ $customAttrOne = $this->_helper()->getCustomAttrOne();
131
+ $customAttrTwo = $this->_helper()->getCustomAttrTwo();
132
+ $numberAttrOne = $this->_helper()->getNumberAttrOne();
133
+ $numberAttrTwo = $this->_helper()->getNumberAttrTwo();
134
+ $attrOneOptionId = $product->getData($customAttrOne);
135
+ $attrTwoOptionId = $product->getData($customAttrTwo);
136
+
137
+ if($attrOneOptionId) {
138
+ $productVariables .= self::TABBED_SPACE . 'var REED_custom_v1 = "' . $this->_editString($this->_getCustomAttributeValue($customAttrOne)) . ';' . $this->_customAttrName($customAttrOne) . '";' . self::NEW_LINE;
139
+ }
140
+ if($attrTwoOptionId) {
141
+ $productVariables .= self::TABBED_SPACE . 'var REED_custom_v2 = "' . $this->_editString($this->_getCustomAttributeValue($customAttrTwo)) . ';' . $this->_customAttrName($customAttrTwo) . '";' . self::NEW_LINE;
142
+ }
143
+ $calcNumAttrOne = $this->_calcNumberAttr($numberAttrOne);
144
+ $calcNumAttrTwo = $this->_calcNumberAttr($numberAttrTwo);
145
+ if($calcNumAttrOne != 0) {
146
+ $productVariables .= self::TABBED_SPACE . 'var REED_custom_v3 = "' . $this->_calcNumberAttr($numberAttrOne) . self::NEW_LINE;
147
+ }
148
+ if($calcNumAttrTwo != 0) {
149
+ $productVariables .= self::TABBED_SPACE . 'var REED_custom_v4 = "' . $this->_calcNumberAttr($numberAttrTwo) . self::NEW_LINE;
150
+ }
151
+ }
152
+ }
153
+ return $productVariables;
154
+ }
155
+
156
+ /**
157
+ * Returns the integer and string description of the number attributes selected on product pages
158
+ *
159
+ * @return string
160
+ */
161
+ protected function _calcNumberAttr($numberAttr) {
162
+ $product = $this->_getProduct();
163
+ //If Age is the attribute chosen
164
+ if($numberAttr && $numberAttr == 'news_from_date') {
165
+ $numberAttr = null;
166
+ $newFromDate = $product->getData('created_at');
167
+ $newFromDate = str_replace("-", "", substr($newFromDate, 0, strpos($newFromDate, " ")));
168
+ $today = date('Ymd');
169
+ if(is_numeric($newFromDate)) {
170
+ $numberAttr = $this->_editString(($today - $newFromDate)) . '";';
171
+ }
172
+ }
173
+ //If Cost is the attribute chosen
174
+ if($numberAttr && $numberAttr == 'cost') {
175
+ $numberAttr = null;
176
+ $cost = round($product->getData('cost'),2);
177
+ if(is_numeric($cost)) {
178
+ $numberAttr = $this->_editString($cost) . '";';
179
+ }
180
+ }
181
+ //If Stock Remaining is the Attribute chosen
182
+ if($numberAttr && $numberAttr == 'inventory') {
183
+ $numberAttr = null;
184
+ $qty = round(Mage::getSingleton('cataloginventory/stock_item')->loadByProduct($product)->getQty(),0);
185
+ if(is_numeric($qty)) {
186
+ $numberAttr = $this->_editString($qty) . '";';
187
+ }
188
+ }
189
+ //If Weight is the attribute chosen
190
+ if($numberAttr && $numberAttr == 'weight') {
191
+ $numberAttr = null;
192
+ $weight = round($product->getData('weight'),2);
193
+ if(is_numeric($weight)) {
194
+ $numberAttr = $this->_editString($weight) . '";';
195
+ }
196
+ }
197
+ return $numberAttr;
198
+ }
199
+
200
+ /**
201
+ * Find the value of the custom product attributes selected in system config
202
+ * if that are stored as int values
203
+ *
204
+ * @param $attribute
205
+ * @return string
206
+ */
207
+ protected function _getCustomAttributeValue($attribute) {
208
+ $product = $this->_getProduct();
209
+ if(is_numeric($product->getData($attribute))) {
210
+ $attributeText = $product->getAttributeText($attribute);
211
+ if($attributeText) {
212
+ return $attributeText;
213
+ }else{
214
+ return round($product->getData($attribute),2);
215
+ }
216
+ }else{
217
+ return $product->getData($attribute);
218
+ }
219
+ }
220
+
221
+ /**
222
+ * Trims each string within the variable definitions to 50 characters or less
223
+ * if the string is more than 50 characters. Also gets rid of characters that
224
+ * may cause JS errors like ", ', and ;
225
+ *
226
+ * @param $string
227
+ * @return string
228
+ */
229
+ protected function _editString($string) {
230
+ if(strlen($string) > 50) {
231
+ $newString = substr($string,0,50);
232
+ }else{
233
+ $newString = $string;
234
+ }
235
+
236
+ $badChars = array("\"","'",";","\n");
237
+ foreach($badChars as $char) {
238
+ if(strstr($newString, $char) !== FALSE){
239
+ $newString = str_replace($badChars,'',$newString);
240
+ }
241
+ }
242
+ return $newString;
243
+ }
244
+
245
+ /**
246
+ * Gets the frontend name of the custom attribute code being used
247
+ *
248
+ * @return mixed
249
+ */
250
+ protected function _customAttrName($customAttr) {
251
+ return $this->_customAttrName = $this->_getProduct()->getResource()->getAttribute($customAttr)->getStoreLabel();
252
+ }
253
+
254
+ /**
255
+ * Gets the current category we're on and finds out category name, ID, and
256
+ * immediate parent if one exists.
257
+ *
258
+ * @return string
259
+ */
260
+ protected function _getCategoryVariables() {
261
+ $category = $this->_getCategory();
262
+ $categoryVariables = "";
263
+ if($this->_helper()->isEnabled() == 1) {
264
+ if($category && !$this->_getProduct()) {
265
+ $categoryName = $category->getName();
266
+ $categoryId = $category->getId();
267
+
268
+ //Retrieve Stores where isset category Path, returns comma separated list
269
+ $pathInStore = $category->getPathInStore();
270
+ //Reverse the list so the current category is at the bottom
271
+ $pathIds = array_reverse(explode(',', $pathInStore));
272
+
273
+ $categories = $category->getParentCategories();
274
+ $categoryTree = array();
275
+ foreach ($pathIds as $categoryId) {
276
+ //Push all category names into $categoryTree array
277
+ if (isset($categories[$categoryId]) && $categories[$categoryId]->getName()) {
278
+ array_push($categoryTree, $categories[$categoryId]->getName());
279
+ }
280
+ }
281
+ //See if there are any parent categories by seeing how many keys are stored
282
+ //in the $categoryTree array
283
+ $categoryTreeCount = count(array_keys($categoryTree));
284
+ $parentCategory = '';
285
+ //If the $categoryTree array does have more than 1 key, then pass the value
286
+ //of the second to last key into $parentCategory
287
+ if($categoryTreeCount > 1) {
288
+ end($categoryTree);
289
+ $parentCategory = ';' . prev($categoryTree);
290
+ }
291
+
292
+ //Generates package and theme name for category template variable
293
+ $designPackage = Mage::getSingleton('core/design_package');
294
+ $package = $designPackage->getPackageName();
295
+ $theme = $designPackage->getTheme('frontend');
296
+ $categoryTemplate = $package . "/" . $theme;
297
+ $customDesign = $category->getData('custom_design');
298
+ if($customDesign && $category->getData('custom_use_parent_settings') == 0) {
299
+ $categoryTemplate = $customDesign;
300
+ }
301
+
302
+ //Create the convert.com category script:
303
+ $categoryVariables = self::TABBED_SPACE . 'var REED_page_type = "Category;' . $categoryTemplate . '";' . self::NEW_LINE;
304
+ $categoryVariables .= self::TABBED_SPACE . 'var REED_category_name = "' . $categoryName . $parentCategory . '";' . self::NEW_LINE;
305
+ $categoryVariables .= self::TABBED_SPACE . 'var REED_category_id = "' . $categoryId . '";' . self::NEW_LINE;
306
+ }
307
+ }
308
+ return $categoryVariables;
309
+ }
310
+
311
+ protected function _getCmsVariables() {
312
+ $cmsVariables = "";
313
+ if($this->_helper()->isEnabled() == 1 && $this->_isCms()) {
314
+ $cmsVariables = self::TABBED_SPACE . 'var REED_page_type = "CMS";' . self::NEW_LINE;
315
+ }
316
+ return $cmsVariables;
317
+ }
318
+ }
app/code/community/ConvertExperiments/ConvertExperiments/Block/System/.DS_Store ADDED
Binary file
app/code/community/ConvertExperiments/ConvertExperiments/Block/System/Config/.DS_Store ADDED
Binary file
app/code/community/ConvertExperiments/ConvertExperiments/Block/System/Config/Explanation.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ *
5
+ * @package ConvertExperiments
6
+ * @subpackage
7
+ * @version 1.0.7
8
+ * @author Robert Henderson
9
+ */
10
+ class ConvertExperiments_ConvertExperiments_Block_System_Config_Explanation extends Mage_Adminhtml_Block_System_Config_Form_Field {
11
+
12
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
13
+ return 'There are 4 attributes you can set to tag product pages with. These attributes will be included in your convert.com report and be available for variant testing. Price, Name, and SKU are not available to select as these attributes will automatically be recorded for every product.';
14
+ }
15
+
16
+ /**
17
+ * Enter description here...
18
+ *
19
+ * @param Varien_Data_Form_Element_Abstract $element
20
+ * @return string
21
+ */
22
+ public function render(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ $id = $element->getHtmlId();
25
+
26
+ $useContainerId = $element->getData('use_container_id');
27
+ $html = '<tr id="row_' . $id . '">'
28
+ . '<td class="label"><label for="'.$id.'">'.$element->getLabel().'</label></td>';
29
+
30
+ //$isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
31
+ $isMultiple = $element->getExtType()==='multiple';
32
+
33
+ // replace [value] with [inherit]
34
+ $namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName());
35
+
36
+ $options = $element->getValues();
37
+
38
+ $addInheritCheckbox = false;
39
+ if ($element->getCanUseWebsiteValue()) {
40
+ $addInheritCheckbox = true;
41
+ $checkboxLabel = Mage::helper('adminhtml')->__('Use Website');
42
+ }
43
+ elseif ($element->getCanUseDefaultValue()) {
44
+ $addInheritCheckbox = true;
45
+ $checkboxLabel = Mage::helper('adminhtml')->__('Use Default');
46
+ }
47
+
48
+ if ($addInheritCheckbox) {
49
+ $inherit = $element->getInherit()==1 ? 'checked="checked"' : '';
50
+ if ($inherit) {
51
+ $element->setDisabled(true);
52
+ }
53
+ }
54
+
55
+ $html.= '<td class="value">';
56
+ $html.= $this->_getElementHtml($element);
57
+ if ($element->getComment()) {
58
+ $html.= '<p class="note"><span>'.$element->getComment().'</span></p>';
59
+ }
60
+ $html.= '</td>';
61
+
62
+ if ($addInheritCheckbox) {
63
+
64
+ $defText = $element->getDefaultValue();
65
+ if ($options) {
66
+ $defTextArr = array();
67
+ foreach ($options as $k=>$v) {
68
+ if ($isMultiple) {
69
+ if (is_array($v['value']) && in_array($k, $v['value'])) {
70
+ $defTextArr[] = $v['label'];
71
+ }
72
+ } elseif ($v['value']==$defText) {
73
+ $defTextArr[] = $v['label'];
74
+ break;
75
+ }
76
+ }
77
+ $defText = join(', ', $defTextArr);
78
+ }
79
+ }
80
+
81
+ $html.= '<td class="">';
82
+ if ($element->getHint()) {
83
+ $html.= '<div class="hint" >';
84
+ $html.= '<div style="display: none;">' . $element->getHint() . '</div>';
85
+ $html.= '</div>';
86
+ }
87
+ $html.= '</td>';
88
+
89
+ $html.= '</tr>';
90
+ return $html;
91
+ }
92
+ }
app/code/community/ConvertExperiments/ConvertExperiments/Block/System/Config/Loginlink.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ *
5
+ * @package ConvertExperiments
6
+ * @subpackage
7
+ * @version 1.0.7
8
+ * @author Robert Henderson
9
+ */
10
+ class ConvertExperiments_ConvertExperiments_Block_System_Config_Loginlink extends Mage_Adminhtml_Block_System_Config_Form_Field {
11
+
12
+ protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
13
+ return '<a href="https://www.convertexperiments.com/login" target="_blank">Convert Experiments Login/Signup</a>';
14
+ }
15
+
16
+ /**
17
+ * Enter description here...
18
+ *
19
+ * @param Varien_Data_Form_Element_Abstract $element
20
+ * @return string
21
+ */
22
+ public function render(Varien_Data_Form_Element_Abstract $element)
23
+ {
24
+ $id = $element->getHtmlId();
25
+
26
+ $useContainerId = $element->getData('use_container_id');
27
+ $html = '<tr id="row_' . $id . '">'
28
+ . '<td class="label"><label for="'.$id.'">'.$element->getLabel().'</label></td>';
29
+
30
+ //$isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
31
+ $isMultiple = $element->getExtType()==='multiple';
32
+
33
+ // replace [value] with [inherit]
34
+ $namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName());
35
+
36
+ $options = $element->getValues();
37
+
38
+ $addInheritCheckbox = false;
39
+ if ($element->getCanUseWebsiteValue()) {
40
+ $addInheritCheckbox = true;
41
+ $checkboxLabel = Mage::helper('adminhtml')->__('Use Website');
42
+ }
43
+ elseif ($element->getCanUseDefaultValue()) {
44
+ $addInheritCheckbox = true;
45
+ $checkboxLabel = Mage::helper('adminhtml')->__('Use Default');
46
+ }
47
+
48
+ if ($addInheritCheckbox) {
49
+ $inherit = $element->getInherit()==1 ? 'checked="checked"' : '';
50
+ if ($inherit) {
51
+ $element->setDisabled(true);
52
+ }
53
+ }
54
+
55
+ $html.= '<td class="value">';
56
+ $html.= $this->_getElementHtml($element);
57
+ if ($element->getComment()) {
58
+ $html.= '<p class="note"><span>'.$element->getComment().'</span></p>';
59
+ }
60
+ $html.= '</td>';
61
+
62
+ if ($addInheritCheckbox) {
63
+
64
+ $defText = $element->getDefaultValue();
65
+ if ($options) {
66
+ $defTextArr = array();
67
+ foreach ($options as $k=>$v) {
68
+ if ($isMultiple) {
69
+ if (is_array($v['value']) && in_array($k, $v['value'])) {
70
+ $defTextArr[] = $v['label'];
71
+ }
72
+ } elseif ($v['value']==$defText) {
73
+ $defTextArr[] = $v['label'];
74
+ break;
75
+ }
76
+ }
77
+ $defText = join(', ', $defTextArr);
78
+ }
79
+ }
80
+
81
+ $html.= '<td class="">';
82
+ if ($element->getHint()) {
83
+ $html.= '<div class="hint" >';
84
+ $html.= '<div style="display: none;">' . $element->getHint() . '</div>';
85
+ $html.= '</div>';
86
+ }
87
+ $html.= '</td>';
88
+
89
+ $html.= '</tr>';
90
+ return $html;
91
+ }
92
+ }
app/code/community/ConvertExperiments/ConvertExperiments/Helper/Data.php ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Methods that retrieve saved data in the module's system configuration
4
+ *
5
+ * @package ConvertExperiments
6
+ * @subpackage ConvertExperiments
7
+ * @version 1.0.7
8
+ * @author Robert Henderson
9
+ */
10
+ class ConvertExperiments_ConvertExperiments_Helper_Data extends Mage_Core_Helper_Abstract {
11
+ const CONFIG_PATH = 'convert_experiments/';
12
+ protected $config = null;
13
+ protected $defaultGroup = "settings";
14
+ protected $storedConfigs = array();
15
+
16
+ /**
17
+ * Config meta method for getting gts config
18
+ *
19
+ * @param <type> $code
20
+ * @return <type>
21
+ */
22
+ public function getConfig($code = null, $group = null) {
23
+ if ($code !== null) {
24
+ if ($group == null) {
25
+ $group = $this->defaultGroup;
26
+ }
27
+ if (!isset($this->storedConfigs[$code])) {
28
+ $this->config = Mage::getStoreConfig(self::CONFIG_PATH . "$group/$code");
29
+ }else{
30
+ $this->config = $this->storedConfigs[$code];
31
+ }
32
+ }
33
+ return $this->config;
34
+ }
35
+
36
+ /**
37
+ * Is Convert Experiments enabled
38
+ *
39
+ * @return boolean
40
+ */
41
+ public function isEnabled() {
42
+ return $this->getConfig('enabled', 'settings');
43
+ }
44
+
45
+ /**
46
+ * Sitewide JS from system config
47
+ *
48
+ * @return string
49
+ */
50
+ public function getConvertProjectCode() {
51
+ if($this->isEnabled() == 1) {
52
+ return $this->getConfig('convert_experiments_project_code', 'settings');
53
+ }else{
54
+ return null;
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Get first custom product attribute from config
60
+ *
61
+ * @return int
62
+ */
63
+ public function getCustomAttrOne() {
64
+ if($this->isEnabled() == 1) {
65
+ return $this->getConfig('convert_experiments_custom_text_one', 'product_settings');
66
+ }else{
67
+ return null;
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Get second custom product attribute from config
73
+ *
74
+ * @return int
75
+ */
76
+ public function getCustomAttrTwo() {
77
+ if($this->isEnabled() == 1) {
78
+ return $this->getConfig('convert_experiments_custom_text_two', 'product_settings');
79
+ }else{
80
+ return null;
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Get third custom product attribute from config (number)
86
+ *
87
+ * @return int
88
+ */
89
+ public function getNumberAttrOne() {
90
+ if($this->isEnabled() == 1) {
91
+ return $this->getConfig('convert_experiments_custom_number_one', 'product_settings');
92
+ }else{
93
+ return null;
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Get fourth custom product attribute from config (number)
99
+ *
100
+ * @return int
101
+ */
102
+ public function getNumberAttrTwo() {
103
+ if($this->isEnabled() == 1) {
104
+ return $this->getConfig('convert_experiments_custom_number_two', 'product_settings');
105
+ }else{
106
+ return null;
107
+ }
108
+ }
109
+ }
app/code/community/ConvertExperiments/ConvertExperiments/Model/.DS_Store ADDED
Binary file
app/code/community/ConvertExperiments/ConvertExperiments/Model/DisallowDuplicates.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * TODO: Fix undefined index: value on line 23 when changing the value of an attribute on the store scope after default values are set.
4
+ * Makes sure the user doesn't select the same attribute twice.
5
+ *
6
+ * @package ConvertExperiments
7
+ * @subpackage ConvertExperiments
8
+ * @version 1.0.7
9
+ * @author Robert Henderson
10
+ */
11
+ class ConvertExperiments_ConvertExperiments_Model_DisallowDuplicates extends Mage_Core_Model_Config_Data {
12
+ /**
13
+ * @return Mage_Core_Model_Abstract
14
+ */
15
+ protected function _beforeSave() {
16
+ $groups = $this->getData('groups');
17
+ if(isset($groups['product_settings']['fields'])) {
18
+ $fields = $groups['product_settings']['fields'];
19
+ unset($fields['explanation']);
20
+
21
+ foreach($fields as $searchKey => $searchField) {
22
+ $searchField = $searchField['value'];
23
+ foreach ($fields as $key => $field) {
24
+ $field = $field['value'];
25
+ if($field && $field !== "" && $searchField && $searchField !== "") {
26
+ if ($searchKey != $key && $field == $searchField) {
27
+ Mage::throwException("Settings have not been saved. An attribute has been chosen twice. Please select only unique attributes.");
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+
34
+ return parent::_beforeSave();
35
+ }
36
+ }
app/code/community/ConvertExperiments/ConvertExperiments/Model/Enabledcheck.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sending a warning after save to tell the user they have not actually enabled
4
+ * the module so no settings will appear on the frontend.
5
+ *
6
+ * @package ConvertExperiments
7
+ * @subpackage ConvertExperiments
8
+ * @version 1.0.7
9
+ * @author Robert Henderson
10
+ */
11
+ class ConvertExperiments_ConvertExperiments_Model_Enabledcheck extends Mage_Core_Model_Config_Data {
12
+ /**
13
+ * Check to see if user has enabled the configuration, if not, warn them they have not
14
+ *
15
+ * @return Mage_Core_Model_Abstract|void
16
+ */
17
+ protected function _afterSave() {
18
+ $enabled = $this->getValue();
19
+ if($enabled == null || $enabled == 0) {
20
+ return Mage::getSingleton('core/session')->addNotice(Mage::helper('adminhtml')->__('You have not enabled the Blue Acorn Convert Experiments configuration. No data will appear on the frontend. Please enable to activate frontend Javascript output.'));
21
+ }
22
+ return parent::_afterSave();
23
+ }
24
+ }
app/code/community/ConvertExperiments/ConvertExperiments/Model/Entity/.DS_Store ADDED
Binary file
app/code/community/ConvertExperiments/ConvertExperiments/Model/Entity/Attribute.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Creates the select values in the configuration by pulling all catalog product
4
+ * attributes from the Magento DB.
5
+ *
6
+ * @package ConvertExperiments
7
+ * @subpackage ConvertExperiments
8
+ * @version 1.0.7
9
+ * @author Robert Henderson
10
+ */
11
+ class ConvertExperiments_ConvertExperiments_Model_Entity_Attribute extends Mage_Eav_Model_Entity_Attribute {
12
+ /**
13
+ * Options select for different types of custom text attributes
14
+ *
15
+ * @return array
16
+ */
17
+ public function toOptionArray() {
18
+ $eavEntityType = Mage::getModel('eav/entity_type')->loadByCode('catalog_product');
19
+ $attributes = $this->getCollection()->setEntityTypeFilter($eavEntityType->getId());
20
+ $excluded = array('sku','cost','price','name','weight');
21
+ $attributeOptions = array(
22
+ array('value' => 0, 'label' => Mage::helper('convert_experiments')->__('')),
23
+ );
24
+ $i = 1;
25
+ foreach($attributes as $attribute) {
26
+ $code = $attribute['attribute_code'];
27
+ $label = $attribute['frontend_label'];
28
+ if(!in_array($code,$excluded)){
29
+ if($label !== null && $label !== ""){
30
+ array_push($attributeOptions, array('value' => $code, 'label' => Mage::helper('convert_experiments')->__($label)));
31
+ $i++;
32
+ }
33
+ }
34
+ }
35
+ uasort($attributeOptions, 'blueAcornConvertExperimentsModelEntityAttributeCompareFunction');
36
+ return $attributeOptions;
37
+ }
38
+ }
39
+
40
+ function blueAcornConvertExperimentsModelEntityAttributeCompareFunction($a, $b)
41
+ {
42
+ if ($a['label'] == $b['label']) {
43
+ return 0;
44
+ }
45
+ return ($a['label'] < $b['label']) ? -1 : 1;
46
+ }
app/code/community/ConvertExperiments/ConvertExperiments/Model/Entity/Attribute/.DS_Store ADDED
Binary file
app/code/community/ConvertExperiments/ConvertExperiments/Model/Entity/Attribute/Integer.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Statically adds integer specific values to number array.
4
+ *
5
+ * @package ConvertExperiments
6
+ * @subpackage
7
+ * @version 1.0.7
8
+ * @author Robert Henderson
9
+ */
10
+ class ConvertExperiments_ConvertExperiments_Model_Entity_Attribute_Integer {
11
+ /**
12
+ * Options getter
13
+ *
14
+ * @return array
15
+ */
16
+ public function toOptionArray() {
17
+ return array(
18
+ array('value' => 0, 'label' => Mage::helper('convert_experiments')->__('')),
19
+ array('value' => 'news_from_date', 'label' => Mage::helper('convert_experiments')->__('Age (days)')),
20
+ array('value' => 'cost', 'label' => Mage::helper('convert_experiments')->__('Cost')),
21
+ array('value' => 'inventory', 'label' => Mage::helper('convert_experiments')->__('Stock Remaining')),
22
+ array('value' => 'weight', 'label' => Mage::helper('convert_experiments')->__('Weight')),
23
+ );
24
+ }
25
+ }
app/code/community/ConvertExperiments/ConvertExperiments/doc/.DS_Store ADDED
Binary file
app/code/community/ConvertExperiments/ConvertExperiments/doc/changelog.txt ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 1.0.0
2
+ Initial development of module. Added system configuration and definitions of
3
+ REED Javascript variables on product, category, and CMS pages.
4
+
5
+ 1.0.1
6
+ Fixed duplication error message that was always showing up on default scope, and
7
+ removed module from Blue Acorn tab and put under General tab.
8
+
9
+ 1.0.2
10
+ Increased PHP version compatibility to 5.3.15
11
+
12
+ 1.0.3
13
+ Moved Convert scripts output to the head block.
14
+
15
+ 1.0.4
16
+ Packaging Extension for EE on Magento Connect
17
+
18
+ 1.0.5
19
+ Removing text from numeric string variables and adding REED_page_type to
20
+ product pages.
21
+
22
+ 1.0.6
23
+ Bug fixes
24
+
25
+ 1.0.7
26
+ Increased PHP version compatibility to 5.4.13 despite Magento system requirements
27
+ only supporting up to 5.3.15 to accommodate those running higher versions on PHP
app/code/community/ConvertExperiments/ConvertExperiments/doc/design.txt ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * ConvertExperiments ConvertExperiments Magento Module
3
+ *
4
+ * @package ConvertExperiments
5
+ * @subpackage ConvertExperiments
6
+ * @version 1.0.7
7
+ * @author Robert Henderson
8
+ */
9
+
10
+ ConvertExperiments ConvertExperiments allows for an easy way to add necessary Convert.com
11
+ Javascript scripts and variables to pages of your Magento web store.
12
+
13
+ System Configuration:
14
+ The System Config is store scope specific so that you can enable the module on
15
+ one store of a multi-store Magento setup.
16
+
17
+ All that needs to be configured are your unique account identifier which will
18
+ look something like 1001234_1001234, and your custom product attributes. The
19
+ first two attributes are text attributes only,and the last two attributes are
20
+ numeric attributes only. The value of the attribute will be cut off at 50
21
+ characters.
22
+
23
+ If the module is disabled, nothing will output on the frontend of your website.
24
+
25
+ The Sitewide Header Javascript is placed directly below the opening <body> tag,
26
+ and before the Google Analytics script. The custom defined REED Javascript
27
+ variables are placed above the sitewide Javascript code, and are encapsulated
28
+ in the same script tag. Custom attribute variables defined in the system config
29
+ will only appear on product pages that have a value defined for that attribute.
30
+
31
+ If an admin user selects two of the same attribute, the configuration will not
32
+ be saved, and an error will be thrown telling the user to select unique
33
+ attributes for each custom value. All four attributes are not required, but it
34
+ is required to select unique attributes for each custom variable.
35
+
36
+ If you use the Age (days) custom number attribute, a value will appear inside
37
+ that variable on product pages that have the 'news_from_date' field defined on
38
+ the product level for that store. The module takes the current date and
39
+ subtracts the value given in 'news_from_date' to come up with an integer value.
40
+ This is represented in the number of days the product has been new for.
app/code/community/ConvertExperiments/ConvertExperiments/doc/makeTar.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ tar -czvf
2
+ ConvertExperiments_ConvertExperiments-1.0.7.tar.gz
3
+ app/code/community/ConvertExperiments/ConvertExperiments
4
+ app/etc/modules/ConvertExperiments_ConvertExperiments.xml
5
+ app/design/frontend/base/default/layout/convertexperiments/convertexperiments.xml
6
+ app/design/frontend/base/default/template/convertexperiments/convertexperiments
app/code/community/ConvertExperiments/ConvertExperiments/etc/.DS_Store ADDED
Binary file
app/code/community/ConvertExperiments/ConvertExperiments/etc/adminhtml.xml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <convert_experiments module="convert_experiments">
12
+ <title>Convert Experiments Extension</title>
13
+ </convert_experiments>
14
+ </children>
15
+ </config>
16
+ </children>
17
+ </system>
18
+ </children>
19
+ </admin>
20
+ </resources>
21
+ </acl>
22
+ </config>
app/code/community/ConvertExperiments/ConvertExperiments/etc/config.xml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <!-- Root node for Magento configuration files -->
3
+ <config>
4
+ <!-- modules node provides basic information about the module -->
5
+ <modules>
6
+ <!-- This node's name has to be the same as module's full name
7
+ including namespace -->
8
+ <ConvertExperiments_ConvertExperiments>
9
+ <!-- Current version of module -->
10
+ <version>1.0.0</version>
11
+ </ConvertExperiments_ConvertExperiments>
12
+ </modules>
13
+ <global>
14
+ <blocks>
15
+ <convert_experiments>
16
+ <class>ConvertExperiments_ConvertExperiments_Block</class>
17
+ </convert_experiments>
18
+ </blocks>
19
+ <helpers>
20
+ <convert_experiments>
21
+ <class>ConvertExperiments_ConvertExperiments_Helper</class>
22
+ </convert_experiments>
23
+ </helpers>
24
+ <models>
25
+ <convert_experiments>
26
+ <class>ConvertExperiments_ConvertExperiments_Model</class>
27
+ </convert_experiments>
28
+ </models>
29
+ </global>
30
+ <frontend>
31
+ <layout>
32
+ <updates>
33
+ <convert_experiments module="ConvertExperiments_ConvertExperiments">
34
+ <file>convertexperiments/convertexperiments.xml</file>
35
+ </convert_experiments>
36
+ </updates>
37
+ </layout>
38
+ </frontend>
39
+ <default>
40
+ <convert_experiments>
41
+ <settings>
42
+ <enabled>0</enabled>
43
+ <convert_experiments_sitewide_script>Enter Javascript provided to you in your account Convert.com here.</convert_experiments_sitewide_script>
44
+ </settings>
45
+ </convert_experiments>
46
+ </default>
47
+ </config>
app/code/community/ConvertExperiments/ConvertExperiments/etc/system.xml ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <convert_experiments translate="label" module="convert_experiments">
5
+ <class>convert-experiments</class>
6
+ <label>Convert Experiments</label>
7
+ <tab>general</tab>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>2000</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <groups>
14
+ <settings translate="label">
15
+ <label>General Settings</label>
16
+ <frontend_type>text</frontend_type>
17
+ <sort_order>0</sort_order>
18
+ <show_in_default>1</show_in_default>
19
+ <show_in_website>1</show_in_website>
20
+ <show_in_store>1</show_in_store>
21
+ <expanded>1</expanded>
22
+ <fields>
23
+ <signup translate="label">
24
+ <label>Login or Signup</label>
25
+ <frontend_model>convert_experiments/system_config_loginlink</frontend_model>
26
+ <frontend_type>text</frontend_type>
27
+ <sort_order>0</sort_order>
28
+ <show_in_default>1</show_in_default>
29
+ <show_in_website>1</show_in_website>
30
+ <show_in_store>1</show_in_store>
31
+ </signup>
32
+ <enabled translate="label">
33
+ <backend_model>convert_experiments/enabledcheck</backend_model>
34
+ <label>Enabled</label>
35
+ <frontend_type>select</frontend_type>
36
+ <source_model>adminhtml/system_config_source_yesno</source_model>
37
+ <sort_order>10</sort_order>
38
+ <show_in_default>1</show_in_default>
39
+ <show_in_website>1</show_in_website>
40
+ <show_in_store>1</show_in_store>
41
+ </enabled>
42
+ <convert_experiments_project_code translate="label">
43
+ <label>Convert.com Project Code</label>
44
+ <frontend_type>textarea</frontend_type>
45
+ <sort_order>20</sort_order>
46
+ <comment><![CDATA[Your Project Code is located on the Project Settings page in your <a href="https://www.convertexperiments.com/login" target="_blank">Convert Experiments Account</a>.]]></comment>
47
+ <show_in_default>1</show_in_default>
48
+ <show_in_website>1</show_in_website>
49
+ <show_in_store>1</show_in_store>
50
+ </convert_experiments_project_code>
51
+ </fields>
52
+ </settings>
53
+ <product_settings translate="label">
54
+ <label>Product Settings</label>
55
+ <frontend_type>text</frontend_type>
56
+ <sort_order>10</sort_order>
57
+ <show_in_default>1</show_in_default>
58
+ <show_in_website>1</show_in_website>
59
+ <show_in_store>1</show_in_store>
60
+ <expanded>1</expanded>
61
+ <fields>
62
+ <explanation translate="label">
63
+ <label>What are Product Settings?</label>
64
+ <frontend_model>convert_experiments/system_config_explanation</frontend_model>
65
+ <frontend_type>text</frontend_type>
66
+ <sort_order>0</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </explanation>
71
+ <convert_experiments_custom_text_one translate="label">
72
+ <label>Custom Text Attribute</label>
73
+ <!--<backend_model>convert_experiments/disallowDuplicates</backend_model>-->
74
+ <source_model>convert_experiments/entity_attribute</source_model>
75
+ <frontend_type>select</frontend_type>
76
+ <sort_order>10</sort_order>
77
+ <comment>Attributes are pulled from Magento Catalog Attributes.</comment>
78
+ <show_in_default>1</show_in_default>
79
+ <show_in_website>1</show_in_website>
80
+ <show_in_store>1</show_in_store>
81
+ </convert_experiments_custom_text_one>
82
+ <convert_experiments_custom_text_two translate="label">
83
+ <label>Custom Text Attribute</label>
84
+ <!--<backend_model>convert_experiments/disallowDuplicates</backend_model>-->
85
+ <source_model>convert_experiments/entity_attribute</source_model>
86
+ <frontend_type>select</frontend_type>
87
+ <sort_order>20</sort_order>
88
+ <comment>Please do not select the same attribute twice.</comment>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>1</show_in_store>
92
+ </convert_experiments_custom_text_two>
93
+ <convert_experiments_custom_number_one translate="label">
94
+ <label>Custom Number Attribute</label>
95
+ <!--<backend_model>convert_experiments/disallowDuplicates</backend_model>-->
96
+ <source_model>convert_experiments/entity_attribute_integer</source_model>
97
+ <frontend_type>select</frontend_type>
98
+ <sort_order>30</sort_order>
99
+ <comment>This attribute will always have an integer value.</comment>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </convert_experiments_custom_number_one>
104
+ <convert_experiments_custom_number_two translate="label">
105
+ <label>Custom Number Attribute</label>
106
+ <!--<backend_model>convert_experiments/disallowDuplicates</backend_model>-->
107
+ <source_model>convert_experiments/entity_attribute_integer</source_model>
108
+ <frontend_type>select</frontend_type>
109
+ <sort_order>40</sort_order>
110
+ <comment>This attribute will always have an integer value. Please do not select the same attribute twice.</comment>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>1</show_in_store>
114
+ </convert_experiments_custom_number_two>
115
+ </fields>
116
+ </product_settings>
117
+ </groups>
118
+ </convert_experiments>
119
+ </sections>
120
+ </config>
app/design/frontend/base/default/layout/convertexperiments/convertexperiments.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * This is the layout xml file for ConvertExperiments ConvertExperiments. It creates two
5
+ * blocks within a text_list block that output the sitewide Convert.com script,
6
+ * and the page specific REED variables, and custom defined product attribute
7
+ * variables.
8
+ *
9
+ * Author: Robert Henderson, Blue Acorn
10
+ * Version: 1.0.7
11
+ */
12
+
13
+ -->
14
+ <layout version="0.1.0">
15
+ <default>
16
+ <reference name="head">
17
+ <block type="core/text_list" name="convert_experiments" as="convert_experiments" after="-">
18
+ <block type="convert_experiments/reedScripts" name="convert_experiments_customer_type" as="convert_experiments_customer_type" template="convertexperiments/convertexperiments/reedVariables.phtml"/>
19
+ <block type="core/template" name="convert_experiments_sidewide" as="convert_experiments_sidewide" template="convertexperiments/convertexperiments/sitewideJs.phtml"/>
20
+ </block>
21
+ </reference>
22
+ </default>
23
+ </layout>
app/design/frontend/base/default/template/convertexperiments/convertexperiments/.DS_Store ADDED
Binary file
app/design/frontend/base/default/template/convertexperiments/convertexperiments/reedVariables.phtml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Outputs the customer ID on every page. If a customer is not logged in, the
4
+ * variable will be defined as "NOT LOGGED IN". If a customer is logged in, the
5
+ * variable will be their specific customer group code.
6
+ *
7
+ * After defining the customer id, the Convert.com REED variables are then
8
+ * printed within the same script tags.
9
+ *
10
+ * @package ConvertExperiments
11
+ * @subpackage ConvertExperiments
12
+ * @version 1.0.5
13
+ * @author Robert Henderson
14
+ */
15
+
16
+ $helper = Mage::helper('convert_experiments/data');
17
+
18
+ if($helper->isEnabled() == 1) {
19
+ $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
20
+ $group = Mage::getModel('customer/group')->load($groupId);
21
+ $groupName = $group->getCode();
22
+ $variables = "\t" . 'var REED_customer_id = "' . $groupName . '"; ' . "\n";
23
+ $variables .= "\t" . 'var REED_plugin_ID = "101"; ' . "\n";
24
+ echo $this->wrapReedVariables($variables);
25
+ }
app/design/frontend/base/default/template/convertexperiments/convertexperiments/sitewideJs.phtml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Displays the necessary Sitewide Convert.com Experiments script after body start
4
+ *
5
+ * @package ConvertExperiments
6
+ * @subpackage ConvertExperiments
7
+ * @version 1.0.5
8
+ * @author Robert Henderson
9
+ */
10
+ ?>
11
+ <?php $helper = Mage::helper('convert_experiments/data') ?>
12
+ <?php if($helper->isEnabled() == 1): ?>
13
+ <?php echo $helper->getConvertProjectCode() ?>
14
+ <?php endif; ?>
app/etc/modules/ConvertExperiments_ConvertExperiments.xml ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <!-- the same block we have in module's config.xml -->
4
+ <modules>
5
+ <!-- This node's name has to be the same as module's full name
6
+ including namespace -->
7
+ <ConvertExperiments_ConvertExperiments>
8
+ <!-- flag indicating weather module is active or not -->
9
+ <active>true</active>
10
+ <!-- code pool -->
11
+ <codePool>community</codePool>
12
+ </ConvertExperiments_ConvertExperiments>
13
+ </modules>
14
+ </config>
package.xml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>ConvertExperiments_ConvertExperiments</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="https://opensource.org/licenses/MIT">Massachusetts Institute of Technology License (MITL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Convert Experiments is an integration module that outputs necessary frontend JavaScript variables (automatic and user selected) based on Magento attributes. These variables are used in the user's Convert.com account to set up conversion testing.</summary>
10
+ <description>This module allows the user to select four unique Magento product attributes on a per-store basis that output values depending on whether the current product has the attribute assigned to it. In addition to the unique attribute variables, the module will automatically print out the product SKU, price, and name. On category pages, it prints out the category name, immediate parent category (if applicable), category ID, and package/theme used. It also places the Convert.com script below these variables for integration with the user's unique account.</description>
11
+ <notes>Has been tested for bugs, compatibility, and performance on Magento Community Edition 1.6+ and Magento Enterprise Edition 1.11+. This extension has not been tested in a live environment, so please leave feedback if you run into any issues. The next release will be after Blue Acorn user testing on a live environment. You will need to set your Magento Connect Manager state settings to Beta in order to install this release.&#xD;
12
+ &#xD;
13
+ *Magento does not officially support PHP versions higher than 5.5 and reference http://www.magentocommerce.com/system-requirements.</notes>
14
+ <authors><author><name>Convert Experiments</name><user>convertcom</user><email>dennis@convert.com</email></author></authors>
15
+ <date>2016-01-15</date>
16
+ <time>07:30:27</time>
17
+ <contents><target name="magecommunity"><dir name="ConvertExperiments"><dir name="ConvertExperiments"><dir name="Block"><file name="ReedScripts.php" hash="82a1db13053e5e7bc1063eae9f5e11f6"/><dir name="System"><dir name="Config"><file name="Explanation.php" hash="8f8964850ca49ba7e724a1274752a432"/><file name="Loginlink.php" hash="d910b72310b28d165bcfa2bd94669b40"/><file name=".DS_Store" hash="81e5faa19a0e6df84e68f55aec0633aa"/></dir><file name=".DS_Store" hash="ef3d3e32123fc5caa5619a71cad784f1"/></dir><file name=".DS_Store" hash="c519aea96cd1dc125ccb6ea3e58b6d12"/></dir><dir name="Helper"><file name="Data.php" hash="fd7a1a9097a54c78f8a4cff451b6f156"/></dir><dir name="Model"><file name="DisallowDuplicates.php" hash="0cd0b17adabc7f78a53f823aabfd676c"/><file name="Enabledcheck.php" hash="c4153d47a69a77599b1d5c9b9c68683c"/><dir name="Entity"><dir name="Attribute"><file name="Integer.php" hash="88d27848eca0f5c27ea0275ca3387a0a"/><file name=".DS_Store" hash="1e7063b77b9595ad9b1bd64a610ba496"/></dir><file name="Attribute.php" hash="0fd522b3256e5adee9d56ec3e01a6454"/><file name=".DS_Store" hash="dafa4ff86b720370ffcd68710b9e5cd8"/></dir><file name=".DS_Store" hash="8b4337e4beb09aa7234144bf440c5e98"/></dir><dir name="doc"><file name="changelog.txt" hash="7131a45315bdae4a5f92469ecf64e44e"/><file name="design.txt" hash="cdf0607888eecc22c56e7e77b81565b0"/><file name="makeTar.txt" hash="5c2c3dd9ad70acbbb3a3524d2f52d901"/><file name=".DS_Store" hash="eb70f9938fa753369feafd88c478c14e"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c58cb52aaf6fc750eedfc8af30e914f2"/><file name="config.xml" hash="3d0ec1610ce96d91d6614207507d7cb1"/><file name="system.xml" hash="d5f1ac292555f0d5fa43e2e40a9a2cd5"/><file name=".DS_Store" hash="91a1fef1e4bda5462303427cae2c283a"/></dir><file name=".DS_Store" hash="8422decdf931bb383c3682dd5614679b"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="ConvertExperiments_ConvertExperiments.xml" hash="e86fbcffdb12f39f171db94e99a5b436"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="convertexperiments"><file name="convertexperiments.xml" hash="fc9c3d2d72450378e46a7c1447dc8fd5"/></dir></dir><dir name="template"><dir name="convertexperiments"><dir name="convertexperiments"><file name="reedVariables.phtml" hash="fe2156ef72e653e61756c24c1ad97fda"/><file name="sitewideJs.phtml" hash="3c71891904035e422b1372a4cb620850"/><file name=".DS_Store" hash="26647f6ec54693265c93ab9802eafaa5"/></dir></dir></dir></dir></dir></dir></target></contents>
18
+ <compatible/>
19
+ <dependencies><required><php><min>5.1.0</min><max>5.6.99</max></php></required></dependencies>
20
+ </package>