Tagman_Intellitag - Version 1.0.8

Version Notes

redone version of TagMan's magento extension

Download this release

Release Info

Developer Toby Doig
Extension Tagman_Intellitag
Version 1.0.8
Comparing to
See all releases


Code changes from version 1.0.7 to 1.0.8

Files changed (25) hide show
  1. app/code/community/Tagman/Intellitag/Block/Adminhtml/Variables.php +12 -13
  2. app/code/community/Tagman/Intellitag/Block/Adminhtml/Variables/Edit/Form.php +62 -160
  3. app/code/community/Tagman/Intellitag/Block/Adminhtml/Variables/Edit/FormHelper.php +209 -0
  4. app/code/community/Tagman/Intellitag/Block/Adminhtml/Variables/Edit/MethodHelper.php +168 -0
  5. app/code/community/Tagman/Intellitag/Block/Adminhtml/Variables/Grid.php +67 -74
  6. app/code/community/Tagman/Intellitag/Block/AttributeHelper.php +96 -0
  7. app/code/community/Tagman/Intellitag/Block/CatalogInformationHelper.php +60 -0
  8. app/code/community/Tagman/Intellitag/Block/CustomerInformationHelper.php +99 -0
  9. app/code/community/Tagman/Intellitag/Block/Field.php +0 -9
  10. app/code/community/Tagman/Intellitag/Block/FilterHelper.php +47 -0
  11. app/code/community/Tagman/Intellitag/Block/GeneralInformationHelper.php +53 -0
  12. app/code/community/Tagman/Intellitag/Block/JsInjector.php +190 -176
  13. app/code/community/Tagman/Intellitag/Block/JsInjectorHelper.php +318 -0
  14. app/code/community/Tagman/Intellitag/Block/OrderAndCartInformationHelper.php +216 -0
  15. app/code/community/Tagman/Intellitag/Block/ProductDetailPageHelper.php +57 -0
  16. app/code/community/Tagman/Intellitag/Block/Select.php +1 -5
  17. app/code/community/Tagman/Intellitag/Block/Text.php +9 -13
  18. app/code/community/Tagman/Intellitag/Helper/Data.php +3 -3
  19. app/code/community/Tagman/Intellitag/controllers/Adminhtml/VariablesController.php +15 -23
  20. app/code/community/Tagman/Intellitag/etc/adminhtml.xml +1 -1
  21. app/code/community/Tagman/Intellitag/etc/config.xml +7 -9
  22. app/code/community/Tagman/Intellitag/sql/tagman_intellitag_setup/{mysql4-install-1.0.7.php → mysql4-install-1.0.0.php} +0 -0
  23. app/code/community/Tagman/Intellitag/sql/tagman_intellitag_setup/mysql4-install-1.0.8.php +34 -0
  24. app/design/frontend/base/default/layout/tagman_intellitag.xml +0 -21
  25. package.xml +9 -9
app/code/community/Tagman/Intellitag/Block/Adminhtml/Variables.php CHANGED
@@ -1,14 +1,13 @@
1
- <?php
2
- class Tagman_Intellitag_Block_Adminhtml_Variables extends Mage_Adminhtml_Block_Widget_Grid_Container
3
- {
4
- public function __construct()
5
- {
6
- parent::__construct();
7
-
8
- $this->_blockGroup = 'tagman_intellitag';
9
- $this->_controller = 'adminhtml_variables';
10
- $this->_headerText = $this->__('Variables');
11
-
12
-
13
- }
14
  }
1
+ <?php
2
+ class Tagman_Intellitag_Block_Adminhtml_Variables extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+
8
+ $this->_blockGroup = 'tagman_intellitag';
9
+ $this->_controller = 'adminhtml_variables';
10
+ $this->_headerText = $this->__('Variables');
11
+
12
+ }
 
13
  }
app/code/community/Tagman/Intellitag/Block/Adminhtml/Variables/Edit/Form.php CHANGED
@@ -1,15 +1,32 @@
1
  <?php
2
- class Tagman_Intellitag_Block_Adminhtml_Variables_Edit_Form extends Mage_Adminhtml_Block_Widget_Form{
3
 
 
 
 
 
 
 
 
 
 
4
  public function __construct(){
5
  parent::__construct();
6
  $this->setId('tagman_intelllitag_variables_form');
7
  $this->setTitle($this->__('Variable Information'));
8
  }
9
-
10
  protected function _prepareForm(){
11
- $lmModelFromRegistry = Mage::registry('tagman_intellitag');
12
-
 
 
 
 
 
 
 
 
 
 
13
  $loForm = new Varien_Data_Form(array(
14
  'id' => 'edit_form',
15
  'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
@@ -51,181 +68,59 @@ class Tagman_Intellitag_Block_Adminhtml_Variables_Edit_Form extends Mage_Adminht
51
  'title' => Mage::helper('tagman_intellitag')->__('Static Variable'),
52
  'required' => true
53
  ));
54
-
55
- //define models for dropdown
56
-
57
- $laModelsForDropdownList=array('catalog/category'=>'catalog/category',
58
- 'catalog/product'=>'catalog/product',
59
- 'customer/customer'=>'customer/customer',
60
- 'sales/order'=>'sales/order',
61
- 'sales/quote'=>'sales/quote');
62
 
63
  $loFieldMagentoModelSelect = $loFieldSet->addField('magento_model', 'select', array(
64
  'name' => 'magento_model',
65
- 'label' => Mage::helper('tagman_intellitag')->__('Model'),
66
  'title' => Mage::helper('tagman_intellitag')->__('Magento Model'),
67
  'required' => true,
68
  'options' => $laModelsForDropdownList
69
  ));
70
-
71
- foreach($laModelsForDropdownList as $tsCurrentModelName){
72
 
 
 
 
 
 
 
 
 
 
73
  $taPropertiesForDropdownList=null;
74
- $tmCurrentlyLoadedModel = Mage::getModel($tsCurrentModelName);
75
- $tsPropertyIdForHTML=str_replace("/","_",$tsCurrentModelName);
76
  $tsPropertyIdForHTML.="_property";
77
- $tsPropertyNameForHTML=$tsPropertyIdForHTML;
78
-
79
- foreach (get_class_methods(get_class($tmCurrentlyLoadedModel)) as $tsCurrentMethodName){
80
- $tsFormatedMethodName=substr($tsCurrentMethodName,3,strlen($tsCurrentMethodName));
81
- $toReflectionMethod = new ReflectionMethod(get_class($tmCurrentlyLoadedModel),$tsCurrentMethodName);
82
- $toReflectionParameters = $toReflectionMethod->getParameters();
83
-
84
- //define dynamic methods that shouldn't be displayed
85
- switch($tsCurrentModelName){
86
- case 'catalog/category':
87
- $laFilteredOutMethods = array('getDesignAttributes','getUrlInstance','getCacheIdTags','getCacheTags');
88
- break;
89
- case 'customer/customer':
90
- $laFilteredOutMethods = array('getEntityType','getStore','getCacheIdTags','getCacheTags','getPrimaryBillingAddress','getDefaultBillingAddress','getPrimaryShippingAddress','getDefaultShippingAddress');
91
- break;
92
- case 'sales/order':
93
- $laFilteredOutMethods = array('getCacheIdTags','getCacheTags','getBillingAddress','getShippingAddress','getPayment','getShippingCarrier');
94
- break;
95
- case 'sales/quote':
96
- $laFilteredOutMethods = array('getStore','getCacheIdTags','getCacheTags');
97
- break;
98
- case 'catalog/product':
99
- $laFilteredOutMethods = array('getCacheIdTags','getCacheTags');
100
- break;
101
- default:
102
- break;
103
- }
104
- if(preg_match('/get/',$tsCurrentMethodName) && substr($tsCurrentMethodName,0,1)!="_" && count($toReflectionParameters)==0 && !in_array($tsCurrentMethodName,$laFilteredOutMethods)){
105
- try{
106
- $property_type = gettype($tmCurrentlyLoadedModel->$tsCurrentMethodName());
107
- }
108
- catch(Exception $e){
109
- $property_type="NULL";
110
- }
111
- switch($property_type){
112
- case 'object':
113
- $loObject=$tmCurrentlyLoadedModel->$tsCurrentMethodName();
114
- $loObjectVariables=get_object_vars($loObject);
115
- if(count($loObjectVariables)>0){
116
- $taReturnedDataArray=$loObject->getData();
117
- $taKeysList=array_keys($taReturnedDataArray);
118
- foreach($taKeysList as $tsKey){
119
- $tsMethodNameExtension=str_replace("_"," ",$tsKey);
120
- $tsMethodNameExtension=ucwords($tsMethodNameExtension);
121
- $tsMethodNameExtension=str_replace(" ","",$tsMethodNameExtension);
122
- $tsPropertyDropdownValue = $tsCurrentMethodName."&&get".$tsMethodNameExtension;
123
- $taPropertiesForDropdownList[$tsPropertyDropdownValue]=$tsFormatedMethodName.' / '.$tsMethodNameExtension;
124
- }
125
- }
126
- break;
127
- case 'array':
128
- $taReturnedArray = $tmCurrentlyLoadedModel->$tsCurrentMethodName();
129
- if(count($taReturnedArray)>0){
130
- switch(gettype(reset($taReturnedArray))){
131
- case 'string':
132
- case 'integer':
133
- case 'double':
134
- case 'boolean':
135
- $taPropertiesForDropdownList[$tsCurrentMethodName]=$tsFormatedMethodName;
136
- break;
137
- case 'NULL':
138
- case 'array':
139
- break;
140
- case 'object':
141
- $loObjectArray=$tmCurrentlyLoadedModel->$tsCurrentMethodName();
142
- foreach($loObjectArray as $loObject){
143
- $loObjectVariables=get_object_vars($loObject);
144
- if(count($loObjectVariables)>0){
145
- $taReturnedDataArray = $loObject->getData();
146
- $taKeysList=array_keys($taReturnedDataArray);
147
- foreach($taKeysList as $tsKey){
148
- $tsMethodNameExtension = str_replace("_"," ",$tsKey);
149
- $tsMethodNameExtension = ucwords($tsMethodNameExtension);
150
- $tsMethodNameExtension = str_replace(" ","",$tsMethodNameExtension);
151
- $tsPropertyDropdownValue = $tsCurrentMethodName."&&get".$tsMethodNameExtension;
152
- $taPropertiesForDropdownList[$tsPropertyDropdownValue]=$tsFormatedMethodName.' / '.$tsMethodNameExtension;
153
- }
154
- }
155
- }
156
- default:
157
- break;
158
- }
159
- }
160
- break;
161
- case 'string':
162
- case 'integer':
163
- case 'boolean':
164
- case 'double':
165
- $taPropertiesForDropdownList[$tsCurrentMethodName]=$tsFormatedMethodName;
166
- break;
167
- case 'NULL':
168
- break;
169
- default:
170
- $taPropertiesForDropdownList[$tsCurrentMethodName]=$tsFormatedMethodName.'('.$property_type.') - NOT HANDELD';
171
- break;
172
- }
173
- }
174
 
175
- // add options manualy for models/methodes that are not initiated in backend
 
 
 
 
 
 
176
 
177
- switch($tsCurrentModelName){
178
- case 'catalog/category':
179
- $taHardcodedMethodsList=array('getName','getId','getStoreIds');
180
- break;
181
- case 'catalog/product':
182
- $taHardcodedMethodsList=array('getName','getPrice','getGroupPrice','getCalculatedFinalPrice','getMinimalPrice','getSpecialPrice','getSpecialFromDate','getSpecialToDate','getSku','getWeight','getId','getCategoryIds','getStoreIds','getRelatedProductIds','getUpSellProductIds','getCrossSellProductIds','getPrimaryAddressIds');
183
- break;
184
- case 'sales/order':
185
- $taHardcodedMethodsList=array('getRealOrderId','getStoreCurrency','getId','getTrackingNumbers');
186
- if($tsCurrentMethodName=="getAllItems"){
187
- $laObjectPropertyStrings = array('getProductId','getName','getSku','getQty','getPrice');
188
- foreach($laObjectPropertyStrings as $tsObjectProperty){
189
- $tsNameExtension=substr($tsObjectProperty,3);
190
- $tsPropertyDropdownValue = $tsCurrentMethodName."&&".$tsObjectProperty;
191
- $taPropertiesForDropdownList[$tsPropertyDropdownValue]=$tsFormatedMethodName.' / '.$tsNameExtension;
192
- next($laObjectPropertyStrings);
193
- }
194
- }
195
- break;
196
- case 'customer/customer':
197
- $taHardcodedMethodsList=array('getId','getPrimaryAddressIds');
198
- break;
199
- case 'sales/quote':
200
- $taHardcodedMethodsList=array('getId');
201
- if($tsCurrentMethodName=="getAllItems"){
202
- $laObjectPropertyStrings = array('getProductId','getName','getSku','getQty','getPrice');
203
- foreach($laObjectPropertyStrings as $tsObjectProperty){
204
- $tsNameExtension=substr($tsObjectProperty,3);
205
- $tsPropertyDropdownValue = $tsCurrentMethodName."&&".$tsObjectProperty;
206
- $taPropertiesForDropdownList[$tsPropertyDropdownValue]=$tsFormatedMethodName.' / '.$tsNameExtension;
207
- next($laObjectPropertyStrings);
208
- }
209
- }
210
- break;
211
- default:
212
- $taHardcodedMethodsList=array('');
213
- break;
214
- }
215
- if (in_array($tsCurrentMethodName, $taHardcodedMethodsList)) {
216
- $taPropertiesForDropdownList[$tsCurrentMethodName]=$tsFormatedMethodName;
217
- }
218
- }
219
  $laFieldModelProperty[] = $loFieldSet->addField($tsPropertyIdForHTML, 'select', array(
220
  'name' => $tsPropertyNameForHTML,
221
- 'label' => Mage::helper('tagman_intellitag')->__('Property'),
222
  'title' => Mage::helper('tagman_intellitag')->__($tsPropertyIdForHTML),
223
  'required' => true,
224
- 'options' => $taPropertiesForDropdownList
225
 
226
  ));
227
  }
228
 
 
 
 
 
229
  if($lmModelFromRegistry->getData('is_static')==2){
230
  $taData=explode("&&",$lmModelFromRegistry->getData('magento_value'));
231
  $tsFieldName=str_replace("/","_",$taData[0]);
@@ -238,10 +133,17 @@ class Tagman_Intellitag_Block_Adminhtml_Variables_Edit_Form extends Mage_Adminht
238
  $lmModelFromRegistry->setData($tsFieldName,$taData[1]);
239
  }
240
  }
 
 
 
241
  $loForm->setValues($lmModelFromRegistry->getData());
242
  $loForm->setUseContainer(true);
243
  $this->setForm($loForm);
244
 
 
 
 
 
245
  $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence','dependence_fields')
246
  ->addFieldMap($loFieldVariableType->getHtmlId(), $loFieldVariableType->getName())
247
  ->addFieldMap($loFieldMagentoValue->getHtmlId(), $loFieldMagentoValue->getName())
@@ -256,7 +158,7 @@ class Tagman_Intellitag_Block_Adminhtml_Variables_Edit_Form extends Mage_Adminht
256
  $loFieldVariableType->getName(),
257
  '2'));
