Ced_NowShop - Version 0.0.2

Version Notes

Stable Release.

Download this release

Release Info

Developer Nowshop
Extension Ced_NowShop
Version 0.0.2
Comparing to
See all releases


Code changes from version 0.0.1 to 0.0.2

app/code/community/NowShop/Synchronize/Block/Adminhtml/Feed/Grid.php CHANGED
@@ -1 +1 @@
1
- <?php
2
  * NowShop
3
  *
4
  * NOTICE OF LICENS
5
  *
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
9
  * http://opensource.org/licenses/osl-3.0.php
10
  * If you did not receive a copy of the license and are unable to
11
  * obtain it through the world-wide-web, please send an email
12
  * to support@nowshop.com so we can send you a copy immediately.
13
  *
14
  * @category NowShop
15
  * @package NowShop_Synchronize
16
  * @author Asheesh Singh<asheeshsingh@cedcoss.com>
17
  * @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
18
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
  * Block for NowShop feed grid
22
  */
23
 
24
  $this->setUseAjax(true);
25
  $this->setVarNameFilter('productfeed_filter');
26
  {
27
  $storeId = (int) $this->getRequest()->getParam('store', 0);
28
  return Mage::app()->getStore($storeId);
29
  }
30
  protected function _prepareCollection()
31
  {
32
  $store = $this->_getStore();
33
  $collection = Mage::getModel('catalog/product')->getCollection()
34
  ->addAttributeToSelect('sku')
35
  ->addAttributeToSelect('name')
36
  ->addAttributeToSelect('attribute_set_id')
37
  ->addAttributeToSelect('type_id');
38
  if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
39
  $collection->joinField('qty',
40
  'cataloginventory/stock_item',
41
  'qty',
42
  'product_id=entity_id',
43
  '{{table}}.stock_id=1',
44
  'left');
45
  }
46
  if ($store->getId()) {
47
  $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
48
  $collection->addStoreFilter($store);
49
  $collection->joinAttribute(
50
  'name',
51
  'catalog_product/name',
52
  'entity_id',
53
  null,
54
  'inner',
55
  $adminStore
56
  );
57
  $collection->joinAttribute(
58
  'custom_name',
59
  'catalog_product/name',
60
  'entity_id',
61
  null,
62
  'inner',
63
  $store->getId()
64
  );
65
  $collection->joinAttribute(
66
  'status',
67
  'catalog_product/status',
68
  'entity_id',
69
  null,
70
  'inner',
71
  $store->getId()
72
  );
73
  $collection->joinAttribute(
74
  'visibility',
75
  'catalog_product/visibility',
76
  'entity_id',
77
  null,
78
  'inner',
79
  $store->getId()
80
  );
81
  $collection->joinAttribute(
82
  'price',
83
  'catalog_product/price',
84
  'entity_id',
85
  null,
86
  'left',
87
  $store->getId()
88
  );
89
  }
90
  else {
91
  $collection->addAttributeToSelect('price');
92
  $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
93
  $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
94
  }
95
  $this->setCollection($collection);
96
  parent::_prepareCollection();
97
  $this->getCollection()->addWebsiteNamesToResult();
98
  return $this;
99
  }
100
  protected function _addColumnFilterToCollection($column)
101
  {
102
  if ($this->getCollection()) {
103
  if ($column->getId() == 'websites') {
104
  $this->getCollection()->joinField('websites',
105
  'catalog/product_website',
106
  'website_id',
107
  'product_id=entity_id',
108
  null,
109
  'left'
110
  }
111
  }
112
  return parent::_addColumnFilterToCollection($column);
113
  }
114
  protected function _prepareColumns()
115
  {
116
  $this->addColumn('entity_id',
117
  array(
118
  'header'=> Mage::helper('catalog')->__('ID'),
119
  'width' => '50px',
120
  'type' => 'number',
121
  'index' => 'entity_id',
122
  ));
123
  $this->addColumn('name',
124
  array(
125
  'header'=> Mage::helper('catalog')->__('Name'),
126
  'index' => 'name',
127
  ));
128
  $store = $this->_getStore();
129
  if ($store->getId()) {
130
  $this->addColumn('custom_name',
131
  array(
132
  'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
133
  'index' => 'custom_name',
134
  ));
135
  }
136
  $this->addColumn('type',
137
  array(
138
  'header'=> Mage::helper('catalog')->__('Type'),
139
  'width' => '60px',
140
  'index' => 'type_id',
141
  'type' => 'options',
142
  'options' => array(
143
  ));
144
  $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
145
  ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
146
  ->load()
147
  ->toOptionHash();
148
  $this->addColumn('set_name',
149
  array(
150
  'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
151
  'width' => '100px',
152
  'index' => 'attribute_set_id',
153
  'type' => 'options',
154
  'options' => $sets,
155
  ));
156
  $this->addColumn('sku',
157
  array(
158
  'header'=> Mage::helper('catalog')->__('SKU'),
159
  'width' => '80px',
160
  'index' => 'sku',
161
  ));
162
  $store = $this->_getStore();
163
  $this->addColumn('price',
164
  array(
165
  'header'=> Mage::helper('catalog')->__('Price'),
166
  'type' => 'price',
167
  'currency_code' => $store->getBaseCurrency()->getCode(),
168
  'index' => 'price',
169
  ));
170
  if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
171
  $this->addColumn('qty',
172
  array(
173
  'header'=> Mage::helper('catalog')->__('Qty'),
174
  'width' => '100px',
175
  'type' => 'number',
176
  'index' => 'qty',
177
  ));
178
  }
179
  $this->addColumn('visibility',
180
  array(
181
  'header'=> Mage::helper('catalog')->__('Visibility'),
182
  'width' => '70px',
183
  'index' => 'visibility',
184
  'type' => 'options',
185
  'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
186
  ));
187
  $this->addColumn('status',
188
  array(
189
  'header'=> Mage::helper('catalog')->__('Status'),
190
  'width' => '70px',
191
  'index' => 'status',
192
  'type' => 'options',
193
  'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
194
  ));
195
  if (!Mage::app()->isSingleStoreMode()) {
196
  $this->addColumn('websites',
197
  array(
198
  'header'=> Mage::helper('catalog')->__('Websites'),
199
  'width' => '100px',
200
  'sortable' => false,
201
  'index' => 'websites',
202
  'type' => 'options',
203
  'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
204
  ));
205
  }
206
  array(
207
  'header'=> Mage::helper('nowshop')->__('Re-listing required?'),
208
  'width' => '70px',
209
  'index' => 'requiredrelisting',
210
  'type' => 'options',
211
  'options' => array(1=>Mage::helper('nowshop')->__('Yes'),-1=>Mage::helper('nowshop')->__('No')),
212
  ));
213
  $this->addColumn('nowshop',
214
  array(
215
  'header'=> Mage::helper('nowshop')->__('On NowShop'),
216
  'width' => '70px',
217
  'index' => 'nowshop',
218
  'type' => 'options',
219
  'options' => Mage::helper('nowshop')->getStatuses(),
220
  ));
221
  return parent::_prepareColumns();
222
  }
223
  protected function _prepareMassaction()
224
  {
225
  $this->setMassactionIdField('entity_id');
226
  $this->getMassactionBlock()->setFormFieldName('product');
227
  $statuses = array(
228
  array_unshift($statuses, array('label'=>'', 'value'=>''));
229
  $this->getMassactionBlock()->addItem('onnowshop', array(
230
  'label'=> Mage::helper('nowshop')->__('On NowShop'),
231
  'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
232
  'additional' => array(
233
  'visibility' => array(
234
  'name' => 'onnowshop',
235
  'type' => 'select',
236
  'class' => 'required-entry',
237
  'label' => Mage::helper('catalog')->__('Status'),
238
  'values' => $statuses
239
  )
240
  )
241
  ));
242
  return $this;
243
  }
244
  public function getGridUrl()
245
  {
246
  return $this->getUrl('*/*/grid', array('_secure'=>true, '_current'=>true));
247
  }
248
  public function getRowUrl($row)
249
  {
250
  return "javascript:void(0)";
251
  }
252
  $this->_prepareGrid();
253
  $this->getCollection()->setPageSize(0);
254
  $this->getCollection()->load();
255
  $this->_afterLoadCollection();
256
  }
257
 
 
258
  * NowShop
259
  *
260
  * NOTICE OF LICENS
261
  *
262
  * This source file is subject to the Open Software License (OSL 3.0)
263
  * that is bundled with this package in the file LICENSE.txt.
264
  * It is also available through the world-wide-web at this URL:
265
  * http://opensource.org/licenses/osl-3.0.php
266
  * If you did not receive a copy of the license and are unable to
267
  * obtain it through the world-wide-web, please send an email
268
  * to support@nowshop.com so we can send you a copy immediately.
269
  *
270
  * @category NowShop
271
  * @package NowShop_Synchronize
272
  * @author Asheesh Singh<asheeshsingh@cedcoss.com>
273
  * @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
274
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
275
  */
276
 
277
  * Block for NowShop feed grid
278
  */
279
 
280
  $this->setUseAjax(true);
281
  $this->setVarNameFilter('productfeed_filter');
282
  {
283
  $storeId = (int) $this->getRequest()->getParam('store', 0);
284
  return Mage::app()->getStore($storeId);
285
  }
286
  protected function _prepareCollection()
287
  {
288
  $store = $this->_getStore();
289
  $collection = Mage::getModel('catalog/product')->getCollection()
290
  ->addAttributeToSelect('sku')
291
  ->addAttributeToSelect('name')
292
  ->addAttributeToSelect('attribute_set_id')
293
  ->addAttributeToSelect('type_id');
294
  if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
295
  $collection->joinField('qty',
296
  'cataloginventory/stock_item',
297
  'qty',
298
  'product_id=entity_id',
299
  '{{table}}.stock_id=1',
300
  'left');
301
  }
302
  if ($store->getId()) {
303
  $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
304
  $collection->addStoreFilter($store);
305
  $collection->joinAttribute(
306
  'name',
307
  'catalog_product/name',
308
  'entity_id',
309
  null,
310
  'inner',
311
  $adminStore
312
  );
313
  $collection->joinAttribute(
314
  'custom_name',
315
  'catalog_product/name',
316
  'entity_id',
317
  null,
318
  'inner',
319
  $store->getId()
320
  );
321
  $collection->joinAttribute(
322
  'status',
323
  'catalog_product/status',
324
  'entity_id',
325
  null,
326
  'inner',
327
  $store->getId()
328
  );
329
  $collection->joinAttribute(
330
  'visibility',
331
  'catalog_product/visibility',
332
  'entity_id',
333
  null,
334
  'inner',
335
  $store->getId()
336
  );
337
  $collection->joinAttribute(
338
  'price',
339
  'catalog_product/price',
340
  'entity_id',
341
  null,
342
  'left',
343
  $store->getId()
344
  );
345
  } else {
346
  $collection->addAttributeToSelect('price');
347
  $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
348
  $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
349
  }
350
  $this->setCollection($collection);
351
  parent::_prepareCollection();
352
  $this->getCollection()->addWebsiteNamesToResult();
353
  return $this;
354
  }
355
  protected function _addColumnFilterToCollection($column)
