Atol_Productfeedgenerator - Version 1.0.1

Version Notes

first release

Download this release

Release Info

Developer Atol C
Extension Atol_Productfeedgenerator
Version 1.0.1
Comparing to
See all releases


Code changes from version 1.0.0 to 1.0.1

app/design/adminhtml/default/default/layout/productfeedgenerator.xml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout version="0.1.0">
4
+ <adminhtml_productflow_index>
5
+ <reference name="head">
6
+ <action method="addCss"><stylesheet>css/productfeedgenerator/styles.css</stylesheet></action>
7
+ </reference>
8
+ <reference name="content">
9
+ <block type="productfeedgenerator/adminhtml_productflow" name="productflow" />
10
+ </reference>
11
+ </adminhtml_productflow_index>
12
+
13
+ <adminhtml_productflow_edit>
14
+ <reference name="head">
15
+ <action method="addJs"><script>colorbox/jquery.colorbox-min.js</script></action>
16
+ <action method="addJs"><script>jquery/jquery-1.4.4.min.js</script></action>
17
+ <action method="addCss"><stylesheet>css/productfeedgenerator/styles.css</stylesheet></action>
18
+ </reference>
19
+ <reference name="content">
20
+ <block type="productfeedgenerator/adminhtml_productflow_edit" name="productflow_edit" template="productflow/edit.phtml">
21
+ <block type="productfeedgenerator/adminhtml_productflow_edit_categories" name="productflow_categories" as="categories">
22
+ <action method="setTemplate"><template>productflow/edit/categories.phtml</template></action>
23
+ </block>
24
+ </block>
25
+ </reference>
26
+ </adminhtml_productflow_edit>
27
+ </layout>
app/design/adminhtml/default/default/template/productflow/edit.phtml ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php define("ORDERBY_COUNT",3); ?>
2
+
3
+ <div id="product_flow_edit">
4
+ <?php $model = Mage::registry('productflow_data'); ?>
5
+ <?php $json_data = (($model) ? Mage::helper('core')->jsonDecode($model->getData('json_data')) : null); ?>
6
+ <input type="hidden" id="productflow_id" name="productflow_id" value="<?php echo (($model) ? $model->getId() : ""); ?>" />
7
+ <?php $attributes = $this->getProductAttributes(); ?>
8
+
9
+ <div id="messages">
10
+ <ul class="messages"></ul>
11
+ </div>
12
+
13
+ <div class="content-header">
14
+ <h3 class="icon-head"><?php echo $this->__('Product flow edition'); ?></h3>
15
+ <p class="form-buttons">
16
+ <button class="scalable back" id="btn_back" type="button"><span><?php echo $this->__('Back'); ?></span></button>
17
+ <!--<button class="scalable" id="btn_test" type="button"><span><?php echo $this->__('Test'); ?></span></button>-->
18
+ <?php if($model) : ?>
19
+ <button class="scalable delete" id="btn_delete" type="button"><span><?php echo $this->__('Delete'); ?></span></button>
20
+ <?php endif; ?>
21
+ <button class="scalable save" id="btn_save" type="button"><span><?php echo $this->__('Save'); ?></span></button>
22
+ </p>
23
+ </div>
24
+
25
+ <div class="entry-edit">
26
+ <div class="entry-edit-head">
27
+ <h4><?php echo $this->__('General informations'); ?></h4>
28
+ </div>
29
+ <fieldset>
30
+ <div class="input_section">
31
+ <label for="productflow_name"><?php echo $this->__('Name :'); ?></label>
32
+ <input id="productflow_name" type="text" value="<?php echo (($model) ? $model->getTitle() : "") ?>" />
33
+ </div>
34
+ <div class="input_section">
35
+ <label for="productflow_comment"><?php echo $this->__('Comment :'); ?></label>
36
+ <textarea id="productflow_comment"><?php echo (($model) ? $model->getNote() : "") ?></textarea>
37
+ </div>
38
+ </fieldset>
39
+ </div>
40
+
41
+ <div class="entry-edit">
42
+ <div class="entry-edit-head">
43
+ <h4><?php echo $this->__('Category filters'); ?></h4>
44
+ </div>
45
+ <fieldset>
46
+ <div class="input_section">
47
+ <?php echo $this->getChildHtml('categories'); ?>
48
+ </div>
49
+ </fieldset>
50
+ </div>
51
+
52
+ <?php
53
+ $attributesList = Array();
54
+ if($json_data && $json_data['attributes']) {
55
+ foreach($json_data['attributes'] as $attribute) {
56
+ $attributesList[$attribute['id']] = array("operator" => $attribute['operator'], "values" => $attribute['values']);
57
+ }
58
+ }
59
+
60
+ ?>
61
+
62
+ <div class="entry-edit">
63
+ <div class="entry-edit-head">
64
+ <h4><?php echo $this->__('Attribute filters'); ?></h4>
65
+ </div>
66
+ <fieldset>
67
+ <div class="attributes_list input_section">
68
+ <div class="entry-edit-head">
69
+ <h4><?php echo $this->__('Attribute list'); ?></h4>
70
+ </div>
71
+ <fieldset>
72
+ <?php foreach($attributes as $attribute) : ?>
73
+ <?php $frontendInput = $attribute->getData('frontend_input'); ?>
74
+ <?php if(in_array($attribute->getData('frontend_input'), array('select', 'multiselect', 'boolean','text'))) : ?>
75
+ <div class="attribute_item <?php echo $frontendInput; ?> <?php echo (isset($attributesList[$attribute->getData('attribute_id')]) ? 'filtered' : ''); ?>" <?php echo (isset($attributesList[$attribute->getData('attribute_id')]) ? '' : 'style="display:none;"'); ?> data-attribute-id="<?php echo $attribute->getData('attribute_id'); ?>" data-attribute-type="<?php echo $frontendInput; ?>">
76
+ <label for="productflow_attribute[<?php echo $attribute->getData('attribute_id'); ?>]['operator']"><?php echo $attribute->getData('frontend_label'); ?></label>
77
+ <select id="productflow_attribute[<?php echo $attribute->getData('attribute_id'); ?>]['operator']" class="operator">
78
+ <?php foreach($this->getOperators($frontendInput) as $operator => $label): ?>
79
+ <option value="<?php echo $operator; ?>" <?php echo ((isset($attributesList[$attribute->getData('attribute_id')]) && $attributesList[$attribute->getData('attribute_id')]['operator'] === $operator) ? 'selected="selected"' : ''); ?>><?php echo $label; ?></option>
80
+ <?php endforeach; ?>
81
+ </select>
82
+
83
+ <?php if($frontendInput === 'multiselect') : ?>
84
+ <select id="productflow_attribute[<?php echo $attribute->getData('attribute_id'); ?>]['value']" class="value" multiple="multiple">
85
+ <?php foreach($attribute->getSource()->getAllOptions(true, true) as $option) : ?>
86
+ <?php if($option['value'] != "" && $option['value'] != null) : ?>
87
+ <option value="<?php echo $option['value']; ?>" <?php echo ((isset($attributesList[$attribute->getData('attribute_id')]) && in_array($option['value'], $attributesList[$attribute->getData('attribute_id')]['values'])) ? 'selected="selected"' : ''); ?>><?php echo $option['label'] ?></option>
88
+ <?php endif; ?>
89
+ <?php endforeach; ?>
90
+ </select>
91
+ <?php elseif($frontendInput === 'select') : ?>
92
+ <select id="productflow_attribute[<?php echo $attribute->getData('attribute_id'); ?>]['value']" class="value" <?php echo (isset($attributesList[$attribute->getData('attribute_id')]) && $attributesList[$attribute->getData('attribute_id')]['operator'] === 'or') ? 'multiple=""' : ''; ?>>
93
+ <?php foreach($attribute->getSource()->getAllOptions(true, true) as $option) : ?>
94
+ <?php if($option['value'] != "" && $option['value'] != null) : ?>
95
+ <option value="<?php echo $option['value']; ?>" <?php echo ((isset($attributesList[$attribute->getData('attribute_id')]) && in_array($option['value'], $attributesList[$attribute->getData('attribute_id')]['values'])) ? 'selected="selected"' : ''); ?>><?php echo $option['label'] ?></option>
96
+ <?php endif; ?>
97
+ <?php endforeach; ?>
98
+ </select>
99
+ <?php elseif($frontendInput === 'boolean') : ?>
100
+ <select id="productflow_attribute[<?php echo $attribute->getData('attribute_id'); ?>]['value']" name="productflow['attributes']" class="value" >
101
+ <option value="true" <?php echo ((isset($attributesList[$attribute->getData('attribute_id')]) && in_array(true, $attributesList[$attribute->getData('attribute_id')]['values'])) ? 'selected="selected"' : ''); ?>><?php echo $this->__('yes'); ?></option>
102
+ <option value="false" <?php echo ((isset($attributesList[$attribute->getData('attribute_id')]) && in_array(false, $attributesList[$attribute->getData('attribute_id')]['values'])) ? 'selected="selected"' : ''); ?>><?php echo $this->__('no'); ?></option>
103
+ </select>
104
+ <?php elseif($frontendInput === 'text') : ?>
105
+ <input type="text" id="productflow_attribute[<?php echo $attribute->getData('attribute_id'); ?>]['value']" name="productflow['attributes']" class="value" style="width:50%" value="<?php echo $attributesList[$attribute->getData('attribute_id')]['values'][0] ?>"/>
106
+ <?php endif; ?>
107
+ <button class="btn_drop_attribute" data-attribute-id="<?php echo $attribute->getData('attribute_id'); ?>" ><?php echo $this->__('Drop'); ?></button>
108
+ </div>
109
+ <?php endif; ?>
110
+ <?php endforeach; ?>
111
+ </fieldset>
112
+ <div id="add_attribute">
113
+ <label for="add_attribute_select"><?php echo $this->__('Add an attribute to filter'); ?></label>
114
+ <select id="add_attribute_select">
115
+ <?php foreach($attributes as $attribute) : ?>
116
+ <option value="<?php echo $attribute->getData('attribute_id'); ?>" class="<?php echo (isset($attributesList[$attribute->getData('attribute_id')]) ? 'filtered' : ''); ?>" ><?php echo $attribute->getData('attribute_code'); ?></option>
117
+ <?php endforeach; ?>
118
+ </select>
119
+ <button class="btn_add_attribute"><?php echo $this->__('Add'); ?></button>
120
+ </div>
121
+ </div>
122
+ </fieldset>
123
+ </div>
124
+
125
+ <div class="entry-edit">
126
+ <div class="entry-edit-head">
127
+ <h4><?php echo $this->__('Other filters'); ?></h4>
128
+ </div>
129
+ <fieldset>
130
+ <div id="product_filters" class="input_section">
131
+ <div class="product_filter">
132
+ <input type="checkbox" id="discounted_products" name="productflow['filters']['discounted']" <?php echo ((isset($json_data) && isset($json_data['filters']) && isset($json_data['filters']['discounted']) && $json_data['filters']['discounted']) ? 'checked="checked"' : ''); ?> />
133
+ <label for="discounted_products"><?php echo $this->__('Filter only discounted products ?'); ?></label>
134
+ </div>
135
+ <div class="product_filter">
136
+ <input type="checkbox" id="new_products" name="productflow['filters']['new']" <?php echo ((isset($json_data) && isset($json_data['filters']) && isset($json_data['filters']['new']) && $json_data['filters']['new']) ? 'checked="checked"' : ''); ?>/>
137
+ <label for="new_products"><?php echo $this->__('Filter only new products ?'); ?></label>
138
+ </div>
139
+ </div>
140
+ </fieldset>
141
+ </div>
142
+
143
+ <div class="entry-edit">
144
+ <div class="entry-edit-head">
145
+ <h4><?php echo $this->__('Collection management'); ?></h4>
146
+ </div>
147
+ <fieldset>
148
+ <!--<div class="input_section">
149
+ <label for="productflow_order_by"><?php echo $this->__('Order by :'); ?></label>
150
+ <select id="productflow_order_by">
151
+ <?php foreach($attributes as $attribute) : ?>
152
+ <option value="<?php echo $attribute->getData('attribute_id'); ?>"><?php echo $attribute->getData('frontend_label'); ?></option>
153
+ <?php endforeach; ?>
154
+ </select>
155
+ <select id="productflow_order_direction">
156
+ <option value="asc"><?php echo $this->__('ASC'); ?></option>
157
+ <option value="desc"><?php echo $this->__('DESC'); ?></option>
158
+ </select>
159
+ </div>-->
160
+ <div class="input_section">
161
+ <label for="productflow_limit"><?php echo $this->__('Limit :'); ?></label>
162
+ <input id="productflow_limit" name="productflow['limit']" type="text" value="<?php echo ((isset($json_data) && isset($json_data['others']) && isset($json_data['others']['limit']) && $json_data['others']['limit']) ? $json_data['others']['limit'] : ''); ?>" />
163
+ </div>
164
+
165
+ <?php $orderByOptions = Mage::getModel('productfeedgenerator/system_config_source_orderbytype')->toOptionArray(); ?>
166
+
167
+ <?php foreach(range(0,ORDERBY_COUNT - 1) as $i) : ?>
168
+ <?php $currentOrderBy = ($json_data && isset($json_data['orderBy']) && isset($json_data['orderBy'][$i]) && isset($json_data['orderBy'][$i]) && isset($json_data['orderBy'][$i]['attribute']) && isset($json_data['orderBy'][$i]['direction'])) ? $json_data['orderBy'][$i] : null; ?>
169
+ <div class="input_section">
170
+ <label for="orderby<?php echo $i; ?>"><?php echo $this->__('Order %s :', $i); ?></label>
171
+ <select name="orderby['<?php echo $i; ?>']" id="orderby<?php echo $i; ?>" class="orderby" data-orderbyid="<?php echo $i; ?>">
172
+ <?php foreach($orderByOptions as $orderBy) : ?>
173
+ <option value="<?php echo $orderBy['value']; ?>" <?php echo ($currentOrderBy && $currentOrderBy['attribute'] == $orderBy['value']) ? 'selected="selected"' :'' ?>><?php echo $orderBy['label']; ?></option>
174
+ <?php endforeach; ?>
175
+ </select>
176
+ <select name="direction['<?php echo $i; ?>']" id="direction<?php echo $i; ?>" class="direction">
177
+ <option value="asc" <?php echo ($currentOrderBy && $currentOrderBy['direction'] == "asc") ? 'selected="selected"' :'' ?>><?php echo $this->__('asc'); ?></option>
178
+ <option value="desc" <?php echo ($currentOrderBy && $currentOrderBy['direction'] == "desc") ? 'selected="selected"' :'' ?>><?php echo $this->__('desc'); ?></option>
179
+ </select>
180
+ </div>
181
+ <?php endforeach; ?>
182
+ </fieldset>
183
+ </div>
184
+
185
+ <script type="text/javascript">
186
+ function formToJson() {
187
+ var limitValue = parseInt(jQuery('#productflow_limit').val());
188
+ if(isNaN(limitValue)) {
189
+ limitValue = null;
190
+ }
191
+
192
+ var json = {
193
+ "attributes" : jQuery('.attribute_item.filtered').map(function() {
194
+ var attributeType = jQuery(this).attr('data-attribute-type');
195
+ return {
196
+ "id" : jQuery(this).attr('data-attribute-id'),
197
+ "operator" : jQuery(this).children('select.operator').val(),
198
+ "values" : jQuery(this).find('select.value option:selected, :text').map(function() {
199
+ return (attributeType == 'boolean') ? (jQuery(this).val() == "true") : jQuery(this).val();
200
+ }).get()
201
+ };
202
+ }).get(),
203
+ "categories" : jQuery('#productflow_categories').val().split(',').map( function(categoryId, i) {
204
+ return (isNaN(parseInt(categoryId))) ? null : parseInt(categoryId);
205
+ }),
206
+ "filters" :
207
+ {
208
+ "discounted" : jQuery('#discounted_products').is(':checked'),
209
+ "new" : jQuery('#new_products').is(':checked')
210
+ },
211
+ "orderBy" : jQuery('.orderby').map(function() {
212
+ var currentSelect = jQuery(this);
213
+ return {
214
+ "attribute" : currentSelect.val(),
215
+ "direction" : currentSelect.siblings('.direction').val()
216
+ };
217
+ }).get(),
218
+ "others" :
219
+ {
220
+ "limit" : limitValue
221
+ }
222
+ };
223
+
224
+ return json;
225
+ }
226
+
227
+ jQuery(document).ready(function () {
228
+ var optionSelected = jQuery('#add_attribute_select option:selected');
229
+ if(optionSelected.length > 0) {
230
+ optionSelected.hide();
231
+ jQuery('#add_attribute_select option:not(.filtered):first').attr("selected","selected");
232
+ }
233
+
234
+ jQuery('.btn_add_attribute').click(function() {
235
+ var optionSelected = jQuery('#add_attribute_select option:selected');
236
+ var id = optionSelected.val();
237
+ var attribute = jQuery('.attribute_item[data-attribute-id='+id+']');
238
+ attribute.show();
239
+ attribute.addClass('filtered');
240
+ optionSelected.hide();
241
+ optionSelected.addClass('filtered');
242
+ jQuery('#add_attribute_select option:not(.filtered):first').attr("selected","selected");
243
+ });
244
+
245
+ jQuery('.btn_drop_attribute').click(function() {
246
+ var id = jQuery(this).attr('data-attribute-id');
247
+ var attribute = jQuery('div.attribute_item[data-attribute-id='+id+']');
248
+ attribute.hide();
249
+ attribute.removeClass('filtered');
250
+ var option = jQuery('#add_attribute_select option[value="'+id+'"]');
251
+ option.show();
252
+ option.removeClass('filtered');
253
+ });
254
+
255
+ jQuery('.btn_drop_category').click(function() {
256
+ var parent = jQuery(this).parent();
257
+ parent.hide();
258
+ parent.removeClass('filtered');
259
+ });
260
+
261
+ jQuery('.attribute_item.select select.operator').change( function() {
262
+ var operator = jQuery(this);
263
+ if(operator.parent().hasClass('filtered') && operator.val() == 'or') {
264
+ operator.siblings('select.value').attr('multiple','multiple');
265
+ } else {
266
+ operator.siblings('select.value').removeAttr('multiple');
267
+ }
268
+ });
269
+
270
+ /*jQuery('#btn_test, #btn_test span').live('click', function() {
271
+ var flow = formToJson();
272
+
273
+ jQuery.ajax({
274
+ type : "POST",
275
+ url : "<?php echo Mage::getUrl('adminhtml/productflow/test'); ?>",
276
+ data : {
277
+ "data" : Object.toJSON(flow),
278
+ "form_key" : FORM_KEY
279
+ },
280
+ dataType : "json",
281
+ success : function(data) {
282
+ jQuery('#messages .messages').html('<li class="info-msg">' + data.count + ' <?php echo $this->__('products given by the current query') ?></li>');
283
+ },
284
+ error : function(data) {
285
+ jQuery('#messages .messages').html('<li class="error-msg"><?php echo $this->__('Server error'); ?></li>');
286
+ }
287
+ });
288
+ });*/
289
+
290
+ jQuery('#btn_save, #btn_save span').live('click', function() {
291
+ var flow = formToJson();
292
+
293
+ jQuery.ajax({
294
+ type : "POST",
295
+ url : "<?php echo Mage::getUrl('adminhtml/productflow/save'); ?>",
296
+ data : {
297
+ "id" : jQuery('#productflow_id').val(),
298
+ "name" : jQuery('#productflow_name').val(),
299
+ "comment" : jQuery('#productflow_comment').val(),
300
+ "data" : Object.toJSON(flow),
301
+ "form_key" : FORM_KEY
302
+ },
303
+ dataType : "json",
304
+ success : function(data) {
305
+ if(data != null) {
306
+ if('error' in data) {
307
+ jQuery('#messages .messages').html('<li class="error-msg">' + data.error + '</li>');
308
+ } else if('success' in data) {
309
+ window.location = "<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/productflow/index'); ?>";
310
+ } else {
311
+ jQuery('#messages .messages').html('<li class="error-msg"><?php echo $this->__('Server error'); ?></li>');
312
+ }
313
+ }
314
+ },
315
+ error : function(data) {
316
+ if(data != null && 'error' in data) {
317
+ jQuery('#messages .messages').html('<li class="error-msg">' + data.error + '</li>');
318
+ } else {
319
+ jQuery('#messages .messages').html('<li class="error-msg"><?php echo $this->__('Server error'); ?></li>');
320
+ }
321
+ }
322
+ });
323
+
324
+ });
325
+
326
+ jQuery('#btn_delete, #btn_delete span').live('click', function() {
327
+ var flow = formToJson();
328
+
329
+ jQuery.ajax({
330
+ type : "POST",
331
+ url : "<?php echo Mage::getUrl('adminhtml/productflow/delete'); ?>",
332
+ data : {
333
+ "id" : jQuery('#productflow_id').val(),
334
+ "form_key" : FORM_KEY
335
+ },
336
+ dataType : "json",
337
+ success : function(data) {
338
+ if(data != null) {
339
+ if('error' in data) {
340
+ jQuery('#messages .messages').html('<li class="error-msg">' + data.error + '</li>');
341
+ } else if('success' in data) {
342
+ window.location = "<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/productflow/index'); ?>";
343
+ } else {
344
+ jQuery('#messages .messages').html('<li class="error-msg"><?php echo $this->__('Server error'); ?></li>');
345
+ }
346
+ }
347
+ },
348
+ error : function(data) {
349
+ if(data != null && 'error' in data) {
350
+ jQuery('#messages .messages').html('<li class="error-msg">' + data.error + '</li>');
351
+ } else {
352
+ jQuery('#messages .messages').html('<li class="error-msg"><?php echo $this->__('Server error'); ?></li>');
353
+ }
354
+ }
355
+ });
356
+ });
357
+
358
+ jQuery('#btn_back').live('click', function() {
359
+ setLocation('<?php echo Mage::helper("adminhtml")->getUrl('adminhtml/productflow/index'); ?>');
360
+ });
361
+
362
+ jQuery('.orderby').change(function() {
363
+ var currentSelect = jQuery(this);
364
+ var id = parseInt(currentSelect.attr('data-orderbyid'));
365
+ if(currentSelect.val() == 0) {
366
+ var others = jQuery('.orderby').filter(function() {
367
+ return jQuery(this).attr("data-orderbyid") > id;
368
+ });
369
+ others.val(0);
370
+ others.parent().hide();
371
+ } else {
372
+ jQuery('.orderby[data-orderbyid="'+(id+1)+'"]').parent().show();
373
+ }
374
+ });
375
+
376
+ var firstToNull = jQuery('.orderby option[value="0"]:selected:first').parent();
377
+ firstToNull.parent().show();
378
+ var idFirst = parseInt(firstToNull.attr('data-orderbyid'));
379
+ var others = jQuery('.orderby').filter(function() {
380
+ return jQuery(this).attr("data-orderbyid") > idFirst;
381
+ });
382
+ others.val(0);
383
+ others.parent().hide();
384
+
385
+ });
386
+ </script>
387
+ </div>
app/design/adminhtml/default/default/template/productflow/edit/categories.phtml ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <input type="hidden" name="category_ids" id="productflow_categories" value="<?php echo $this->getIdsString(); ?>">
28
+ <div id="categories_tree" class="tree"></div>
29
+ <?php if($this->getRoot() && $this->getRoot()->hasChildren()): ?>
30
+ <script type="text/javascript">
31
+ Ext.EventManager.onDocumentReady(function() {
32
+ var categoryLoader = new Ext.tree.TreeLoader({
33
+ dataUrl: '<?php echo $this->getLoadTreeUrl()?>'
34
+ });
35
+
36
+ categoryLoader.createNode = function(config) {
37
+ config.uiProvider = Ext.tree.CheckboxNodeUI;
38
+ var node;
39
+ if (config.children && !config.children.length) {
40
+ delete(config.children);
41
+ node = new Ext.tree.AsyncTreeNode(config);
42
+
43
+ } else {
44
+ node = new Ext.tree.TreeNode(config);
45
+ }
46
+ return node;
47
+ };
48
+
49
+ categoryLoader.on("beforeload", function(treeLoader, node) {
50
+ treeLoader.baseParams.category = node.attributes.id;
51
+ <?php $productFlowId = $this->getProductflowId(); ?>
52
+ <?php if($productFlowId) : ?>
53
+ treeLoader.baseParams.productflow = <?php echo $productFlowId; ?>;
54
+ <?php endif; ?>
55
+ });
56
+
57
+ categoryLoader.on("load", function(treeLoader, node, config) {
58
+ varienWindowOnload();
59
+ });
60
+
61
+ var tree = new Ext.tree.TreePanel('categories_tree', {
62
+ animate:true,
63
+ loader: categoryLoader,
64
+ enableDD:false,
65
+ containerScroll: true,
66
+ rootUIProvider: Ext.tree.CheckboxNodeUI,
67
+ selModel: new Ext.tree.CheckNodeMultiSelectionModel(),
68
+ rootVisible: '<?php echo $this->getRoot()->getIsVisible() ?>'
69
+ });
70
+
71
+ tree.on('check', function(node) {
72
+ if(node.attributes.checked) {
73
+ categoryAdd(node.id);
74
+ } else {
75
+ categoryRemove(node.id);
76
+ }
77
+ varienElementMethods.setHasChanges(node.getUI().checkbox);
78
+ }, tree);
79
+
80
+ // set the root node
81
+ var root = new Ext.tree.TreeNode({
82
+ text: '<?php echo $this->jsQuoteEscape($this->getRoot()->getName()) ?>',
83
+ draggable:false,
84
+ checked:'<?php echo $this->getRoot()->getChecked() ?>',
85
+ id:'<?php echo $this->getRoot()->getId() ?>',
86
+ disabled: <?php echo ($this->getRoot()->getDisabled() ? 'true' : 'false') ?>,
87
+ uiProvider: Ext.tree.CheckboxNodeUI
88
+ });
89
+
90
+ tree.setRootNode(root);
91
+ bildCategoryTree(root, <?php echo $this->getTreeJson() ?>);
92
+ tree.addListener('click', categoryClick.createDelegate(this));
93
+
94
+ // render the tree
95
+ tree.render();
96
+ root.expand();
97
+ //tree.expandAll();
98
+ });
99
+
100
+ function bildCategoryTree(parent, config){
101
+ if (!config) return null;
102
+
103
+ if (parent && config && config.length){
104
+ for (var i = 0; i < config.length; i++){
105
+ config[i].uiProvider = Ext.tree.CheckboxNodeUI;
106
+ var node;
107
+ var _node = Object.clone(config[i]);
108
+ if (_node.children && !_node.children.length) {
109
+ delete(_node.children);
110
+ node = new Ext.tree.AsyncTreeNode(_node);
111
+
112
+ } else {
113
+ node = new Ext.tree.TreeNode(config[i]);
114
+ }
115
+ parent.appendChild(node);
116
+ node.loader = node.getOwnerTree().loader;
117
+ if(config[i].children){
118
+ bildCategoryTree(node, config[i].children);
119
+ }
120
+ }
121
+ }
122
+ }
123
+
124
+ function categoryClick(node, e){
125
+ if (node.disabled) {
126
+ return;
127
+ }
128
+ node.getUI().check(!node.getUI().checked());
129
+ varienElementMethods.setHasChanges(Event.element(e), e);
130
+ };
131
+ function categoryAdd(id) {
132
+ var ids = $('productflow_categories').value.split(',');
133
+ ids.push(id);
134
+ $('productflow_categories').value = ids.join(',');
135
+ }
136
+ function categoryRemove(id) {
137
+ var ids = $('productflow_categories').value.split(',');
138
+ // bug #7654 fixed
139
+ while (-1 != ids.indexOf(id)) {
140
+ ids.splice(ids.indexOf(id), 1);
141
+ }
142
+ $('productflow_categories').value = ids.join(',');
143
+ }
144
+ </script>
145
+ <?php endif; ?>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Atol_Productfeedgenerator</name>
4
- <version>1.0.0</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
@@ -45,9 +45,9 @@ Pour en savoir plus sur notre soci&#xE9;t&#xE9;, n'h&#xE9;sitez pas &#xE0; consu
45
  </description>