258
  foreach($laModelsForDropdownList as $tsCurrentModelName){
259
- $modelName[]=$tsCurrentModelName;
260
  }
261
  $block = $this->getChild('form_after');
262
  for($i=0;$i<count($laFieldModelProperty);$i++){
1
  <?php
 
2
 
3
+ /**
4
+ * Creates a Edit/New Form for Creating TagMan static and dynamic variables
5
+ */
6
+
7
+ require_once "FormHelper.php";
8
+ require_once "MethodHelper.php";
9
+
10
+ class Tagman_Intellitag_Block_Adminhtml_Variables_Edit_Form extends Mage_Adminhtml_Block_Widget_Form{
11
+
12
  public function __construct(){
13
  parent::__construct();
14
  $this->setId('tagman_intelllitag_variables_form');
15
  $this->setTitle($this->__('Variable Information'));
16
  }
 
17
  protected function _prepareForm(){
18
+
19
+ /**
20
+ * Load a TagMan variables model
21
+ */
22
+
23
+ $lmModelFromRegistry = Mage::registry('tagman_intellitag');
24
+
25
+ /**
26
+ * Create Form field-sets and fields
27
+ */
28
+
29
+
30
  $loForm = new Varien_Data_Form(array(
31
  'id' => 'edit_form',
32
  'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
68
  'title' => Mage::helper('tagman_intellitag')->__('Static Variable'),
69
  'required' => true
70
  ));
71
+
72
+ /**
73
+ * Get Magento models and custom defined groups
74
+ * Used the create dropdown options in form
75
+ */
76
+
77
+ $laModelsForDropdownList=FormHelper::getModelsForDropdown();
 
78
 
79
  $loFieldMagentoModelSelect = $loFieldSet->addField('magento_model', 'select', array(
80
  'name' => 'magento_model',
81
+ 'label' => Mage::helper('tagman_intellitag')->__('Scope'),
82
  'title' => Mage::helper('tagman_intellitag')->__('Magento Model'),
83
  'required' => true,
84
  'options' => $laModelsForDropdownList
85
  ));
 
 
86
 
87
+ /**
88
+ * Loop trough every model from dropdown
89
+ * Create dropdowns with model 'get' methods of basic type(num, string, array)
90
+ * Filter out 'get' methods that should not be used
91
+ * Extend the dropdowns with custom defined methods
92
+ */
93
+
94
+ foreach($laModelsForDropdownList as $tsCurrentModelName){
95
+
96
  $taPropertiesForDropdownList=null;
97
+
98
+ $tsPropertyIdForHTML=str_replace("/","_",array_search($tsCurrentModelName, $laModelsForDropdownList));
99
  $tsPropertyIdForHTML.="_property";
100
+ $tsPropertyNameForHTML=$tsPropertyIdForHTML;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
+ $tmCurrentlyLoadedModel = Mage::getModel(array_search($tsCurrentModelName, $laModelsForDropdownList));
103
+ $taLoadedModelGetMethods = FormHelper::getLoadedModelGetMethods($tmCurrentlyLoadedModel);
104
+ $taBasicTypeMethods = FormHelper::getBasicTypeMethods($tmCurrentlyLoadedModel, $taLoadedModelGetMethods);
105
+ $taFilteredAndCustomMethods = MethodHelper::prepareArray($taBasicTypeMethods,array_search($tsCurrentModelName, $laModelsForDropdownList));
106
+
107
+ $laFormatedMethodNames = FormHelper::formatMethodNames($taFilteredAndCustomMethods);
108
+ $finalMethodList = FormHelper::getFinalMethodList($laFormatedMethodNames, $taFilteredAndCustomMethods);
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  $laFieldModelProperty[] = $loFieldSet->addField($tsPropertyIdForHTML, 'select', array(
111
  'name' => $tsPropertyNameForHTML,
112
+ 'label' => Mage::helper('tagman_intellitag')->__('Value'),
113
  'title' => Mage::helper('tagman_intellitag')->__($tsPropertyIdForHTML),
114
  'required' => true,
115
+ 'options' => $finalMethodList
116
 
117
  ));
118
  }
119
 
120
+ /**
121
+ * In edit mode populate the form with the saved data
122
+ */
123
+
124
  if($lmModelFromRegistry->getData('is_static')==2){
125
  $taData=explode("&&",$lmModelFromRegistry->getData('magento_value'));
126
  $tsFieldName=str_replace("/","_",$taData[0]);
133
  $lmModelFromRegistry->setData($tsFieldName,$taData[1]);
134
  }
135
  }
136
+ if($lmModelFromRegistry->getData('is_static')==3){
137
+ $lmModelFromRegistry->setData("custom_value",$lmModelFromRegistry->getData('magento_value'));
138
+ }
139
  $loForm->setValues($lmModelFromRegistry->getData());
140
  $loForm->setUseContainer(true);
141
  $this->setForm($loForm);
142
 
143
+ /**
144
+ * Set form field dependencies
145
+ */
146
+
147
  $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence','dependence_fields')
148
  ->addFieldMap($loFieldVariableType->getHtmlId(), $loFieldVariableType->getName())
149
  ->addFieldMap($loFieldMagentoValue->getHtmlId(), $loFieldMagentoValue->getName())
158
  $loFieldVariableType->getName(),
159
  '2'));
160
  foreach($laModelsForDropdownList as $tsCurrentModelName){
161
+ $modelName[]=array_search($tsCurrentModelName, $laModelsForDropdownList);
162
  }
163
  $block = $this->getChild('form_after');