356
  {
357
  if ($this->getCollection()) {
358
  if ($column->getId() == 'websites') {
359
  $this->getCollection()->joinField('websites',
360
  'catalog/product_website',
361
  'website_id',
362
  'product_id=entity_id',
363
  null,
364
  'left'
365
  }
366
  }
367
  return parent::_addColumnFilterToCollection($column);
368
  }
369
  protected function _prepareColumns()
370
  {
371
  $this->addColumn('entity_id',
372
  array(
373
  'header'=> Mage::helper('catalog')->__('ID'),
374
  'width' => '50px',
375
  'type' => 'number',
376
  'index' => 'entity_id',
377
  ));
378
  $this->addColumn('name',
379
  array(
380
  'header'=> Mage::helper('catalog')->__('Name'),
381
  'index' => 'name',
382
  ));
383
  $store = $this->_getStore();
384
  if ($store->getId()) {
385
  $this->addColumn('custom_name',
386
  array(
387
  'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
388
  'index' => 'custom_name',
389
  ));
390
  }
391
  $this->addColumn('type',
392
  array(
393
  'header'=> Mage::helper('catalog')->__('Type'),
394
  'width' => '60px',
395
  'index' => 'type_id',
396
  'type' => 'options',
397
  'options' => array(
398
  ));
399
  $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
400
  ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
401
  ->load()
402
  ->toOptionHash();
403
  $this->addColumn('set_name',
404
  array(
405
  'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
406
  'width' => '100px',
407
  'index' => 'attribute_set_id',
408
  'type' => 'options',
409
  'options' => $sets,
410
  ));
411
  $this->addColumn('sku',
412
  array(
413
  'header'=> Mage::helper('catalog')->__('SKU'),
414
  'width' => '80px',
415
  'index' => 'sku',
416
  ));
417
  $store = $this->_getStore();
418
  $this->addColumn('price',
419
  array(
420
  'header'=> Mage::helper('catalog')->__('Price'),
421
  'type' => 'price',
422
  'currency_code' => $store->getBaseCurrency()->getCode(),
423
  'index' => 'price',
424
  ));
425
  if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
426
  $this->addColumn('qty',
427
  array(
428
  'header'=> Mage::helper('catalog')->__('Qty'),
429
  'width' => '100px',
430
  'type' => 'number',
431
  'index' => 'qty',
432
  ));
433
  }
434
  $this->addColumn('visibility',
435
  array(
436
  'header'=> Mage::helper('catalog')->__('Visibility'),
437
  'width' => '70px',
438
  'index' => 'visibility',
439
  'type' => 'options',
440
  'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
441
  ));
442
  $this->addColumn('status',
443
  array(
444
  'header'=> Mage::helper('catalog')->__('Status'),
445
  'width' => '70px',
446
  'index' => 'status',
447
  'type' => 'options',
448
  'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
449
  ));
450
  if (!Mage::app()->isSingleStoreMode()) {
451
  $this->addColumn('websites',
452
  array(
453
  'header'=> Mage::helper('catalog')->__('Websites'),
454
  'width' => '100px',
455
  'sortable' => false,
456
  'index' => 'websites',
457
  'type' => 'options',
458
  'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
459
  ));
460
  }
461
  array(
462
  'header'=> Mage::helper('nowshop')->__('Re-listing required?'),
463
  'width' => '70px',
464
  'index' => 'requiredrelisting',
465
  'type' => 'options',
466
  'options' => array(1=>Mage::helper('nowshop')->__('Yes'),-1=>Mage::helper('nowshop')->__('No')),
467
  ));
468
  $this->addColumn('nowshop',
469
  array(
470
  'header'=> Mage::helper('nowshop')->__('On NowShop'),
471
  'width' => '70px',
472
  'index' => 'nowshop',
473
  'type' => 'options',
474
  'options' => Mage::helper('nowshop')->getStatuses(),
475
  ));
476
  return parent::_prepareColumns();
477
  }
478
  protected function _prepareMassaction()
479
  {
480
  $this->setMassactionIdField('entity_id');
481
  $this->getMassactionBlock()->setFormFieldName('product');
482
  $statuses = array(
483
  array_unshift($statuses, array('label'=>'', 'value'=>''));
484
  $this->getMassactionBlock()->addItem('onnowshop', array(
485
  'label'=> Mage::helper('nowshop')->__('On NowShop'),
486
  'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
487
  'additional' => array(
488
  'visibility' => array(
489
  'name' => 'onnowshop',
490
  'type' => 'select',
491
  'class' => 'required-entry',
492
  'label' => Mage::helper('catalog')->__('Status'),
493
  'values' => $statuses
494
  )
495
  )
496
  ));
497
  return $this;
498
  }
499
  public function getGridUrl()
500
  {
501
  return $this->getUrl('*/*/grid', array('_secure'=>true, '_current'=>true));
502
  }
503
  public function getRowUrl($row)
504
  {
505
  return "javascript:void(0)";
506
  }
507
  $this->_prepareGrid();
508
  $this->getCollection()->setPageSize(0);
509
  $this->getCollection()->load();
510
  $this->_afterLoadCollection();
511
  }
512
 
 
1
  * NowShop
2
  *
3
  * NOTICE OF LICENS
4
  *
5
  * This source file is subject to the Open Software License (OSL 3.0)
6
  * that is bundled with this package in the file LICENSE.txt.
7
  * It is also available through the world-wide-web at this URL:
8
  * http://opensource.org/licenses/osl-3.0.php
9
  * If you did not receive a copy of the license and are unable to
10
  * obtain it through the world-wide-web, please send an email
11
  * to support@nowshop.com so we can send you a copy immediately.
12
  *
13
  * @category NowShop
14
  * @package NowShop_Synchronize
15
  * @author Asheesh Singh<asheeshsingh@cedcoss.com>
16
  * @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
17
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
  */
19
 
20
  * Block for NowShop feed grid
21
  */
22
 
23
  $this->setUseAjax(true);
24
  $this->setVarNameFilter('productfeed_filter');
25
  {
26
  $storeId = (int) $this->getRequest()->getParam('store', 0);
27
  return Mage::app()->getStore($storeId);
28
  }
29
  protected function _prepareCollection()
30
  {
31
  $store = $this->_getStore();
32
  $collection = Mage::getModel('catalog/product')->getCollection()
33
  ->addAttributeToSelect('sku')
34
  ->addAttributeToSelect('name')
35
  ->addAttributeToSelect('attribute_set_id')
36
  ->addAttributeToSelect('type_id');
37
  if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
38
  $collection->joinField('qty',
39
  'cataloginventory/stock_item',
40
  'qty',
41
  'product_id=entity_id',
42
  '{{table}}.stock_id=1',
43
  'left');
44
  }
45
  if ($store->getId()) {
46
  $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
47
  $collection->addStoreFilter($store);
48
  $collection->joinAttribute(
49
  'name',
50
  'catalog_product/name',
51
  'entity_id',
52
  null,
53
  'inner',
54
  $adminStore
55
  );
56
  $collection->joinAttribute(
57
  'custom_name',
58
  'catalog_product/name',
59
  'entity_id',
60
  null,
61
  'inner',
62
  $store->getId()
63
  );
64
  $collection->joinAttribute(
65
  'status',
66
  'catalog_product/status',
67
  'entity_id',
68
  null,
69
  'inner',
70
  $store->getId()
71
  );
72
  $collection->joinAttribute(
73
  'visibility',
74
  'catalog_product/visibility',
75
  'entity_id',
76
  null,
77
  'inner',
78
  $store->getId()
79
  );
80
  $collection->joinAttribute(
81
  'price',
82
  'catalog_product/price',
83
  'entity_id',
84
  null,
85
  'left',
86
  $store->getId()
87
  );
88
  }
89
  else {
90
  $collection->addAttributeToSelect('price');
91
  $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
92
  $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
93
  }
94
  $this->setCollection($collection);
95
  parent::_prepareCollection();
96
  $this->getCollection()->addWebsiteNamesToResult();
97
  return $this;
98
  }
99
  protected function _addColumnFilterToCollection($column)
100
  {
101
  if ($this->getCollection()) {
102
  if ($column->getId() == 'websites') {
103
  $this->getCollection()->joinField('websites',
104
  'catalog/product_website',
105
  'website_id',
106
  'product_id=entity_id',
107
  null,
108
  'left'
109
  }
110
  }
111
  return parent::_addColumnFilterToCollection($column);
112
  }
113
  protected function _prepareColumns()
114
  {
115
  $this->addColumn('entity_id',
116
  array(
117
  'header'=> Mage::helper('catalog')->__('ID'),
118
  'width' => '50px',
119
  'type' => 'number',
120
  'index' => 'entity_id',
121
  ));
122
  $this->addColumn('name',
123
  array(
124
  'header'=> Mage::helper('catalog')->__('Name'),
125
  'index' => 'name',
126
  ));
127
  $store = $this->_getStore();
128
  if ($store->getId()) {
129
  $this->addColumn('custom_name',
130
  array(
131
  'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
132
  'index' => 'custom_name',
133
  ));
134
  }
135
  $this->addColumn('type',
136
  array(
137
  'header'=> Mage::helper('catalog')->__('Type'),
138
  'width' => '60px',
139
  'index' => 'type_id',
140
  'type' => 'options',
141
  'options' => array(
142
  ));
143
  $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
144
  ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
145
  ->load()
146
  ->toOptionHash();
147
  $this->addColumn('set_name',
148
  array(
149
  'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
150
  'width' => '100px',
151
  'index' => 'attribute_set_id',
152
  'type' => 'options',
153
  'options' => $sets,
154
  ));
155
  $this->addColumn('sku',
156
  array(
157
  'header'=> Mage::helper('catalog')->__('SKU'),
158
  'width' => '80px',
159
  'index' => 'sku',
160
  ));
161
  $store = $this->_getStore();
162
  $this->addColumn('price',
163
  array(
164
  'header'=> Mage::helper('catalog')->__('Price'),
165
  'type' => 'price',
166
  'currency_code' => $store->getBaseCurrency()->getCode(),
167
  'index' => 'price',
168
  ));
169
  if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
170
  $this->addColumn('qty',
171
  array(
172
  'header'=> Mage::helper('catalog')->__('Qty'),
173
  'width' => '100px',
174
  'type' => 'number',
175
  'index' => 'qty',
176
  ));
177
  }
178
  $this->addColumn('visibility',
179
  array(
180
  'header'=> Mage::helper('catalog')->__('Visibility'),
181
  'width' => '70px',
182
  'index' => 'visibility',
183
  'type' => 'options',
184
  'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
185
  ));
186
  $this->addColumn('status',
187
  array(
188
  'header'=> Mage::helper('catalog')->__('Status'),
189
  'width' => '70px',
190
  'index' => 'status',
191
  'type' => 'options',
192
  'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
193
  ));
194
  if (!Mage::app()->isSingleStoreMode()) {
195
  $this->addColumn('websites',
196
  array(
197
  'header'=> Mage::helper('catalog')->__('Websites'),
198
  'width' => '100px',
199
  'sortable' => false,
200
  'index' => 'websites',
201
  'type' => 'options',
202
  'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
203
  ));
204
  }
205
  array(
206
  'header'=> Mage::helper('nowshop')->__('Re-listing required?'),
207
  'width' => '70px',
208
  'index' => 'requiredrelisting',
209
  'type' => 'options',
210
  'options' => array(1=>Mage::helper('nowshop')->__('Yes'),-1=>Mage::helper('nowshop')->__('No')),
211
  ));
212
  $this->addColumn('nowshop',
213
  array(
214
  'header'=> Mage::helper('nowshop')->__('On NowShop'),
215
  'width' => '70px',
216
  'index' => 'nowshop',
217
  'type' => 'options',
218
  'options' => Mage::helper('nowshop')->getStatuses(),
219
  ));
220
  return parent::_prepareColumns();
221
  }
222
  protected function _prepareMassaction()
223
  {
224
  $this->setMassactionIdField('entity_id');
225
  $this->getMassactionBlock()->setFormFieldName('product');
226
  $statuses = array(
227
  array_unshift($statuses, array('label'=>'', 'value'=>''));
228
  $this->getMassactionBlock()->addItem('onnowshop', array(
229
  'label'=> Mage::helper('nowshop')->__('On NowShop'),
230
  'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
231
  'additional' => array(
232
  'visibility' => array(
233
  'name' => 'onnowshop',
234
  'type' => 'select',
235
  'class' => 'required-entry',
236
  'label' => Mage::helper('catalog')->__('Status'),
237
  'values' => $statuses
238
  )
239
  )
240
  ));
241
  return $this;
242
  }
243
  public function getGridUrl()
244
  {
245
  return $this->getUrl('*/*/grid', array('_secure'=>true, '_current'=>true));
246
  }
247
  public function getRowUrl($row)
248
  {
249
  return "javascript:void(0)";
250
  }
251
  $this->_prepareGrid();
252
  $this->getCollection()->setPageSize(0);
253
  $this->getCollection()->load();
254
  $this->_afterLoadCollection();
255
  }
256
 
257
+ <?php
258
  * NowShop
259
  *
260
  * NOTICE OF LICENS
261
  *
262
  * This source file is subject to the Open Software License (OSL 3.0)
263
  * that is bundled with this package in the file LICENSE.txt.
264
  * It is also available through the world-wide-web at this URL:
265
  * http://opensource.org/licenses/osl-3.0.php
266
  * If you did not receive a copy of the license and are unable to
267
  * obtain it through the world-wide-web, please send an email
268
  * to support@nowshop.com so we can send you a copy immediately.
269
  *
270
  * @category NowShop
271
  * @package NowShop_Synchronize
272
  * @author Asheesh Singh<asheeshsingh@cedcoss.com>
