Dnd_Shoppingflux - Version 1.0.0

Version Notes

More good things to come

Download this release

Release Info

Developer Magento Core Team
Extension Dnd_Shoppingflux
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Dnd/Shoppingflux/Helper/Data.php ADDED
@@ -0,0 +1,8 @@
1
+ <?php
2
+
3
+ class Dnd_Shoppingflux_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+
7
+
8
+ }
app/code/community/Dnd/Shoppingflux/Model/Attr.php ADDED
@@ -0,0 +1,35 @@
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ class Dnd_Shoppingflux_Model_Attr
29
+ {
30
+ public function toOptionArray()
31
+ {
32
+ $attrs = Mage::getSingleton('catalog/convert_parser_product')->getExternalAttributes();
33
+ return $attrs;
34
+ }
35
+ }
app/code/community/Dnd/Shoppingflux/Model/Flux.php ADDED
@@ -0,0 +1,675 @@
1
+ <?php
2
+
3
+ class Dnd_Shoppingflux_Model_Flux extends Mage_Core_Model_Abstract
4
+ {
5
+ public $nom_rayon='';
6
+ public $nom_gamme='';
7
+ public $metaArray=array();
8
+ public $description='';
9
+ public $stock='';
10
+ public $ImageUrl='';
11
+
12
+ public function getFlux()
13
+ {
14
+ $flux = '';
15
+ $flux .= $this->getHeader();
16
+ $flux .= $this->getBody();
17
+
18
+ return $flux;
19
+ }
20
+
21
+
22
+ public function getHeader()
23
+ {
24
+ $header = '<?xml version="1.0" encoding="utf-8"?>';
25
+
26
+ return $header;
27
+ }
28
+
29
+
30
+ public function getBody()
31
+ {
32
+ $body = '<products>';
33
+ $body .= $this->getAllProductsXml();
34
+ $body .= '</products>';
35
+
36
+ return $body;
37
+ }
38
+
39
+
40
+ public function getAllProductsXml()
41
+ {
42
+ $productsXml = '';
43
+
44
+ // Récupération de tous les produits simple + conf + en stock + activé
45
+
46
+ // ENLEVE PRODUIT FILS - BOUCLE A REVOIR TROP GOURMANDE EN RESSOURCE
47
+ $products = Mage::getResourceModel('catalog/product_collection')
48
+ ->addAttributeToSelect('entity_id')
49
+ ->addAttributeToFilter("status",1);
50
+
51
+
52
+ $configurable_product = Mage::getModel('catalog/product_type_configurable');
53
+
54
+ $exclude=array();
55
+
56
+
57
+ //echo count($products);
58
+
59
+ foreach($products as $product)
60
+ {
61
+
62
+ $parentIdArray = $configurable_product->getParentIdsByChild($product->getId());
63
+
64
+
65
+ if(isset($parentIdArray) && $parentIdArray[0]!=''){
66
+
67
+ $exclude[]=$product->getData('entity_id');
68
+
69
+ }
70
+
71
+
72
+ }
73
+
74
+ $productsCollec = Mage::getResourceModel('catalog/product_collection')
75
+ ->addAttributeToSelect('*')
76
+ ->addAttributeToFilter("status",1)
77
+ ->addAttributeToFilter('entity_id',array('nin'=>$exclude));
78
+
79
+ foreach($productsCollec as $product)
80
+ {
81
+
82
+ $productsXml .= $this->getProductXml($product);
83
+
84
+ }
85
+
86
+ return $productsXml;
87
+ }
88
+
89
+
90
+ public function getProductXml($product)
91
+ {
92
+ $productXml = '<product>';
93
+ $productXml .= $this->getProductDataXml($product);
94
+ $productXml .= '</product>';
95
+
96
+ return $productXml;
97
+ }
98
+
99
+
100
+ public function getProductDataXml($product)
101
+ {
102
+ $productDataXml = '';
103
+ $allData = $this->getStructure();
104
+
105
+ foreach($allData as $data)
106
+ {
107
+ if($data["type"]=="simple")
108
+ {
109
+ $productDataXml .= $this->getSimpleDataXml($product,$data["value"]);
110
+ }
111
+ elseif($data["type"]=="pdm")
112
+ {
113
+ $productDataXml .= $this->getPdmDataXml($product,$data["value"]);
114
+ }
115
+ elseif($data["type"]=="nonrequired")
116
+ {
117
+ $productDataXml .= $this->getNonRequiredDataXml($product,$data["value"]);
118
+ }
119
+ elseif($data["type"]=="options")
120
+ {
121
+ $productDataXml .= $this->getOptionsDataXml($product,$data["value"]);
122
+ }
123
+ else
124
+ {
125
+ $productDataXml .= $this->getSpecialDataXml($product,$data["value"]);
126
+ }
127
+ }
128
+
129
+ return $productDataXml;
130
+ }
131
+
132
+ public function getSimpleDataXml($product,$data)
133
+ {
134
+ $dataXml = '<'.$data.'>';
135
+ $dataXml .= '<![CDATA['.$product->getData($data).']]>';
136
+ $dataXml .= '</'.$data.'>';
137
+
138
+ return $dataXml;
139
+ }
140
+
141
+ //function qui gere les options des configurables
142
+ public function getOptionsDataXml($product,$data)
143
+ {
144
+ if($product->getData('type_id')=="configurable"){
145
+
146
+ $configurableAttributeCollection = $product->getTypeInstance()->getConfigurableAttributes();
147
+
148
+ $result = array();
149
+ $i=1;
150
+
151
+ $dataXml='';
152
+
153
+ foreach($configurableAttributeCollection as $attribute){
154
+
155
+ $dataXml .= '<opt'.$i.'>';
156
+
157
+ $dataXml .= '<label>';
158
+ $dataXml .= $attribute->getProductAttribute()->getFrontend()->getLabel();
159
+ $dataXml .= '</label>';
160
+ $dataXml .= '<value>';
161
+
162
+ $childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$product);
163
+
164
+ $names=array();
165
+
166
+ foreach($childProducts as $prod){
167
+
168
+ array_push($names,$prod->getResource()->getAttribute($attribute->getProductAttribute()->getAttributeCode())->getFrontend()->getValue($prod));
169
+ }
170
+
171
+ $dataXml .= implode(",",$names);
172
+ $dataXml .= '</value>';
173
+ $dataXml .= '</opt'.$i.'>';
174
+
175
+ $i++;
176
+ }
177
+
178
+ return $dataXml;
179
+ }
180
+ }
181
+
182
+ //function qui gere les attributs non obligatoire
183
+ public function getNonRequiredDataXml($product,$data)
184
+ {
185
+ global $nom_rayon;
186
+ global $nom_gamme;
187
+ global $stock;
188
+
189
+ $dataXml = '';
190
+
191
+ switch($data)
192
+ {
193
+ case 'nom_rayon_gamme':
194
+
195
+ if(Mage::getStoreConfig('shoppingflux/gestion_attribut/rayon_gamme_active')==1){
196
+
197
+ if(isset($nom_rayon) && isset($nom_gamme))
198
+ {
199
+ $dataXml .= '<'.$data.'>';
200
+ $dataXml .= $nom_rayon.'/'.$nom_gamme;
201
+ $dataXml .= '</'.$data.'>';
202
+ }
203
+ }
204
+ break;
205
+
206
+ case 'taux':
207
+ if(Mage::getStoreConfig('shoppingflux/gestion_attribut/remise_taux_active')==1){
208
+
209
+ if($product->getSpecialPrice())
210
+ {
211
+ $percent = (($product->getPrice() - $product->getSpecialPrice())/$product->getPrice())*100;
212
+
213
+ $dataXml .= '<'.$data.'>';
214
+ $dataXml .= round($percent,2);
215
+ $dataXml .= '</'.$data.'>';
216
+ }
217
+ }
218
+ break;
219
+
220
+ case 'remise':
221
+ if(Mage::getStoreConfig('shoppingflux/gestion_attribut/remise_active')==1){
222
+
223
+ if($product->getSpecialPrice())
224
+ {
225
+ $dataXml .= '<'.$data.'>';
226
+ $remise = $product->getPrice() - $product->getSpecialPrice();
227
+ $dataXml .= Mage::helper('core')->currency($remise,true,false);
228
+ $dataXml .= '</'.$data.'>';
229
+ }
230
+ }
231
+ break;
232
+
233
+ case 'weight':
234
+
235
+ if(Mage::getStoreConfig('shoppingflux/gestion_attribut/weight_active')==1){
236
+
237
+ $dataXml .= '<'.$data.'>';
238
+ $dataXml .= $product->getWeight();
239
+ $dataXml .= '</'.$data.'>';
240
+
241
+ }
242
+
243
+ break;
244
+
245
+ case 'stock':
246
+
247
+ if(Mage::getStoreConfig('shoppingflux/gestion_attribut/stock_active')==1){
248
+
249
+ $dataXml .= '<'.$data.'>';
250
+ $dataXml .= $stock;
251
+ $dataXml .= '</'.$data.'>';
252
+
253
+ }
254
+
255
+ break;
256
+
257
+ case 'visible':
258
+
259
+ if(Mage::getStoreConfig('shoppingflux/gestion_attribut/visibility_active')==1){
260
+
261
+ $dataXml .= '<'.$data.'>';
262
+ $dataXml .= 'oui';
263
+ $dataXml .= '</'.$data.'>';
264
+
265
+ }
266
+
267
+ break;
268
+
269
+
270
+ }
271
+
272
+ return $dataXml;
273
+
274
+ }
275
+
276
+ //function special pour les 4 rang Place de Marché on verifie avant tout la bonne configuration en BO
277
+ public function getPdmDataXml($product,$data)
278
+ {
279
+ $dataXml='';
280
+
281
+ if(Mage::getStoreConfig('shoppingflux/marketplace/pdm_active')==1){
282
+
283
+ $dataXml = '<'.$data.'>';
284
+
285
+ switch($data)
286
+ {
287
+ case 'reference_constructeur':
288
+
289
+ if(Mage::getStoreConfig('shoppingflux/marketplace/pdm_attribut_ref_constructeur')!=''){
290
+
291
+ $dataXml .= $product->getData(Mage::getStoreConfig('shoppingflux/marketplace/pdm_attribut_ref_constructeur'));
292
+
293
+ }else{
294
+ echo "Pas d'attribut reference_constructeur renseigné en BO";
295
+ die();
296
+ }
297
+
298
+ break;
299
+
300
+ case 'reference_fournisseur':
301
+
302
+ if(Mage::getStoreConfig('shoppingflux/marketplace/pdm_attribut_ref_fournisseur')!=''){
303
+
304
+ $dataXml .= $product->getData(Mage::getStoreConfig('shoppingflux/marketplace/pdm_attribut_ref_fournisseur'));
305
+
306
+ }else{
307
+ echo "Pas d'attribut reference_fournisseur renseigné en BO";
308
+ die();
309
+ }
310
+
311
+ break;
312
+
313
+ case 'code_ean':
314
+
315
+ if(Mage::getStoreConfig('shoppingflux/marketplace/pdm_attribut_ean')!=''){
316
+
317
+ $dataXml .= $product->getData(Mage::getStoreConfig('shoppingflux/marketplace/pdm_attribut_ean'));
318
+
319
+ }else{
320
+ echo "Pas d'attribut code ean renseigné en BO";
321
+ die();
322
+ }
323
+
324
+ break;
325
+
326
+ case 'code_isbn':
327
+
328
+ if(Mage::getStoreConfig('shoppingflux/marketplace/pdm_attribut_isbn')!=''){
329
+
330
+ $dataXml .= $product->getData(Mage::getStoreConfig('shoppingflux/marketplace/pdm_attribut_isbn'));
331
+
332
+ }else{
333
+ echo "Pas d'attribut code isbn renseigné en BO";
334
+ die();
335
+ }
336
+
337
+ break;
338
+
339
+ case 'delais':
340
+
341
+ if(Mage::getStoreConfig('shoppingflux/general/delai_livraison')!=''){
342
+
343
+ $dataXml .= Mage::getStoreConfig('shoppingflux/general/delai_livraison');
344
+
345
+ }else{
346
+ echo "Pas d'attribut delai_livraison renseigné en BO";
347
+ die();
348
+ }
349
+
350
+ break;
351
+
352
+ case 'frais_de_port':
353
+
354
+ if(Mage::getStoreConfig('shoppingflux/general/port')!=''){
355
+
356
+ $dataXml .= Mage::getStoreConfig('shoppingflux/general/port');
357
+
358
+ }else{
359
+ echo "Pas d'attribut frais de port renseigné en BO";
360
+ die();
361
+ }
362
+
363
+ break;
364
+
365
+ case 'nom_marque':
366
+
367
+ if(Mage::getStoreConfig('shoppingflux/general/marque')!=''){
368
+
369
+ $dataXml .= $product->getResource()->getAttribute(Mage::getStoreConfig('shoppingflux/general/marque'))->getFrontend()->getValue($product);
370
+
371
+ }else{
372
+
373
+ echo "Pas d'attribut pour la marque renseigné en BO";
374
+ die();
375
+ }
376
+
377
+ break;
378
+
379
+
380
+ }
381
+
382
+ $dataXml .= '</'.$data.'>';
383
+ }
384
+
385
+ return $dataXml;
386
+ }
387
+
388
+
389
+ public function getSpecialDataXml($product,$data)
390
+ {
391
+ $dataXml = '<'.$data.'>';
392
+
393
+ $dataValue = NULL;
394
+
395
+ global $nom_rayon;
396
+ global $nom_gamme;
397
+ global $metaArray;
398
+ global $description;
399
+ global $stock;
400
+ global $ImageUrl;
401
+
402
+ switch($data)
403
+ {
404
+ case 'price':
405
+ $dataValue = Mage::helper('core')->currency($product->getData($data),true,false);
406
+ break;
407
+
408
+ case 'special_price':
409
+ $dataValue = Mage::helper('core')->currency($product->getData($data),true,false);
410
+ break;
411
+
412
+ case 'url':
413
+ $dataValue = $product->getProductUrl();
414
+ break;
415
+
416
+ case 'image_url':
417
+ $dataValue = $ImageUrl;
418
+ break;
419
+
420
+ case 'thumbnail_url':
421
+ $dataValue = $product->getThumbnailUrl();
422
+ break;
423
+
424
+ case 'nom_rayon':
425
+ $value = $product->getCategoryIds();
426
+ $dataValue='';
427
+
428
+ if(count($value)>=1){
429
+
430
+ $lastLevel='';
431
+
432
+ foreach($value as $key => $id){
433
+
434
+ $cur_subcategory=Mage::getModel('catalog/category')->load($id);
435
+ $newLevel = $cur_subcategory->getLevel();
436
+
437
+ if($lastLevel==''){ // si vide 1er tour
438
+
439
+ $dataValue=$cur_subcategory->getName();
440
+ $nom_rayon = $cur_subcategory->getName();
441
+
442
+ } elseif($lastLevel<$newLevel){ // si la cat precedente est plus petite on fait rien
443
+
444
+
445
+
446
+ } elseif($lastLevel>$newLevel){ // si la nouvelle cat est plus petite on remplace la gamme
447
+
448
+ $dataValue=$cur_subcategory->getName();
449
+ $nom_rayon = $cur_subcategory->getName();
450
+
451
+ } elseif($lastLevel==$newLevel){ // si elle sont egale on prend la derniere
452
+
453
+ //$dataValue=$cur_subcategory->getName();
454
+
455
+ }
456
+
457
+
458
+ //on sauvegarde le dernier level connu
459
+ $lastLevel=$cur_subcategory->getLevel();
460
+
461
+ }
462
+
463
+
464
+ } else {
465
+
466
+ $dataValue='';
467
+ $nom_rayon ='';
468
+
469
+ }
470
+
471
+ break;
472
+ case 'nom_gamme':
473
+
474
+ $value = $product->getCategoryIds();
475
+ $dataValue='';
476
+
477
+ if(count($value)>=1){
478
+
479
+ $lastLevel='';
480
+
481
+ foreach($value as $key => $id){
482
+
483
+ $cur_subcategory=Mage::getModel('catalog/category')->load($id);
484
+ $newLevel = $cur_subcategory->getLevel();
485
+
486
+ if($lastLevel==''){ // si vide 1er tour
487
+
488
+ $dataValue=$cur_subcategory->getName();
489
+ $nom_gamme = $cur_subcategory->getName();
490
+
491
+ } elseif($lastLevel>$newLevel){ // si la cat precedente est plus grande on change rien
492
+
493
+
494
+
495
+ } elseif($lastLevel<$newLevel){ // si la nouvelle cat est plus grande on remplace la gamme
496
+
497
+ $dataValue=$cur_subcategory->getName();
498
+ $nom_gamme = $cur_subcategory->getName();
499
+
500
+ } elseif($lastLevel==$newLevel){ // si elle sont egale on prend la derniere
501
+
502
+ $dataValue=$cur_subcategory->getName();
503
+ $nom_gamme = $cur_subcategory->getName();
504
+
505
+ }
506
+
507
+
508
+ //on sauvegarde le dernier level connu
509
+ $lastLevel=$cur_subcategory->getLevel();
510
+
511
+ }
512
+ //$dataValue = $value[0];
513
+
514
+ } else {
515
+
516
+ $dataValue='';
517
+ $nom_gamme ='';
518
+
519
+ }
520
+
521
+ break;
522
+
523
+ case 'meta_title':
524
+
525
+ $dataValue= $metaArray['title'];
526
+
527
+ break;
528
+
529
+ case 'meta_description':
530
+
531
+ $dataValue= $metaArray['desc'];
532
+
533
+ break;
534
+
535
+ case 'meta_keyword':
536
+
537
+ $dataValue= $metaArray['keywords'];
538
+
539
+ break;
540
+
541
+ case 'description':
542
+
543
+ $productId=$product->getEntity_id();
544
+ $productLoaded =Mage::getModel('catalog/product')->load($productId);
545
+
546
+ //on intialise les futur var dont on as besoin
547
+
548
+ $metaArray['title'] = $productLoaded->getData('meta_title');
549
+ $metaArray['desc'] = $productLoaded->getData('meta_description');
550
+ $metaArray['keywords'] = $productLoaded->getData('meta_keywords');
551
+ $description = $productLoaded->getDescription();
552
+ $stock = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
553
+ $ImageUrl = $productLoaded->getImageUrl();
554
+
555
+ if($description!=''){
556
+
557
+ $dataValue = $description;
558
+
559
+ } else {
560
+
561
+ $dataValue ='';
562
+
563
+ }
564
+ break;
565
+
566
+ case 'is_in_stock':
567
+
568
+ $dataValue ='oui';
569
+
570
+ break;
571
+
572
+ }
573
+
574
+ $dataXml .= '<![CDATA['.$dataValue.']]>';
575
+ $dataXml .= '</'.$data.'>';
576
+
577
+ return $dataXml;
578
+ }
579
+
580
+ public function getStructure()
581
+ {
582
+ $structure = array();
583
+
584
+ $structure[1]["type"]= "simple";
585
+ $structure[1]["value"]= "sku";
586
+
587
+ $structure[2]["type"]= "pdm";
588
+ $structure[2]["value"]= "reference_constructeur";
589
+
590
+ $structure[3]["type"]= "pdm";
591
+ $structure[3]["value"]= "reference_fournisseur";
592
+
593
+ $structure[4]["type"]= "pdm";
594
+ $structure[4]["value"]= "code_ean";
595
+
596
+ $structure[5]["type"]= "pdm";
597
+ $structure[5]["value"]= "code_isbn";
598
+
599
+ $structure[6]["type"]= "special";
600
+ $structure[6]["value"]= "nom_rayon";
601
+
602
+ $structure[7]["type"]= "special";
603
+ $structure[7]["value"]= "nom_gamme";
604
+
605
+ $structure[8]["type"]= "nonrequired";
606
+ $structure[8]["value"]= "nom_rayon_gamme";
607
+
608
+ $structure[9]["type"]= "simple";
609
+ $structure[9]["value"]= "name";
610
+
611
+ $structure[10]["type"]= "pdm";
612
+ $structure[10]["value"]= "nom_marque";
613
+
614
+ $structure[11]["type"]= "special";
615
+ $structure[11]["value"]= "price";
616
+
617
+ $structure[12]["type"]= "simple";
618
+ $structure[12]["value"]= "short_description";
619
+
620
+ $structure[13]["type"]= "special";
621
+ $structure[13]["value"]= "description";
622
+
623
+ $structure[14]["type"]= "nonrequired";
624
+ $structure[14]["value"]= "weight";
625
+
626
+ $structure[15]["type"]= "nonrequired";
627
+ $structure[15]["value"]= "visible";
628
+
629
+ $structure[16]["type"]= "special";
630
+ $structure[16]["value"]= "is_in_stock";
631
+
632
+ $structure[17]["type"]= "nonrequired";
633
+ $structure[17]["value"]= "stock";
634
+
635
+ $structure[18]["type"]= "special";
636
+ $structure[18]["value"]= "meta_title";
637
+
638
+ $structure[19]["type"]= "special";
639
+ $structure[19]["value"]= "meta_description";
640
+
641
+ $structure[20]["type"]= "special";
642
+ $structure[20]["value"]= "meta_keyword";
643
+
644
+ $structure[21]["type"]= "options";
645
+ $structure[21]["value"]= "options";
646
+
647
+ $structure[22]["type"]= "special";
648
+ $structure[22]["value"]= "special_price";
649
+
650
+ $structure[23]["type"]= "nonrequired";
651
+ $structure[23]["value"]= "taux";
652
+
653
+ $structure[24]["type"]= "nonrequired";
654
+ $structure[24]["value"]= "remise";
655
+
656
+ $structure[25]["type"]= "pdm";
657
+ $structure[25]["value"]= "delais";
658
+
659
+ $structure[26]["type"]= "pdm";
660
+ $structure[26]["value"]= "frais_de_port";
661
+
662
+ $structure[27]["type"]= "special";
663
+ $structure[27]["value"]= "url";
664
+
665
+ $structure[28]["type"]= "special";
666
+ $structure[28]["value"]= "image_url";
667
+
668
+ $structure[29]["type"]= "special";
669
+ $structure[29]["value"]= "thumbnail_url";
670
+
671
+ return $structure;
672
+ }
673
+
674
+
675
+ }
app/code/community/Dnd/Shoppingflux/controllers/IndexController.php ADDED
@@ -0,0 +1,67 @@
1
+ <?php
2
+ class Dnd_Shoppingflux_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ header ("content-type: text/xml"); // Modification en-t�te HTTP - Content type XML
7
+ $shoppingModel = Mage::getModel("shoppingflux/flux"); // Chargement du mod�le du flux
8
+ $flux = $shoppingModel->getFlux(); // R�cup�ration du flux
9
+
10
+ echo $flux; // Affichage du flux
11
+ }
12
+
13
+
14
+ public function debugAction()
15
+ {
16
+ $products = Mage::getResourceModel('catalog/product_collection')
17
+ ->addAttributeToSelect('entity_id')
18
+ ->addAttributeToFilter("status",1);
19
+ //->addAttributeToFilter('visibility',array('in' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH));
20
+
21
+
22
+
23
+
24
+ $configurable_product = Mage::getModel('catalog/product_type_configurable');
25
+
26
+ $exclude=array();
27
+
28
+
29
+ echo count($products);
30
+
31
+ foreach($products as $product)
32
+ {
33
+
34
+ $parentIdArray = $configurable_product->getParentIdsByChild($product->getId());
35
+
36
+
37
+ if(isset($parentIdArray) && $parentIdArray[0]!=''){
38
+
39
+ $exclude[]=$product->getData('entity_id');
40
+
41
+ }
42
+
43
+
44
+ }
45
+
46
+ $productsCollec = Mage::getResourceModel('catalog/product_collection')
47
+ ->addAttributeToSelect('*')
48
+ ->addAttributeToFilter("status",1)
49
+ ->addAttributeToFilter('entity_id',array('nin'=>$exclude));
50
+ //->addAttributeToFilter("sku",'BAOM008 ');
51
+
52
+ echo count($productsCollec);
53
+
54
+ foreach($productsCollec as $product)
55
+ {
56
+
57
+ $productsXml .= $this->getProductXml($product);
58
+
59
+ }
60
+
61
+
62
+
63
+ }
64
+
65
+
66
+
67
+ }
app/code/community/Dnd/Shoppingflux/etc/config.xml ADDED
@@ -0,0 +1,63 @@
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Effisys
5
+ * @package Dnd_Shopoon
6
+ * @author DnD
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Dnd_Shoppingflux>
13
+ <version>1.0.0</version>
14
+ </Dnd_Shoppingflux>
15
+ </modules>
16
+ <frontend>
17
+ <routers>
18
+ <shoppingflux>
19
+ <use>standard</use>
20
+ <args>
21
+ <module>Dnd_Shoppingflux</module>
22
+ <frontName>shopping-flux</frontName>
23
+ </args>
24
+ </shoppingflux>
25
+ </routers>
26
+ </frontend>
27
+ <adminhtml>
28
+ <acl>
29
+ <resources>
30
+ <all>
31
+ <title>Allow Everything</title>
32
+ </all>
33
+ <admin>
34
+ <children>
35
+ <system>
36
+ <children>
37
+ <config>
38
+ <children>
39
+ <shoppingflux>
40
+ <title>Shopping Flux</title>
41
+ </shoppingflux>
42
+ </children>
43
+ </config>
44
+ </children>
45
+ </system>
46
+ </children>
47
+ </admin>
48
+ </resources>
49
+ </acl>
50
+ </adminhtml>
51
+ <global>
52
+ <models>
53
+ <shoppingflux>
54
+ <class>Dnd_Shoppingflux_Model</class>
55
+ </shoppingflux>
56
+ </models>
57
+ <helpers>
58
+ <shoppingflux>
59
+ <class>Dnd_Shoppingflux_Helper</class>
60
+ </shoppingflux>
61
+ </helpers>
62
+ </global>
63
+ </config>
app/code/community/Dnd/Shoppingflux/etc/system.xml ADDED
@@ -0,0 +1,181 @@
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <shoppingflux translate="label" module="shoppingflux">
5
+ <label>Shopping Flux</label>
6
+ <tab>catalog</tab>
7
+ <frontend_type>text</frontend_type>
8
+ <sort_order>100</sort_order>
9
+ <show_in_default>1</show_in_default>
10
+ <show_in_website>1</show_in_website>
11
+ <show_in_store>1</show_in_store>
12
+ <groups>
13
+ <general translate="label">
14
+ <label>Generale</label>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <sort_order>1</sort_order>
19
+ <fields>
20
+ <delai_livraison>
21
+ <label>Valeur globale - Délai de livraison</label>
22
+ <comment>Valeur appliquée au Délai de livraison pour tous les produits</comment>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>12</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ </delai_livraison>
29
+ <port>
30
+ <label>Valeur globale - Frais de port</label>
31
+ <comment>Valeur appliquée au frais de port pour tous les produits</comment>
32
+ <frontend_type>text</frontend_type>
33
+ <sort_order>12</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </port>
38
+ <marque>
39
+ <label>Attribut Marque</label>
40
+ <comment>Selectionner le code de l'attribut pour la marque</comment>
41
+ <frontend_type>select</frontend_type>
42
+ <source_model>shoppingflux/attr</source_model>
43
+ <sort_order>12</sort_order>
44
+ <show_in_default>1</show_in_default>
45
+ <show_in_website>1</show_in_website>
46
+ <show_in_store>1</show_in_store>
47
+ </marque>
48
+ </fields>
49
+ </general>
50
+ <marketplace translate="label">
51
+ <label>Marketplace</label>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ <sort_order>2</sort_order>
56
+ <fields>
57
+ <pdm_active>
58
+ <label>Marketplaces</label>
59
+ <comment>Rendre disponible vos produits sur les Marketplaces</comment>
60
+ <frontend_type>select</frontend_type>
61
+ <sort_order>10</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ <source_model>adminhtml/system_config_source_yesno</source_model>
66
+ </pdm_active>
67
+ <pdm_attribut_ean>
68
+ <label>Attribut code ean</label>
69
+ <comment>Selectionner le code de l'attribut Marketplace pour le code ean</comment>
70
+ <frontend_type>select</frontend_type>
71
+ <source_model>shoppingflux/attr</source_model>
72
+ <sort_order>20</sort_order>
73
+ <show_in_default>1</show_in_default>
74
+ <show_in_website>1</show_in_website>
75
+ <show_in_store>1</show_in_store>
76
+ </pdm_attribut_ean>
77
+ <pdm_attribut_isbn>
78
+ <label>Attribut code isbn</label>
79
+ <comment>Selectionner le code de l'attribut Marketplace pour le code isbn</comment>
80
+ <frontend_type>select</frontend_type>
81
+ <source_model>shoppingflux/attr</source_model>
82
+ <sort_order>20</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ </pdm_attribut_isbn>
87
+ <pdm_attribut_ref_constructeur>
88
+ <label>Attribut référence constructeur</label>
89
+ <comment>Selectionner le code de l'attribut Marketplace pour la référence constructeur</comment>
90
+ <frontend_type>select</frontend_type>
91
+ <source_model>shoppingflux/attr</source_model>
92
+ <sort_order>20</sort_order>
93
+ <show_in_default>1</show_in_default>
94
+ <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </pdm_attribut_ref_constructeur>
97
+ <pdm_attribut_ref_fournisseur>
98
+ <label>Attribut référence fournisseur</label>
99
+ <comment>Selectionner le code de l'attribut Marketplace pour la référence fournisseur</comment>
100
+ <frontend_type>select</frontend_type>
101
+ <source_model>shoppingflux/attr</source_model>
102
+ <sort_order>20</sort_order>
103
+ <show_in_default>1</show_in_default>
104
+ <show_in_website>1</show_in_website>
105
+ <show_in_store>1</show_in_store>
106
+ </pdm_attribut_ref_fournisseur>
107
+ </fields>
108
+ </marketplace>
109
+ <gestion_attribut translate="label">
110
+ <label>Gestion des attributs non obligatoire</label>
111
+ <show_in_default>1</show_in_default>
112
+ <show_in_website>1</show_in_website>
113
+ <show_in_store>1</show_in_store>
114
+ <sort_order>3</sort_order>
115
+ <fields>
116
+ <rayon_gamme_active>
117
+ <label>Afficher chemin catégorie</label>
118
+ <comment>Rendre disponible le chemin catégorie ( nom du rayon + nom de la gamme ) dans le flux</comment>
119
+ <frontend_type>select</frontend_type>
120
+ <sort_order>1</sort_order>
121
+ <show_in_default>1</show_in_default>
122
+ <show_in_website>1</show_in_website>
123
+ <show_in_store>1</show_in_store>
124
+ <source_model>adminhtml/system_config_source_yesno</source_model>
125
+ </rayon_gamme_active>
126
+ <weight_active>
127
+ <label>Afficher le poids</label>
128
+ <comment>Rendre disponible le poids des produits dans le flux</comment>
129
+ <frontend_type>select</frontend_type>
130
+ <sort_order>2</sort_order>
131
+ <show_in_default>1</show_in_default>
132
+ <show_in_website>1</show_in_website>
133
+ <show_in_store>1</show_in_store>
134
+ <source_model>adminhtml/system_config_source_yesno</source_model>
135
+ </weight_active>
136
+ <visibility_active>
137
+ <label>Afficher la visibilité</label>
138
+ <comment>Rendre disponible la visibilité des produits dans le flux</comment>
139
+ <frontend_type>select</frontend_type>
140
+ <sort_order>3</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ <source_model>adminhtml/system_config_source_yesno</source_model>
145
+ </visibility_active>
146
+ <stock_active>
147
+ <label>Afficher le stock des produits</label>
148
+ <comment>Rendre disponible le stock des produits dans le flux</comment>
149
+ <frontend_type>select</frontend_type>
150
+ <sort_order>4</sort_order>
151
+ <show_in_default>1</show_in_default>
152
+ <show_in_website>1</show_in_website>
153
+ <show_in_store>1</show_in_store>
154
+ <source_model>adminhtml/system_config_source_yesno</source_model>
155
+ </stock_active>
156
+ <remise_taux_active>
157
+ <label>Afficher le taux de remise des produits</label>
158
+ <comment>Rendre disponible le taux de remise des produits dans le flux</comment>
159
+ <frontend_type>select</frontend_type>
160
+ <sort_order>5</sort_order>
161
+ <show_in_default>1</show_in_default>
162
+ <show_in_website>1</show_in_website>
163
+ <show_in_store>1</show_in_store>
164
+ <source_model>adminhtml/system_config_source_yesno</source_model>
165
+ </remise_taux_active>
166
+ <remise_active>
167
+ <label>Afficher la valeur de la remise des produits</label>
168
+ <comment>Rendre disponible la valeur de la remise des produits dans le flux</comment>
169
+ <frontend_type>select</frontend_type>
170
+ <sort_order>5</sort_order>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>1</show_in_website>
173
+ <show_in_store>1</show_in_store>
174
+ <source_model>adminhtml/system_config_source_yesno</source_model>
175
+ </remise_active>
176
+ </fields>
177
+ </gestion_attribut>
178
+ </groups>
179
+ </shoppingflux>
180
+ </sections>
181
+ </config>
app/etc/modules/Dnd_Shoppingflux.xml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Dnd_Shoppingflux>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Dnd_Shoppingflux>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Dnd_Shoppingflux</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>G&#xE9;n&#xE8;re le flux catalogue pour le r&#xE9;f&#xE9;rencement des produits sur Shopping Flux</summary>
10
+ <description>Shopping-Flux est le logiciel de gestion de Comparateurs de Prix et des Places de March&#xE9;s &#xE9;dit&#xE9; par la soci&#xE9;t&#xE9; sp&#xE9;cialis&#xE9;e en g&#xE9;n&#xE9;ration de trafic pour Ecommerce : Blog-Ecommerce.com.
11
+ Avec Shopping-Flux, vous gagnerez en temps et en rentabilit&#xE9; pour votre visibilit&#xE9; sur les comparateurs de prix. Et pour ce qui concerne les places de march&#xE9;s, Shopping Flux permet d&#x2019;optimiser les flux de vos produits et de r&#xE9;cup&#xE9;rer vos commandes dans votre back-office.</description>
12
+ <notes>More good things to come</notes>
13
+ <authors><author><name>Agence DnD</name><user>auto-converted</user><email>cd@dnd.fr</email></author></authors>
14
+ <date>2011-02-03</date>
15
+ <time>10:38:55</time>
16
+ <contents><target name="magecommunity"><dir name="Dnd"><dir name="Shoppingflux"><dir name="controllers"><file name="IndexController.php" hash="fd7b7d208df1f6f63ec545973645565d"/></dir><dir name="etc"><file name="config.xml" hash="0fe5c210225436ad9e80632bbc2b0126"/><file name="system.xml" hash="ccf5da305c545f9cf68326fd0eacef2a"/></dir><dir name="Helper"><file name="Data.php" hash="5c8b44fc0207438788a48e2b0f46af90"/></dir><dir name="Model"><file name="Attr.php" hash="34081165efd36c7726d7f4eae7592a4a"/><file name="Flux.php" hash="1f66b14ff157bc854ce978fa9516c61e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Dnd_Shoppingflux.xml" hash="d531b5446cf40eee7c42394463341885"/></dir></target></contents>
17
+ <compatible/>
18
+ <dependencies/>
19
+ </package>