164
  for($i=0;$i<count($laFieldModelProperty);$i++){
app/code/community/Tagman/Intellitag/Block/Adminhtml/Variables/Edit/FormHelper.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Methods used to populate the Form dropdown options
4
+ */
5
+ final class FormHelper{
6
+
7
+ private static $paModelsForDropdown = array();
8
+
9
+ private static $pbHasParameters;
10
+ private static $pbIsBasicType;
11
+ private static $pbIsBasicArray;
12
+ private static $objectHasData;
13
+
14
+ /**
15
+ * Get the defined list of Magento models
16
+ * @return array
17
+ */
18
+
19
+ public static function getModelsForDropdown(){
20
+
21
+ self::$paModelsForDropdown['catalog/product']='Product Detail Page';
22
+ self::$paModelsForDropdown['customer/customer']='Customer Information';
23
+ self::$paModelsForDropdown['sales/order']='Order Confirmation Page';
24
+ self::$paModelsForDropdown['sales/quote']='Cart & Checkout Page';
25
+ self::$paModelsForDropdown['catalog/category']='Catalog Information';
26
+ self::$paModelsForDropdown['general']='Other information';
27
+
28
+ asort(self::$paModelsForDropdown);
29
+
30
+ return self::$paModelsForDropdown;
31
+ }
32
+
33
+ /**
34
+ * Get 'get' class methods for given model
35
+ * @param Magento Model $model
36
+ * @return array
37
+ */
38
+
39
+ public static function getLoadedModelGetMethods($model){
40
+
41
+ $paGetMethods=array();
42
+
43
+ if($model){
44
+ foreach (get_class_methods(get_class($model)) as $tsCurrentMethodName){
45
+ if(preg_match('/get/',$tsCurrentMethodName) && substr($tsCurrentMethodName,0,1)!="_"){
46
+ array_push($paGetMethods, $tsCurrentMethodName);
47
+ }
48
+ }
49
+ }
50
+
51
+ return $paGetMethods;
52
+ }
53
+
54
+ /**
55
+ * Get the 'get' methods of basic type (num, string, array)
56
+ * @param Magento Model $model
57
+ * @param array $methodList
58
+ * @return array
59
+ */
60
+
61
+ public static function getBasicTypeMethods($model,$methodList){
62
+
63
+ $paBasicTypeMethods=array();
64
+
65
+ if ($model) {
66
+ foreach ($methodList as $method){
67
+ if(!self::hasParameters($model, $method)){
68
+ try {
69
+ $tmp = gettype($model->$method());
70
+ if(self::isBasicType($model,$method)) array_push($paBasicTypeMethods, $method);
71
+ }
72
+ catch (Exception $e){
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ return $paBasicTypeMethods;
79
+ }
80
+
81
+ /**
82
+ * Check does the given method require attributes
83
+ * @param Magento Model $model
84
+ * @param String $method
85
+ * @return bool
86
+ */
87
+
88
+ private static function hasParameters($model,$method){
89
+
90
+ if ($model) {
91
+ try{
92
+ $toReflectionMethod = new ReflectionMethod(get_class($model),$method);
93
+ $toReflectionParameters = $toReflectionMethod->getParameters();
94
+ }
95
+ catch (Exception $e){
96
+
97
+ }
98
+ if (count($toReflectionParameters)==0) {
99
+ self::$pbHasParameters=(bool)false;
100
+ }
101
+ else{
102
+ self::$pbHasParameters=(bool)true;
103
+ }
104
+ }
105
+
106
+ return self::$pbHasParameters;
107
+ }
108
+
109
+ /**
110
+ * Check does the given method return a basic type
111
+ * @param Magento Model $model
112
+ * @param String $method
113
+ */
114
+
115
+ private static function isBasicType($model,$method){
116
+
117
+ self::$pbIsBasicType = (bool)false;
118
+
119
+ switch (gettype($model->$method())){
120
+ case 'array':
121
+ self::$pbIsBasicType =(bool)self::handleArrayType($model,$method);
122
+ break;
123
+ case 'string':
124
+ case 'integer':
125
+ case 'double':
126
+ self::$pbIsBasicType = (bool)true;
127
+ break;
128
+ default:
129
+ self::$pbIsBasicType = (bool)false;
130
+ break;
131
+ }
132
+
133
+ return self::$pbIsBasicType;
134
+ }
135
+
136
+ /**
137
+ * Check is array member of basic type
138
+ * @param unknown $model
139
+ * @param unknown $method
140
+ * @return boolean
141
+ */
142
+
143
+ private static function handleArrayType($model,$method){
144
+
145
+ $taReturnedArray = $model->$method();
146
+
147
+ if(count($taReturnedArray)>0){
148
+ switch (gettype(reset($taReturnedArray))){
149
+ case 'string':
150
+ case 'integer':
151
+ case 'double':
152
+ case 'boolean':
153
+ self::$pbIsBasicArray = (bool)true;
154
+ break;
155
+ default:
156
+ self::$pbIsBasicArray = (bool)false;
157
+ break;
158
+ }
159
+ }
160
+ else{
161
+ self::$pbIsBasicArray = (bool)false;
162
+ }
163
+
164
+ return self::$pbIsBasicArray;
165
+ }
166
+
167
+ /**
168
+ * Format the method names for dropdown
169
+ * @param array $inputArray
170
+ * @return array
171
+ */
172
+
173
+ public static function formatMethodNames($inputArray){
174
+
175
+ $formatedMethodName=null;
176
+
177
+ foreach ($inputArray as $rawName){
178
+ $trimedData=null;
179
+ $explodedData = explode("&&", $rawName);
180
+ foreach ($explodedData as $data){
181
+ $trimedData[] = substr($data,3,strlen($data));
182
+ }
183
+ $formatedMethodName[]=implode(" / ", $trimedData);
184
+ }
185
+
186
+ return $formatedMethodName;
187
+ }
188
+
189
+ /**
190
+ * Merge the formated and method names in to one array
191
+ * @param array $arrayValues
192
+ * @param array $arrayKeys
193
+ * @return array
194
+ */
195
+
196
+ public static function getFinalMethodList($arrayValues,$arrayKeys){
197
+
198
+ $finalMethodList=array();
199
+ reset($arrayKeys);
200
+
201
+ foreach ($arrayValues as $tsValue){
202
+ $finalMethodList[current($arrayKeys)] = $tsValue;
203
+ next($arrayKeys);
204
+ }
205
+ asort($finalMethodList);
206
+
207
+ return $finalMethodList;
208
+ }
209
+ }
app/code/community/Tagman/Intellitag/Block/Adminhtml/Variables/Edit/MethodHelper.php ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ final class MethodHelper{
3
+
4
+ private static $taMergedFinalArray=array();
5
+
6
+ /**
7
+ * Define methods that should not be displayed in dropdown menu
8
+ */
9
+
10
+ private static $laProductFilteredOutMethods = array('getReservedAttributes','getIdFieldName','getResourceName','getFormatedPrice','getCacheTags','getTierPriceCount','getStoreId','getDefaultAttributeSetId');
11
+ private static $laCategoryFilteredOutMethods = array('getDesignAttributes','getUrlInstance','getCacheIdTags','getCacheTags','getDefaultAttributeSetId','getLayoutUpdateHandle','getIdFieldName','getResourceName');
12
+ private static $laCustomerFilteredOutMethods = array('getSharedStoreIds','getIdFieldName','getResourceName','getFieldName','getEntityTypeId','getRandomConfirmationKey','getStoreId','getAttributes','getEntityType','getStore','getCacheIdTags','getCacheTags','getPrimaryBillingAddress','getDefaultBillingAddress','getPrimaryShippingAddress','getDefaultShippingAddress');
13
+ private static $laOrderFilteredOutMethods = array('getIdFieldName','getResourceName','getCacheIdTags','getCacheTags','getBillingAddress','getShippingAddress','getPayment','getShippingCarrier','getEmailCustomerNote');
14
+ private static $laCartFilteredOutMethods = array('getIsVirtual','getStore','getCacheIdTags','getCacheTags','getStoreId','getSharedStoreId','getFieldName','getResourceName','getIdFieldName','getSharedStoreIds','getItemVirtualQty');
15
+ private static $laGeneralFilteredOutMethods = array();
16
+
17
+ /**
18
+ * Define custom methods and methods that couldn't be pulled from system
19
+ */
20
+
21
+ private static $laProductHardcodedMethodsList=array('getName','getPrice','getGroupPrice','getMinimalPrice','getSpecialPrice','getSpecialFromDate','getSpecialToDate','getSku','getWeight','getId','getCategoryIds','getRelatedProductIds','getUpSellProductIds','getCrossSellProductIds',"getProductCategory","getMainCategory","getSub1CategoryName","getSub2CategoryName","getSub3CategoryName");
22
+ private static $laCategoryHardcodedMethodsList=array('getName','getId');
23
+ private static $laCustomerHardcodedMethodsList=array('getCustomerType','getId','getGender','getFirstname','getEmail','getLastname','getPrefix','getDeliveryCity','getDeliveryCountry','getDeliveryRegion','getDeliveryPostcode');
24
+ private static $laOrderHardcodedMethodsList=array('getOrderCurrencyCode','getTotalQtyOrdered','getTaxAmount','getRealOrderId','getId',"getCouponCode","getSubtotalInclTax","getShippingAmount","getShippingDescription","getPaymentMethod","getBaseDiscountAmount","getSubtotal");
25
+ private static $laCartHardcodedMethodsList=array("getCouponCode");
26
+ private static $laGeneralHardcodedMethodsList=array("getCurrencyCode","getPageName","getPageURL","getSiteLanguage","getSiteCountryCode","getSiteCountryName","getSearchResults","getInternalSearch");
27
+
28
+ /**
29
+ * Define second level methods (they apply to all items in cart or order)
30
+ */
31
+
32
+ private static $laOrderSecondLavelMethodList=array("getAllItems&&getVariant","getAllItems&&getSubtotal","getAllItems&&getSimpleQtyToShip","getAllItems&&getQuantityTotal",'getAllItems&&getProductId','getAllItems&&getName','getAllItems&&getSku','getAllItems&&getSimpleQtyToShip','getAllItems&&getPrice','getAllItems&&getProductCategory',"getAllItems&&getMainCategory","getAllItems&&getSub1CategoryName","getAllItems&&getSub2CategoryName","getAllItems&&getSub3CategoryName");
33
+ private static $laCartSecondLavelMethodList=array("getAllItems&&getVariant",'getAllItems&&getProductId','getAllItems&&getName','getAllItems&&getSku','getAllItems&&getQty','getAllItems&&getPrice','getAllItems&&getProductCategory',"getAllItems&&getMainCategory","getAllItems&&getSub1CategoryName","getAllItems&&getSub2CategoryName","getAllItems&&getSub3CategoryName");
34
+
35
+ /**
36
+ * Prepares the array, merging dynamic and custom methods list
37
+ * Removes filtered dynamic variables
38
+ * @param array of methods $inputArray
39
+ * @param Magento $model
40
+ * @return array:
41
+ */
42
+
43
+ public static function prepareArray($inputArray,$model){
44
+
45
+ $addUserAttributes = false;
46
+ $addSecondLevelUserAttribute = false;
47
+
48
+ self::$taMergedFinalArray=null;
49
+
50
+ switch ($model){
51
+ case 'catalog/product':
52
+ $filterOutArray = self::$laProductFilteredOutMethods;
53
+ $customMethodArray = self::$laProductHardcodedMethodsList;
54
+ $addUserAttributes = true;
55
+ break;
56
+ case 'catalog/category':
57
+ $filterOutArray = self::$laCategoryFilteredOutMethods;
58
+ $customMethodArray = self::$laCategoryHardcodedMethodsList;
59
+ break;
60
+ case 'customer/customer':
61
+ $filterOutArray = self::$laCustomerFilteredOutMethods;
62
+ $customMethodArray = self::$laCustomerHardcodedMethodsList;
63
+ break;
64
+ case 'sales/order':
65
+ $filterOutArray = self::$laOrderFilteredOutMethods;
66
+ $customMethodArray = array_merge(self::$laOrderHardcodedMethodsList,self::$laOrderSecondLavelMethodList);
67
+ $addUserAttributes = true;
68
+ $addSecondLevelUserAttribute = true;
69
+ break;
70
+ case 'sales/quote':
71
+ $filterOutArray = self::$laCartFilteredOutMethods;
72
+ $customMethodArray = array_merge(self::$laCartHardcodedMethodsList,self::$laCartSecondLavelMethodList);
73
+ $addUserAttributes = true;
74
+ $addSecondLevelUserAttribute = true;
75
+ break;
76
+ case 'general':
77
+ $filterOutArray = self::$laGeneralFilteredOutMethods;
78
+ $customMethodArray = self::$laGeneralHardcodedMethodsList;
79
+ break;
80
+ default:
81
+ $filterOutArray=array();
82
+ $customMethodArray=array();
83
+ break;
84
+ }
85
+
86
+ self::$taMergedFinalArray = array_diff($inputArray, $filterOutArray);
87
+ self::$taMergedFinalArray = array_merge(self::$taMergedFinalArray,$customMethodArray);
88
+
89
+ if($addUserAttributes) self::$taMergedFinalArray = array_merge(self::$taMergedFinalArray, self::getUserDefinedAttributes($addSecondLevelUserAttribute));
90
+
91
+ //TEST
92
+ $string = "INSERT INTO tagman_intellitag_variables (name,is_static,static_value,magento_value,value) VALUES ";
93
+ foreach (self::$taMergedFinalArray as $cMethhod){
94
+ switch($model){
95
+ case'catalog/product':
96
+ $tmp='product';
97
+ break;
98
+ case'customer/customer':
99
+ $tmp = 'customer';
100
+ break;
101
+ case'catalog/category':
102
+ $tmp = 'category';
103
+ break;
104
+ case'sales/quote':
105
+ $tmp = 'cart';
106
+ break;
107
+ case'sales/order':
108
+ $tmp = 'order';
109
+ break;
110
+ case'general':
111
+ $tmp = 'general';
112
+ break;
113
+ default:
114
+ break;
115
+ }
116
+ $values[] = "('{$tmp}{$cMethhod}',2,'','{$model}&&{$cMethhod}','dynamic')";
117
+ }
118
+ $values = implode(",", $values);
119
+ $values.=";";
120
+ $string.=$values;
121
+ //echo $string;
122
+ //TEST
123
+
124
+ return self::$taMergedFinalArray;
125
+ }
126
+
127
+ /**
128
+ * Get the user defined attributes from the Magento system
129
+ * @param bool $isSecondLevel
130
+ * @return array:
131
+ */
132
+
133
+ private static function getUserDefinedAttributes($isSecondLevel){
134
+
135
+ if($isSecondLevel) $tsPrefix = "getAllItems&&getAttribute&&get";
136
+ else $tsPrefix = "getAttribute&&get";
137
+
138
+ $attributeList=array();
139
+
140
+ $attributes = Mage::getSingleton('eav/config')->getEntityType(Mage_Catalog_Model_Product::ENTITY)->getAttributeCollection();
141
+
142
+ foreach ($attributes as $attr){
143
+
144
+ $tsAttributeCode = $attr->getAttributeCode();
145
+ if ($attr->getIsUserDefined()) array_push($attributeList, $tsPrefix.self::camelize($tsAttributeCode));
146
+
147
+ }
148
+
149
+ return $attributeList;
150
+ }
151
+
152
+ /**
153
+ * Make a camelized string from a underscore string
154
+ * @param string $string
155
+ * @return string
156
+ */
157
+
158
+ private static function camelize($string){
159
+
160
+ $tsParts=explode("_", $string);
161
+
162
+ foreach ($tsParts as $tsPart){
163
+ $camelizedWords[] = ucfirst($tsPart);
164
+ }
165
+
166
+ return implode("", $camelizedWords);
167
+ }
168
+ }
app/code/community/Tagman/Intellitag/Block/Adminhtml/Variables/Grid.php CHANGED
@@ -1,75 +1,68 @@
1
- <?php
2
- class Tagman_Intellitag_Block_Adminhtml_Variables_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
- {
4
- public function __construct()
5
- {
6
- parent::__construct();
7
-
8
- // Set some defaults for our grid
9
- $this->setDefaultSort('id');
10
- $this->setId('tagman_intellitag_variables_grid');
11
- $this->setDefaultDir('asc');
12
- $this->setSaveParametersInSession(true);
13
- $this->setUseAjax(true);
14
- //$this->setPagerVisibility(false);
15
- //$this->setFilterVisibility(false);
16
-
17
- }
18
-
19
- protected function _getCollectionClass()
20
- {
21
- // This is the model we are using for the grid
22
- return 'tagman_intellitag/variables_collection';
23
- }
24
-
25
- protected function _prepareCollection()
26
- {
27
- // Get and set our collection for the grid
28
- $collection = Mage::getResourceModel($this->_getCollectionClass());
29
- $this->setCollection($collection);
30
-
31
- return parent::_prepareCollection();
32
- }
33
-
34
- protected function _prepareColumns()
35
- {
36
- // Add the columns that should appear in the grid
37
- $this->addColumn('id',
38
- array(
39
- 'header'=> $this->__('ID'),
40
- 'align' =>'right',
41
- 'width' => '50px',
42
- 'index' => 'id'
43
- )
44
- );
45
-
46
- $this->addColumn('name',
47
- array(
48
- 'header'=> $this->__('Name'),
49
- 'index' => 'name'
50
- )
51
- );
52
-
53
- $this->addColumn('value',
54
- array(
55
- 'header'=> $this->__('Value'),
56
- 'index' => 'value'
57
- )
58
- );
59
-
60
-
61
- return parent::_prepareColumns();
62
- }
63
-
64
- public function getRowUrl($row)
65
- {
66
- // This is where our row data will link to
67
- return $this->getUrl('*/*/edit', array('id' => $row->getId()));
68
- }
69
-
70
- public function getGridUrl()
71
- {
72
- return $this->getUrl('*/*/grid', array('_current'=>true));
73
-
74
- }
75
  }
1
+ <?php
2
+ class Tagman_Intellitag_Block_Adminhtml_Variables_Grid extends Mage_Adminhtml_Block_Widget_Grid
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+
8
+ $this->setDefaultSort('id');
9
+ $this->setId('tagman_intellitag_variables_grid');
10
+ $this->setDefaultDir('asc');
11
+ $this->setSaveParametersInSession(true);
12
+ $this->setUseAjax(true);
13
+
14
+ }
15
+
16
+ protected function _getCollectionClass()
17
+ {
18
+ return 'tagman_intellitag/variables_collection';
19
+ }
20
+
21
+ protected function _prepareCollection()
22
+ {
23
+ $collection = Mage::getResourceModel($this->_getCollectionClass());
24
+ $this->setCollection($collection);
25
+
26
+ return parent::_prepareCollection();
27
+ }
28
+
29
+ protected function _prepareColumns()
30
+ {
31
+ $this->addColumn('id',
32
+ array(
33
+ 'header'=> $this->__('ID'),
34
+ 'align' =>'right',
35
+ 'width' => '50px',
36
+ 'index' => 'id'
37
+ )
38
+ );
39
+
40
+ $this->addColumn('name',
41
+ array(
42
+ 'header'=> $this->__('Name'),
43
+ 'index' => 'name'
44
+ )
45
+ );
46
+
47
+ $this->addColumn('value',
48
+ array(
49
+ 'header'=> $this->__('Value'),
50
+ 'index' => 'value'
51
+ )
52
+ );
53
+
54
+
55
+ return parent::_prepareColumns();
56
+ }
57
+
58
+ public function getRowUrl($row)
59
+ {
60
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
61
+ }
62
+
63
+ public function getGridUrl()
64
+ {
65
+ return $this->getUrl('*/*/grid', array('_current'=>true));
66
+
67
+ }
 
 
 
 
 
 
 
68
  }
app/code/community/Tagman/Intellitag/Block/AttributeHelper.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ final class AttributeHelper{
3
+
4
+ /**
5
+ * Get the user defined attribute value
6
+ * @param Magento Model $tmModel
7
+ * @param string $tsMethod
8
+ * @param bool $isAllItem
9
+ * @return string
10
+ */
11
+
12
+ public static function tryToGetAttributeVariable($tmModel,$tsMethod,$isAllItem){
13
+
14
+ $tsReturnValue="";
15
+
16
+ try{
17
+ if($isAllItem){
18
+ foreach ($tmModel as $cartItem){
19
+ $pdmodel = Mage::getModel('catalog/product')->load($cartItem->getProduct()->getId());
20
+ $taReturnCartValues[] = self::getAttribute($pdmodel,$tsMethod);
21
+ }
22
+ $tsReturnValue = implode("|", $taReturnCartValues);
23
+ }
24
+ else{
25
+ $tsMethod = explode("&&", $tsMethod);
26
+ $tsMethod = $tsMethod[2];
27
+ $tsReturnValue = self::getAttribute($tmModel,$tsMethod);
28
+ if(gettype($tsReturnValue)=="array"){
29
+ $tsReturnValue = implode("#", $tsReturnValue);
30
+ }
31
+ }
32
+ }
33
+ catch (Exception $e){
34
+ $tsReturnValue = "Error executing {$tsMethod}";
35
+ }
36
+
37
+ return $tsReturnValue;
38
+ }
39
+
40
+ /**
41
+ *
42
+ * @param Magento Model $tmModel
43
+ * @param string $tsMethod
44
+ * @return string or array
45
+ */
46
+
47
+ private static function getAttribute($tmModel,$tsMethod){
48
+
49
+ $tsReturnValue = "";
50
+
51
+ if($tmModel->$tsMethod()){
52
+ $tsAttributeCode = self::attributeNameToCode($tsMethod);
53
+ $tsDynamicValue = FilterHelper::filterInput($tmModel->getAttributeText($tsAttributeCode));
54
+ switch (gettype($tsDynamicValue)){
55
+ case 'boolean':
56
+ $tsDynamicValue = FilterHelper::filterInput($tmModel->$tsMethod());
57
+ if(gettype($tsDynamicValue)=="array"){
58
+ $taDataList = $tmModel->$tsMethod();
59
+ $tsDynamicValue=null;
60
+ foreach ($taDataList as $tsData){
61
+ $tsDynamicValue[]=implode("#", $tsData);
62
+ }
63
+ }
64
+ break;
65
+ break;
66
+ default:
67
+ break;
68
+ }
69
+ if(gettype($tsDynamicValue)=="array"){
70
+ $tsDynamicValue = implode("#", $tsDynamicValue);
71
+ }
72
+ $tsReturnValue=$tsDynamicValue;
73
+ }
74
+
75
+ return $tsReturnValue;
76
+
77
+ }
78
+
79
+ /**
80
+ * Convert a camelized name to a underscore code
81
+ * @param string $tsString
82
+ * @return string
83
+ */
84
+
85
+ private static function attributeNameToCode($tsString){
86
+
87
+ $taParts = preg_split("/(?<=[a-z])(?![a-z])/", $tsString, -1, PREG_SPLIT_NO_EMPTY);
88
+ $taParts=array_reverse($taParts);
89
+ array_pop($taParts);
90
+ $taParts=array_reverse($taParts);
91
+ $taParts = array_map('strtolower', $taParts);
92
+ $tsString = implode("_", $taParts);
93
+
94
+ return $tsString;
95
+ }
96
+ }
app/code/community/Tagman/Intellitag/Block/CatalogInformationHelper.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ final class CatalogInformationHelper{
3
+
4
+ /**
5
+ * Get path in store for a given category
6
+ * @param Magento Category Model $tmCatalogModel
7
+ * @return string
8
+ */
9
+
10
+ public static function getPathInStore($tmCatalogModel){
11
+
12
+ $tsReturnValue = "";
13
+ $tsPathInStore = "";
14
+ $taPathNames = array();
15
+
16
+ $tsPathInStore = $tmCatalogModel->getPathInStore();
17
+
18
+ if($tsPathInStore!="") {
19
+ $taPath = explode(",", $tsPathInStore);
20
+ $taPath = array_reverse($taPath);
21
+ }
22
+
23
+ foreach ($taPath as $tsPath){
24
+ $taPathNames[]=$tmCatalogModel->load($tsPath)->getName();
25
+ }
26
+
27
+ $tsReturnValue = implode("/", $taPathNames);
28
+
29
+ return $tsReturnValue;
30
+ }
31
+
32
+ /**
33
+ * Get children category names
34
+ * @param Magento Category Model $tmCatalogModel
35
+ * @return string
36
+ */
37
+
38
+ public static function getChildren($tmCatalogModel){
39
+
40
+ $tsReturnValue = "";
41
+ $tsChildren = "";
42
+ $taChildrenNames = array();
43
+ $taChildren = array();
44
+
45
+ $tsChildren = $tmCatalogModel->getChildren();
46
+
47
+ if($tsChildren!="") {
48
+ $taChildren = explode(",", $tsChildren);
49
+ $taChildren = array_reverse($taChildren);
50
+ }
51
+
52
+ foreach ($taChildren as $tsChild){
53
+ $taChildrenNames[]=$tmCatalogModel->load($tsChild)->getName();
54
+ }
55
+
56
+ $tsReturnValue = implode("|", $taChildrenNames);
57
+
58
+ return $tsReturnValue;
59
+ }
60
+ }
app/code/community/Tagman/Intellitag/Block/CustomerInformationHelper.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'FilterHelper.php';
3
+ final class CustomerInformationHelper{
4
+
5
+ /**
6
+ * Get the gender of a customer
7
+ * @param Magento Customer Model $tmCustomerModel
8
+ * @param string $tsMethod
9
+ * @return array or string
10
+ */
11
+
12
+ public static function getGender($tmCustomerModel,$tsMethod){
13
+ $tsReturnValue ="";
14
+ try{
15
+ $tsReturnValue = FilterHelper::filterInput(Mage::getResourceSingleton('customer/customer')->getAttribute('gender')->getSource()->getOptionText($tmCustomerModel->$tsMethod()));
16
+ }
17
+ catch (Exception $e){
18
+ $tsReturnValue = "Error executing {$tsMethod}";
19
+ }
20
+ if(gettype($tsReturnValue) == "array"){
21
+ $tsReturnValue = implode("#", $tsReturnValue);
22
+ }
23
+ return $tsReturnValue;
24
+ }
25
+
26
+ /**
27
+ * Get delivery info
28
+ * @param Magento Customer Model $tmCustomerModel
29
+ * @param string $tsMethod
30
+ * @return string
31
+ */
32
+
33
+ public static function getDeliveryInfo($tmCustomerModel,$tsMethod){
34
+
35
+ $tsReturnValue ="";
36
+ $tsDynamicValue="";
37
+ $tsGetFromAddress="";
38
+ $isCountry = false;
39
+
40
+ switch ($tsMethod){
41
+ case 'getDeliveryCity':
42
+ $tsGetFromAddress = "getCity";
43
+ break;
44
+ case 'getDeliveryRegion':
45
+ $tsGetFromAddress = "getRegion";
46
+ break;
47
+ case 'getDeliveryPostcode':
48
+ $tsGetFromAddress = "getPostcode";
49
+ break;
50
+ case 'getDeliveryCountry':
51
+ $tsGetFromAddress = "getCountry";
52
+ $isCountry = true;
53
+ default:
54
+ break;
55
+ }
56
+
57
+ try{
58
+ $tsBillingId = Mage::getSingleton('customer/session')->getCustomer()->getDefaultBilling();
59
+ if ($tsBillingId) {
60
+ $tsReturnValue =FilterHelper::filterInput(Mage::getModel('customer/address')->load($tsBillingId)->$tsGetFromAddress());
61
+ if($isCountry) $tsReturnValue = FilterHelper::filterInput(Mage::getModel('directory/country')->loadByCode($tsReturnValue)->getName());
62
+ }
63
+ }
64
+
65
+ catch (Exception $e){
66
+ $tsReturnValue = "Error executing {$tsMethod}";
67
+ }
68
+ if(gettype($tsReturnValue) == "array"){
69
+ $tsReturnValue = implode("#", $tsReturnValue);
70
+ }
71
+ return $tsReturnValue;
72
+ }
73
+
74
+ /**
75
+ * Get type of customer
76
+ * If customer bought something the type is returning customer
77
+ * Else new customer
78
+ * @param Magento Model $tmCustomerModel
79
+ * @param string $tsMethod
80
+ * @return string
81
+ */
82
+
83
+ public static function getCustomerType($tmCustomerModel,$tsMethod){
84
+ $tsReturnValue ="";
85
+ try{
86
+ $tiNumberOfOrders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id',$tmCustomerModel->getId())->count();
87
+ if($tiNumberOfOrders>0) $tsReturnValue = "returning customer";
88
+ else $tsReturnValue = "new customer";
89
+ }
90
+ catch (Exception $e){
91
+ $tsReturnValue = "Error executing {$tsMethod}";
92
+ }
93
+ if(gettype($tsReturnValue) == "array"){
94
+ $tsReturnValue = implode("#", $tsReturnValue);
95
+ }
96
+ return $tsReturnValue;
97
+ }
98
+
99
+ }
app/code/community/Tagman/Intellitag/Block/Field.php CHANGED
@@ -45,8 +45,6 @@ class Tagman_Intellitag_Block_Field
45
  'label' => Mage::helper('tagman_intellitag')->__('Value')
46
  ));
47
 
48
-
49
- // Disables "Add after" button
50
  $this->_addAfter = false;
51
  $this->_addButtonLabel = Mage::helper('tagman_intellitag')->__('Add New');
52
  }