273
  * @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
274
  * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
275
  */
276
 
277
  * Block for NowShop feed grid
278
  */
279
 
280
  $this->setUseAjax(true);
281
  $this->setVarNameFilter('productfeed_filter');
282
  {
283
  $storeId = (int) $this->getRequest()->getParam('store', 0);
284
  return Mage::app()->getStore($storeId);
285
  }
286
  protected function _prepareCollection()
287
  {
288
  $store = $this->_getStore();
289
  $collection = Mage::getModel('catalog/product')->getCollection()
290
  ->addAttributeToSelect('sku')
291
  ->addAttributeToSelect('name')
292
  ->addAttributeToSelect('attribute_set_id')
293
  ->addAttributeToSelect('type_id');
294
  if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
295
  $collection->joinField('qty',
296
  'cataloginventory/stock_item',
297
  'qty',
298
  'product_id=entity_id',
299
  '{{table}}.stock_id=1',
300
  'left');
301
  }
302
  if ($store->getId()) {
303
  $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID;
304
  $collection->addStoreFilter($store);
305
  $collection->joinAttribute(
306
  'name',
307
  'catalog_product/name',
308
  'entity_id',
309
  null,
310
  'inner',
311
  $adminStore
312
  );
313
  $collection->joinAttribute(
314
  'custom_name',
315
  'catalog_product/name',
316
  'entity_id',
317
  null,
318
  'inner',
319
  $store->getId()
320
  );
321
  $collection->joinAttribute(
322
  'status',
323
  'catalog_product/status',
324
  'entity_id',
325
  null,
326
  'inner',
327
  $store->getId()
328
  );
329
  $collection->joinAttribute(
330
  'visibility',
331
  'catalog_product/visibility',
332
  'entity_id',
333
  null,
334
  'inner',
335
  $store->getId()
336
  );
337
  $collection->joinAttribute(
338
  'price',
339
  'catalog_product/price',
340
  'entity_id',
341
  null,
342
  'left',
343
  $store->getId()
344
  );
345
  } else {
346
  $collection->addAttributeToSelect('price');
347
  $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
348
  $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
349
  }
350
  $this->setCollection($collection);
351
  parent::_prepareCollection();
352
  $this->getCollection()->addWebsiteNamesToResult();
353
  return $this;
354
  }
355
  protected function _addColumnFilterToCollection($column)
356
  {
357
  if ($this->getCollection()) {
358
  if ($column->getId() == 'websites') {
359
  $this->getCollection()->joinField('websites',
360
  'catalog/product_website',
361
  'website_id',
362
  'product_id=entity_id',
363
  null,
364
  'left'
365
  }
366
  }
367
  return parent::_addColumnFilterToCollection($column);
368
  }
369
  protected function _prepareColumns()
370
  {
371
  $this->addColumn('entity_id',
372
  array(
373
  'header'=> Mage::helper('catalog')->__('ID'),
374
  'width' => '50px',
375
  'type' => 'number',
376
  'index' => 'entity_id',
377
  ));
378
  $this->addColumn('name',
379
  array(
380
  'header'=> Mage::helper('catalog')->__('Name'),
381
  'index' => 'name',
382
  ));
383
  $store = $this->_getStore();
384
  if ($store->getId()) {
385
  $this->addColumn('custom_name',
386
  array(
387
  'header'=> Mage::helper('catalog')->__('Name in %s', $store->getName()),
388
  'index' => 'custom_name',
389
  ));
390
  }
391
  $this->addColumn('type',
392
  array(
393
  'header'=> Mage::helper('catalog')->__('Type'),
394
  'width' => '60px',
395
  'index' => 'type_id',
396
  'type' => 'options',
397
  'options' => array(
398
  ));
399
  $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
400
  ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
401
  ->load()
402
  ->toOptionHash();
403
  $this->addColumn('set_name',
404
  array(
405
  'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
406
  'width' => '100px',
407
  'index' => 'attribute_set_id',
408
  'type' => 'options',
409
  'options' => $sets,
410
  ));
411
  $this->addColumn('sku',
412
  array(
413
  'header'=> Mage::helper('catalog')->__('SKU'),
414
  'width' => '80px',
415
  'index' => 'sku',
416
  ));
417
  $store = $this->_getStore();
418
  $this->addColumn('price',
419
  array(
420
  'header'=> Mage::helper('catalog')->__('Price'),
421
  'type' => 'price',
422
  'currency_code' => $store->getBaseCurrency()->getCode(),
423
  'index' => 'price',
424
  ));
425
  if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) {
426
  $this->addColumn('qty',
427
  array(
428
  'header'=> Mage::helper('catalog')->__('Qty'),
429
  'width' => '100px',
430
  'type' => 'number',
431
  'index' => 'qty',
432
  ));
433
  }
434
  $this->addColumn('visibility',
435
  array(
436
  'header'=> Mage::helper('catalog')->__('Visibility'),
437
  'width' => '70px',
438
  'index' => 'visibility',
439
  'type' => 'options',
440
  'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
441
  ));
442
  $this->addColumn('status',
443
  array(
444
  'header'=> Mage::helper('catalog')->__('Status'),
445
  'width' => '70px',
446
  'index' => 'status',
447
  'type' => 'options',
448
  'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
449
  ));
450
  if (!Mage::app()->isSingleStoreMode()) {
451
  $this->addColumn('websites',
452
  array(
453
  'header'=> Mage::helper('catalog')->__('Websites'),
454
  'width' => '100px',
455
  'sortable' => false,
456
  'index' => 'websites',
457
  'type' => 'options',
458
  'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
459
  ));
460
  }
461
  array(
462
  'header'=> Mage::helper('nowshop')->__('Re-listing required?'),
463
  'width' => '70px',
464
  'index' => 'requiredrelisting',
465
  'type' => 'options',
466
  'options' => array(1=>Mage::helper('nowshop')->__('Yes'),-1=>Mage::helper('nowshop')->__('No')),
467
  ));
468
  $this->addColumn('nowshop',
469
  array(
470
  'header'=> Mage::helper('nowshop')->__('On NowShop'),
471
  'width' => '70px',
472
  'index' => 'nowshop',
473
  'type' => 'options',
474
  'options' => Mage::helper('nowshop')->getStatuses(),
475
  ));
476
  return parent::_prepareColumns();
477
  }
478
  protected function _prepareMassaction()
479
  {
480
  $this->setMassactionIdField('entity_id');
481
  $this->getMassactionBlock()->setFormFieldName('product');
482
  $statuses = array(
483
  array_unshift($statuses, array('label'=>'', 'value'=>''));
484
  $this->getMassactionBlock()->addItem('onnowshop', array(
485
  'label'=> Mage::helper('nowshop')->__('On NowShop'),
486
  'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
487
  'additional' => array(
488
  'visibility' => array(
489
  'name' => 'onnowshop',
490
  'type' => 'select',
491
  'class' => 'required-entry',
492
  'label' => Mage::helper('catalog')->__('Status'),
493
  'values' => $statuses
494
  )
495
  )
496
  ));
497
  return $this;
498
  }
499
  public function getGridUrl()
500
  {
501
  return $this->getUrl('*/*/grid', array('_secure'=>true, '_current'=>true));
502
  }
503
  public function getRowUrl($row)
504
  {
505
  return "javascript:void(0)";
506
  }
507
  $this->_prepareGrid();
508
  $this->getCollection()->setPageSize(0);
509
  $this->getCollection()->load();
510
  $this->_afterLoadCollection();
511
  }
512
 
app/code/community/NowShop/Synchronize/Helper/Data.php CHANGED
@@ -68,34 +68,34 @@ class NowShop_Synchronize_Helper_Data extends Mage_Core_Helper_Abstract{
68
 
69
  public function uploadViaFtp($file=''){
70
  if(!strlen(Mage::getStoreConfig('nowshop/ftp/host')) || !strlen(Mage::getStoreConfig('nowshop/ftp/username')) || !strlen(Mage::getStoreConfig('nowshop/ftp/password'))){
 
71
  return false;
72
  }
73
- $ftp_server = Mage::getStoreConfig('nowshop/ftp/host');
74
- $ftp_user_name = Mage::getStoreConfig('nowshop/ftp/username');
75
- $ftp_user_pass = Mage::getStoreConfig('nowshop/ftp/password');
76
  $remote_file_name = basename($file);
77
 
78
-
79
- /* set up basic connection */
80
- $conn_id = ftp_connect($ftp_server);
81
-
82
- /* login with username and password */
83
- $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
84
 
85
- /* upload a file */
86
- /* Initiate */
87
- $ret = ftp_nb_put($conn_id, $remote_file_name, $file, FTP_BINARY, ftp_size($remote_file_name));
88
-
89
- while ($ret == FTP_MOREDATA) {
90
- /* Continue uploading... */
91
- $ret = ftp_nb_continue($conn_id);
92
- }
93
- if ($ret != FTP_FINISHED) {
94
- ftp_close($conn_id);
95
- return false;
96
- }else{
97
- ftp_close($conn_id);
98
- return true;
99
  }
100
  }
101
  }
68
 
69
  public function uploadViaFtp($file=''){
70
  if(!strlen(Mage::getStoreConfig('nowshop/ftp/host')) || !strlen(Mage::getStoreConfig('nowshop/ftp/username')) || !strlen(Mage::getStoreConfig('nowshop/ftp/password'))){
71
+ Mage::log('Error: Ftp Credentials Not Found..!!',null,'nowshop_ftp.log');
72
  return false;
73
  }
74
+ $ftp_server = trim(Mage::getStoreConfig('nowshop/ftp/host'));
75
+ $ftp_user_name = trim(Mage::getStoreConfig('nowshop/ftp/username'));
76
+ $ftp_user_pass = trim(Mage::getStoreConfig('nowshop/ftp/password'));
77
  $remote_file_name = basename($file);
78
 
79
+ try {
80
+ /* set up basic connection */
81
+ $ftp = new NowShop_Synchronize_Helper_Ftp("http://$ftp_user_name:$ftp_user_pass@$ftp_server");
82
+
83
+ /* upload a file */
 
84
 
85
+ $ret = $ftp->nbput($remote_file_name, $file, FTP_ASCII, $ftp->size($remote_file_name));
86
+
87
+ while ($ret == NowShop_Synchronize_Helper_Ftp::MOREDATA) {
88
+ // Continue uploading...
89
+ $ret = $ftp->nb_continue();
90
+ }
91
+ if ($ret != NowShop_Synchronize_Helper_Ftp::FINISHED) {
92
+ Mage::log('Error: There was an error uploading the file('.$file.')',null,'nowshop_ftp.log');
93
+ return false;
94
+ }
95
+ return true;
96
+ } catch (FtpException $e) {
97
+ Mage::log('Error: '.$e->getMessage(),null,'nowshop_ftp.log');
98
+ return false;
99
  }
100
  }
101
  }