46
  <notes>first release</notes>
47
  <authors><author><name>AtolCD</name><user>AtolCD</user><email>magento@atolcd.com</email></author><author><name>Antoine Trapet</name><user>atr</user><email>atr@atolcd.com</email></author><author><name>Aur&#xE9;lien Pon&#xE7;on</name><user>apo</user><email>apo@atolcd.com</email></author><author><name>Antoine Chevaldonn&#xE9;</name><user>ach</user><email>ach@atolcd.com</email></author></authors>
48
- <date>2016-03-10</date>
49
- <time>10:51:45</time>
50
- <contents><target name="magelocal"><dir name="Atol"><dir name="Productfeedgenerator"><dir name="Block"><dir name="Adminhtml"><dir name="Productflow"><dir name="Edit"><file name="Categories.php" hash="1dab18a40a30827f9b1ab3001f04d13a"/></dir><file name="Edit.php" hash="000b7dc9137a5e92e7b503ff13713006"/><file name="Grid.php" hash="cc7def146fe698de4249b252eeb3c63e"/><dir name="Renderer"><file name="Linkscolumn.php" hash="d831799203369be2586698559aabf161"/></dir></dir><file name="Productflow.php" hash="827fd19128b6f6b03febbbb5387be50f"/></dir><file name="Frontdisplay.php" hash="ab7997b46c7391e0a0e5b24c6070beb8"/><dir name="Productflow"><file name="Rss.php" hash="a4caa2e3ac07511634be1bc5ee0267da"/></dir></dir><dir name="Helper"><file name="Data.php" hash="7795364cf1483083b9594d95c34bc660"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Productflow"><file name="Collection.php" hash="0d8056368d6c4599a00e3b3dd4f69722"/></dir><file name="Productflow.php" hash="e68259670802fa7f84571b19b0a030cb"/></dir><file name="Productflow.php" hash="aa0fb13c57acb92c3b3855dd6b115e1c"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Orderbytype.php" hash="1a390fda30c5c9d1ca9f5a8c2bf1bb6f"/><file name="Productflowtype.php" hash="967ca8318947473e696612ceb8b9f2c6"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProductflowController.php" hash="787a5ec0239348658787be719de4574b"/></dir><file name="IndexController.php" hash="39e2e2cf9354c35b32e5a738840b6d87"/><file name="ProductflowController.php" hash="5125ac0325a8f2fc62deb8c89d097111"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c8d2bb91591aae5a80941ef44e19dcc9"/><file name="config.xml" hash="8c2136b71a9c5e306fbf815455a5b443"/><file name="system.xml" hash="511c6ea6cbd55527dfc278b83a44eccb"/><file name="widget.xml" hash="b29e594a7912a2244c1d6fd01912d1c0"/></dir><dir name="sql"><dir name="productfeedgenerator_setup"><file name="mysql4-install-0.1.0.php" hash="178841fb1c45d4fd7e70abc5054ad0ce"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><file name="layout.productfeedgenerator.xml" hash=""/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Atol_Productfeedgenerator.xml" hash="21350607b70c31828328ba4e41f8bd04"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Atol_Productfeedgenerator.csv" hash="9e1bfbad6d620a09811cdbd9c1a5abfb"/></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="jquery-1.4.4.min.js" hash="eef9a6a171184899b08ebd61f1a03425"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="productfeedgenerator"><file name="styles.css" hash="8a550d9db1fcf37915a96e67919de9da"/></dir></dir></dir></dir></dir></target></contents>
51
  <compatible/>