@@ -76,12 +74,5 @@ class Tagman_Intellitag_Block_Field
76
  $row->getData('drop_down')),
77
  'selected="selected"'
78
  );
79
- /*
80
- $row->setData(
81
- 'option_extra_attr_' . $this->_getSeconFieldRenderer()->calcOptionHash(
82
- $row->getData('second_field')),
83
- 'selected="selected"'
84
- );
85
- */
86
  }
87
  }
45
  'label' => Mage::helper('tagman_intellitag')->__('Value')
46
  ));
47
 
 
 
48
  $this->_addAfter = false;
49
  $this->_addButtonLabel = Mage::helper('tagman_intellitag')->__('Add New');
50
  }
74
  $row->getData('drop_down')),
75
  'selected="selected"'
76
  );
 
 
 
 
 
 
 
77
  }
78
  }
app/code/community/Tagman/Intellitag/Block/FilterHelper.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ final class FilterHelper{
3
+
4
+ /**
5
+ * Filter an input
6
+ * @param string or array $tsInput
7
+ * @return string or array
8
+ */
9
+
10
+ public static function filterInput($tsInput){
11
+
12
+ $tsReturnValue="";
13
+ $taReturnedList = array();
14
+
15
+ switch (gettype($tsInput)){
16
+ case 'array':
17
+ foreach ($tsInput as $tsValue){
18
+ $taReturnedList[]= self::filterInputString($tsValue);
19
+ }
20
+ $tsReturnValue=$taReturnedList;
21
+ break;
22
+ case 'string':
23
+ $tsReturnValue = self::filterInputString($tsInput);
24
+ break;
25
+ default:
26
+ $tsReturnValue = $tsInput;
27
+ break;
28
+ }
29
+ return $tsReturnValue;
30
+
31
+ }
32
+
33
+ /**
34
+ * Filter a string
35
+ * Trim, strip tags, add slashes
36
+ * @param string $tsString
37
+ * @return string
38
+ */
39
+
40
+ private static function filterInputString($tsString){
41
+ $tsString = trim($tsString);
42
+ //$tsString = htmlspecialchars($tsString);
43
+ $tsString = strip_tags($tsString);
44
+ $tsString = addslashes($tsString);
45
+ return $tsString;
46
+ }
47
+ }
app/code/community/Tagman/Intellitag/Block/GeneralInformationHelper.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'FilterHelper.php';
3
+ final class GeneralInformationHelper{
4
+
5
+ /**
6
+ * Get general information if available
7
+ * @param string $tsMethod
8
+ * @return string
9
+ */
10
+
11
+ public static function getGeneralValue($tsMethod){
12
+
13
+ $tsReturnValue="";
14
+
15
+ try{
16
+ switch ($tsMethod){
17
+ case 'getCurrencyCode':
18
+ $tsReturnValue = FilterHelper::filterInput(Mage::app()->getStore()->getCurrentCurrencyCode());
19
+ break;
20
+ case 'getPageName':
21
+ $tsReturnValue = FilterHelper::filterInput(Mage::app()->getLayout()->getBlock('head')->getTitle());
22
+ break;
23
+ case 'getPageURL':
24
+ $tsReturnValue = FilterHelper::filterInput(Mage::helper('core/url')->getCurrentUrl());
25
+ break;
26
+ case 'getSiteLanguage':
27
+ $tsReturnValue = FilterHelper::filterInput(Mage::app()->getLocale()->getLocaleCode());
28
+ break;
29
+ case 'getSiteCountryCode':
30
+ $tsReturnValue = FilterHelper::filterInput(Mage::getStoreConfig('general/country/default'));
31
+ break;
32
+ case 'getInternalSearch':
33
+ if(Mage::app()->getRequest()->getControllerName()=="result")
34
+ $tsReturnValue = FilterHelper::filterInput(Mage::helper('catalogsearch')->getQuery()->getQueryText());
35
+ break;
36
+ case 'getSearchResults':
37
+ if(Mage::app()->getRequest()->getControllerName()=="result")
38
+ $tsReturnValue = FilterHelper::filterInput(Mage::helper('catalogsearch')->getQuery()->getNumResults());
39
+ break;
40
+ case 'getSiteCountryName':
41
+ $tsCountryCode = Mage::getStoreConfig('general/country/default');
42
+ $tsReturnValue = FilterHelper::filterInput( Mage::getModel('directory/country')->loadByCode($tsCountryCode)->getName());
43
+ break;
44
+ default:
45
+ break;
46
+ }
47
+ }
48
+ catch(Exception $e){
49
+ $tsReturnValue = "Error executing {$tsMethod}";
50
+ }
51
+ return $tsReturnValue;
52
+ }
53
+ }
app/code/community/Tagman/Intellitag/Block/JsInjector.php CHANGED
@@ -1,202 +1,216 @@
1
  <?php