app/code/community/NowShop/Synchronize/Helper/Ftp.php ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * NowShop
5
+ *
6
+ * NOTICE OF LICENS
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to support@nowshop.com so we can send you a copy immediately.
15
+ *
16
+ * @category NowShop
17
+ * @package NowShop_Synchronize
18
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
19
+ * @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+
23
+ class NowShop_Synchronize_Helper_Ftp extends Mage_Core_Helper_Abstract
24
+ {
25
+ /**#@+ FTP constant alias */
26
+ const ASCII = FTP_ASCII;
27
+ const TEXT = FTP_TEXT;
28
+ const BINARY = FTP_BINARY;
29
+ const IMAGE = FTP_IMAGE;
30
+ const TIMEOUT_SEC = FTP_TIMEOUT_SEC;
31
+ const AUTOSEEK = FTP_AUTOSEEK;
32
+ const AUTORESUME = FTP_AUTORESUME;
33
+ const FAILED = FTP_FAILED;
34
+ const FINISHED = FTP_FINISHED;
35
+ const MOREDATA = FTP_MOREDATA;
36
+ /**#@-*/
37
+
38
+ private static $aliases = array(
39
+ 'sslconnect' => 'ssl_connect',
40
+ 'getoption' => 'get_option',
41
+ 'setoption' => 'set_option',
42
+ 'nbcontinue' => 'nb_continue',
43
+ 'nbfget' => 'nb_fget',
44
+ 'nbfput' => 'nb_fput',
45
+ 'nbget' => 'nb_get',
46
+ 'nbput' => 'nb_put',
47
+ );
48
+
49
+ /** @var resource */
50
+ private $resource;
51
+
52
+ /** @var array */
53
+ private $state;
54
+
55
+ /** @var string */
56
+ private $errorMsg;
57
+
58
+
59
+
60
+ /**
61
+ * @param string URL ftp://...
62
+ */
63
+ public function __construct($url = NULL)
64
+ {
65
+ if (!extension_loaded('ftp')) {
66
+ throw new /*\*/Exception("PHP extension FTP is not loaded.");
67
+ }
68
+ if ($url) {
69
+ $parts = parse_url($url);
70
+ $this->connect($parts['host'], empty($parts['port']) ? NULL : (int) $parts['port']);
71
+ $this->login($parts['user'], $parts['pass']);
72
+ $this->pasv(TRUE);
73
+ if (isset($parts['path'])) {
74
+ $this->chdir($parts['path']);
75
+ }
76
+ }
77
+ }
78
+
79
+
80
+
81
+ /**
82
+ * Magic method (do not call directly).
83
+ * @param string method name
84
+ * @param array arguments
85
+ * @return mixed
86
+ * @throws Exception
87
+ * @throws FtpException
88
+ */
89
+ public function __call($name, $args)
90
+ {
91
+ $name = strtolower($name);
92
+ $silent = strncmp($name, 'try', 3) === 0;
93
+ $func = $silent ? substr($name, 3) : $name;
94
+ $func = 'ftp_' . (isset(self::$aliases[$func]) ? self::$aliases[$func] : $func);
95
+
96
+ if (!function_exists($func)) {
97
+ throw new Exception("Call to undefined method Ftp::$name().");
98
+ }
99
+
100
+ $this->errorMsg = NULL;
101
+ set_error_handler(array($this, '_errorHandler'));
102
+
103
+ if ($func === 'ftp_connect' || $func === 'ftp_ssl_connect') {
104
+ $this->state = array($name => $args);
105
+ $this->resource = call_user_func_array($func, $args);
106
+ $res = NULL;
107
+
108
+ } elseif (!is_resource($this->resource)) {
109
+ restore_error_handler();
110
+ throw new FtpException("Not connected to FTP server. Call connect() or ssl_connect() first.");
111
+
112
+ } else {
113
+ if ($func === 'ftp_login' || $func === 'ftp_pasv') {
114
+ $this->state[$name] = $args;
115
+ }
116
+
117
+ array_unshift($args, $this->resource);
118
+ /* if($func === 'ftp_size') {
119
+ print_r($args);die;
120
+ } */
121
+ $res = call_user_func_array($func, $args);
122
+
123
+ if ($func === 'ftp_chdir' || $func === 'ftp_cdup') {
124
+ $this->state['chdir'] = array(ftp_pwd($this->resource));
125
+ }
126
+ }
127
+
128
+ restore_error_handler();
129
+ if (!$silent && $this->errorMsg !== NULL) {
130
+ if (ini_get('html_errors')) {
131
+ $this->errorMsg = html_entity_decode(strip_tags($this->errorMsg));
132
+ }
133
+
134
+ if (($a = strpos($this->errorMsg, ': ')) !== FALSE) {
135
+ $this->errorMsg = substr($this->errorMsg, $a + 2);
136
+ }
137
+
138
+ throw new FtpException($this->errorMsg);
139
+ }
140
+
141
+ return $res;
142
+ }
143
+
144
+
145
+
146
+ /**
147
+ * Internal error handler. Do not call directly.
148
+ */
149
+ public function _errorHandler($code, $message)
150
+ {
151
+ $this->errorMsg = $message;
152
+ }
153
+
154
+
155
+
156
+ /**
157
+ * Reconnects to FTP server.
158
+ * @return void
159
+ */
160
+ public function reconnect()
161
+ {
162
+ @ftp_close($this->resource); // intentionally @
163
+ foreach ($this->state as $name => $args) {
164
+ call_user_func_array(array($this, $name), $args);
165
+ }
166
+ }
167
+
168
+
169
+
170
+ /**
171
+ * Checks if file or directory exists.
172
+ * @param string
173
+ * @return bool
174
+ */
175
+ public function fileExists($file)
176
+ {
177
+ return is_array($this->nlist($file));
178
+ }
179
+
180
+
181
+
182
+ /**
183
+ * Checks if directory exists.
184
+ * @param string
185
+ * @return bool
186
+ */
187
+ public function isDir($dir)
188
+ {
189
+ $current = $this->pwd();
190
+ try {
191
+ $this->chdir($dir);
192
+ } catch (FtpException $e) {
193
+ }
194
+ $this->chdir($current);
195
+ return empty($e);
196
+ }
197
+
198
+
199
+
200
+ /**
201
+ * Recursive creates directories.
202
+ * @param string
203
+ * @return void
204
+ */
205
+ public function mkDirRecursive($dir)
206
+ {
207
+ $parts = explode('/', $dir);
208
+ $path = '';
209
+ while (!empty($parts)) {
210
+ $path .= array_shift($parts);
211
+ try {
212
+ if ($path !== '') $this->mkdir($path);
213
+ } catch (FtpException $e) {
214
+ if (!$this->isDir($path)) {
215
+ throw new FtpException("Cannot create directory '$path'.");
216
+ }
217
+ }
218
+ $path .= '/';
219
+ }
220
+ }
221
+
222
+
223
+
224
+ /**
225
+ * Recursive deletes path.
226
+ * @param string
227
+ * @return void
228
+ */
229
+ public function deleteRecursive($path)
230
+ {
231
+ if (!$this->tryDelete($path)) {
232
+ foreach ((array) $this->nlist($path) as $file) {
233
+ if ($file !== '.' && $file !== '..') {
234
+ $this->deleteRecursive(strpos($file, '/') === FALSE ? "$path/$file" : $file);
235
+ }
236
+ }
237
+ $this->rmdir($path);
238
+ }
239
+ }
240
+
241
+ }
242
+
243
+
244
+
245
+ class FtpException extends Exception
246
+ {
247
+ }
app/code/community/NowShop/Synchronize/Model/System/Config/Source/Configattr.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * NowShop
5
+ *
6
+ * NOTICE OF LICENS
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to support@nowshop.com so we can send you a copy immediately.
15
+ *
16
+ * @category NowShop
17
+ * @package NowShop_Synchronize
18
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
19
+ * @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+
23
+ class NowShop_Synchronize_Model_System_Config_Source_Configattr
24
+ {
25
+ const BY_DEFAULT_BRAND = 'retailer_store_name';
26
+ /**
27
+ * Options getter
28
+ *
29
+ * @return array
30
+ */
31
+ public function toOptionArray($empty = false)
32
+ {
33
+ $option = array();
34
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')
35
+ ->addVisibleFilter()
36
+ ->addFieldToFilter('is_configurable',array('eq'=>1))
37
+ ->addFieldToFilter('is_global',array('eq'=>1))
38
+ ->addFieldToFilter('frontend_input',array('eq'=>'select'));
39
+
40
+ if(count($attributes)>0){
41
+ foreach ($attributes as $attribute) {
42
+ /* print_r($attribute->getData());die; */
43
+ if(strlen($attribute->getData('frontend_label')))
44
+ $option[] = array('value'=>$attribute->getData('attribute_code'),'label'=>Mage::helper('catalog')->__('%s',$attribute->getData('frontend_label')));
45
+ }
46
+ }
47
+ return $option;
48
+ /* return array(
49
+ array('value' => self::EZ, 'label' => Mage::helper('nowshop')->__('Eurozone')),
50
+ array('value' => self::DK, 'label' => Mage::helper('nowshop')->__('Denmark')),
51
+ array('value' => self::NO, 'label' => Mage::helper('nowshop')->__('Nowrway')),
52
+ array('value' => self::SE, 'label' => Mage::helper('nowshop')->__('Sweden')),
53
+ array('value' => self::GB, 'label' => Mage::helper('nowshop')->__('United Kingdom')),
54
+ ); */
55
+ }
56
+ }
app/code/community/NowShop/Synchronize/controllers/Adminhtml/ProductfeedController.php CHANGED
@@ -1,417 +1,517 @@
1
- <?php
2
-
3
- /**
4
- * NowShop
5
- *
6
- * NOTICE OF LICENS
7
- *
8
- * This source file is subject to the Open Software License (OSL 3.0)
9
- * that is bundled with this package in the file LICENSE.txt.
10
- * It is also available through the world-wide-web at this URL:
11
- * http://opensource.org/licenses/osl-3.0.php
12
- * If you did not receive a copy of the license and are unable to
13
- * obtain it through the world-wide-web, please send an email
14
- * to support@nowshop.com so we can send you a copy immediately.
15
- *
16
- * @category NowShop
17
- * @package NowShop_Synchronize
18
- * @author Asheesh Singh<asheeshsingh@cedcoss.com>
19
- * @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
20
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
- */
22
-
23
- class NowShop_Synchronize_Adminhtml_ProductfeedController extends Mage_Adminhtml_Controller_Action {
24
-
25
- const EXCULDED_ATTRIBUTES = 'name,description,price,short_description,sku,special_price,fixed_special_price,image,small_image,thumbnail,media_gallery,options_container';
26
- protected $_ndebug = null;
27
- /**
28
- * Initialize titles, navigation
29
- * @return NowShop_Synchronize_Adminhtml_ProductFeedController
30
- */
31
- protected function _initAction()
32
- {
33
- $this->_title($this->__('Sell On NowShop'));
34
- $this->loadLayout()
35
- ->_setActiveMenu('nowshop')
36
- ->_addBreadcrumb($this->__('Sell On NowShop'),$this->__('Sell On NowShop'));
37
- return $this;
38
- }
39
-
40
- public function indexAction(){
41
- $this->_initAction()
42
- ->renderLayout();
43
- }
44
-
45
- public function gridAction()
46
- {
47
- $this->loadLayout();
48
- $this->renderLayout();
49
- }
50
-
51
- public function massStatusAction()
52
- {
53
- $this->_ndebug = Mage::getStoreConfig('nowshop/setting/debug');
54
- $productIds = $this->getRequest()->getParam('product');
55
- if(!is_array($productIds)) {
56
- Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
57
- } else {
58
- try {
59
-
60
- $feed = Mage::getModel('nowshop/feed')->getCollection()
61
- ->addFieldToFilter('product_id',array('in'=>$productIds));
62
- $feed->getSelect()->columns(
63
- array('product_ids' => new Zend_Db_Expr(
64
- "IFNULL(GROUP_CONCAT(DISTINCT main_table.product_id SEPARATOR ','), '')"
65
- )));
66
- $feed = $feed->getFirstItem()->load()->getData('product_ids');
67
- $feed = explode(',',$feed);
68
- $relistedIds = array_intersect($productIds,$feed);
69
- /* $productIds = array_diff($productIds,$feed); */
70
-
71
- $allowedCategoryIds = Mage::getModel('nowshop/cfeed')->getCollection()->addFieldToFilter('status',1);
72
- $allowedCategoryIds->getSelect()->columns(
73
- array('category_ids' => new Zend_Db_Expr(
74
- "IFNULL(GROUP_CONCAT(DISTINCT main_table.category_id SEPARATOR ','), '')"
75
- )));
76
- $allowedCategoryIds = $allowedCategoryIds->getFirstItem()->load()->getData('category_ids');
77
- $allowedCategoryIds = explode(',',$allowedCategoryIds);
78
-
79
- if($this->getRequest()->getParam('onnowshop') == 'add' || $this->getRequest()->getParam('onnowshop') == 'adds'){
80
-
81
- $loadedcollection = $this->getLayout()->getBlockSingleton("nowshop/adminhtml_feed_grid")->manualInit();
82
- $store = $loadedcollection->getStore();
83
- $currency = $store->getBaseCurrency()->getCode();
84
- $taxHelper = Mage::helper('tax');
85
- $isvatincluded = (int)$taxHelper->priceIncludesTax();
86
- $baseurl = Mage::getBaseUrl();
87
- $helper = Mage::helper('nowshop');
88
- $brand = '';
89
- $brandAttr = Mage::getStoreConfig('nowshop/productfeed/brand',$store);
90
- if($brandAttr == NowShop_Synchronize_Model_System_Config_Source_Brand::BY_DEFAULT_BRAND){
91
- $brand = Mage::getStoreConfig('general/store_information/name',$store);
92
- }
93
- $minDay = Mage::getStoreConfig('nowshop/productfeed/min',$store->getId());
94
- $maxDay = Mage::getStoreConfig('nowshop/productfeed/max',$store->getId());
95
- if(count($productIds)){
96
- $data = array();
97
- $infoData = array();
98
- $feedData = array();
99
- $existProductCollection = Mage::getModel('nowshop/feed')->getCollection()
100
- ->addFieldToSelect('product_xml_data')
101
- ->addFieldToFilter('product_id',array('nin'=>$relistedIds))
102
- ->addFieldToFilter('status',array('eq'=>1));
103
- foreach($existProductCollection as $existProduct){
104
- $data['product'][] = json_decode($existProduct->getData('product_xml_data'),true);
105
- }
106
-
107
- foreach($productIds as $productId){
108
-
109
- $product = Mage::getModel('catalog/product')->load($productId);
110
- $brandValue = '';
111
- if($product->getStatus()==1){
112
- $stockItem = $product->getStockItem();
113
- $allowedQty = Mage::getStoreConfig('nowshop/productfeed/qty',$store->getId());
114
- if($allowedQty >= 0){
115
- $qty = (int)$allowedQty;
116
- }else{
117
- $qty = (int)$stockItem->getQty();
118
- }
119
- $info = array(
120
- 'sku' => $product->getSku(),
121
- 'type' => $helper->getAttribute('type',$product->getTypeId()),
122
- 'title' => $product->getName(),
123
- 'description' => array('@cdata'=>$helper->getAttribute('description',$product->getDescription())),
124
- 'url' => $baseurl.$product->getUrlPath(),
125
- );
126
- if(strlen($brand)){
127
- $info['brand'] = $brand;
128
- }elseif(strlen($brandAttr) && $brandValue = $product->getData($brandAttr)){
129
- $info['brand'] = $brandValue;
130
- }else{
131
- $info['brand'] = Mage::getStoreConfig('general/store_information/name',$store);
132
- }
133
-
134
- if($product->getWeight())
135
- $info['weight'] = $product->getWeight();
136
-
137
-
138
- $info['shipping'] = array(
139
- '@attributes' => array(
140
- 'min' => (int)$minDay,
141
- 'max' => (int)$maxDay,
142
- )
143
- );
144
-
145
- if($product->getData('ean'))
146
- $info['ean'] = $product->getData('ean');
147
- if($product->getData('isbn10'))
148
- $info['isbn10'] = $product->getData('isbn10');
149
- if($product->getData('isbn13'))
150
- $info['isbn13'] = $product->getData('isbn13');
151
- $info['pricing'] = array(
152
- '@attributes' => array(
153
- 'currency' => $currency,
154
- 'isvatincluded' => $isvatincluded,
155
- ),
156
- 'price' => $product->getFinalPrice(),
157
- 'originalprice' => $product->getPrice(),
158
- );
159
- if($info['type']!='master'){
160
- $info['stock'] = array('quantity'=> $qty * $stockItem->getIsInStock());
161
- $info['stock']['enablestocklimitation'] = $stockItem->getManageStock();
162
- }else{
163
- $info['stock'] = array('quantity'=> '1');
164
- }
165
- if($images = $product->getMediaGalleryImages()){
166
- foreach($images as $image){
167
- $info['images']['image'][] = array('@attributes' =>
168
- array('url' => $image->getUrl())
169
- );
170
- }
171
- }
172
- $parents = array();
173
- $variant = array();
174
- $variants = array();
175
- if($info['type']=='simple'){
176
- $parents = $this->getParent($product->getId());
177
- if(count($parents)>0){
178
- $info['type'] = 'variant';
179
- $parentsku = array();
180
- $parentsku = $this->getParent($product->getId(),'sku');
181
- $info['parentsku'] = $parentsku['sku'];
182
- $variants = $this->getOptions($product, $parents);
183
- }
184
- }elseif($info['type']=='master'){
185
- $variants = $this->getOptions($product);
186
- }
187
- if(count($variants)>0){
188
- foreach($variants as $name=>$value){
189
- if($value!=''){
190
- $variant[] = array('@attributes' => array(
191
- 'name' => $name,
192
- ),
193
- '@value' => $value,
194
- );
195
- }else{
196
- $variant[] = array('@attributes' => array(
197
- 'name' => $name,
198
- ),
199
- );
200
- }
201
- }
202
- $info['variants']['variant'] = $variant;
203
- }
204
- $attributes = $this->attributes($product->getAttributeSetId());
205
-
206
- foreach($attributes as $attribute){
207
- if(!in_array($attribute->getData('attribute_code'),$EXCULDED_ATTRIBUTES) && ($value = $product->getData($attribute->getData('attribute_code'))) && $attribute->getData('frontend_label')){
208
- $info['attributes']['attribute'][] = array('@attributes' => array(
209
- 'name' => $attribute->getData('frontend_label'),
210
- ),
211
- '@value'=> $helper->getAttribute('description',$value),
212
- );
213
- }
214
- }
215
- if($categoryIds = $product->getCategoryIds()){
216
- foreach($categoryIds as $id){
217
- if(in_array($id,$allowedCategoryIds)){
218
- $info['categories']['category'][] = array('@attributes' => array(
219
- 'id' => $id,
220
- ),
221
- );
222
- }
223
- }
224
- }
225
- if(!in_array($productId,$relistedIds)){
226
- $feedData[] = array('product_id'=>$productId,'status'=>1, 'updated_at'=>date('Y-m-d H:i:s',time()), 'product_xml_data'=>json_encode($info));
227
- } else {
228
- $infoData[$product->getId()] = json_encode($info);
229
- }
230
-
231
- $data['product'][] = $info;
232
- }else{
233
- $relistedIds = array_values(array_diff($relistedIds,array($product->getId())));
234
- $productIds = array_values(array_diff($productIds,array($product->getId())));
235
- }
236
- }
237
-
238
- $xml = NowShop_Synchronize_Helper_Arraytoxml::createXML('products', $data);
239
-
240
- $arraytoxml = Mage::helper('nowshop/arraytoxml');
241
- $schema = $arraytoxml->getSchema();
242
- if($xml->schemaValidate($schema)){
243
- $diff = 0;
244
- $fileName = $arraytoxml->formatedFileName('product',$diff);
245
- if($xml->save($fileName) && $this->setListed($fileName,$feedData) && $this->setReListed($relistedIds,$infoData)){
246
- if($this->getRequest()->getParam('onnowshop') == 'adds'){
247
- echo $this->__('Total of %d product(s) were successfully queued for listing on NowShop.', count($productIds)).'<br/>';
248
- echo $this->__("It will take atmost one day to list.");
249
- echo '<a href="'.Mage::helper('adminhtml')->getUrl('*/*/index',array('_secure'=>true)).'">Return to Admin</a><br/>';
250
- echo '<iframe src="'.Mage::getBaseUrl('media',array('_secure'=>true)).'nowshop/productfeed/'.basename($fileName).'"></iframe>';
251
- }else{
252
- $this->_getSession()->addSuccess(
253
- $this->__('Total of %d product(s) were successfully queued for listing on NowShop.', count($productIds))
254
- );
255
- $this->_getSession()->addSuccess(
256
- $this->__("It will take atmost one day to list.").'To See Feed Click <a target="_blank" href="'.Mage::getBaseUrl('media',array('_secure'=>true)).'nowshop/productfeed/'.basename($fileName).'">Here</a>'
257
- );
258
- }
259
- }else{
260
- $this->_getSession()->addError(
261
- $this->__('Total of %d product(s) were failed to queued.Please try again later', count($productIds))
262
- );
263
- }
264
- }else{
265
- $this->_getSession()->addError(
266
- $this->__('Total of %d product(s) were failed to queued.', count($productIds))
267
- );
268
- $this->_getSession()->addError(
269
- $this->__('The product feed content must according to <a target="_blank" href="https://nowshop.com/retailer/setup/products">NowShop Product Feed specification</a>')
270
- );
271
- $this->_getSession()->addError(
272
- $this->__('An XML file you export for NowShop must be valid against this <a href="https://nowshop.com/product_feed.xsd">XML Schema</a>')
273
- );
274
-
275
- }
276
- }else{
277
- Mage::getSingleton('adminhtml/session')->addError($this->__('Selected item(s) are already in feed.Please try different products.'));
278
- }
279
- }elseif($this->getRequest()->getParam('onnowshop') == 'remove'){
280
- /* foreach ($productIds as $id) {
281
- $product = Mage::getSingleton('nowshop/feed')
282
- ->loadByProductId($id)
283
- ->save();
284
-
285
- } */
286
- $this->_getSession()->addSuccess(
287
- $this->__('Total of %d product(s) were successfully removed form listing queue.', count($productIds))
288
- );
289
- }else{
290
- $this->_getSession()->addError(
291
- $this->__('No action specified.')
292
- );
293
- }
294
- } catch (Exception $e) {
295
- if($this->_ndebug){
296
- $this->_getSession()->addError($e->getMessage());
297
- }else{
298
- $this->_getSession()->addError('Error in processing.');
299
- }
300
- }
301
- }
302
- if($this->getRequest()->getParam('onnowshop') != 'adds'){
303
- $this->_redirect('*/*/index',array('_secure'=>true));
304
- }
305
- }
306
-
307
- /**
308
- * ACL check
309
- * @return bool
310
- */
311
- protected function _isAllowed()
312
- {
313
- switch ($this->getRequest()->getActionName()) {
314
- case 'index':
315
- case 'grid':
316
- return Mage::getSingleton('admin/session')->isAllowed('nowshop/productfeed/view');
317
- break;
318
- case 'massStatus':
319
- return Mage::getSingleton('admin/session')->isAllowed('nowshop/productfeed/list');
320
- break;
321
- default:
322
- return Mage::getSingleton('admin/session')->isAllowed('nowshop/productfeed');
323
- break;
324
- }
325
- }
326
-
327
- protected function getParent($productId = 0,$return = 'ids'){
328
- $parentIds = array();
329
- /* Check configurable */
330
- $parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($productId);
331
-
332
- /* Check bundle */
333
- /* if(count($parentIds)==0){
334
- $parentIds = Mage::getModel('bundle/product_type')->getParentIdsByChild($productId);
335
- } */
336
-
337
- /* Check grouped */
338
- /* if(count($parentIds)==0){
339
- $parentIds = Mage::getResourceSingleton('catalog/product_type_grouped')->getParentIdsByChild($productId);
340
- } */
341
- if($return == 'sku'){
342
- $collection = Mage::getModel('catalog/product')->getCollection()
343
- ->addAttributeToSelect('sku')
344
- ->addAttributeToFilter('entity_id',$parentIds[0]);
345
- $parentIds = $collection->getFirstItem()->getData();
346
- }
347
- return $parentIds;
348
- }
349
-
350
- protected function getOptions($product, $parentIds = array()){
351
- $attributeValues = array();
352
- if($product->getTypeId()=='simple'){
353
- $productType = '';
354
- $productId = 0;
355
- $parent = array();
356
- foreach($parentIds as $id){
357
- $parentProduct = Mage::getModel('catalog/product')->load($id);
358
- if(1 || $parentProduct->isSaleable()){
359
- $productType = $parentProduct->getTypeId();
360
- $productId = $parentProduct->getId();
361
- $parent = $parentProduct;
362
- break;
363
- }
364
- }
365
- }elseif($product->getTypeId()=='configurable'){
366
- $productType = 'configurable';
367
- $productId = $product->getId();
368
- $parent = $product;
369
- }
370
- if($productType!=''){
371
- switch($productType){
372
- case 'configurable' : foreach ($parent->getTypeInstance()->getConfigurableAttributes() as $attribute){
373
- if(count($parentIds)>0){
374
- $attributeValues[$attribute->getProductAttribute()->getAttributeCode()] = $product->getAttributeText($attribute->getProductAttribute()->getAttributeCode());
375
- }else{
376
- $attributeValues[$attribute->getProductAttribute()->getAttributeCode()] = '';
377
- }
378
- }
379
- break;
380
- }
381
- }
382
- return $attributeValues;
383
- }
384
-
385
- protected function setListed($fileName,$feedData = array()){
386
- if(Mage::helper('nowshop')->uploadViaFtp($fileName)){
387
- $coreResource = Mage::getSingleton('core/resource');
388
- $feedTable = $coreResource->getTableName('nowshop/feed');
389
- $conn = $coreResource->getConnection('write');
390
- if($conn->insertMultiple($feedTable, $feedData))
391
- return true;
392
- }
393
- return false;
394
- }
395
-
396
- protected function setReListed($feedData = array(), $infoData = array()){
397
- if(count($feedData)>0 && count($infoData)>0){
398
- foreach($feedData as $productId){
399
- Mage::getModel('nowshop/feed')->loadByProductId($productId)
400
- ->setData('product_xml_data',$infoData[$productId])
401
- ->setUpdatedAt(date('Y-m-d H:i:s'))
402
- ->save();
403
- }
404
- return true;
405
- }
406
- return false;
407
- }
408
-
409
- protected function attributes($setId) {
410
- $attributeCollection = Mage::getResourceModel('eav/entity_attribute_collection');
411
- $attributeCollection
412
- ->setAttributeSetFilter($setId)
413
- ->addSetInfo()
414
- ->getData();
415
- return $attributeCollection;
416
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
417
  }
1
+ <?php
2
+
3
+ /**
4
+ * NowShop
5
+ *
6
+ * NOTICE OF LICENS
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to support@nowshop.com so we can send you a copy immediately.
15
+ *
16
+ * @category NowShop
17
+ * @package NowShop_Synchronize
18
+ * @author Asheesh Singh<asheeshsingh@cedcoss.com>
19
+ * @copyright Copyright NowShop 2012 - 2014 (http://nowshop.com/)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+
23
+ class NowShop_Synchronize_Adminhtml_ProductfeedController extends Mage_Adminhtml_Controller_Action {
24
+
25
+ const EXCULDED_ATTRIBUTES = 'name,description,price,short_description,sku,special_price,fixed_special_price,image,small_image,thumbnail,media_gallery,options_container';
26
+ protected $_ndebug = null;
27
+ protected $_storeId = null;
28
+ protected $_colors = null;
29
+ protected $_sizes = null;
30
+
31
+ /**
32
+ * get allowed color attributes
33
+ */
34
+ public function getColors() {
35
+ if(empty($this->_colors))
36
+ $this->_colors = explode(',',Mage::getStoreConfig('nowshop/productfeed/color',$this->_storeId));
37
+ return $this->_colors;
38
+ }
39
+
40
+ /**
41
+ * get allowed size attributes
42
+ */
43
+ public function getSizes() {
44
+ if(empty($this->_sizes))
45
+ $this->_sizes = explode(',', Mage::getStoreConfig('nowshop/productfeed/size',$this->_storeId));
46
+ return $this->_sizes;
47
+ }
48
+
49
+ /**
50
+ * Initialize titles, navigation
51
+ * @return NowShop_Synchronize_Adminhtml_ProductFeedController
52
+ */
53
+ protected function _initAction()
54
+ {
55
+ $this->_title($this->__('Sell On NowShop'));
56
+ $this->loadLayout()
57
+ ->_setActiveMenu('nowshop')
58
+ ->_addBreadcrumb($this->__('Sell On NowShop'),$this->__('Sell On NowShop'));
59
+ return $this;
60
+ }
61
+
62
+ public function indexAction(){
63
+ $this->_initAction()
64
+ ->renderLayout();
65
+ }
66
+
67
+ public function gridAction()
68
+ {
69
+ $this->loadLayout();
70
+ $this->renderLayout();
71
+ }
72
+
73
+ public function massStatusAction()
74
+ {
75
+ $this->_ndebug = Mage::getStoreConfig('nowshop/setting/debug');
76
+ $productIds = $this->getRequest()->getParam('product');
77
+ if(!is_array($productIds)) {
78
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
79
+ } else {
80
+ try {
81
+
82
+ $feed = Mage::getModel('nowshop/feed')->getCollection()
83
+ ->addFieldToFilter('product_id',array('in'=>$productIds));
84
+ $feed->getSelect()->columns(
85
+ array('product_ids' => new Zend_Db_Expr(
86
+ "IFNULL(GROUP_CONCAT(DISTINCT main_table.product_id SEPARATOR ','), '')"
87
+ )));
88
+ $feed = $feed->getFirstItem()->load()->getData('product_ids');
89
+ $feed = explode(',',$feed);
90
+
91
+ $relistedIds = array_intersect($productIds,$feed);
92
+ /* print_r($relistedIds);die; */
93
+ /* $productIds = array_diff($productIds,$feed); */
94
+
95
+ $allowedCategoryIds = Mage::getModel('nowshop/cfeed')->getCollection()->addFieldToFilter('status',1);
96
+ $allowedCategoryIds->getSelect()->columns(
97
+ array('category_ids' => new Zend_Db_Expr(
98
+ "IFNULL(GROUP_CONCAT(DISTINCT main_table.category_id SEPARATOR ','), '')"
99
+ )));
100
+ $allowedCategoryIds = $allowedCategoryIds->getFirstItem()->load()->getData('category_ids');
101
+ $allowedCategoryIds = explode(',',$allowedCategoryIds);
102
+
103
+ if($this->getRequest()->getParam('onnowshop') == 'add' || $this->getRequest()->getParam('onnowshop') == 'adds'){
104
+
105
+ $loadedcollection = $this->getLayout()->getBlockSingleton("nowshop/adminhtml_feed_grid")->manualInit();
106
+ $store = $loadedcollection->getStore();
107
+ $this->_storeId = $store->getId();
108
+ $currency = $store->getBaseCurrency()->getCode();
109
+ $taxHelper = Mage::helper('tax');
110
+ $isvatincluded = (int)$taxHelper->priceIncludesTax();
111
+ $baseurl = Mage::getBaseUrl();
112
+ $helper = Mage::helper('nowshop');
113
+ $brand = '';
114
+ $brandAttr = Mage::getStoreConfig('nowshop/productfeed/brand',$store);
115
+ if($brandAttr == NowShop_Synchronize_Model_System_Config_Source_Brand::BY_DEFAULT_BRAND){
116
+ $brand = Mage::getStoreConfig('general/store_information/name',$store);
117
+ }
118
+ $minDay = Mage::getStoreConfig('nowshop/productfeed/min',$store->getId());
119
+ $maxDay = Mage::getStoreConfig('nowshop/productfeed/max',$store->getId());
120
+ if(count($productIds)){
121
+ $data = array();
122
+ $infoData = array();
123
+ $feedData = array();
124
+ $sortOrder = array();
125
+ $existProductCollection = Mage::getModel('nowshop/feed')->getCollection()
126
+ ->addFieldToSelect('product_xml_data')
127
+ ->addFieldToFilter('product_id',array('nin'=>$relistedIds))
128
+ ->addFieldToFilter('status',array('eq'=>1));
129
+ foreach($existProductCollection as $existProduct){
130
+ $temData = array();
131
+ $tempData = json_decode($existProduct->getData('product_xml_data'),true);
132
+ if($tempData && is_array($tempData) && count($tempData) > 0 && isset($tempData['sku']) && $tempData['sku']) {
133
+ /* $data['product'][] = $tempData; */
134
+ if(isset($tempData['parentsku'])) {
135
+ if(!isset($sortOrder[$tempData['parentsku']][0]))
136
+ $sortOrder[$tempData['parentsku']][0] = array();
137
+ $sortOrder[$tempData['parentsku']][] = $tempData;
138
+ } elseif(!isset($tempData['parentsku']) && $tempData['type']=='master') {
139
+ $sortOrder[$tempData['sku']][0] = $tempData;
140
+ } elseif($tempData && is_array($tempData) && count($tempData) > 0 && isset($tempData['sku']) && $tempData['sku']) {
141
+ $data['product'][] = $tempData;
142
+ }
143
+ }
144
+ }
145
+
146
+ foreach($productIds as $productId){
147
+
148
+ $product = Mage::getModel('catalog/product')->load($productId);
149
+ $brandValue = '';
150
+ if($product->getStatus()==1) {
151
+ $stockItem = $product->getStockItem();
152
+ $allowedQty = Mage::getStoreConfig('nowshop/productfeed/qty',$store->getId());
153
+ if($allowedQty >= 0){
154
+ $qty = (int)$allowedQty;
155
+ }else{
156
+ $qty = (int)$stockItem->getQty();
157
+ }
158
+ $info = array(
159
+ 'sku' => $product->getSku(),
160
+ 'type' => $helper->getAttribute('type',$product->getTypeId()),
161
+ 'title' => $product->getName(),
162
+ 'description' => array('@cdata'=>$helper->getAttribute('description',$product->getDescription())),
163
+ 'url' => $baseurl.$product->getUrlPath(),
164
+ );
165
+ if(strlen($brand)){
166
+ $info['brand'] = $brand;
167
+ }elseif(strlen($brandAttr) && $brandValue = $product->getData($brandAttr)){
168
+ $info['brand'] = $brandValue;
169
+ }else{
170
+ $info['brand'] = Mage::getStoreConfig('general/store_information/name',$store);
171
+ }
172
+
173
+ if($product->getWeight())
174
+ $info['weight'] = $product->getWeight();
175
+
176
+
177
+ $info['shipping'] = array(
178
+ '@attributes' => array(
179
+ 'min' => (int)$minDay,
180
+ 'max' => (int)$maxDay,
181
+ )
182
+ );
183
+
184
+ if($product->getData('ean'))
185
+ $info['ean'] = $product->getData('ean');
186
+ if($product->getData('isbn10'))
187
+ $info['isbn10'] = $product->getData('isbn10');
188
+ if($product->getData('isbn13'))
189
+ $info['isbn13'] = $product->getData('isbn13');
190
+ $info['pricing'] = array(
191
+ '@attributes' => array(
192
+ 'currency' => $currency,
193
+ 'isvatincluded' => $isvatincluded,
194
+ ),
195
+ 'price' => $product->getFinalPrice(),
196
+ 'originalprice' => $product->getPrice(),
197
+ );
198
+ if($info['type']!='master'){
199
+ $info['stock'] = array('quantity'=> $qty * $stockItem->getIsInStock());
200
+ $info['stock']['enablestocklimitation'] = $stockItem->getManageStock();
201
+ }else{
202
+ $info['stock'] = array('quantity'=> '1');
203
+ }
204
+ if($images = $product->getMediaGalleryImages()){
205
+ foreach($images as $image){
206
+ $info['images']['image'][] = array('@attributes' =>
207
+ array('url' => $image->getUrl())
208
+ );
209
+ }
210
+ }
211
+ $parents = array();
212
+ $variant = array();
213
+ $variants = array();
214
+ if($info['type']=='simple'){
215
+ $parents = $this->getParent($product->getId());
216
+ if(count($parents)>0){
217
+ $info['type'] = 'variant';
218
+ $parentsku = array();
219
+ $parentsku = $this->getParent($product->getId(),'sku');
220
+ $info['parentsku'] = $parentsku['sku'];
221
+ $variants = $this->getOptions($product, $parents);
222
+ }
223
+ }elseif($info['type']=='master'){
224
+ $variants = $this->getOptions($product);
225
+ }
226
+ if(count($variants)>0){
227
+
228
+ foreach($variants as $name=>$value){
229
+ if($value!=''){
230
+ $variant[] = array('@attributes' => array(
231
+ 'name' => $name,
232
+ ),
233
+ '@value' => $value,
234
+ );
235
+ }else{
236
+ $variant[] = array('@attributes' => array(
237
+ 'name' => $name,
238
+ ),
239
+ );
240
+ }
241
+ }
242
+ $info['variants']['variant'] = $variant;
243
+ }
244
+ $attributes = $this->attributes($product->getAttributeSetId());
245
+ $EXCULDED_ATTRIBUTES = explode(',',self::EXCULDED_ATTRIBUTES);
246
+ foreach($attributes as $attribute){
247
+ if(!in_array($attribute->getData('attribute_code'),$EXCULDED_ATTRIBUTES) && ($value = $product->getData($attribute->getData('attribute_code'))) && $attribute->getData('frontend_label')){
248
+ if($attribute->usesSource()) {
249
+ $value = $product->getAttributeText($attribute->getData('attribute_code'));
250
+ }
251
+ $info['attributes']['attribute'][] = array('@attributes' => array(
252
+ 'name' => $attribute->getData('frontend_label'),
253
+ ),
254
+ '@value'=> $helper->getAttribute('description',$value),
255
+ );
256
+ }
257
+ }
258
+ if($categoryIds = $product->getCategoryIds()) {
259
+ foreach($categoryIds as $id){
260
+ if(in_array($id,$allowedCategoryIds)){
261
+ $info['categories']['category'][] = array('@attributes' => array(
262
+ 'id' => $id,
263
+ ),
264
+ );
265
+ }
266
+ }
267
+ }
268
+ if(!in_array($productId,$relistedIds)){
269
+ $feedData[] = array('product_id'=>$productId,'status'=>1, 'updated_at'=>date('Y-m-d H:i:s',time()), 'product_xml_data'=>json_encode($info));
270
+ } else {
271
+ $infoData[$product->getId()] = json_encode($info);
272
+ }
273
+
274
+ if(isset($info['parentsku'])) {
275
+ if(!isset($sortOrder[$info['parentsku']][0]))
276
+ $sortOrder[$info['parentsku']][0] = array();
277
+ $sortOrder[$info['parentsku']][] = $info;
278
+ } elseif(!isset($info['parentsku']) && $info['type']=='master') {
279
+ $sortOrder[$info['sku']][0] = $info;
280
+ } elseif($info && is_array($info) && count($info) > 0 && isset($info['sku']) && $info['sku']) {
281
+ $data['product'][] = $info;
282
+ }
283
+ } else {
284
+ $relistedIds = array_values(array_diff($relistedIds,array($product->getId())));
285
+ $productIds = array_values(array_diff($productIds,array($product->getId())));
286
+ }
287
+ }
288
+ if(count($sortOrder)) {
289
+ foreach($sortOrder as $parentSku=>$sortedValue){
290
+ if(is_array($sortedValue) && count($sortedValue) >1) {
291
+ foreach($sortedValue as $key=>$value) {
292
+ if(is_array($value) && count($value) > 0) {
293
+ $data['product'][] = $value;
294
+ } else {
295
+ break;
296
+ }
297
+ }
298
+ }
299
+ }
300
+ }
301
+
302
+ /* print_r($data['product']);die; */
303
+ $xml = NowShop_Synchronize_Helper_Arraytoxml::createXML('products', $data);
304
+ /* header('Content-type: application/xml'); */
305
+ /* echo $xml->saveXML();die; */
306
+ $arraytoxml = Mage::helper('nowshop/arraytoxml');
307
+ $schema = $arraytoxml->getSchema();
308
+ if($xml->schemaValidate($schema)){
309
+ $diff = 0;
310
+ $fileName = $arraytoxml->formatedFileName('product',$diff);
311
+ if($xml->save($fileName) && $this->setListed($fileName,$feedData) && $this->setReListed($relistedIds,$infoData)){
312
+ if($this->getRequest()->getParam('onnowshop') == 'adds'){
313
+ echo $this->__('Total of %d product(s) were successfully queued for listing on NowShop.', count($productIds)).'<br/>';
314
+ echo $this->__("It will take atmost one day to list.");
315
+ echo '<a href="'.Mage::helper('adminhtml')->getUrl('*/*/index',array('_secure'=>true)).'">Return to Admin</a><br/>';
316
+ echo '<iframe src="'.Mage::getBaseUrl('media',array('_secure'=>true)).'nowshop/productfeed/'.basename($fileName).'"></iframe>';
317
+ }else{
318
+ $this->_getSession()->addSuccess(
319
+ $this->__('Total of %d product(s) were successfully queued for listing on NowShop.', count($productIds))
320
+ );
321
+ $this->_getSession()->addSuccess(
322
+ $this->__("It will take atmost one day to list.").'To See Feed Click <a target="_blank" href="'.Mage::getBaseUrl('media',array('_secure'=>true)).'nowshop/productfeed/'.basename($fileName).'">Here</a>'
323
+ );
324
+ }
325
+ }else{
326
+ $this->_getSession()->addError(
327
+ $this->__('Total of %d product(s) were failed to queued.Please try again later', count($productIds))
328
+ );
329
+ }
330
+ }else{
331
+ $this->_getSession()->addError(
332
+ $this->__('Total of %d product(s) were failed to queued.', count($productIds))
333
+ );
334
+ $this->_getSession()->addError(
335
+ $this->__('The product feed content must according to <a target="_blank" href="https://nowshop.com/retailer/setup/products">NowShop Product Feed specification</a>')
336
+ );
337
+ $this->_getSession()->addError(
338
+ $this->__('An XML file you export for NowShop must be valid against this <a href="https://nowshop.com/product_feed.xsd">XML Schema</a>')
339
+ );
340
+
341
+ }
342
+ }else{
343
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Selected item(s) are already in feed.Please try different products.'));
344
+ }
345
+ } elseif($this->getRequest()->getParam('onnowshop') == 'remove') {
346
+ /* foreach ($productIds as $id) {
347
+ $product = Mage::getSingleton('nowshop/feed')
348
+ ->loadByProductId($id)
349
+ ->save();
350
+
351
+ } */
352
+ $this->_getSession()->addSuccess(
353
+ $this->__('Total of %d product(s) were successfully removed form listing queue.', count($productIds))
354
+ );
355
+ } else {
356
+ $this->_getSession()->addError(
357
+ $this->__('No action specified.')
358
+ );
359
+ }
360
+ } catch (Exception $e) {
361
+ if($this->_ndebug){
362
+ $this->_getSession()->addError($e->getMessage());
363
+ }else{
364
+ $this->_getSession()->addError('Error in processing.');
365
+ }
366
+ }
367
+ }
368
+ if($this->getRequest()->getParam('onnowshop') != 'adds'){
369
+ $this->_redirect('*/*/index',array('_secure'=>true));
370
+ }
371
+ }
372
+
373
+ /**
374
+ * ACL check
375
+ * @return bool
376
+ */
377
+ protected function _isAllowed()
378
+ {
379
+ switch ($this->getRequest()->getActionName()) {
380
+ case 'index':
381
+ case 'grid':
382
+ return Mage::getSingleton('admin/session')->isAllowed('nowshop/productfeed/view');
383
+ break;
384
+ case 'massStatus':
385
+ return Mage::getSingleton('admin/session')->isAllowed('nowshop/productfeed/list');
386
+ break;
387
+ default:
388
+ return Mage::getSingleton('admin/session')->isAllowed('nowshop/productfeed');
389
+ break;
390
+ }
391
+ }
392
+
393
+ protected function getParent($productId = 0,$return = 'ids'){
394
+ $parentIds = array();
395
+ /* Check configurable */
396
+ $parentIds = Mage::getResourceSingleton('catalog/product_type_configurable')->getParentIdsByChild($productId);
397
+
398
+ /* Check bundle */
399
+ /* if(count($parentIds)==0){
400
+ $parentIds = Mage::getModel('bundle/product_type')->getParentIdsByChild($productId);
401
+ } */
402
+
403
+ /* Check grouped */
404
+ /* if(count($parentIds)==0){
405
+ $parentIds = Mage::getResourceSingleton('catalog/product_type_grouped')->getParentIdsByChild($productId);
406
+ } */
407
+ if($return == 'sku'){
408
+ $collection = Mage::getModel('catalog/product')->getCollection()
409
+ ->addAttributeToSelect('sku')
410
+ ->addAttributeToFilter('entity_id',$parentIds[0]);
411
+ $parentIds = $collection->getFirstItem()->getData();
412
+ }
413
+ return $parentIds;
414
+ }
415
+
416
+ protected function getOptions($product, $parentIds = array()){
417
+ $attributeValues = array();
418
+ $noColorAttr = true;
419
+ $noSizeAttr = true;
420
+ if($product->getTypeId()=='simple'){
421
+ $productType = '';
422
+ $productId = 0;
423
+ $parent = array();
424
+ foreach($parentIds as $id){
425
+ $parentProduct = Mage::getModel('catalog/product')->load($id);
426
+ if(1 || $parentProduct->isSaleable()){
427
+ $productType = $parentProduct->getTypeId();
428
+ $productId = $parentProduct->getId();
429
+ $parent = $parentProduct;
430
+ break;
431
+ }
432
+ }
433
+ }elseif($product->getTypeId()=='configurable'){
434
+ $productType = 'configurable';
435
+ $productId = $product->getId();
436
+ $parent = $product;
437
+ }
438
+ /* print_r($this->getColors());
439
+ echo "<hr>";
440
+ print_r($this->getSizes());
441
+ die; */
442
+ if($productType!=''){
443
+ switch($productType){
444
+ case 'configurable' : foreach ($parent->getTypeInstance()->getConfigurableAttributes() as $attribute){
445
+ $attrCode = $attribute->getProductAttribute()->getAttributeCode();
446
+ if(in_array($attribute->getProductAttribute()->getAttributeCode(),$this->getColors())) {
447
+ $attrCode ='Color';
448
+ $noColorAttr = false;
449
+ } elseif(in_array($attribute->getProductAttribute()->getAttributeCode(),$this->getSizes())) {
450
+ $attrCode ='Size';
451
+ $noSizeAttr = false;
452
+ }
453
+
454
+ if(count($parentIds)>0) {
455
+ $attributeValues[$attrCode] = $product->getAttributeText($attribute->getProductAttribute()->getAttributeCode());
456
+ } else {
457
+ $attributeValues[$attrCode] = '';
458
+ }
459
+ }
460
+ break;
461
+ }
462
+ }
463
+ if ($noColorAttr) {
464
+ if(count($parentIds)>0){
465
+ $attributeValues['Color'] = 'One Color';
466
+ } else {
467
+ $attributeValues['Color'] = '';
468
+ }
469
+ }
470
+ if ($noSizeAttr) {
471
+ if(count($parentIds)>0){
472
+ $attributeValues['Size'] = 'One Size';
473
+ } else {
474
+ $attributeValues['Size'] = '';
475
+ }
476
+ }
477
+ return $attributeValues;
478
+ }
479
+
480
+ protected function setListed($fileName,$feedData = array()) {
481
+ if(Mage::helper('nowshop')->uploadViaFtp($fileName)) {
482
+ $coreResource = Mage::getSingleton('core/resource');
483
+ $feedTable = $coreResource->getTableName('nowshop/feed');
484
+ $conn = $coreResource->getConnection('write');
485
+ if($conn->insertMultiple($feedTable, $feedData))
486
+ return true;
487
+ }
488
+ return false;
489
+ }
490
+
491
+ protected function setReListed($feedData = array(), $infoData = array()){
492
+ if(count($feedData)>0 && count($infoData)>0){
493
+ try {
494
+ foreach($feedData as $productId){
495
+
496
+ Mage::getModel('nowshop/feed')->loadByProductId($productId)
497
+ ->setData('product_xml_data',$infoData[$productId])
498
+ ->setUpdatedAt(date('Y-m-d H:i:s'))
499
+ ->save();
500
+ }
501
+ return true;
502
+ } catch (Exception $e) {
503
+ return false;
504
+ }
505
+ }
506
+ return true;
507
+ }
508
+
509
+ protected function attributes($setId) {
510
+ $attributeCollection = Mage::getResourceModel('eav/entity_attribute_collection');
511
+ $attributeCollection
512
+ ->setAttributeSetFilter($setId)
513
+ ->addSetInfo()
514
+ ->getData();
515
+ return $attributeCollection;
516
+ }
517
  }