52
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
53
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Atol_Productfeedgenerator</name>
4
+ <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license>GNU General Public License (GPL)</license>
7
  <channel>community</channel>
45
  </description>
46
  <notes>first release</notes>
47
  <authors><author><name>AtolCD</name><user>AtolCD</user><email>magento@atolcd.com</email></author><author><name>Antoine Trapet</name><user>atr</user><email>atr@atolcd.com</email></author><author><name>Aur&#xE9;lien Pon&#xE7;on</name><user>apo</user><email>apo@atolcd.com</email></author><author><name>Antoine Chevaldonn&#xE9;</name><user>ach</user><email>ach@atolcd.com</email></author></authors>
48
+ <date>2016-03-14</date>
49
+ <time>08:29:17</time>
50
+ <contents><target name="magelocal"><dir name="Atol"><dir name="Productfeedgenerator"><dir name="Block"><dir name="Adminhtml"><dir name="Productflow"><dir name="Edit"><file name="Categories.php" hash="1dab18a40a30827f9b1ab3001f04d13a"/></dir><file name="Edit.php" hash="000b7dc9137a5e92e7b503ff13713006"/><file name="Grid.php" hash="cc7def146fe698de4249b252eeb3c63e"/><dir name="Renderer"><file name="Linkscolumn.php" hash="d831799203369be2586698559aabf161"/></dir></dir><file name="Productflow.php" hash="827fd19128b6f6b03febbbb5387be50f"/></dir><file name="Frontdisplay.php" hash="ab7997b46c7391e0a0e5b24c6070beb8"/><dir name="Productflow"><file name="Rss.php" hash="a4caa2e3ac07511634be1bc5ee0267da"/></dir></dir><dir name="Helper"><file name="Data.php" hash="7795364cf1483083b9594d95c34bc660"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Productflow"><file name="Collection.php" hash="0d8056368d6c4599a00e3b3dd4f69722"/></dir><file name="Productflow.php" hash="e68259670802fa7f84571b19b0a030cb"/></dir><file name="Productflow.php" hash="aa0fb13c57acb92c3b3855dd6b115e1c"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Orderbytype.php" hash="1a390fda30c5c9d1ca9f5a8c2bf1bb6f"/><file name="Productflowtype.php" hash="967ca8318947473e696612ceb8b9f2c6"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProductflowController.php" hash="787a5ec0239348658787be719de4574b"/></dir><file name="IndexController.php" hash="39e2e2cf9354c35b32e5a738840b6d87"/><file name="ProductflowController.php" hash="5125ac0325a8f2fc62deb8c89d097111"/></dir><dir name="etc"><file name="adminhtml.xml" hash="c8d2bb91591aae5a80941ef44e19dcc9"/><file name="config.xml" hash="8c2136b71a9c5e306fbf815455a5b443"/><file name="system.xml" hash="511c6ea6cbd55527dfc278b83a44eccb"/><file name="widget.xml" hash="b29e594a7912a2244c1d6fd01912d1c0"/></dir><dir name="sql"><dir name="productfeedgenerator_setup"><file name="mysql4-install-0.1.0.php" hash="178841fb1c45d4fd7e70abc5054ad0ce"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><file name="layout.productfeedgenerator.xml" hash=""/></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="productfeedgenerator.xml" hash="2819062aab01040c428185362050432e"/></dir><dir name="template"><dir name="productflow"><dir><dir name="edit"><file name="categories.phtml" hash="e88f45634328726e01768916cfe407d5"/></dir></dir><file name="edit.phtml" hash="3dfa6696bf128cd285d5a0b85765b68d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Atol_Productfeedgenerator.xml" hash="21350607b70c31828328ba4e41f8bd04"/></dir></target><target name="magelocale"><dir name="fr_FR"><file name="Atol_Productfeedgenerator.csv" hash="9e1bfbad6d620a09811cdbd9c1a5abfb"/></dir></target><target name="mageweb"><dir name="js"><dir name="jquery"><file name="jquery-1.4.4.min.js" hash="eef9a6a171184899b08ebd61f1a03425"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="css"><dir name="productfeedgenerator"><file name="styles.css" hash="8a550d9db1fcf37915a96e67919de9da"/></dir></dir></dir></dir></dir></target></contents>
51
  <compatible/>
52
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
53
  </package>