2
- class Tagman_Intellitag_Block_JsInjector
3
- extends Mage_Core_Block_Template
4
- {
5
-
6
- public function addTagManJavascriptBlock()
7
- {
8
 
9
- $lClient = Mage::getStoreConfig('tab1/credentials/client_id_text_field',Mage::app()->getStore());
10
- $lSite = Mage::getStoreConfig('tab1/credentials/site_id_text_field',Mage::app()->getStore());
11
- $lHost = Mage::getStoreConfig('tab1/credentials/host_text_field',Mage::app()->getStore());
12
-
13
- $lJs = '';
 
 
 
 
14
 
15
- if(($lClient != 'CLIENT ID SAMPLE' && strlen($lClient) > 0) && $lSite != 'SITE ID SAMPLE' && ($lHost != 'CDN HOST SAMPLE' && strlen($lHost) > 0)){
 
 
 
 
 
 
 
16
 
 
17
 
18
- //page_type
19
- $lControlerName = Mage::app()->getRequest()->getControllerName();
20
-
21
- $lTmParams = $this->getTmParams();
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- $lClient = str_replace(' ', '', $lClient);
24
- if ( is_numeric ( $lSite ) )
25
- $lSite = (trim($lSite) == '')? 1 :$lSite;
26
- else
27
- $lSite = 1;
28
- $lHost = str_replace(' ', '', $lHost);
29
 
 
 
 
30
 
31
- $lJs = '
32
- <script type="text/javascript">
33
- window.tmParam = {
34
- page_type: "'.$lControlerName.'"'.$lTmParams.'
35
- };
36
- </script>
37
-
38
- <script type="text/javascript">
39
-
40
- (function(d,s){
41
- var client = "'.$lClient.'";
42
- var siteId = '.$lSite.';
43
- // do not edit
44
- var a=d.createElement(s),b=d.getElementsByTagName(s)[0];
45
- a.async=true;a.type="text/javascript";
46
- a.src="//'.$lHost.'/clients/"+client+"/"+siteId+".js";
47
- a.tagman="st="+(+new Date())+"&c="+client+"&sid="+siteId;
48
- b.parentNode.insertBefore(a,b);
49
- })(document,"script");
50
-
51
- </script>';
52
- } else {
53
- $lJs = '<script type="text/javascript">//Setup TagMan extension properly</script>';
54
- }
55
- return ($lJs);
56
- }
57
-
58
- private function getTmParams()
59
- {
60
- $lVariables = unserialize(Mage::getStoreConfig("tab1/variables/field"));
61
- $lModel = Mage::getModel('tagman_intellitag/variables');
62
- $lTmParam = '';
63
- $aPrefix = ',
64
- ';
65
- foreach($lVariables as $tVar){
66
- $aVarName = $tVar['text_field'];
67
- $lVarId = $tVar['drop_down'];
68
- $lModel->load($lVarId);
69
- $lIsStatic=$lModel->getData('is_static');
70
- if($lIsStatic==1){
71
- $lTmParam .= $aPrefix . $aVarName.': '. '"' . $lModel->getValue() .'"';
72
- } else {
73
 
74
- $aDynamic = explode('&&', $lModel->getData('magento_value'));
75
- $aModel = Mage::getModel($aDynamic[0]);
76
- switch($aDynamic[0]){
77
- case 'catalog/product':
78
- $lTmParam .= $this->getCatalogProduct($aPrefix, $aVarName, $aModel, $aDynamic);
79
- break;
80
- case 'catalog/category':
81
- $lTmParam .= $this->getCatalogCategory($aPrefix, $aVarName, $aModel, $aDynamic);
82
- break;
83
- case 'customer/customer':
84
- $lTmParam .= $this->getCustomerCustomer($aPrefix, $aVarName, $aModel, $aDynamic);
85
- break;
86
- case 'sales/order':
87
- $lTmParam .= $this->getSalesOrder($aPrefix, $aVarName, $aModel, $aDynamic);
88
  break;
89
- case 'sales/quote':
90
-
91
- $lTmParam .= $this->getSalesQuote($aPrefix, $aVarName, $aModel, $aDynamic);
92
  break;
93
  default:
94
-
95
- break;
96
- }
97
- }
 
 
98
  }
 
 
99
 
100
- return ($lTmParam);
101
- }
102
-
103
- private function getCatalogProduct($aPrefix, $aVarName, $aModel, $aDynamic){
104
- $lParam = '';
105
- if(Mage::registry('current_product')){
106
- $lId=Mage::registry('current_product')->getId();
107
- $aModel->load($lId);
108
- $lMethodVal = $aModel->$aDynamic[1]();
109
- if (gettype($lMethodVal)=="object"){
110
- $lMethodVal = $lMethodVal->$aDynamic[2]();
111
- }
112
- if(gettype($lMethodVal)=="array"){
113
- $lMethodVal=implode("|", $lMethodVal);
114
- }
115
- $lMethodVal = strip_tags($lMethodVal);
116
- $lParam .= $aPrefix . $aVarName.': "'.addslashes($lMethodVal).'"';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
- }
119
- return ($lParam);
 
 
 
 
 
 
 
 
 
 
 
120
  }
121
 
122
- private function getCatalogCategory($aPrefix, $aVarName, $aModel, $aDynamic){
123
- $lParam = '';
124
- if(Mage::registry('current_category')){
125
- $lId=Mage::registry('current_category')->getId();
126
- $aModel->load($lId);
127
- $lMethodVal = $aModel->$aDynamic[1]();
128
- if (gettype($lMethodVal)=="object"){
129
- $lMethodVal = $lMethodVal->$aDynamic[2]();
130
- }
131
- if(gettype($lMethodVal)=="array"){
132
- $lMethodVal=implode("|", $lMethodVal);
133
- }
134
-
135
- $lParam .= $aPrefix . $aVarName.': "'.addslashes($lMethodVal).'"';
136
- }
137
- return ($lParam);
138
- }
139
 
140
- private function getCustomerCustomer($aPrefix, $aVarName, $aModel, $aDynamic){
141
- $lParam = '';
142
- if(Mage::getSingleton('customer/session')->isLoggedIn()) {
143
- $id=Mage::getSingleton('customer/session')->getId();
144
- $aModel->load($id);
145
- $lMethodVal = $aModel->$aDynamic[1]();
146
- if (gettype($lMethodVal)=="object"){
147
- $lMethodVal = $lMethodVal->$aDynamic[2]();
148
- }
149
- if(gettype($lMethodVal)=="array"){
150
- $lMethodVal=implode("|", $lMethodVal);
151
- }
152
- $lParam .= $aPrefix . $aVarName.': "'.addslashes($lMethodVal).'"';
153
- }
154
- return ($lParam);
155
  }
156
 
157
- private function getSalesOrder($aPrefix, $aVarName, $aModel, $aDynamic){
158
- $lParam = '';
159
- $aModel->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
160
- $lMethodVal = $aModel->$aDynamic[1]();
161
-
162
- if (gettype($lMethodVal)=="object"){
163
- $lMethodVal = $lMethodVal->$aDynamic[2]();
164
- }
165
- if($aDynamic[1]=="getAllItems"){
166
- $lMethodVal = $this->getAllItems($lMethodVal, $aDynamic);
167
- }
168
- elseif(gettype($lMethodVal)=="array"){
169
- $lMethodVal=implode("|", $lMethodVal);
170
- }
171
- $lParam .= $aPrefix . $aVarName.': "'.$lMethodVal.'"';
172
- return ($lParam);
173
- }
174
 
175
- private function getSalesQuote($aPrefix, $aVarName, $aModel, $aDynamic){
176
- $lParam = '';
177
- $lQuote = Mage::getSingleton('checkout/session')->getQuote();
178
- $lMethodVal = $lQuote->$aDynamic[1]();
179
 
180
- if($aDynamic[1]=="getAllItems"){
181
- $lMethodVal = $this->getAllItems($lMethodVal, $aDynamic);
182
- }
183
 
184
- elseif(gettype($lMethodVal)=="array"){
185
- $lMethodVal=implode("|", $lMethodVal);
186
- }
187
- $lParam .= $aPrefix . $aVarName.': "'.$lMethodVal.'"';
188
- return ($lParam);
189
  }
190
 
191
- private function getAllItems($lMethod, $aDynamic){
192
- $lAllItemsVal='';
193
- $lPipe = '';
194
- foreach($lMethod as $tItem) {
195
- if($tItem->getOriginalPrice()> 0){
196
- $lAllItemsVal .= $lPipe . addslashes($tItem->$aDynamic[2]());
197
- $lPipe = '|';
198
- }
199
- }
200
- return ($lAllItemsVal);
201
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  }
1
  <?php
 
 
 
 
 
 
2
 
3
+ /**
4
+ * Inserts the TagMan intellitag Javascript code in to the head of every page
5
+ * The configured dynamic values are scrapped from the viewed page
6
+ */
7
+
8
+ require_once 'JsInjectorHelper.php';
9
+ require_once 'FilterHelper.php';
10
+
11
+ class Tagman_Intellitag_Block_JsInjector extends Mage_Core_Block_Template {
12
 
13
+ private static $tbReturnValue;
14
+
15
+ /**
16
+ * Creates the TagMan Javascript code for head injection
17
+ * @return string
18
+ */
19
+
20
+ public function addTagManJavascriptBlock(){
21
 
22
+ $psFinalCodeForInjection="<script type='text/javascript'>\n//BEGINING OF TagMan CODE\n\n";
23
 
24
+ /**
25
+ * Get TagMan credentials from configuration page
26
+ * If credentials are set build the intellitag
27
+ */
28
+
29
+ $psClientName = FilterHelper::filterInput("".Mage::getStoreConfig('tab1/credentials/client_id_text_field',Mage::app()->getStore()));
30
+ $psSiteId = FilterHelper::filterInput("".Mage::getStoreConfig('tab1/credentials/site_id_text_field',Mage::app()->getStore()));
31
+ $psHostURL = FilterHelper::filterInput("".Mage::getStoreConfig('tab1/credentials/host_text_field',Mage::app()->getStore()));
32
+
33
+ if(!self::isStringEmpty($psClientName) && !self::isStringEmpty($psSiteId) && !self::isStringEmpty($psHostURL)){
34
+
35
+ $psFinalCodeForInjection.=self::createTmObject();
36
+ $psFinalCodeForInjection.=self::createIntelliTag($psClientName,$psSiteId,$psHostURL);
37
+ $psFinalCodeForInjection.=self::insertTagManLoadVerification();
38
+ $psFinalCodeForInjection.=self::addPageType();
39
 
40
+ $laConfiguredVariables = unserialize(Mage::getStoreConfig("tab1/variables/field"));
41
+ $lmTagManVariableModel = Mage::getModel('tagman_intellitag/variables');
42
+ JsInjectorHelper::loadModels();
 
 
 
43
 
44
+ /**
45
+ * Get configured variables
46
+ */
47
 
48
+ foreach($laConfiguredVariables as $tsConfiguredVariable){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
+ $tsMachineFriendlyName = $tsConfiguredVariable['text_field'];
51
+ $tsVariableModelId = $tsConfiguredVariable['drop_down'];
52
+
53
+ $lmTagManVariableModel->load($tsVariableModelId);
54
+
55
+ switch ($lmTagManVariableModel->getIsStatic()){
56
+ case '1':
57
+ $psFinalCodeForInjection.= self::handleStaticVariable($lmTagManVariableModel->getStaticValue(),$tsMachineFriendlyName);
 
 
 
 
 
 
58
  break;
59
+ case'2':
60
+ $psFinalCodeForInjection.= self::handleDynamicVariable($lmTagManVariableModel->getMagentoValue(),$tsMachineFriendlyName);
 
61
  break;
62
  default:
63
+ break;
64
+ }
65
+ }
66
+ }
67
+ else {
68
+ $psFinalCodeForInjection.=self::insertAlertMsg("Fill In TagMan Client Credentials!");
69
  }
70
+
71
+ $psFinalCodeForInjection.="\n\n//END OF TagMan CODE\n</script>";
72
 
73
+ return $psFinalCodeForInjection;
74
+ }
75
+
76
+ /**
77
+ * Determine Magento page type and prepare the string for injection
78
+ * @return string
79
+ */
80
+
81
+ private static function addPageType(){
82
+
83
+ $tsPageType = FilterHelper::filterInput(Mage::app()->getRequest()->getControllerName());
84
+ $tsReturnValue="\ntmParam['page_type'] = '{$tsPageType}';";
85
+
86
+ return $tsReturnValue;
87
+ }
88
+
89
+ /**
90
+ * Get defined static variable and prepare the string for injection
91
+ * @param string $tmTagManStaticValue
92
+ * @param string $tsMachineFriendlyName
93
+ * @return string
94
+ */
95
+
96
+ private static function handleStaticVariable($tmTagManStaticValue,$tsMachineFriendlyName){
97
+
98
+ $tmTagManStaticValue = FilterHelper::filterInput($tmTagManStaticValue);
99
+ $tsReturnValue="\ntmParam['{$tsMachineFriendlyName}'] = '{$tmTagManStaticValue}';";
100
+
101
+ return $tsReturnValue;
102
+ }
103
+
104
+ /**
105
+ * Get defined dynamic variable and prepare the string for injection
106
+ * @param unknown $tmTagManDynamicValue
107
+ * @param unknown $tsMachineFriendlyName
108
+ * @return string
109
+ */
110
+
111
+ private static function handleDynamicVariable($tmTagManDynamicValue,$tsMachineFriendlyName){
112
+
113
+ $tsParts = explode("&&", $tmTagManDynamicValue);
114
+
115
+ switch ($tsParts[0]){
116
+ case 'catalog/product':
117
+ $tsReturnValue = JsInjectorHelper::getProductPageVariable($tmTagManDynamicValue, $tsMachineFriendlyName);
118
+ break;
119
+ case 'customer/customer':
120
+ $tsReturnValue = JsInjectorHelper::getCustomerInformationVariable($tmTagManDynamicValue, $tsMachineFriendlyName);
121
+ break;
122
+ case 'catalog/category':
123
+ $tsReturnValue = JsInjectorHelper::getCatalogInformation($tmTagManDynamicValue, $tsMachineFriendlyName);
124
+ break;
125
+ case 'sales/order':
126
+ $tsReturnValue = JsInjectorHelper::getOrderInformation($tmTagManDynamicValue, $tsMachineFriendlyName);
127
+ break;
128
+ case 'sales/quote':
129
+ $tsReturnValue = JsInjectorHelper::getCartAndCheckoutInformation($tmTagManDynamicValue, $tsMachineFriendlyName);
130
+ break;
131
+ case 'general':
132
+ $tsReturnValue = JsInjectorHelper::getGeneralInformation($tmTagManDynamicValue, $tsMachineFriendlyName);
133
+ break;
134
+ default:
135
+ break;
136
+ }
137
 
138
+ return $tsReturnValue;
139
+ }
140
+
141
+ /**
142
+ * Create empty Javascript tmParam object
143
+ * @return string
144
+ */
145
+
146
+ private static function createTmObject(){
147
+
148
+ $tsReturnValue = "window.tmParam = {};\n\n";
149
+
150
+ return $tsReturnValue;
151
  }
152
 
153
+ /**
154
+ * Create TagMan Intellitag Javascript code
155
+ * @param string $tsClientName
156
+ * @param string $tsSiteId
157
+ * @param string $tsHostURL
158
+ * @return string
159
+ */
 
 
 
 
 
 
 
 
 
 
160
 
161
+ private static function createIntelliTag($tsClientName,$tsSiteId,$tsHostURL){
162
+
163
+ $tsReturnValue = "(function(d,s){
164
+ var client = '{$tsClientName}';
165
+ var siteId = '{$tsSiteId}';
166
+ // do not edit
167
+ var a=d.createElement(s),b=d.getElementsByTagName(s)[0];
168
+ a.async=true;a.type='text/javascript';
169
+ a.src='//{$tsHostURL}/clients/'+client+'/'+siteId+'.js';
170
+ a.tagman='st='+(+new Date())+'&c='+client+'&sid='+siteId;
171
+ b.parentNode.insertBefore(a,b);
172
+ })(document,'script');";
173
+
174
+ return $tsReturnValue;
 
175
  }
176
 
177
+ /**
178
+ * Insert an alert that fires if the TagMan code did not load
179
+ * @return string
180
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
181
 
182
+ private static function insertTagManLoadVerification(){
 
 
 
183
 
184
+ $tsReturnValue = "\n\nsetTimeout(function(){if(!window.TAGMAN) alert('TagMan did not load. Check your credentials!');},8000);\n";
 
 
185
 
186
+ return $tsReturnValue;
 
 
 
 
187
  }
188
 
189
+ /**
190
+ * Insert an alert
191
+ * @param string $tsString
192
+ * @return string
193
+ */
194
+
195
+ private static function insertAlertMsg($tsString){
196
+
197
+ $tsString = FilterHelper::filterInput($tsString);
198
+ $tsReturnValue = "setTimeout(function(){alert('{$tsString}')},5000);";
199
+
200
+ return $tsReturnValue;
201
+ }
202
+
203
+ /**
204
+ * Check is string empty
205
+ * @param string $tsString
206
+ * @return bool
207
+ */
208
+ private static function isStringEmpty($tsString){
209
+
210
+ $tsString = trim($tsString);
211
+ if(strlen($tsString)>0) self::$tbReturnValue = (bool)false;
212
+ else self::$tbReturnValue = (bool)true;
213
+
214
+ return self::$tbReturnValue;
215
+ }
216
  }