app/code/community/NowShop/Synchronize/etc/system.xml CHANGED
@@ -135,11 +135,33 @@
135
  <show_in_website>0</show_in_website>
136
  <show_in_store>1</show_in_store>
137
  </allowed_brand>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  <min translate="label comment" module="nowshop">
139
  <label>Minimum Shipping day(s)</label>
140
  <frontend_type>text</frontend_type>
141
  <config_path>nowshop/productfeed/min</config_path>
142
- <sort_order>3</sort_order>
143
  <comment>Minimum number of days before the product is shipped.0 indicates same day shipping. </comment>
144
  <show_in_default>1</show_in_default>
145
  <show_in_website>1</show_in_website>
@@ -149,7 +171,7 @@
149
  <label>Maximum Shipping day(s)</label>
150
  <frontend_type>text</frontend_type>
151
  <config_path>nowshop/productfeed/max</config_path>
152
- <sort_order>4</sort_order>
153
  <comment>Maximum number of days before the product is shipped.0 indicates same day shipping. </comment>
154
  <show_in_default>1</show_in_default>
155
  <show_in_website>1</show_in_website>
135
  <show_in_website>0</show_in_website>
136
  <show_in_store>1</show_in_store>
137
  </allowed_brand>
138
+ <color translate="label comment" module="nowshop">
139
+ <label>Color</label>
140
+ <frontend_type>multiselect</frontend_type>
141
+ <source_model>nowshop/system_config_source_configattr</source_model>
142
+ <config_path>nowshop/productfeed/color</config_path>
143
+ <sort_order>3</sort_order>
144
+ <comment>Product's attributes which is used as Color attribute.</comment>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>0</show_in_website>
147
+ <show_in_store>1</show_in_store>
148
+ </color>
149
+ <size translate="label comment" module="nowshop">
150
+ <label>Size</label>
151
+ <frontend_type>multiselect</frontend_type>
152
+ <source_model>nowshop/system_config_source_configattr</source_model>
153
+ <config_path>nowshop/productfeed/size</config_path>
154
+ <sort_order>4</sort_order>
155
+ <comment>Product's attributes which is used as Size attribute.</comment>
156
+ <show_in_default>1</show_in_default>
157
+ <show_in_website>0</show_in_website>
158
+ <show_in_store>1</show_in_store>
159
+ </size>
160
  <min translate="label comment" module="nowshop">