app/code/community/Tagman/Intellitag/Block/JsInjectorHelper.php ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Helpers for dynamic variables
5
+ */
6
+
7
+ require_once 'FilterHelper.php';
8
+ require_once 'ProductDetailPageHelper.php';
9
+ require_once 'CustomerInformationHelper.php';
10
+ require_once 'CatalogInformationHelper.php';
11
+ require_once 'AttributeHelper.php';
12
+ require_once 'OrderAndCartInformationHelper.php';
13
+ require_once 'GeneralInformationHelper.php';
14
+
15
+ final class JsInjectorHelper{
16
+
17
+ private static $lmProductPageModel = null;
18
+ private static $lmCategoryModel = null;
19
+ private static $lmCustomerModel = null;
20
+ private static $lmCartModel = null;
21
+ private static $lmOrderModel = null;
22
+ private static $lmGeneralCategoryModel = null;
23
+ private static $lmVisibleItems = null;
24
+
25
+ /**
26
+ * Load all needed models
27
+ */
28
+
29
+ public static function loadModels(){
30
+
31
+ if(Mage::registry('current_product')){
32
+
33
+ $tsProductModelId = Mage::registry('current_product')->getId();
34
+ self::$lmProductPageModel = Mage::getModel('catalog/product');
35
+ self::$lmProductPageModel->load($tsProductModelId);
36
+
37
+ }
38
+
39
+ if(Mage::registry('current_category')){
40
+
41
+ $tsCategoryModelId = Mage::registry('current_category')->getId();
42
+ self::$lmCategoryModel = Mage::getModel('catalog/category');
43
+ self::$lmCategoryModel->load($tsCategoryModelId);
44
+
45
+ }
46
+
47
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
48
+
49
+ $tsCustomerid=Mage::getSingleton('customer/session')->getId();
50
+ self::$lmCustomerModel = Mage::getModel('customer/customer');
51
+ self::$lmCustomerModel->load($tsCustomerid);
52
+
53
+ }
54
+
55
+ if(count(Mage::getSingleton('checkout/session')->getQuote()->getAllItems())>0 &&
56
+ preg_match('/checkout/',Mage::helper('core/url')->getCurrentUrl()) &&
57
+ !preg_match('/success/',Mage::helper('core/url')->getCurrentUrl())){
58
+ self::$lmCartModel = Mage::getSingleton('checkout/session')->getQuote();
59
+ self::$lmVisibleItems = Mage::getSingleton('checkout/session')->getQuote()->getAllVisibleItems();
60
+ }
61
+
62
+ if(preg_match('/success/',Mage::helper('core/url')->getCurrentUrl())){
63
+ self::$lmOrderModel = Mage::getModel('sales/order');
64
+ self::$lmOrderModel->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
65
+ self::$lmVisibleItems = self::$lmOrderModel->getAllVisibleItems();
66
+ }
67
+ self::$lmGeneralCategoryModel = Mage::getModel('catalog/category');
68
+ }
69
+
70
+ /**
71
+ * Get dynamic variables from the product detail page
72
+ * @param string $tmTagManDynamicValue
73
+ * @param string $tsMachineFriendlyName
74
+ * @return string
75
+ */
76
+
77
+ public static function getProductPageVariable($tmTagManDynamicValue,$tsMachineFriendlyName){
78
+
79
+ $tsReturnValue = "";
80
+
81
+ if(self::$lmProductPageModel) {
82
+
83
+ $tsParts = explode("&&", $tmTagManDynamicValue);
84
+ $tsVariableGetMethod = $tsParts[1];
85
+
86
+ switch ($tsVariableGetMethod){
87
+ case 'getMainCategory':
88
+ case 'getSub1CategoryName':
89
+ case 'getSub2CategoryName':
90
+ case 'getSub3CategoryName':
91
+ case 'getProductCategory':
92
+ $tsReturnValue = ProductDetailPageHelper::getCategoryName(self::$lmCategoryModel, $tsVariableGetMethod);
93
+ break;
94
+ case 'getAllItems':
95
+ break;
96
+ case 'getAttribute':
97
+ $tsReturnValue = AttributeHelper::tryToGetAttributeVariable(self::$lmProductPageModel, $tmTagManDynamicValue,false);
98
+ break;
99
+ default:
100
+ $tsReturnValue = self::tryToGetVariable(self::$lmProductPageModel, $tsVariableGetMethod);
101
+ break;
102
+ }
103
+ $tsReturnValue=self::formatReturn($tsReturnValue, $tsMachineFriendlyName);
104
+ }
105
+
106
+ return $tsReturnValue;
107
+ }
108
+
109
+ /**
110
+ * Get dynamic variables if the customer is logged in
111
+ * @param string $tmTagManDynamicValue
112
+ * @param string $tsMachineFriendlyName
113
+ * @return string
114
+ */
115
+
116
+ public static function getCustomerInformationVariable($tmTagManDynamicValue,$tsMachineFriendlyName){
117
+
118
+ $tsReturnValue = "";
119
+
120
+ if(self::$lmCustomerModel) {
121
+
122
+ $tsParts = explode("&&", $tmTagManDynamicValue);
123
+ $tsVariableGetMethod = $tsParts[1];
124
+
125
+ switch ($tsVariableGetMethod){
126
+ case 'getDeliveryRegion':
127
+ case 'getDeliveryPostcode':
128
+ case 'getDeliveryCountry':
129
+ case 'getDeliveryCity':
130
+ $tsReturnValue = CustomerInformationHelper::getDeliveryInfo(self::$lmCustomerModel, $tsVariableGetMethod);
131
+ break;
132
+ case 'getGender':
133
+ $tsReturnValue = CustomerInformationHelper::getGender(self::$lmCustomerModel,$tsVariableGetMethod);
134
+ break;
135
+ case 'getCustomerType':
136
+ $tsReturnValue = CustomerInformationHelper::getCustomerType(self::$lmCustomerModel,$tsVariableGetMethod);
137
+ break;
138
+ case 'getAllItems':
139
+ break;
140
+ default:
141
+ $tsReturnValue = self::tryToGetVariable(self::$lmCustomerModel, $tsVariableGetMethod);
142
+ break;
143
+ }
144
+ $tsReturnValue=self::formatReturn($tsReturnValue, $tsMachineFriendlyName);
145
+ }
146
+
147
+ return $tsReturnValue;
148
+ }
149
+
150
+ /**
151
+ * Get dynamic variables if on a catalog page
152
+ * @param string $tmTagManDynamicValue
153
+ * @param string $tsMachineFriendlyName
154
+ * @return string
155
+ */
156
+
157
+ public static function getCatalogInformation($tmTagManDynamicValue,$tsMachineFriendlyName){
158
+ $tsReturnValue = "";
159
+ if(self::$lmCategoryModel) {
160
+
161
+ $tsParts = explode("&&", $tmTagManDynamicValue);
162
+ $tsVariableGetMethod = $tsParts[1];
163
+
164
+ switch ($tsVariableGetMethod){
165
+ case 'getAllItems':
166
+ break;
167
+ case 'getChildren':
168
+ $tsReturnValue = CatalogInformationHelper::getChildren(self::$lmCategoryModel);
169
+ break;
170
+ case 'getPathInStore':
171
+ $tsReturnValue = CatalogInformationHelper::getPathInStore(self::$lmCategoryModel);
172
+ break;
173
+ default:
174
+ $tsReturnValue = self::tryToGetVariable(self::$lmCategoryModel, $tsVariableGetMethod);
175
+ break;
176
+ }
177
+ $tsReturnValue=self::formatReturn($tsReturnValue, $tsMachineFriendlyName);
178
+ }
179
+ return $tsReturnValue;
180
+ }
181
+
182
+ /**
183
+ * Get dynamic variables from the cart and checkout page
184
+ * @param string $tmTagManDynamicValue
185
+ * @param string $tsMachineFriendlyName
186
+ * @return string
187
+ */
188
+
189
+ public static function getCartAndCheckoutInformation($tmTagManDynamicValue,$tsMachineFriendlyName){
190
+ $tsReturnValue = "";
191
+ if(self::$lmCartModel) {
192
+
193
+ $tsParts = explode("&&", $tmTagManDynamicValue);
194
+ $tsVariableGetMethod = $tsParts[1];
195
+
196
+ switch ($tsVariableGetMethod){
197
+ case 'getAllItems':
198
+ $tsReturnValue = OrderAndCartInformationHelper::handleAllItemCase($tsParts,self::$lmGeneralCategoryModel,self::$lmVisibleItems);
199
+ break;
200
+ default:
201
+ $tsReturnValue = self::tryToGetVariable(self::$lmCartModel, $tsVariableGetMethod);
202
+ break;
203
+ }
204
+ $tsReturnValue=self::formatReturn($tsReturnValue, $tsMachineFriendlyName);
205
+ }
206
+ return $tsReturnValue;
207
+ }
208
+
209
+ /**
210
+ * Get dynamic variables from the order confirmation page
211
+ * @param string $tmTagManDynamicValue
212
+ * @param string $tsMachineFriendlyName
213
+ * @return string
214
+ */
215
+
216
+ public static function getOrderInformation($tmTagManDynamicValue,$tsMachineFriendlyName){
217
+ $tsReturnValue = "";
218
+ if(self::$lmOrderModel) {
219
+
220
+ $tsParts = explode("&&", $tmTagManDynamicValue);
221
+ $tsVariableGetMethod = $tsParts[1];
222
+
223
+ switch ($tsVariableGetMethod){
224
+ case 'getAllItems':
225
+ $tsReturnValue = OrderAndCartInformationHelper::handleAllItemCase($tsParts,self::$lmGeneralCategoryModel,self::$lmVisibleItems);
226
+ break;
227
+ case'getPaymentMethod':
228
+ $tsReturnValue = OrderAndCartInformationHelper::getPaymentMethod(self::$lmOrderModel);
229
+ break;
230
+ case'getBaseDiscountAmount':
231
+ $tsReturnValue = abs(self::tryToGetVariable(self::$lmOrderModel, $tsVariableGetMethod));
232
+ break;
233
+ case'getTotalQtyOrdered':
234
+ $tsReturnValue = abs(self::tryToGetVariable(self::$lmOrderModel, $tsVariableGetMethod));
235
+ break;
236
+ default:
237
+ $tsReturnValue = self::tryToGetVariable(self::$lmOrderModel, $tsVariableGetMethod);
238
+ break;
239
+ }
240
+ $tsReturnValue=self::formatReturn($tsReturnValue, $tsMachineFriendlyName);
241
+ }
242
+ return $tsReturnValue;
243
+ }
244
+
245
+ /**
246
+ * Get dynamic variables if data is available
247
+ * @param string $tmTagManDynamicValue
248
+ * @param string $tsMachineFriendlyName
249
+ * @return string
250
+ */
251
+
252
+ public static function getGeneralInformation($tmTagManDynamicValue,$tsMachineFriendlyName){
253
+ $tsReturnValue = "";
254
+
255
+ $tsParts = explode("&&", $tmTagManDynamicValue);
256
+ $tsVariableGetMethod = $tsParts[1];
257
+
258
+ switch ($tsVariableGetMethod){
259
+ case 'getCurrencyCode':
260
+ case 'getPageName':
261
+ case 'getPageURL':
262
+ case 'getSiteLanguage':
263
+ case 'getSiteCountryCode':
264
+ case 'getInternalSearch':
265
+ case 'getSearchResults':
266
+ case 'getSiteCountryName':
267
+ $tsReturnValue = GeneralInformationHelper::getGeneralValue($tsVariableGetMethod);
268
+ break;
269
+ case 'getAllItems':
270
+ break;
271
+ default:
272
+ $tsReturnValue = self::tryToGetVariable(self::$lmCategoryModel, $tsVariableGetMethod);
273
+ break;
274
+ }
275
+ $tsReturnValue=self::formatReturn($tsReturnValue, $tsMachineFriendlyName);
276
+
277
+ return $tsReturnValue;
278
+ }
279
+
280
+ /**
281
+ * Make a formated string for Javascript code injection
282
+ * @param string $returnInput
283
+ * @param string $machineFriendlyName
284
+ * @return string
285
+ */
286
+
287
+ private static function formatReturn($returnInput,$machineFriendlyName){
288
+ $formatedReturn = "";
289
+ if(gettype($returnInput)=="array"){
290
+ $returnInput = implode("|", $returnInput);
291
+ }
292
+ $formatedReturn = "\ntmParam['{$machineFriendlyName}'] = '{$returnInput}';";
293
+ return $formatedReturn;
294
+ }
295
+
296
+ /**
297
+ * Get dynamic value with default method
298
+ * @param Magento Model $tmModel
299
+ * @param string $tsMethod
300
+ * @return array or string
301
+ */
302
+
303
+ private static function tryToGetVariable($tmModel,$tsMethod){
304
+
305
+ $tsReturnValue="";
306
+ try{
307
+ $tsReturnValue = FilterHelper::filterInput($tmModel->$tsMethod());
308
+ if(gettype($tsReturnValue)=="array"){
309
+ $tsReturnValue = implode("|", $tsReturnValue);
310
+ }
311
+ }
312
+ catch (Exception $e){
313
+ $tsReturnValue = "Error executing {$tsMethod}";
314
+ }
315
+
316
+ return $tsReturnValue;
317
+ }
318
+ }
app/code/community/Tagman/Intellitag/Block/OrderAndCartInformationHelper.php ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once 'FilterHelper.php';
3
+ require_once 'AttributeHelper.php';
4
+
5
+ final class OrderAndCartInformationHelper{
6
+
7
+ /**
8
+ * Get the needed values from all Order or Cart items
9
+ * @param array $taParts
10
+ * @param Magento Category Model $lmCategoryModel
11
+ * @param Magento Quote $lmVisibleItems
12
+ * @return string
13
+ */
14
+
15
+ public static function handleAllItemCase($taParts,$lmCategoryModel,$lmVisibleItems){
16
+
17
+ $tsReturnValue="";
18
+ $tsMethod = $taParts[2];
19
+
20
+ switch ($tsMethod){
21
+ case'getAttribute':
22
+ $tsReturnValue = AttributeHelper::tryToGetAttributeVariable($lmVisibleItems, $taParts[3],true);
23
+ break;
24
+ case 'getMainCategory':
25
+ case 'getSub1CategoryName':
26
+ case 'getSub2CategoryName':
27
+ case 'getSub3CategoryName':
28
+ case 'getProductCategory':
29
+ $tsReturnValue = self::getCategoryName($lmVisibleItems,$lmCategoryModel,$tsMethod);
30
+ break;
31
+ case'getSubtotal':
32
+ $tsReturnValue = self::getItemSubtotal($lmVisibleItems,$tsMethod);
33
+ break;
34
+ case'getVariant':
35
+ $tsReturnValue = self::getVariant($lmVisibleItems,$tsMethod,$taParts);
36
+ break;
37
+ default:
38
+ $tsReturnValue = self::getDefaultCartItemData($lmVisibleItems,$tsMethod);
39
+ break;
40
+ }
41
+
42
+ return $tsReturnValue;
43
+ }
44
+
45
+ /**
46
+ * Get Item data with default methods
47
+ * @param Quote $lmVisibleItems
48
+ * @param string $tsMethod
49
+ * @return string
50
+ */
51
+
52
+ private static function getDefaultCartItemData($lmVisibleItems,$tsMethod){
53
+
54
+ $tsReturnValue="";
55
+ $taCartValues = array();
56
+ try {
57
+ foreach ($lmVisibleItems as $tsCartItem){
58
+ $taCartValues[] = FilterHelper::filterInput($tsCartItem->$tsMethod());
59
+ }
60
+ $tsReturnValue = join("|", $taCartValues);
61
+ }
62
+ catch (Exception $e){
63
+ $tsReturnValue = "Error executing {$tsMethod}";
64
+ }
65
+ return $tsReturnValue;
66
+ }
67
+
68
+ /**
69
+ * Get the payment method name
70
+ * @param Magento Order Model $tmOrderModel
71
+ * @return string
72
+ */
73
+
74
+ public static function getPaymentMethod($tmOrderModel){
75
+
76
+ $tsReturnValue ="";
77
+
78
+ if($tmOrderModel->getPayment()){
79
+ try{
80
+ $tsReturnValue = FilterHelper::filterInput($tmOrderModel->getPayment()->getMethodInstance()->getCode());
81
+ }
82
+ catch (Exception $e){
83
+ $tsReturnValue = "Error executing getPaymentMethod";
84
+ }
85
+ if(gettype($tsReturnValue) == "array"){
86
+ $tsReturnValue = implode("#", $tsReturnValue);
87
+ }
88
+
89
+ }
90
+ return $tsReturnValue;
91
+ }
92
+
93
+ /**
94
+ * Get the main and sub category names
95
+ * @param Quote $lmVisibleItems
96
+ * @param Magento Category Model $tmCategoryModel
97
+ * @param string $tsVariableGetMethod
98
+ * @return string
99
+ */
100
+
101
+ private static function getCategoryName($lmVisibleItems,$tmCategoryModel,$tsVariableGetMethod){
102
+
103
+ $tsReturnValue="";
104
+ $taCartValues = array();
105
+ try {
106
+ foreach ($lmVisibleItems as $tsCartItem){
107
+ $tsDynamicValue="";
108
+
109
+ $taProductCategoryId = $tsCartItem->getProduct()->getCategoryIds();
110
+ $tsProductCategoryId =end($taProductCategoryId);
111
+
112
+ $tsCategoryIds = Mage::getModel('catalog/category')->load($tsProductCategoryId)->getPathInStore();
113
+
114
+ $taCategoryIds = explode(",", $tsCategoryIds);
115
+ $taCategoryIds=array_reverse($taCategoryIds);
116
+
117
+ switch ($tsVariableGetMethod){
118
+ case'getMainCategory':
119
+ if(count($taCategoryIds)>0)
120
+ $tsDynamicValue = FilterHelper::filterInput($tmCategoryModel->load($taCategoryIds[0])->getName());
121
+ break;
122
+ case'getSub1CategoryName':
123
+ if(count($taCategoryIds)>1)
124
+ $tsDynamicValue = FilterHelper::filterInput($tmCategoryModel->load($taCategoryIds[1])->getName());
125
+ break;
126
+ case'getSub2CategoryName':
127
+ if(count($taCategoryIds)>2)
128
+ $tsDynamicValue = FilterHelper::filterInput($tmCategoryModel->load($taCategoryIds[2])->getName());
129
+ break;
130
+ case'getSub3CategoryName':
131
+ if(count($taCategoryIds)>3)
132
+ $tsDynamicValue = FilterHelper::filterInput($tmCategoryModel->load($taCategoryIds[3])->getName());
133
+ break;
134
+ case'getProductCategory':
135
+ if(count($taCategoryIds)>0)
136
+ $tsDynamicValue = FilterHelper::filterInput($tmCategoryModel->load(end($taCategoryIds))->getName());
137
+ break;
138
+ default:
139
+ break;
140
+ }
141
+
142
+ $taCartValues[] = FilterHelper::filterInput($tsDynamicValue);
143
+ }
144
+ $tsReturnValue = join("|", $taCartValues);
145
+ }
146
+ catch (Exception $e){
147
+ $tsReturnValue = "Error executing {$tsVariableGetMethod}";
148
+ }
149
+ return $tsReturnValue;
150
+ }
151
+
152
+ /**
153
+ * Get subtotal for each item in cart
154
+ * @param Quote $lmVisibleItems
155
+ * @param string $tsMethod
156
+ * @return string
157
+ */
158
+
159
+ private static function getItemSubtotal($lmVisibleItems,$tsMethod){
160
+
161
+ $tsReturnValue="";
162
+ $taCartValues = array();
163
+ try {
164
+ foreach ($lmVisibleItems as $tsCartItem){
165
+ $taCartValues[] = FilterHelper::filterInput(($tsCartItem->getPrice()*$tsCartItem->getSimpleQtyToShip()));
166
+ }
167
+ $tsReturnValue = join("|", $taCartValues);
168
+ }
169
+ catch (Exception $e){
170
+ $tsReturnValue = "Error executing {$tsMethod}";
171
+ }
172
+ return $tsReturnValue;
173
+
174
+ }
175
+
176
+ /**
177
+ * Get the product variant (selected options)
178
+ * @param Quote $lmVisibleItems
179
+ * @param string $tsMethod
180
+ * @param array $taParts
181
+ * @return string or array
182
+ */
183
+
184
+ private static function getVariant($lmVisibleItems,$tsMethod,$taParts){
185
+
186
+ $tsReturnValue="";
187
+ $taCartValues = array();
188
+ $tsModel = $taParts[0];
189
+
190
+ try {
191
+ foreach ($lmVisibleItems as $tsCartItem){
192
+
193
+ if($tsModel == 'sales/quote') $toOrderOptions = $tsCartItem->getProduct()->getTypeInstance(true)->getOrderOptions($tsCartItem->getProduct());
194
+ else $toOrderOptions = $tsCartItem->getProductOptions();
195
+
196
+ if(array_key_exists('attributes_info', $toOrderOptions)){
197
+ $taAttributesInfo = $toOrderOptions['attributes_info'];
198
+ }
199
+ else $taAttributesInfo = array();
200
+
201
+
202
+ $taItemValue = array();
203
+ foreach ($taAttributesInfo as $taOption){
204
+ $taItemValue[] = $taOption['label'].' '.$taOption['value'];
205
+ }
206
+ $taCartValues[] = implode("#", $taItemValue);
207
+ }
208
+ $tsReturnValue = implode("|", $taCartValues);
209
+ }
210
+ catch (Exception $e){
211
+ $tsReturnValue = "Error executing {$tsMethod}";
212
+ }
213
+
214
+ return $tsReturnValue;
215
+ }
216
+ }
app/code/community/Tagman/Intellitag/Block/ProductDetailPageHelper.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once "FilterHelper.php";
3
+
4
+ final class ProductDetailPageHelper{
5
+
6
+ /**
7
+ * Get the main and sub category names
8
+ * @param Magento Category Model $tmCategoryModel
9
+ * @param string $tsVariableGetMethod
10
+ * @return string
11
+ */
12
+
13
+ public static function getCategoryName($tmCategoryModel,$tsVariableGetMethod){
14
+ $tsReturnValue="";
15
+ $taCategoryIds = array();
16
+
17
+ try{
18
+ if($tmCategoryModel){
19
+
20
+ $tsCategoryIds = $tmCategoryModel->getPathInStore();
21
+ $taCategoryIds = explode(",", $tsCategoryIds);
22
+ $taCategoryIds=array_reverse($taCategoryIds);
23
+
24
+ switch ($tsVariableGetMethod){
25
+ case'getMainCategory':
26
+ if(count($taCategoryIds)>0)
27
+ $tsReturnValue = FilterHelper::filterInput($tmCategoryModel->load($taCategoryIds[0])->getName());
28
+ break;
29
+ case'getSub1CategoryName':
30
+ if(count($taCategoryIds)>1)
31
+ $tsReturnValue = FilterHelper::filterInput($tmCategoryModel->load($taCategoryIds[1])->getName());
32
+ break;
33
+ case'getSub2CategoryName':
34
+ if(count($taCategoryIds)>2)
35
+ $tsReturnValue = FilterHelper::filterInput($tmCategoryModel->load($taCategoryIds[2])->getName());
36
+ break;
37
+ case'getSub3CategoryName':
38
+ if(count($taCategoryIds)>3)
39
+ $tsReturnValue = FilterHelper::filterInput($tmCategoryModel->load($taCategoryIds[3])->getName());
40
+ break;
41
+ case'getProductCategory':
42
+ if(count($taCategoryIds)>0)
43
+ $tsReturnValue = FilterHelper::filterInput($tmCategoryModel->load(end($taCategoryIds))->getName());
44
+ break;
45
+ default:
46
+ break;
47
+ }
48
+ }
49
+ }
50
+ catch (Exception $e){
51
+ $tsReturnValue = "Error executing {$tsVariableGetMethod}";
52
+ }
53
+
54
+ return $tsReturnValue;
55
+ }
56
+
57
+ }
app/code/community/Tagman/Intellitag/Block/Select.php CHANGED
@@ -2,11 +2,7 @@
2
  class Tagman_Intellitag_Block_Select
3
  extends Mage_Core_Block_Html_Select
4
  {
5
- /**
6
- * Return output in one line
7
- *
8
- * @return string
9
- */
10
  public function _toHtml()
11
  {
12
  return trim(preg_replace('/\s+/', ' ',parent::_toHtml()));
2
  class Tagman_Intellitag_Block_Select
3
  extends Mage_Core_Block_Html_Select
4
  {
5
+
 
 
 
 
6
  public function _toHtml()
7
  {
8
  return trim(preg_replace('/\s+/', ' ',parent::_toHtml()));
app/code/community/Tagman/Intellitag/Block/Text.php CHANGED
@@ -1,14 +1,10 @@
1
- <?php
2
- class Tagman_Intellitag_Block_Text
3
- extends Mage_Core_Block_Text
4
- {
5
- /**
6
- * Return output in one line
7
- *
8
- * @return string
9
- */
10
- public function _toHtml()
11
- {
12
- parent::_toHtml();
13
- }
14
  }
1
+ <?php
2
+ class Tagman_Intellitag_Block_Text
3
+ extends Mage_Core_Block_Text
4
+ {
5
+
6
+ public function _toHtml()
7
+ {
8
+ parent::_toHtml();
9
+ }
 
 
 
 
10
  }
app/code/community/Tagman/Intellitag/Helper/Data.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
- class Tagman_Intellitag_Helper_Data extends Mage_Core_Helper_Abstract
3
- {
4
  }
1
+ <?php
2
+ class Tagman_Intellitag_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
  }
app/code/community/Tagman/Intellitag/controllers/Adminhtml/VariablesController.php CHANGED
@@ -3,15 +3,12 @@ class Tagman_Intellitag_Adminhtml_VariablesController extends Mage_Adminhtml_Con
3
  {
4
  public function indexAction()
5
  {
6
- // Let's call our initAction method which will set some basic params for each action
7
  $this->_initAction()
8
  ->renderLayout();
9
- //$this->removeButton('add');
10
  }
11
 
12
  public function newAction()
13
  {
14
- // We just forward the new action to a blank edit form
15
  $this->_forward('edit');
16
  }
17
 
@@ -19,15 +16,13 @@ class Tagman_Intellitag_Adminhtml_VariablesController extends Mage_Adminhtml_Con
19
  {
20
  $this->_initAction();
21
 
22
- // Get id if available
23
  $id = $this->getRequest()->getParam('id');
24
  $model = Mage::getModel('tagman_intellitag/variables');
25
 
26
  if ($id) {
27
- // Load record
28
  $model->load($id);
29
-
30
- // Check if record is loaded
31
  if (!$model->getId()) {
32
  Mage::getSingleton('adminhtml/session')->addError($this->__('This variable no longer exists.'));
33
  $this->_redirect('*/*/');
@@ -62,8 +57,9 @@ class Tagman_Intellitag_Adminhtml_VariablesController extends Mage_Adminhtml_Con
62
  if($postData['is_static']==1){
63
  $postData['value']=$postData['static_value'];
64
  $postData['magento_value']="";
 
65
  }
66
- else{
67
  $postData['magento_value']=$postData['magento_model'];
68
  $postData['magento_value'].="&&";
69
 
@@ -73,7 +69,13 @@ class Tagman_Intellitag_Adminhtml_VariablesController extends Mage_Adminhtml_Con
73
  $postData['magento_value'].=$postData[$tmp_data];
74
  $postData['value']= "dynamic value";
75
  $postData['static_value']="";
 
76
  }
 
 
 
 
 
77
 
78
  $model->setData($postData);
79
  try {
@@ -119,17 +121,10 @@ class Tagman_Intellitag_Adminhtml_VariablesController extends Mage_Adminhtml_Con
119
  }
120
  $this->_redirect('*/*/');
121
  }
122
- /**
123
- * Initialize action
124
- *
125
- * Here, we set the breadcrumbs and the active menu
126
- *
127
- * @return Mage_Adminhtml_Controller_Action
128
- */
129
  protected function _initAction()
130
  {
131
  $this->loadLayout()
132
- // Make the active menu match the menu config nodes (without 'children' inbetween)
133
  ->_setActiveMenu('tagman_menu')
134
  ->_title($this->__('tagman_menu'))->_title($this->__('Variables'))
135
  ->_addBreadcrumb($this->__('tagman_menu'), $this->__('tagman_intellitag'))
@@ -137,6 +132,7 @@ class Tagman_Intellitag_Adminhtml_VariablesController extends Mage_Adminhtml_Con
137
 
138
  return $this;
139
  }
 
140
  public function gridAction()
141
  {
142
  $this->loadLayout();
@@ -144,14 +140,10 @@ class Tagman_Intellitag_Adminhtml_VariablesController extends Mage_Adminhtml_Con
144
  $this->getLayout()->createBlock('tagman_intellitag/adminhtml_variables_grid')->toHtml()
145
  );
146
  }
147
-
148
- /**
149
- * Check currently called action by permissions for current user
150
- *
151
- * @return bool
152
- */
153
  protected function _isAllowed()
154
  {
155
- return Mage::getSingleton('admin/session')->isAllowed('tagman_intellitag/tagman_intellitag_variables');
 
156
  }
157
  }
3
  {
4
  public function indexAction()
5
  {
 
6
  $this->_initAction()
7
  ->renderLayout();
 
8
  }
9
 
10
  public function newAction()
11
  {
 
12
  $this->_forward('edit');
13
  }
14
 
16
  {
17
  $this->_initAction();
18
 
 
19
  $id = $this->getRequest()->getParam('id');
20
  $model = Mage::getModel('tagman_intellitag/variables');
21
 
22
  if ($id) {
23
+
24
  $model->load($id);
25
+
 
26
  if (!$model->getId()) {
27
  Mage::getSingleton('adminhtml/session')->addError($this->__('This variable no longer exists.'));
28
  $this->_redirect('*/*/');
57
  if($postData['is_static']==1){
58
  $postData['value']=$postData['static_value'];
59
  $postData['magento_value']="";
60
+ $postData['custom_value']="";
61
  }
62
+ else if ($postData['is_static']==2){
63
  $postData['magento_value']=$postData['magento_model'];
64
  $postData['magento_value'].="&&";
65
 
69
  $postData['magento_value'].=$postData[$tmp_data];
70
  $postData['value']= "dynamic value";
71
  $postData['static_value']="";
72
+ $postData['custom_value']="";
73
  }
74
+ else{
75
+ $postData['magento_value']=$postData['custom_value'];
76
+ $postData['value']= "dynamic value";
77
+ $postData['static_value']="";
78
+ }
79
 
80
  $model->setData($postData);
81
  try {
121
  }
122
  $this->_redirect('*/*/');
123
  }
124
+
 
 
 
 
 
 
125
  protected function _initAction()
126
  {
127
  $this->loadLayout()
 
128
  ->_setActiveMenu('tagman_menu')
129
  ->_title($this->__('tagman_menu'))->_title($this->__('Variables'))
130
  ->_addBreadcrumb($this->__('tagman_menu'), $this->__('tagman_intellitag'))
132
 
133
  return $this;
134
  }
135
+
136
  public function gridAction()
137
  {
138
  $this->loadLayout();
140
  $this->getLayout()->createBlock('tagman_intellitag/adminhtml_variables_grid')->toHtml()
141
  );
142
  }
143
+
 
 
 
 
 
144
  protected function _isAllowed()
145
  {
146
+ return Mage::getSingleton('admin/session')->isAllowed('tagman_menu/variables_menu_item');
147
+
148
  }
149
  }
app/code/community/Tagman/Intellitag/etc/adminhtml.xml CHANGED
@@ -27,7 +27,7 @@
27
 
28
  <variables_menu_item translate="title" module="tagman_intellitag">
29
  <title>Variables</title>
30
- <sort_order>10</sort_order>
31
  </variables_menu_item>
32
 
33
  </children>
27
 
28
  <variables_menu_item translate="title" module="tagman_intellitag">
29
  <title>Variables</title>
30
+ <sort_order>20</sort_order>
31
  </variables_menu_item>
32
 
33
  </children>
app/code/community/Tagman/Intellitag/etc/config.xml CHANGED
@@ -2,16 +2,14 @@
2
  <config>
3
  <modules>
4
  <Tagman_Intellitag>
5
- <version>1.0.7</version>
6
  </Tagman_Intellitag>
7
  </modules>
8
  <global>
9
  <blocks>
10
-
11
- <!-- a unique short name for our block files -->
12
- <tagman_intellitag>
13
-
14
- <!-- the location of our module's blocks -->
15
  <class>Tagman_Intellitag_Block</class>
16
 
17
  </tagman_intellitag>
@@ -60,9 +58,9 @@
60
  <default>
61
  <tab1>
62
  <credentials>
63
- <client_id_text_field>CLIENT ID SAMPLE</client_id_text_field>
64
- <site_id_text_field>SITE ID SAMPLE</site_id_text_field>
65
- <host_text_field>CDN HOST SAMPLE</host_text_field>
66
  </credentials>
67
  </tab1>
68
  </default>
2
  <config>
3
  <modules>
4
  <Tagman_Intellitag>
5
+ <version>1.0.8</version>
6
  </Tagman_Intellitag>
7
  </modules>
8
  <global>
9
  <blocks>
10
+
11
+ <tagman_intellitag>
12
+
 
 
13
  <class>Tagman_Intellitag_Block</class>
14
 
15
  </tagman_intellitag>
58
  <default>
59
  <tab1>
60
  <credentials>
61
+ <client_id_text_field></client_id_text_field>
62
+ <site_id_text_field></site_id_text_field>
63
+ <host_text_field></host_text_field>
64
  </credentials>
65
  </tab1>
66
  </default>
app/code/community/Tagman/Intellitag/sql/tagman_intellitag_setup/{mysql4-install-1.0.7.php → mysql4-install-1.0.0.php} RENAMED
File without changes
app/code/community/Tagman/Intellitag/sql/tagman_intellitag_setup/mysql4-install-1.0.8.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* @var $installer Mage_Core_Model_Resource_Setup */
3
+ $installer = $this;
4
+ $installer->startSetup();
5
+
6
+
7
+ $table_variables = $installer->getConnection()
8
+
9
+ ->newTable($installer->getTable('tagman_intellitag/variables'))
10
+ ->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
11
+ 'identity' => true,
12
+ 'unsigned' => true,
13
+ 'nullable' => false,
14
+ 'primary' => true,
15
+ ), 'ID')
16
+ ->addColumn('name', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
17
+ 'nullable' => false,
18
+ ), 'Name')
19
+ ->addColumn('is_static', Varien_Db_Ddl_Table::TYPE_BOOLEAN, 1, array(
20
+ 'nullable' => false,
21
+ ),'Type of Value')
22
+ ->addColumn('static_value', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
23
+ 'nullable' => false,
24
+ ), 'Static Value')
25
+ ->addColumn('magento_value', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
26
+ 'nullable' => false,
27
+ ), 'Magento Value')
28
+ ->addColumn('value', Varien_Db_Ddl_Table::TYPE_CLOB, 0, array(
29
+ 'nullable' => false,
30
+ ), 'Value');
31
+
32
+ $installer->getConnection()->createTable($table_variables);
33
+
34
+ $installer->endSetup();
app/design/frontend/base/default/layout/tagman_intellitag.xml CHANGED
@@ -1,31 +1,10 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
-
3
- <!-- all layout files begin with this node -->
4
  <layout>