161
  <label>Minimum Shipping day(s)</label>
162
  <frontend_type>text</frontend_type>
163
  <config_path>nowshop/productfeed/min</config_path>
164
+ <sort_order>5</sort_order>
165
  <comment>Minimum number of days before the product is shipped.0 indicates same day shipping. </comment>
166
  <show_in_default>1</show_in_default>
167
  <show_in_website>1</show_in_website>
171
  <label>Maximum Shipping day(s)</label>
172
  <frontend_type>text</frontend_type>
173
  <config_path>nowshop/productfeed/max</config_path>
174
+ <sort_order>6</sort_order>
175
  <comment>Maximum number of days before the product is shipped.0 indicates same day shipping. </comment>
176
  <show_in_default>1</show_in_default>
177
  <show_in_website>1</show_in_website>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ced_NowShop</name>
4
- <version>0.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Sell on NowShop.</description>
11
  <notes>Stable Release.</notes>
12
  <authors><author><name>Nowshop</name><user>Nowshop</user><email>dan@nowshop.com</email></author><author><name>Asheesh Singh</name><user>asheeshsingh</user><email>asheeshsingh@cedcoss.com</email></author></authors>
13
- <date>2014-06-02</date>
14
- <time>11:44:05</time>
15
- <contents><target name="magecommunity"><dir name="NowShop"><dir><dir name="NowShopPayment"><dir name="Model"><file name="Nowshop.php" hash="7810c3318342e32bed3ece6bebc9fec5"/></dir><dir name="etc"><file name="config.xml" hash="92c93dd60cab7d0f0bae2737d9105437"/><file name="system.xml--" hash="fe50468fd403f28a90a5f167b2ca844d"/></dir></dir><dir name="NowShopShipping"><dir name="Model"><dir name="Carrier"><file name="Nowshop.php" hash="b298a471f0bb1020d2459decff5140b6"/></dir><dir name="Sales"><dir name="Quote"><file name="Address.php" hash="7b41cde8941657a2477efe542a492609"/></dir></dir><dir name="Shipping"><file name="Config.php" hash="c5280419a21742772a2ee2bdfd6ca41c"/></dir></dir><dir name="etc"><file name="config.xml" hash="f6aed07d83d59b1876e247f409c38446"/><file name="system.xml--" hash="f42eb1a9c76e87a25b35596f94738fa7"/></dir></dir><dir name="Synchronize"><dir name="Block"><dir name="Adminhtml"><dir name="Feed"><file name="Categories.php" hash="ef79b79d4ebe2cf73227e42117f0f4c4"/><file name="Grid.php" hash="8a7f63ef281a29058a1591c95222c334"/><dir name="Renderer"><file name="Listed.php" hash="7fd94eb87180cc162ea4cc77b48a4607"/><file name="Relisted.php" hash="9e0bf3a4c568f051f5c4b4e4e76bf522"/></dir></dir><file name="Feed.php" hash="e0b8b4fae1c4f0310410fbde3c23924e"/></dir></dir><dir name="Helper"><file name="Arraytoxml.php" hash="afc6c942e7ed8388e1beadeae0b190ce"/><file name="Data.php" hash="e3050cd7bf68c57b16733422def7420d"/></dir><dir name="Model"><file name="Cfeed.php" hash="4b2ae9d960e662fe40161b35e4b9c6ac"/><file name="Feed.php" hash="e433bcbb61ccc1298e3425738402b110"/><dir name="Mysql4"><dir name="Cfeed"><file name="Collection.php" hash="ed5a4387d19663d82f4f91bff890d446"/></dir><file name="Cfeed.php" hash="710e43c5830a12413a501b5019c0ee90"/><dir name="Feed"><file name="Collection.php" hash="c025fb1ea502042a5432cdf86f228a43"/></dir><file name="Feed.php" hash="a7e43caa7777333569d8f943a894ebe6"/><file name="Setup.php" hash="b21da92587897b12a1a04848a5d5721a"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Brand.php" hash="bc4ec0fdd6b67cbdb2cce98f2699bbae"/><file name="Isocode.php" hash="482cf305f0deb3af5e426964109dbd3a"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CategoryfeedController.php" hash="8845716c832fe441e0b8026f2e462bc4"/><file name="ProductfeedController.php" hash="83fdbab78abdbd7818b565c2a0bd3b38"/></dir><file name="OrderController.php" hash="cbc5b01bb8519647949ea80a31098d1c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="9d13b6038e537cc351b7c9d7f0ca27e0"/><file name="config.xml" hash="6165c6baffe2f92f5c12b7f386b70e41"/><file name="system.xml" hash="c2a7c5afee37c07f104e5ffb2e56b883"/><dir name="xsd"><file name="product_feed.xsd" hash="c07e735a6696919adc95910101441b56"/></dir></dir><dir name="sql"><dir name="nowshop_synchronize_setup"><file name="mysql4-install-0.0.1.php" hash="4e39f52f4b59a8616fa441f56aa1cbf9"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="704bfc039f2a66a0e360a0b523c84a73"/><file name="mysql4-upgrade-0.0.2-0.0.3.php" hash="14199af61f956d982632d600ef1b8332"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NowShop_NowShopPayment.xml" hash="333cd81914d0da258884511ef34f91eb"/><file name="NowShop_NowShopShipping.xml" hash="cf4415f704aafb1102db91d2d515bb6c"/><file name="NowShop_Synchronize.xml" hash="575e14f3e0906c155d025bbf70e1de33"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="nowshop.xml" hash="6de84482c216cf6d07f8e7d493e85bb4"/></dir><dir name="template"><dir name="nowshop"><file name="categories.phtml" hash="8ba76f2b6602f21bcf854161c8d3462b"/><file name="feed.phtml" hash="8a601e8f650f0dd7cafe4fa1be07ff81"/><file name="grid.phtml" hash="6b22801e0e7a8b5c19e0182a75854915"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="nowshop"><dir name="productfeed"><file name="test.txt" hash="6f187b66ae7a361b28988ee534a5b8ba"/></dir><dir name="categoryfeed"><file name="test.txt" hash="3c6f24cc8bba1983873f0aa978c025b3"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Ced_NowShop</name>
4
+ <version>0.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
7
  <channel>community</channel>