5
-
6
- <!-- this is the layout handle we are interested in -->
7
  <default>
8
-
9
-
10
  <reference name="head">
11
  <block type="tagman_intellitag/JsInjector"
12
  name="tagman_intellitag_jsinjector"
13
  template="tagman_intellitag/jsinjector.phtml" />
14
-
15
  </reference>
16
-
17
- <!--<reference name="head">
18
- <block type="core/text" name="simple_example_javascript_block">
19
- <action method="setText">
20
- <text><![CDATA[
21
- <script type="text/javascript">
22
- alert("Tagman js alert from tagman_intellitag.xml");
23
- </script>
24
- ]]></text>
25
- </action>
26
- </block>
27
- </reference>-->
28
-
29
  </default>
30
-
31
  </layout>
1
  <?xml version="1.0" encoding="UTF-8"?>
 
 
2
  <layout>
 
 
3
  <default>
 
 
4
  <reference name="head">
5
  <block type="tagman_intellitag/JsInjector"
6
  name="tagman_intellitag_jsinjector"
7
  template="tagman_intellitag/jsinjector.phtml" />
 
8
  </reference>
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  </default>
 
10
  </layout>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Tagman_Intellitag</name>
4
- <version>1.0.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Provides a simple and seamless integration with TagMan&amp;amp;amp;apos;s Marketing Data Platform and Tag Management System.</summary>
10
- <description>TagMan's Marketing Data Platform (MDP) is powered by our leading tag management system to provide marketers the ability to collect, unify and distribute a clean layer of third-party, first-party and CRM data to your marketing technology vendors in real-time.</description>
11
- <notes>Bug on enterprise version fixed</notes>
12
- <authors><author><name>TagMan ltd.</name><user>tobyattagman</user><email>toby.doig@tagman.com</email></author></authors>
13
- <date>2013-10-31</date>
14
- <time>13:56:49</time>
15
- <contents><target name="magecommunity"><dir name="Tagman"><dir name="Intellitag"><dir name="Block"><dir name="Adminhtml"><dir name="Variables"><dir name="Edit"><file name="Form.php" hash="37260f123a4c05396b1ef2dd5a5f33f7"/></dir><file name="Edit.php" hash="c27734e57889971ae4cafff4ddb08ed8"/><file name="Grid.php" hash="3e6b1c8e49e60af21aa1d1c55ec7ef69"/></dir><file name="Variables.php" hash="9d5fa2b7442f92bfa5840abb2017d067"/></dir><file name="Field.php" hash="50b4bace6bec94d4693923b79ace1f44"/><file name="JsInjector.php" hash="fd66634d313f3a8e5ac17f3f55483d47"/><file name="Select.php" hash="01aa8523ede2440a5d3de5dc32085866"/><file name="Text.php" hash="0ef1ce4825caa74406ee9b37a397c0b3"/></dir><dir name="Helper"><file name="Data.php" hash="906f295b2d648c9a349c2565e09ddc18"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Variables"><file name="Collection.php" hash="dc0ef1f229e89cef8c52ac20adbc395b"/></dir><file name="Variables.php" hash="1b5357557412cdfa258b3bf532c869f3"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Model"><file name="Select.php" hash="61b6852fdf992661525d1da63dfdca4e"/></dir></dir></dir></dir><file name="Variables.php" hash="2d3ed7cf392258cd8868c9c8cd45e7d6"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="VariablesController.php" hash="b281e1de3d527046960aad9ba4890e35"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="61187b3ac51a10ca5ba73ccd0880db7f"/><file name="config.xml" hash="aa86ba7d01c3019aeb73b69a19c0ec61"/><file name="system.xml" hash="8484f9945f5246b2d9f44dc76e3ae0bf"/></dir><dir name="sql"><dir name="tagman_intellitag_setup"><file name="mysql4-install-1.0.7.php" hash="a91da3d51779b91d218caa9482268c45"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tagman_Intellitag.xml" hash="333d03b67ee4a65f9a78910b2f901803"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="tagman_intellitag"><file name="jsinjector.phtml" hash="58add90971f6d8ff56b6f80930d8b4a9"/></dir></dir><dir name="layout"><file name="tagman_intellitag.xml" hash="a11c923250f82ed34b7cc7935f3c6401"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="tagman"><file name="intellitag.xml" hash="444a905ddb69a1062501acd3984e80b1"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.3.24</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Tagman_Intellitag</name>
4
+ <version>1.0.8</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>redone version of TagMan's magento extension</summary>
10
+ <description>redone version of TagMan's magento extension</description>
11
+ <notes>redone version of TagMan's magento extension</notes>
12
+ <authors><author><name>Toby Doig</name><user>tobyattagman</user><email>toby.doig@tagman.com</email></author></authors>
13
+ <date>2013-12-23</date>
14
+ <time>14:29:18</time>
15
+ <contents><target name="magecommunity"><dir name="Tagman"><dir name="Intellitag"><dir name="Block"><dir name="Adminhtml"><dir name="Variables"><dir name="Edit"><file name="Form.php" hash="74e86b241c8d36d9a40e1873ba561097"/><file name="FormHelper.php" hash="4cabab17f0ce1c8c92a17d9c2d91d7c1"/><file name="MethodHelper.php" hash="e16fef8a5aeb74ab5911a96f1c9ea07f"/></dir><file name="Edit.php" hash="c27734e57889971ae4cafff4ddb08ed8"/><file name="Grid.php" hash="6a2aec2735900d8fa4fab2fa80120bec"/></dir><file name="Variables.php" hash="218025da0a4afeca015e35d2c74585e1"/></dir><file name="AttributeHelper.php" hash="843dbe74a6b21079df1076c3d9cfb600"/><file name="CatalogInformationHelper.php" hash="d44b804b157aeed433f0907ac79ff447"/><file name="CustomerInformationHelper.php" hash="10fb746d024a4f70b771ab941bc7f212"/><file name="Field.php" hash="9d0857567fb7a0148e59c2eaa66111e1"/><file name="FilterHelper.php" hash="c9e0b76aa3b338213766b8d6bf170acf"/><file name="GeneralInformationHelper.php" hash="355caf255af1324d19aeaefc19a1d8cc"/><file name="JsInjector.php" hash="5d575a2057a5ef2ff39ce61aeed88488"/><file name="JsInjectorHelper.php" hash="6d1e7f9f22df4fa8c88f17be789b220b"/><file name="OrderAndCartInformationHelper.php" hash="0f3ed7a95edf925cb8c2912e75a65370"/><file name="ProductDetailPageHelper.php" hash="ef6615fba0a2670c59daab4edd21a3cc"/><file name="Select.php" hash="c6aa5543de500239509f19352e638852"/><file name="Text.php" hash="9002cae7ae018d60c0920a28642a870b"/></dir><dir name="Helper"><file name="Data.php" hash="4a419a5f13c87f5a90c3a5bd7193b0d0"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Variables"><file name="Collection.php" hash="dc0ef1f229e89cef8c52ac20adbc395b"/></dir><file name="Variables.php" hash="1b5357557412cdfa258b3bf532c869f3"/></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Model"><file name="Select.php" hash="61b6852fdf992661525d1da63dfdca4e"/></dir></dir></dir></dir><file name="Variables.php" hash="2d3ed7cf392258cd8868c9c8cd45e7d6"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="VariablesController.php" hash="affefe614ffbae9bfcf96d77183f97e8"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="6389a214078dd7d9848676ca4052675b"/><file name="config.xml" hash="4dc56703356ba405b4cc6dc933572894"/><file name="system.xml" hash="8484f9945f5246b2d9f44dc76e3ae0bf"/></dir><dir name="sql"><dir name="tagman_intellitag_setup"><file name="mysql4-install-1.0.0.php" hash="a91da3d51779b91d218caa9482268c45"/><file name="mysql4-install-1.0.8.php" hash="a3890937b0f8aeb2e5b8736367485dd8"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Tagman_Intellitag.xml" hash="333d03b67ee4a65f9a78910b2f901803"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="tagman"><file name="intellitag.xml" hash="444a905ddb69a1062501acd3984e80b1"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="tagman_intellitag.xml" hash="f49c4cafa990ea8c01744ed247cec277"/></dir><dir name="template"><dir name="tagman_intellitag"><file name="jsinjector.phtml" hash="58add90971f6d8ff56b6f80930d8b4a9"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>