10
  <description>Sell on NowShop.</description>
11
  <notes>Stable Release.</notes>
12
  <authors><author><name>Nowshop</name><user>Nowshop</user><email>dan@nowshop.com</email></author><author><name>Asheesh Singh</name><user>asheeshsingh</user><email>asheeshsingh@cedcoss.com</email></author></authors>
13
+ <date>2014-11-01</date>
14
+ <time>06:50:03</time>
15
+ <contents><target name="magecommunity"><dir name="NowShop"><dir><dir name="NowShopPayment"><dir name="Model"><file name="Nowshop.php" hash="7810c3318342e32bed3ece6bebc9fec5"/></dir><dir name="etc"><file name="config.xml" hash="92c93dd60cab7d0f0bae2737d9105437"/><file name="system.xml--" hash="fe50468fd403f28a90a5f167b2ca844d"/></dir></dir><dir name="NowShopShipping"><dir name="Model"><dir name="Carrier"><file name="Nowshop.php" hash="b298a471f0bb1020d2459decff5140b6"/></dir><dir name="Sales"><dir name="Quote"><file name="Address.php" hash="7b41cde8941657a2477efe542a492609"/></dir></dir><dir name="Shipping"><file name="Config.php" hash="c5280419a21742772a2ee2bdfd6ca41c"/></dir></dir><dir name="etc"><file name="config.xml" hash="f6aed07d83d59b1876e247f409c38446"/><file name="system.xml--" hash="f42eb1a9c76e87a25b35596f94738fa7"/></dir></dir><dir name="Synchronize"><dir name="Block"><dir name="Adminhtml"><dir name="Feed"><file name="Categories.php" hash="ef79b79d4ebe2cf73227e42117f0f4c4"/><file name="Grid.php" hash="3c525e014993c21c76ebd2c4fe4b5a12"/><dir name="Renderer"><file name="Listed.php" hash="7fd94eb87180cc162ea4cc77b48a4607"/><file name="Relisted.php" hash="9e0bf3a4c568f051f5c4b4e4e76bf522"/></dir></dir><file name="Feed.php" hash="e0b8b4fae1c4f0310410fbde3c23924e"/></dir></dir><dir name="Helper"><file name="Arraytoxml.php" hash="afc6c942e7ed8388e1beadeae0b190ce"/><file name="Data.php" hash="1f40eb2a4fa9a134240f79c7d6ed98e0"/><file name="Ftp.php" hash="95066b831ba0960e0b75e59269e33aff"/></dir><dir name="Model"><file name="Cfeed.php" hash="4b2ae9d960e662fe40161b35e4b9c6ac"/><file name="Feed.php" hash="e433bcbb61ccc1298e3425738402b110"/><dir name="Mysql4"><dir name="Cfeed"><file name="Collection.php" hash="ed5a4387d19663d82f4f91bff890d446"/></dir><file name="Cfeed.php" hash="710e43c5830a12413a501b5019c0ee90"/><dir name="Feed"><file name="Collection.php" hash="c025fb1ea502042a5432cdf86f228a43"/></dir><file name="Feed.php" hash="a7e43caa7777333569d8f943a894ebe6"/><file name="Setup.php" hash="b21da92587897b12a1a04848a5d5721a"/></dir><dir name="System"><dir name="Config"><dir name="Source"><file name="Brand.php" hash="bc4ec0fdd6b67cbdb2cce98f2699bbae"/><file name="Configattr.php" hash="17bc3252c5d2417dc11915d839cf0ced"/><file name="Isocode.php" hash="482cf305f0deb3af5e426964109dbd3a"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CategoryfeedController.php" hash="8845716c832fe441e0b8026f2e462bc4"/><file name="ProductfeedController.php" hash="f8a1982707afca87b37bc226299d7d17"/></dir><file name="OrderController.php" hash="cbc5b01bb8519647949ea80a31098d1c"/></dir><dir name="etc"><file name="adminhtml.xml" hash="9d13b6038e537cc351b7c9d7f0ca27e0"/><file name="config.xml" hash="6165c6baffe2f92f5c12b7f386b70e41"/><file name="system.xml" hash="4726ee23409d0bcfa660ff0612866684"/><dir name="xsd"><file name="product_feed.xsd" hash="c07e735a6696919adc95910101441b56"/></dir></dir><dir name="sql"><dir name="nowshop_synchronize_setup"><file name="mysql4-install-0.0.1.php" hash="4e39f52f4b59a8616fa441f56aa1cbf9"/><file name="mysql4-upgrade-0.0.1-0.0.2.php" hash="704bfc039f2a66a0e360a0b523c84a73"/><file name="mysql4-upgrade-0.0.2-0.0.3.php" hash="14199af61f956d982632d600ef1b8332"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="NowShop_NowShopPayment.xml" hash="333cd81914d0da258884511ef34f91eb"/><file name="NowShop_NowShopShipping.xml" hash="cf4415f704aafb1102db91d2d515bb6c"/><file name="NowShop_Synchronize.xml" hash="575e14f3e0906c155d025bbf70e1de33"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="nowshop.xml" hash="6de84482c216cf6d07f8e7d493e85bb4"/></dir><dir name="template"><dir name="nowshop"><file name="categories.phtml" hash="8ba76f2b6602f21bcf854161c8d3462b"/><file name="feed.phtml" hash="8a601e8f650f0dd7cafe4fa1be07ff81"/><file name="grid.phtml" hash="6b22801e0e7a8b5c19e0182a75854915"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="nowshop"><dir name="productfeed"><file name="test.txt" hash="6f187b66ae7a361b28988ee534a5b8ba"/></dir><dir name="categoryfeed"><file name="test.txt" hash="3c6f24cc8bba1983873f0aa978c025b3"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>