AvisVerifies - Version 2.6.8

Version Notes

La version 2.6.8 est stable.

Download this release

Release Info

Developer Johnny
Extension AvisVerifies
Version 2.6.8
Comparing to
See all releases


Code changes from version 2.6.7 to 2.6.8

Files changed (185) hide show
  1. app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/Export/Export.php +0 -0
  2. app/code/local/Netreviews/Avisverifies/Block/Observers/Checkout.php +0 -0
  3. app/code/local/Netreviews/Avisverifies/Block/Rating/Entity/Detailed.php +0 -0
  4. app/code/local/Netreviews/Avisverifies/Block/Review/Helper.php +0 -0
  5. app/code/local/Netreviews/Avisverifies/Block/Review/Product/View/List.php +0 -0
  6. app/code/local/Netreviews/Avisverifies/Helper/API.php +0 -0
  7. app/code/local/Netreviews/Avisverifies/Helper/Data.php +0 -0
  8. app/code/local/Netreviews/Avisverifies/Helper/Export.php +0 -0
  9. app/code/local/Netreviews/Avisverifies/Helper/Install.php +0 -0
  10. app/code/local/Netreviews/Avisverifies/Model/Average.php +0 -0
  11. app/code/local/Netreviews/Avisverifies/Model/Mysql4/Average.php +0 -0
  12. app/code/local/Netreviews/Avisverifies/Model/Mysql4/Average/Collection.php +0 -0
  13. app/code/local/Netreviews/Avisverifies/Model/Mysql4/Reviews.php +0 -0
  14. app/code/local/Netreviews/Avisverifies/Model/Mysql4/Reviews/Collection.php +0 -0
  15. app/code/local/Netreviews/Avisverifies/Model/Observers/Checkout/Track.php +0 -0
  16. app/code/local/Netreviews/Avisverifies/Model/Observers/Product/List.php +0 -0
  17. app/code/local/Netreviews/Avisverifies/Model/Observers/System.php +0 -0
  18. app/code/local/Netreviews/Avisverifies/Model/Reviews.php +0 -0
  19. app/code/local/Netreviews/Avisverifies/Model/RichsnippetsList.php +0 -0
  20. app/code/local/Netreviews/Avisverifies/controllers/Adminhtml/AvisverifiesController.php +0 -0
  21. app/code/local/Netreviews/Avisverifies/controllers/DialogController.php +31 -35
  22. app/code/local/Netreviews/Avisverifies/controllers/IndexController.php +1 -1
  23. app/code/local/Netreviews/Avisverifies/etc/config.xml +1 -1
  24. app/code/local/Netreviews/Avisverifies/etc/system.xml +0 -0
  25. app/code/local/Netreviews/Avisverifies/sql/avisverifies_setup/mysql4-install-2.0.0.php +0 -0
  26. app/code/local/Netreviews/Pla/Block/Adminhtml/Edit.php +29 -0
  27. app/code/local/Netreviews/Pla/Block/Adminhtml/Edit/Content.php +252 -0
  28. app/code/local/Netreviews/Pla/Block/Adminhtml/Edit/Form.php +19 -0
  29. app/code/local/Netreviews/Pla/Block/Adminhtml/Form/Export/Export.php +16 -0
  30. app/code/local/Netreviews/Pla/Block/Adminhtml/Tabs.php +22 -0
  31. app/code/local/Netreviews/Pla/Helper/Data.php +51 -0
  32. app/code/local/Netreviews/Pla/Helper/Export.php +441 -0
  33. app/code/local/Netreviews/Pla/controllers/Adminhtml/NetreviewsplaController.php +181 -0
  34. app/code/local/Netreviews/Pla/controllers/DialogController.php +140 -0
  35. app/code/local/Netreviews/Pla/etc/config.xml +89 -0
  36. app/code/local/Netreviews/Pla/etc/system.xml +22 -0
  37. app/design/adminhtml/base/default/template/netreviews/pla/content.phtml +58 -0
  38. app/design/adminhtml/base/default/template/netreviews/pla/mapping.phtml +20 -0
  39. app/design/adminhtml/base/default/template/netreviews/pla/switcher.phtml +53 -0
  40. app/design/adminhtml/default/default/template/avisverifies/checkinstallation.phtml +0 -0
  41. app/design/adminhtml/default/default/template/avisverifies/checkinstallation_tab.phtml +0 -0
  42. app/design/adminhtml/default/default/template/avisverifies/export.phtml +0 -0
  43. app/design/adminhtml/default/default/template/avisverifies/export_tab.phtml +0 -0
  44. app/design/adminhtml/default/default/template/netreviews/pla/content.phtml +58 -0
  45. app/design/adminhtml/default/default/template/netreviews/pla/mapping.phtml +20 -0
  46. app/design/adminhtml/default/default/template/netreviews/pla/switcher.phtml +53 -0
  47. app/design/frontend/base/default/layout/avisverifies.xml +0 -0
  48. app/design/frontend/base/default/template/avisverifies/catalogProductList.phtml +0 -0
  49. app/design/frontend/base/default/template/avisverifies/css.phtml +0 -0
  50. app/design/frontend/base/default/template/avisverifies/float.phtml +0 -0
  51. app/design/frontend/base/default/template/avisverifies/js.phtml +0 -0
  52. app/design/frontend/base/default/template/avisverifies/left.phtml +0 -0
  53. app/design/frontend/base/default/template/avisverifies/list.phtml +1 -1
  54. app/design/frontend/base/default/template/avisverifies/observers/checkout.phtml +0 -0
  55. app/design/frontend/base/default/template/avisverifies/pagination.phtml +0 -0
  56. app/design/frontend/base/default/template/avisverifies/review/helper/list_summary.phtml +0 -0
  57. app/design/frontend/base/default/template/avisverifies/review/helper/product_summary.phtml +0 -0
  58. app/design/frontend/base/default/template/avisverifies/review/helper/product_summary_rdfa.phtml +0 -0
  59. app/design/frontend/base/default/template/avisverifies/review/helper/product_summary_schema.phtml +1 -1
  60. app/design/frontend/base/default/template/avisverifies/review/helper/review_summary.phtml +0 -0
  61. app/design/frontend/base/default/template/avisverifies/review/helper/summary.phtml +0 -0
  62. app/design/frontend/base/default/template/avisverifies/review/helper/summary_short.phtml +0 -0
  63. app/design/frontend/base/default/template/avisverifies/review/product/view/count.phtml +0 -0
  64. app/design/frontend/base/default/template/avisverifies/reviewProductList.phtml +0 -0
  65. app/design/frontend/base/default/template/avisverifies/right.phtml +0 -0
  66. app/design/frontend/default/default/layout/avisverifies.xml +0 -0
  67. app/design/frontend/default/default/template/avisverifies/catalogProductList.phtml +0 -0
  68. app/design/frontend/default/default/template/avisverifies/css.phtml +0 -0
  69. app/design/frontend/default/default/template/avisverifies/float.phtml +0 -0
  70. app/design/frontend/default/default/template/avisverifies/js.phtml +0 -0
  71. app/design/frontend/default/default/template/avisverifies/left.phtml +0 -0
  72. app/design/frontend/default/default/template/avisverifies/list.phtml +1 -1
  73. app/design/frontend/default/default/template/avisverifies/observers/checkout.phtml +0 -0
  74. app/design/frontend/default/default/template/avisverifies/pagination.phtml +0 -0
  75. app/design/frontend/default/default/template/avisverifies/review/helper/list_summary.phtml +0 -0
  76. app/design/frontend/default/default/template/avisverifies/review/helper/product_summary.phtml +0 -0
  77. app/design/frontend/default/default/template/avisverifies/review/helper/product_summary_rdfa.phtml +0 -0
  78. app/design/frontend/default/default/template/avisverifies/review/helper/product_summary_schema.phtml +1 -1
  79. app/design/frontend/default/default/template/avisverifies/review/helper/review_summary.phtml +0 -0
  80. app/design/frontend/default/default/template/avisverifies/review/helper/summary.phtml +0 -0
  81. app/design/frontend/default/default/template/avisverifies/review/helper/summary_short.phtml +0 -0
  82. app/design/frontend/default/default/template/avisverifies/review/product/view/count.phtml +0 -0
  83. app/design/frontend/default/default/template/avisverifies/reviewProductList.phtml +0 -0
  84. app/design/frontend/default/default/template/avisverifies/right.phtml +0 -0
  85. app/etc/modules/Netreviews_Avisverifies.xml +0 -0
  86. app/etc/modules/Netreviews_Pla.xml +12 -0
  87. app/locale/de_DE/avisverifies.csv +0 -0
  88. app/locale/en_AU/avisverifies.csv +0 -0
  89. app/locale/en_CA/avisverifies.csv +0 -0
  90. app/locale/en_GB/avisverifies.csv +0 -0
  91. app/locale/en_NZ/avisverifies.csv +0 -0
  92. app/locale/en_US/avisverifies.csv +0 -0
  93. app/locale/es_CL/avisverifies.csv +0 -0
  94. app/locale/es_CO/avisverifies.csv +0 -0
  95. app/locale/es_ES/avisverifies.csv +0 -0
  96. app/locale/es_MX/avisverifies.csv +0 -0
  97. app/locale/es_PE/avisverifies.csv +0 -0
  98. app/locale/fr_FR/avisverifies.csv +0 -0
  99. app/locale/it_IT/avisverifies.csv +0 -0
  100. app/locale/nl_NL/avisverifies.csv +49 -49
  101. app/locale/pt_BR/avisverifies.csv +3 -3
  102. app/locale/pt_PT/avisverifies.csv +3 -3
  103. package.xml +5 -5
  104. skin/frontend/base/default/images/avisverifies/Sceau_100de_DE.png +0 -0
  105. skin/frontend/base/default/images/avisverifies/Sceau_100en_AU.png +0 -0
  106. skin/frontend/base/default/images/avisverifies/Sceau_100en_CA.png +0 -0
  107. skin/frontend/base/default/images/avisverifies/Sceau_100en_GB.png +0 -0
  108. skin/frontend/base/default/images/avisverifies/Sceau_100en_NZ.png +0 -0
  109. skin/frontend/base/default/images/avisverifies/Sceau_100en_US.png +0 -0
  110. skin/frontend/base/default/images/avisverifies/Sceau_100es_CL.png +0 -0
  111. skin/frontend/base/default/images/avisverifies/Sceau_100es_CO.png +0 -0
  112. skin/frontend/base/default/images/avisverifies/Sceau_100es_ES.png +0 -0
  113. skin/frontend/base/default/images/avisverifies/Sceau_100es_MX.png +0 -0
  114. skin/frontend/base/default/images/avisverifies/Sceau_100es_PE.png +0 -0
  115. skin/frontend/base/default/images/avisverifies/Sceau_100fr_FR.png +0 -0
  116. skin/frontend/base/default/images/avisverifies/Sceau_100it_IT.png +0 -0
  117. skin/frontend/base/default/images/avisverifies/Sceau_100nl_NL.png +0 -0
  118. skin/frontend/base/default/images/avisverifies/Sceau_100pt_BR.png +0 -0
  119. skin/frontend/base/default/images/avisverifies/Sceau_100pt_PT.png +0 -0
  120. skin/frontend/base/default/images/avisverifies/Sceau_45de_DE.png +0 -0
  121. skin/frontend/base/default/images/avisverifies/Sceau_45en_AU.png +0 -0
  122. skin/frontend/base/default/images/avisverifies/Sceau_45en_CA.png +0 -0
  123. skin/frontend/base/default/images/avisverifies/Sceau_45en_GB.png +0 -0
  124. skin/frontend/base/default/images/avisverifies/Sceau_45en_NZ.png +0 -0
  125. skin/frontend/base/default/images/avisverifies/Sceau_45en_US.png +0 -0
  126. skin/frontend/base/default/images/avisverifies/Sceau_45es_CL.png +0 -0
  127. skin/frontend/base/default/images/avisverifies/Sceau_45es_CO.png +0 -0
  128. skin/frontend/base/default/images/avisverifies/Sceau_45es_ES.png +0 -0
  129. skin/frontend/base/default/images/avisverifies/Sceau_45es_MX.png +0 -0
  130. skin/frontend/base/default/images/avisverifies/Sceau_45es_PE.png +0 -0
  131. skin/frontend/base/default/images/avisverifies/Sceau_45fr_FR.png +0 -0
  132. skin/frontend/base/default/images/avisverifies/Sceau_45it_IT.png +0 -0
  133. skin/frontend/base/default/images/avisverifies/Sceau_45nl_NL.png +0 -0
  134. skin/frontend/base/default/images/avisverifies/Sceau_45pt_BR.png +0 -0
  135. skin/frontend/base/default/images/avisverifies/Sceau_45pt_PT.png +0 -0
  136. skin/frontend/base/default/images/avisverifies/etoile0.png +0 -0
  137. skin/frontend/base/default/images/avisverifies/etoile1.png +0 -0
  138. skin/frontend/base/default/images/avisverifies/etoile2.png +0 -0
  139. skin/frontend/base/default/images/avisverifies/etoile3.png +0 -0
  140. skin/frontend/base/default/images/avisverifies/etoile4.png +0 -0
  141. skin/frontend/base/default/images/avisverifies/etoile5.png +0 -0
  142. skin/frontend/base/default/images/avisverifies/mini_etoile_empty.png +0 -0
  143. skin/frontend/base/default/images/avisverifies/mini_etoile_full.png +0 -0
  144. skin/frontend/base/default/images/avisverifies/pagination-loader.gif +0 -0
  145. skin/frontend/default/default/images/avisverifies/Sceau_100de_DE.png +0 -0
  146. skin/frontend/default/default/images/avisverifies/Sceau_100en_AU.png +0 -0
  147. skin/frontend/default/default/images/avisverifies/Sceau_100en_CA.png +0 -0
  148. skin/frontend/default/default/images/avisverifies/Sceau_100en_GB.png +0 -0
  149. skin/frontend/default/default/images/avisverifies/Sceau_100en_NZ.png +0 -0
  150. skin/frontend/default/default/images/avisverifies/Sceau_100en_US.png +0 -0
  151. skin/frontend/default/default/images/avisverifies/Sceau_100es_CL.png +0 -0
  152. skin/frontend/default/default/images/avisverifies/Sceau_100es_CO.png +0 -0
  153. skin/frontend/default/default/images/avisverifies/Sceau_100es_ES.png +0 -0
  154. skin/frontend/default/default/images/avisverifies/Sceau_100es_MX.png +0 -0
  155. skin/frontend/default/default/images/avisverifies/Sceau_100es_PE.png +0 -0
  156. skin/frontend/default/default/images/avisverifies/Sceau_100fr_FR.png +0 -0
  157. skin/frontend/default/default/images/avisverifies/Sceau_100it_IT.png +0 -0
  158. skin/frontend/default/default/images/avisverifies/Sceau_100nl_NL.png +0 -0
  159. skin/frontend/default/default/images/avisverifies/Sceau_100pt_BR.png +0 -0
  160. skin/frontend/default/default/images/avisverifies/Sceau_100pt_PT.png +0 -0
  161. skin/frontend/default/default/images/avisverifies/Sceau_45de_DE.png +0 -0
  162. skin/frontend/default/default/images/avisverifies/Sceau_45en_AU.png +0 -0
  163. skin/frontend/default/default/images/avisverifies/Sceau_45en_CA.png +0 -0
  164. skin/frontend/default/default/images/avisverifies/Sceau_45en_GB.png +0 -0
  165. skin/frontend/default/default/images/avisverifies/Sceau_45en_NZ.png +0 -0
  166. skin/frontend/default/default/images/avisverifies/Sceau_45en_US.png +0 -0
  167. skin/frontend/default/default/images/avisverifies/Sceau_45es_CL.png +0 -0
  168. skin/frontend/default/default/images/avisverifies/Sceau_45es_CO.png +0 -0
  169. skin/frontend/default/default/images/avisverifies/Sceau_45es_ES.png +0 -0
  170. skin/frontend/default/default/images/avisverifies/Sceau_45es_MX.png +0 -0
  171. skin/frontend/default/default/images/avisverifies/Sceau_45es_PE.png +0 -0
  172. skin/frontend/default/default/images/avisverifies/Sceau_45fr_FR.png +0 -0
  173. skin/frontend/default/default/images/avisverifies/Sceau_45it_IT.png +0 -0
  174. skin/frontend/default/default/images/avisverifies/Sceau_45nl_NL.png +0 -0
  175. skin/frontend/default/default/images/avisverifies/Sceau_45pt_BR.png +0 -0
  176. skin/frontend/default/default/images/avisverifies/Sceau_45pt_PT.png +0 -0
  177. skin/frontend/default/default/images/avisverifies/etoile0.png +0 -0
  178. skin/frontend/default/default/images/avisverifies/etoile1.png +0 -0
  179. skin/frontend/default/default/images/avisverifies/etoile2.png +0 -0
  180. skin/frontend/default/default/images/avisverifies/etoile3.png +0 -0
  181. skin/frontend/default/default/images/avisverifies/etoile4.png +0 -0
  182. skin/frontend/default/default/images/avisverifies/etoile5.png +0 -0
  183. skin/frontend/default/default/images/avisverifies/mini_etoile_empty.png +0 -0
  184. skin/frontend/default/default/images/avisverifies/mini_etoile_full.png +0 -0
  185. skin/frontend/default/default/images/avisverifies/pagination-loader.gif +0 -0
app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/Export/Export.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Block/Observers/Checkout.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Block/Rating/Entity/Detailed.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Block/Review/Helper.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Block/Review/Product/View/List.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Helper/API.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Helper/Data.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Helper/Export.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Helper/Install.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Model/Average.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Model/Mysql4/Average.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Model/Mysql4/Average/Collection.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Model/Mysql4/Reviews.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Model/Mysql4/Reviews/Collection.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Model/Observers/Checkout/Track.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Model/Observers/Product/List.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Model/Observers/System.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Model/Reviews.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/Model/RichsnippetsList.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/controllers/Adminhtml/AvisverifiesController.php CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/controllers/DialogController.php CHANGED
@@ -2,7 +2,9 @@
2
class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Front_Action
3
{
4
5
- public function indexAction() {
6
7
/**************************************
8
* GET PARENT IDS FROM CHILD ID: *
@@ -372,12 +374,37 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
372
}
373
// if the product exist then do nothing
374
if (!$this->productExistInArray($tmp[$id],$order['product_id'])) {
375
- $tmp[$id]['products'][] = array(
376
'id_product' => $order['product_id'],
377
'name_product' => $order['product_name'],
378
'url' => $order['url'],
379
'url_image' => $order['url_image'],
380
);
381
}
382
$ordersIds[] = $id;
383
}
@@ -416,11 +443,11 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
416
417
protected function productExistInArray($array,$id) {
418
// first test if product array exist
419
- if (empty($tmp[$id]['products'])) {
420
return false;
421
}
422
// else
423
- foreach ($array as $prod) {
424
if ($prod['id_product'] == $id) {
425
return true;
426
}
@@ -674,35 +701,4 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
674
->addFieldToFilter('path','avisverifies/system/idwebsite')->getFirstItem();
675
return $storeConfig->getData('value');
676
}
677
-
678
- public function parentChildRelationship($productId) {
679
- // first test if id is pk or sku
680
- // check if is_numeric
681
- if(is_numeric($productId)){
682
- $product = Mage::getModel('catalog/product')->load($productId);
683
- if (!$product->getId()) {
684
- $product = Mage::getModel('catalog/product')->loadByAttribute('sku', 'stylobleu01');
685
- if (!$product->getId()) {
686
- return array();
687
- }
688
- }
689
- }
690
- else {
691
- $product = Mage::getModel('catalog/product')->loadByAttribute('sku', 'stylobleu01');
692
- if (!$product->getId()) {
693
- $product = Mage::getModel('catalog/product')->load($productId);
694
- if (!$product->getId()) {
695
- return array();
696
- }
697
- }
698
- }
699
- // ok now we have the product
700
- $returnedIds[] = $product->getId();
701
- // we check if product is parent.
702
- $childIds = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($product->getId());
703
- // now merge the ids
704
- foreach($childIds as $_ids){
705
- $returnedIds[] = $_ids;
706
- }
707
- }
708
}
2
class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Front_Action
3
{
4
5
+ protected $plaModuleCompatibale = 1;
6
+
7
+ public function indexAction() {
8
9
/**************************************
10
* GET PARENT IDS FROM CHILD ID: *
374
}
375
// if the product exist then do nothing
376
if (!$this->productExistInArray($tmp[$id],$order['product_id'])) {
377
+ // CODE UPDATED
378
+ $foo = array(
379
'id_product' => $order['product_id'],
380
'name_product' => $order['product_name'],
381
'url' => $order['url'],
382
'url_image' => $order['url_image'],
383
);
384
+ for($i=1;$i<11;$i++){
385
+ $name = 'info'.$i;
386
+ // product_mpn
387
+ if (!empty($order[$name])) {
388
+ $foo[$name] = $order[$name];
389
+ }
390
+ }
391
+ if (!empty($order['gtin'])) {
392
+ $foo['GTIN_UPC'] = $order['gtin'];
393
+ }
394
+ if (!empty($order['brand'])) {
395
+ $foo['brand_name'] = $order['brand'];
396
+ }
397
+ if (!empty($order['sku'])) {
398
+ $foo['sku'] = $order['sku'];
399
+ }
400
+ if (!empty($order['mpn'])) {
401
+ $foo['MPN'] = $order['mpn'];
402
+ }
403
+ if (!empty($order['category'])) {
404
+ $foo['category'] = $order['category'];
405
+ }
406
+ // CODE UPDATED END HERE
407
+ $tmp[$id]['products'][] = $foo;
408
}
409
$ordersIds[] = $id;
410
}
443
444
protected function productExistInArray($array,$id) {
445
// first test if product array exist
446
+ if (empty($array['products'])) {
447
return false;
448
}
449
// else
450
+ foreach ($array['products'] as $prod) {
451
if ($prod['id_product'] == $id) {
452
return true;
453
}
701
->addFieldToFilter('path','avisverifies/system/idwebsite')->getFirstItem();
702
return $storeConfig->getData('value');
703
}
704
}
app/code/local/Netreviews/Avisverifies/controllers/IndexController.php CHANGED
@@ -20,5 +20,5 @@ class Netreviews_Avisverifies_IndexController extends Mage_Core_Controller_Front
20
echo $html;
21
}
22
}
23
-
24
}
20
echo $html;
21
}
22
}
23
+
24
}
app/code/local/Netreviews/Avisverifies/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
<config>
3
<modules>
4
<Netreviews_Avisverifies>
5
- <version>2.6.7</version>
6
</Netreviews_Avisverifies>
7
</modules>
8
<global>
2
<config>
3
<modules>
4
<Netreviews_Avisverifies>
5
+ <version>2.6.8</version>
6
</Netreviews_Avisverifies>
7
</modules>
8
<global>
app/code/local/Netreviews/Avisverifies/etc/system.xml CHANGED
File without changes
app/code/local/Netreviews/Avisverifies/sql/avisverifies_setup/mysql4-install-2.0.0.php CHANGED
File without changes
app/code/local/Netreviews/Pla/Block/Adminhtml/Edit.php ADDED
@@ -0,0 +1,29 @@
1
+ <?php
2
+
3
+ class Netreviews_Pla_Block_Adminhtml_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
4
+
5
+ public function __construct(){
6
+ // save button , Main container
7
+ parent::__construct();
8
+ $this->_objectId = 'id';
9
+ $this->_blockGroup = 'netreviews_pla';
10
+ $this->_controller = 'adminhtml';
11
+ $this->_headerText = $this->__('Manage PLA');
12
+
13
+ $this->_updateButton('save', 'label', $this->__('Save'));
14
+
15
+ $this->_addButton('add_new', array(
16
+ 'label' => Mage::helper('catalog')->__('Export Product Info'),
17
+ 'onclick' => "setLocation('{$this->getUrl('*/*/exportProduct')}')",
18
+ 'class' => 'add'
19
+ ));
20
+
21
+ }
22
+
23
+ protected function _prepareLayout()
24
+ {
25
+ $this->_removeButton('back');
26
+ $this->_removeButton('reset');
27
+ return parent::_prepareLayout();
28
+ }
29
+ }
app/code/local/Netreviews/Pla/Block/Adminhtml/Edit/Content.php ADDED
@@ -0,0 +1,252 @@
1
+ <?php
2
+
3
+ class Netreviews_Pla_Block_Adminhtml_Edit_Content extends Mage_Adminhtml_Block_Template
4
+ {
5
+
6
+ protected static $feed = array();
7
+
8
+ public static function loadFeed() {
9
+ // get current store id
10
+ $storeCode = Mage::app()->getRequest()->getParam('store');
11
+ if (empty($storeCode)) {
12
+ static::$feed = array();
13
+ return '';
14
+ }
15
+ $store = Mage::getModel('core/store')->load($storeCode);
16
+ $storeId = $store->getId();
17
+ $config = Mage::getStoreConfig('avisverifies/extra/pla_configuration', $storeId);
18
+ // json decode
19
+ $json = json_decode($config,true);
20
+ static::$feed = (is_array($json))?$json : array();
21
+ }
22
+
23
+ public static function getAttributeCollection() {
24
+ $attribute_collection = Mage::getResourceModel('eav/entity_attribute_collection')
25
+ ->setItemObjectClass('catalog/resource_eav_attribute')
26
+ ->setEntityTypeFilter(Mage::getResourceModel('catalog/product')->getTypeId());
27
+ $array = array();
28
+
29
+ foreach($attribute_collection as $attribute) {
30
+ if (!self::skipAttribute($attribute->getAttributeCode())) {
31
+ $array[] = $attribute;
32
+ }
33
+ }
34
+
35
+ return $array;
36
+ }
37
+
38
+ public static function getAttributeOptionsArray($field) {
39
+
40
+ $options = array();
41
+ if ($field == 'id' || $field == 'sku') {
42
+ $options['Product Id'] = array(
43
+ 'code' => 'entity_id',
44
+ 'label' => 'Product Id',
45
+ );
46
+ }
47
+ foreach (self::getAttributeCollection() as $attribute) {
48
+ if ($field == 'id') {
49
+ if (!self::skipAttributeEntityId($attribute->getAttributeCode())) {
50
+ $options[$attribute->getFrontendLabel()] = array(
51
+ 'code' => $attribute->getAttributeCode(),
52
+ 'label' => ($attribute->getFrontendLabel())? $attribute->getFrontendLabel() : $attribute->getAttributeCode(),
53
+ );
54
+ }
55
+ }
56
+ elseif ($field == 'sku') {
57
+ if (!self::skipAttributeEntityId($attribute->getAttributeCode())) {
58
+ $options[$attribute->getFrontendLabel()] = array(
59
+ 'code' => $attribute->getAttributeCode(),
60
+ 'label' => ($attribute->getFrontendLabel())? $attribute->getFrontendLabel() : $attribute->getAttributeCode(),
61
+ );
62
+ }
63
+ }
64
+ elseif ($field == 'description') {
65
+ if (!self::skipAttributeDescription($attribute->getAttributeCode())) {
66
+ $options[$attribute->getFrontendLabel()] = array(
67
+ 'code' => $attribute->getAttributeCode(),
68
+ 'label' => ($attribute->getFrontendLabel())? $attribute->getFrontendLabel() : $attribute->getAttributeCode(),
69
+ );
70
+ }
71
+ }
72
+ elseif ($field == 'url_path') {
73
+ if (!self::skipAttributeLink($attribute->getAttributeCode())) {
74
+ $options[$attribute->getFrontendLabel()] = array(
75
+ 'code' => $attribute->getAttributeCode(),
76
+ 'label' => ($attribute->getFrontendLabel())? $attribute->getFrontendLabel() : $attribute->getAttributeCode(),
77
+ );
78
+ }
79
+ }
80
+ elseif ($field == 'brand') {
81
+ if (!self::skipAttributeBrand($attribute->getAttributeCode())) {
82
+ $options[$attribute->getFrontendLabel()] = array(
83
+ 'code' => $attribute->getAttributeCode(),
84
+ 'label' => ($attribute->getFrontendLabel())? $attribute->getFrontendLabel() : $attribute->getAttributeCode(),
85
+ );
86
+ }
87
+ }
88
+ elseif ($field == 'category') {
89
+ if (!self::skipAttributeBrand($attribute->getAttributeCode())) {
90
+ $options[$attribute->getFrontendLabel()] = array(
91
+ 'code' => $attribute->getAttributeCode(),
92
+ 'label' => ($attribute->getFrontendLabel())? $attribute->getFrontendLabel() : $attribute->getAttributeCode(),
93
+ );
94
+ }
95
+ }
96
+ elseif ($field == 'image_link') {
97
+ if (!self::skipAttributeImageLink($attribute->getAttributeCode())) {
98
+ $options[$attribute->getFrontendLabel()] = array(
99
+ 'code' => $attribute->getAttributeCode(),
100
+ 'label' => ($attribute->getFrontendLabel())? $attribute->getFrontendLabel() : $attribute->getAttributeCode(),
101
+ );
102
+ }
103
+ }
104
+ elseif ($field == 'gtin') {
105
+ if (!self::skipAttributeGTIN($attribute->getAttributeCode())) {
106
+ $options[$attribute->getFrontendLabel()] = array(
107
+ 'code' => $attribute->getAttributeCode(),
108
+ 'label' => ($attribute->getFrontendLabel())? $attribute->getFrontendLabel() : $attribute->getAttributeCode(),
109
+ );
110
+ }
111
+ }
112
+ elseif ($field == 'mpn') {
113
+ if (!self::skipAttributeMPN($attribute->getAttributeCode())) {
114
+ $options[$attribute->getFrontendLabel()] = array(
115
+ 'code' => $attribute->getAttributeCode(),
116
+ 'label' => ($attribute->getFrontendLabel())? $attribute->getFrontendLabel() : $attribute->getAttributeCode(),
117
+ );
118
+ }
119
+ }
120
+ else {
121
+ $options[$attribute->getFrontendLabel()] = array(
122
+ 'code' => $attribute->getAttributeCode(),
123
+ 'label' => ($attribute->getFrontendLabel())? $attribute->getFrontendLabel() : $attribute->getAttributeCode(),
124
+ );
125
+ }
126
+ }
127
+ ksort($options);
128
+ return $options;
129
+ }
130
+
131
+ public static function skipAttributeMPN($code) {
132
+ $array = array('description','image','name','samples_title',
133
+ 'short_description','small_image','thumbnail','url_path');
134
+ if (in_array($code, $array)) {
135
+ return true;
136
+ }
137
+ else {
138
+ return false;
139
+ }
140
+ }
141
+
142
+ public static function skipAttributeGTIN($code) {
143
+ $array = array('description','image','name','samples_title',
144
+ 'short_description','small_image','thumbnail','url_path');
145
+ if (in_array($code, $array)) {
146
+ return true;
147
+ }
148
+ else {
149
+ return false;
150
+ }
151
+ }
152
+
153
+ public static function skipAttributeImageLink($code) {
154
+ $array = array('brand','country_of_manufacture','description','manufacturer','name','samples_title',
155
+ 'short_description','sku','url_path');
156
+ if (in_array($code, $array)) {
157
+ return true;
158
+ }
159
+ else {
160
+ return false;
161
+ }
162
+ }
163
+
164
+ public static function skipAttributeBrand($code) {
165
+ $array = array('url_path','image','small_image','thumbnail','sku');
166
+ if (in_array($code, $array)) {
167
+ return true;
168
+ }
169
+ else {
170
+ return false;
171
+ }
172
+ }
173
+
174
+ public static function skipAttributeLink($code) {
175
+ $array = array('brand','country_of_manufacture','description','image','manufacturer','name','samples_title',
176
+ 'short_description','small_image','thumbnail','sku');
177
+ if (in_array($code, $array)) {
178
+ return true;
179
+ }
180
+ else {
181
+ return false;
182
+ }
183
+ }
184
+
185
+ public static function skipAttributeDescription($code) {
186
+ $array = array('country_of_manufacture','image','small_image','thumbnail','url_path','sku');
187
+ if (in_array($code, $array)) {
188
+ return true;
189
+ }
190
+ else {
191
+ return false;
192
+ }
193
+ }
194
+
195
+ public static function skipAttributeEntityId($code) {
196
+ $array = array('brand','country_of_manufacture','description','image','manufacturer','name','samples_title',
197
+ 'short_description','small_image','thumbnail','url_path');
198
+ if (in_array($code, $array)) {
199
+ return true;
200
+ }
201
+ else {
202
+ return false;
203
+ }
204
+ }
205
+
206
+ public static function skipAttribute($code) {
207
+ $array = array('color','cost','created_at','custom_design','custom_design_from','custom_design_to',
208
+ 'custom_layout_update','gift_message_available','group_price','has_options','is_recurring','links_exist',
209
+ 'links_purchased_separately','links_title','minimal_price','news_from_date','news_to_date','options_container',
210
+ 'page_layout','price','msrp','msrp_display_actual_price_type','msrp_enabled','price_type','price_view','recurring_profile',
211
+ 'shirt_size','special_from_date','special_price','special_to_date','status','tax_class_id','tier_price','updated_at','weight',
212
+ 'weight_type','meta_description','meta_keyword','meta_title','category_ids','gallery','image_label','media_gallery','old_id',
213
+ 'required_options','shipment_type','sku_type','small_image_label','thumbnail_label','visibility','url_key'
214
+ );
215
+ if (in_array($code, $array)) {
216
+ return true;
217
+ }
218
+ else {
219
+ return false;
220
+ }
221
+ }
222
+
223
+ public static function getAttributeSelect($field) {
224
+ $options = array();
225
+ $options[] = "<option value=''>Not Set</option>";
226
+ foreach (self::getAttributeOptionsArray($field) as $attribute) {
227
+ $selected = self::getIsSelected($field,$attribute['code']);
228
+ $options[] = "<option value=\"{$attribute['code']}\" {$selected}>{$attribute['label']}</option>";
229
+ }
230
+ return implode('', $options);
231
+ }
232
+
233
+ public static function getIsSelected($field,$code) {
234
+ // if feed is empty then use standard mapping
235
+ if (static::getFeedArrayData($field) == $code) {
236
+ return ' selected="selected" ';
237
+ }// else use the saved mapping
238
+ else {
239
+ return '';
240
+ }
241
+ }
242
+
243
+ public static function getFeedArrayData($field){
244
+ foreach (static::$feed as $array) {
245
+ if (isset($array['name']) && $array['name'] == $field) {
246
+ return $array['static_value'];
247
+ }
248
+ }
249
+ return false;
250
+ }
251
+
252
+ }
app/code/local/Netreviews/Pla/Block/Adminhtml/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
1
+ <?php
2
+
3
+ class Netreviews_Pla_Block_Adminhtml_Edit_Form extends Mage_Adminhtml_Block_Widget_Form{
4
+
5
+ protected function _prepareForm(){
6
+ // auto called by magento
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('store' => $this->getRequest()->getParam('store'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ ));
13
+
14
+ $form->setUseContainer(true);
15
+ $this->setForm($form);
16
+
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Netreviews/Pla/Block/Adminhtml/Form/Export/Export.php ADDED
@@ -0,0 +1,16 @@
1
+ <?php
2
+ class Netreviews_Pla_Block_Adminhtml_Form_Export_Export extends Netreviews_Avisverifies_Block_Adminhtml_Form_Export_Export
3
+ {
4
+ protected function _prepareForm() {
5
+ parent::_prepareForm();
6
+ $fieldset = $this->getForm()->getElement('export');
7
+ $fieldset->removeField('sku');
8
+ $fieldset->addField('sku', 'hidden', array(
9
+ 'required' => false,
10
+ 'name' => 'sku',
11
+ 'value' => 0,
12
+ ));
13
+ return $this; // @return Mage_Adminhtml_Block_Widget_Form
14
+ }
15
+
16
+ }
app/code/local/Netreviews/Pla/Block/Adminhtml/Tabs.php ADDED
@@ -0,0 +1,22 @@
1
+ <?php
2
+
3
+ class Netreviews_Pla_Block_Adminhtml_Tabs extends Mage_Adminhtml_Block_Widget_Tabs {
4
+
5
+ public function __construct(){
6
+ // tabs section
7
+ parent::__construct();
8
+ $this->setId('netreviews_pla_tabs');
9
+ $this->setDestElementId('edit_form');
10
+ $this->setTitle($this->__('PLA Information'));
11
+ }
12
+
13
+ protected function _prepareLayout(){
14
+ $this->addTab('content_section', array(
15
+ 'label' => $this->__('Content Settings'),
16
+ 'title' => $this->__('Content Settings'),
17
+ 'content' => $this->getLayout()->createBlock('netreviews_pla/adminhtml_edit_content')
18
+ ->setTemplate('netreviews/pla/content.phtml')->toHtml(),
19
+ ));
20
+ return parent::_beforeToHtml();
21
+ }
22
+ }
app/code/local/Netreviews/Pla/Helper/Data.php ADDED
@@ -0,0 +1,51 @@
1
+ <?php
2
+ class Netreviews_Pla_Helper_Data extends Mage_Core_Helper_Abstract{
3
+
4
+ public function getGoogleContentArray(){
5
+ $data[] = array(
6
+ "name" => "id",
7
+ "attribute_value" => "entity_id"
8
+ );
9
+ $data[] = array(
10
+ "name" => "sku",
11
+ "attribute_value" => "sku"
12
+ );
13
+ $data[] = array(
14
+ "name" => "description",
15
+ "attribute_value" => "description"
16
+ );
17
+ $data[] = array(
18
+ "name" => "link",
19
+ "attribute_value" => "url_path"
20
+ );
21
+ $data[] = array(
22
+ "name" => "image_link",
23
+ "attribute_value" => "image_link"
24
+ );
25
+ $data[] = array(
26
+ "name" => "brand",
27
+ "attribute_value" => "brand"
28
+ );
29
+ $data[] = array(
30
+ "name" => "category",
31
+ "attribute_value" => "category"
32
+ );
33
+ $data[] = array(
34
+ "name" => "gtin",
35
+ "attribute_value" => "gtin"
36
+ );
37
+ $data[] = array(
38
+ "name" => "mpn",
39
+ "attribute_value" => "mpn"
40
+ );
41
+ for($i=1;$i<11;$i++){
42
+ $data[] = array(
43
+ "name" => "Extra Info".$i,
44
+ "attribute_value" => "info".$i
45
+ );
46
+ }
47
+
48
+ return $data;
49
+
50
+ }
51
+ }
app/code/local/Netreviews/Pla/Helper/Export.php ADDED
@@ -0,0 +1,441 @@
1
+ <?php // Our EXPORT CLASS.
2
+ class Netreviews_Pla_Helper_Export extends Netreviews_Avisverifies_Helper_Export{
3
+ protected $collection;
4
+
5
+ protected $plaProducts = array();
6
+ protected $defaultProducts = array();
7
+ protected $newCsvHeader = array();
8
+
9
+
10
+ public function __construct() {
11
+ $this->collection = Mage::getModel("sales/order")->getCollection();
12
+ $this->resource = Mage::getSingleton('core/resource');
13
+ $this->dataExport = array();
14
+ $this->newCsvHeader[] = array(
15
+ 'id_order',
16
+ 'email',
17
+ 'lastname',
18
+ 'firstname',
19
+ 'date_order',
20
+ 'delay',
21
+ 'id_shop',
22
+ 'amount_order',
23
+ 'id_order_state',
24
+ 'id_product',
25
+ 'sku',
26
+ 'description',
27
+ 'product_url',
28
+ 'url_image',
29
+ 'brand',
30
+ 'category',
31
+ 'gtin',
32
+ 'mpn',
33
+ 'info1','info2','info3',
34
+ 'info4','info5','info6',
35
+ 'info7','info8','info9','info10'
36
+ );
37
+ // check for sale order module version
38
+ $version = Mage::getConfig()->getModuleConfig("Mage_Sales")->version;
39
+ $version = $this->convertVersion($version);
40
+ // stable version (known): 1.4.0.15, but going with 1.4.0.0
41
+ $stableVersion = $this->convertVersion('1.4.0.0');
42
+ $this->isVersion13 = ($version < $stableVersion)? true : false;
43
+
44
+ }
45
+
46
+ public function getDataExport(){
47
+ // some memory optimization
48
+ $dataExport = ($this->dataExport)? $this->dataExport : array();
49
+ $this->dataExport = array();
50
+ $this->collection = Null;
51
+ return $dataExport;
52
+ }
53
+
54
+ public function createExportCSV($from,$to){
55
+ $this->newQuery();
56
+
57
+ $results = Mage::getSingleton('core/resource')->getConnection('core_read')->query("select $from as date_time")->fetch();
58
+ $this->collection->addAttributeToFilter('created_at', array('gteq' =>$results['date_time']));
59
+ $this->dataExport = array_merge($this->newCsvHeader,$this->reformatDataForCSV($this->collectionPagination()));
60
+ }
61
+
62
+ public function createExportAPI(array $config){
63
+ $this->newQuery();
64
+ // filter by date
65
+ if (isset($config['from']) && isset($config['to'])) {
66
+ $this->collection->addAttributeToFilter('created_at', array(
67
+ 'from' => $config['from'],
68
+ 'to' => $config['to'],
69
+ 'date' => true, // specifies conversion of comparison values
70
+ ));
71
+ }
72
+ // filter by av_flag
73
+ if (isset($config['flag'])) {
74
+ $this->collection->addFieldToFilter('av_flag', 0);
75
+ }
76
+ // filter by status
77
+ if (isset($config['status'])) {
78
+ $this->collection->addAttributeToFilter('status',array("in"=>$config['status']));
79
+ }
80
+
81
+ $this->dataExport = $this->collectionPagination();
82
+ }
83
+
84
+ protected function newQuery(){
85
+ $this->collection
86
+ ->addFieldToFilter('store_id', $this->arrStoresIds)
87
+ ->addAttributeToSort('entity_id', 'DESC')
88
+ ->addAttributeToSelect('entity_id')
89
+ ->addAttributeToSelect('increment_id')
90
+ ->addAttributeToSelect('grand_total')
91
+ ->addAttributeToSelect('av_flag')
92
+ ->addAttributeToSelect('av_horodate_get')
93
+ ->addAttributeToSelect('status')
94
+ ->addAttributeToSelect('customer_email')
95
+ ->addAttributeToSelect('customer_firstname')
96
+ ->addAttributeToSelect('customer_lastname')
97
+ ->addAttributeToSelect('store_id')
98
+ ->setPageSize(50);
99
+ $this->collection->getSelect()->columns('DATE_FORMAT(created_at,"%d/%m/%Y %H:%i") as createdAtt')
100
+ ->columns('UNIX_TIMESTAMP(created_at) as timestamp');
101
+
102
+
103
+ }
104
+
105
+ protected function collectionPagination(){
106
+ $page = 1; // 0 & 1 are the same pages.
107
+ $pages = $this->collection->getLastPageNumber();
108
+ $orders = array();
109
+ $pla = $this->getAllPlaConfiguration();
110
+ $allShops = $this->getAllShopName();
111
+ try
112
+ {
113
+ do {
114
+ $this->collection->setCurPage($page)->load();
115
+ foreach ($this->collection as $order) {
116
+ $order_data = array();
117
+ $products_data = array();
118
+ $storeId = $order->getStoreId();
119
+ $order_data['entity_id'] = $order->getEntityId();
120
+ $order_data['order_id'] = $order->getIncrementId();
121
+ $order_data['date'] = $order->getData('createdAtt');
122
+ $order_data['timestamp'] = $order->getTimestamp();
123
+ $order_data['amount_order'] = $order->getGrandTotal();
124
+ $order_data['date_av_getted_order'] = $order->getAvHorodateGet();
125
+ $order_data['is_flag'] = $order->getAvFlag();
126
+ $order_data['status_order'] = $order->getstatus();
127
+ $order_data['prenom'] = utf8_decode($order->getCustomerFirstname());
128
+ $order_data['nom'] = utf8_decode($order->getCustomerLastname());
129
+ $order_data['email'] = $order->getCustomerEmail();
130
+ $order_data['id_shop'] = $allShops[$storeId];
131
+ // check if option get product active
132
+ if ($this->isProductExport && empty($pla[$storeId])) { // default Product array compatible with our API return
133
+ $products_data = $this->defaultProductsData($order);
134
+ }
135
+ elseif ($this->isProductExport) { // PLA Product array compatible with our API return
136
+ $products_data = $this->plaProductsData($order,$pla[$storeId]);
137
+ }
138
+ else { // default EMPTY array compatible with our API return
139
+ $products_data[] = array('product_id' =>'','product_name' =>'','url' =>'','url_image' =>'');
140
+ }
141
+ // create multiple line per product
142
+ foreach($products_data as $_tmp){
143
+ $order_data = array_merge($order_data,$_tmp);
144
+ $orders[] = $order_data;
145
+ }
146
+ $orders[] = $order_data;
147
+ }
148
+ $page++;
149
+ $this->collection->clear();
150
+ } while ($page <= $pages);
151
+ } catch(Exception $e) {var_dump($e);}
152
+ // some memory optimisation
153
+ $this->plaProducts = array();
154
+ $this->defaultProducts = array();
155
+ return $orders;
156
+ }
157
+
158
+ protected function plaProductsData($order,$pla){
159
+ // var_dump($pla);die;
160
+ $products = $order->getAllVisibleItems(); //filter out simple products
161
+ $products_arr = array();
162
+ foreach ($products as $product) {
163
+ $productId = $product->getProductId();
164
+ if (!empty($this->plaProducts[$productId])) {
165
+ $products_arr[] = $this->plaProducts[$productId];
166
+ }
167
+ else {
168
+ $full_product = Mage::getModel('catalog/product')->load($productId);
169
+ $collection = Mage::getModel('catalog/product')->getCollection();
170
+ $collection->addAttributeToFilter('entity_id', $productId);
171
+ $collection->addAttributeToSelect('entity_id');
172
+ // get product $data according to format pla
173
+ foreach($pla as $fields){
174
+ // first check if its the product id
175
+ $collection->addAttributeToSelect($fields['static_value']);
176
+ }
177
+ $full_product = $collection->getFirstItem();
178
+ $tmp_product = Mage::getModel('catalog/product')->load($productId);
179
+ $_data = $full_product->getData();
180
+ $product_data = array();
181
+ foreach ($pla as $attribute) {
182
+ // product_id
183
+ if ($attribute['name'] == 'id') {
184
+ $_val = $full_product->getData($attribute['static_value']);
185
+ $product_data['product_id'] = ($_val)? $_val : '';
186
+ }
187
+ // product_description
188
+ if ($attribute['name'] == 'description') {
189
+ $_val = $full_product->getData($attribute['static_value']);
190
+ $product_data['product_name'] = ($_val)? $_val : '';
191
+ }
192
+ // product_link
193
+ if ($attribute['name'] == 'link') {
194
+ // get parent URL or NOT
195
+ $product_data['url'] = $this->getProductUrlOrParentUrl($productId,$full_product->getData($attribute['static_value']),$order->getStoreId(),true);
196
+ }
197
+ // product_image_link
198
+ if ($attribute['name'] == 'image_link') {
199
+ $product_data['url_image'] = $this->getProductImageOrParentImage($productId,$full_product->getData($attribute['static_value']),true);
200
+ }
201
+ // product_sku
202
+ if ($attribute['name'] == 'sku') {
203
+ $_val = $full_product->getData($attribute['static_value']);
204
+ $product_data['sku'] = ($_val)? $_val : '';
205
+ }
206
+ // product_brand
207
+ if ($attribute['name'] == 'brand') {
208
+ $_val = $full_product->getData($attribute['static_value']);
209
+ $product_data['brand'] = ($_val)? $_val : '';
210
+ }
211
+ // product_category
212
+ if ($attribute['name'] == 'category') {
213
+ $_val = $full_product->getData($attribute['static_value']);
214
+ $product_data['category'] = ($_val)? $_val : '';
215
+ }
216
+ // product_gtin
217
+ if ($attribute['name'] == 'gtin') {
218
+ $_val = $full_product->getData($attribute['static_value']);
219
+ $product_data['gtin'] = ($_val)? $_val : '';
220
+ }
221
+ // product_mpn
222
+ if ($attribute['name'] == 'mpn') {
223
+ $_val = $full_product->getData($attribute['static_value']);
224
+ $product_data['mpn'] = ($_val)? $_val : '';
225
+ }
226
+ // extra info 1 to 10
227
+ for($i=1;$i<11;$i++){
228
+ $name = 'Extra Info'.$i;
229
+ // product_mpn
230
+ if ($attribute['name'] == $name) {
231
+ $_val = $full_product->getData($attribute['static_value']);
232
+ $product_data['info'.$i] = ($_val)? $_val : '';
233
+ }
234
+ }
235
+ }
236
+
237
+ // now test if basic value are present , if not the add them
238
+ // product_id
239
+ if (empty($product_data['product_id'])) {
240
+ $product_data['product_id'] = $tmp_product->getId();
241
+ }
242
+ // product_description
243
+ if (empty($product_data['product_name'])) {
244
+ $product_data['product_name'] = utf8_decode(str_replace(",", " - ", $tmp_product->getName()));
245
+ }
246
+ // product_link
247
+ if (empty($product_data['url'])) {
248
+ $product_data['url'] = $this->getProductUrlOrParentUrl($productId,$tmp_product->getUrlInStore(array('_store' => $order->getStoreId())),$order->getStoreId());
249
+ }
250
+ // product_image_link
251
+ if (empty($product_data['url_image'])) {
252
+ try{
253
+ $product_data['url_image'] = $this->getProductImageOrParentImage($productId,$tmp_product->getImageUrl());
254
+
255
+ }catch(Exception $e) {
256
+ $product_data['url_image'] = '';
257
+ };
258
+ }
259
+ // product_sku
260
+ if (empty($product_data['sku'])) {
261
+ $product_data['sku'] = $full_product->getSku();
262
+ }
263
+ $products_arr[] = $this->plaProducts[$productId] = $product_data;
264
+ }
265
+ }
266
+ return $products_arr;
267
+ }
268
+
269
+ protected function defaultProductsData($order){
270
+ $products = $order->getAllVisibleItems(); //filter out simple products
271
+ $products_arr = array();
272
+ foreach ($products as $product) {
273
+ $productId = $product->getProductId();
274
+ if (!empty($this->defaultProducts[$productId])) {
275
+ $products_arr[] = $this->defaultProducts[$productId];
276
+ }
277
+ else {
278
+ $full_product = Mage::getModel('catalog/product')->load($productId);
279
+ $product_data = array();
280
+ $product_data['product_name'] = utf8_decode(str_replace(",", " - ", $full_product->getName()));
281
+ $product_data['product_id'] = $full_product->getId();
282
+ $product_data['sku'] = $full_product->getSku();
283
+ $product_data['url'] = '';
284
+ $product_data['url_image'] = '';
285
+ try
286
+ {
287
+ $product_data['url'] = $this->getProductUrlOrParentUrl($productId,$full_product->getUrlInStore(array('_store' => $order->getStoreId())),$order->getStoreId());
288
+ $product_data['url_image'] = $this->getProductImageOrParentImage($productId,$full_product->getImageUrl());
289
+ } catch(Exception $e) {}
290
+
291
+ $products_arr[] = $this->defaultProducts[$productId] = $product_data;
292
+ }
293
+
294
+ }
295
+ return $products_arr;
296
+ }
297
+
298
+ public function getAllPlaConfiguration(){
299
+ $resource = Mage::getModel("core/config_data")->getCollection()
300
+ ->addFieldToFilter('scope','stores')
301
+ ->addFieldToFilter('path','avisverifies/extra/pla_configuration');
302
+ $array = array();
303
+ foreach ($resource as $store) {
304
+ $json = json_decode($store->getData('value'),true);
305
+ if (is_array($json)) {
306
+ $array[$store->getData('scope_id')] = $json;
307
+ }
308
+ }
309
+ return $array;
310
+ }
311
+
312
+ public function getAllShopName(){
313
+ $array = array();
314
+ foreach (Mage::getModel('core/store')->getCollection() as $store) {
315
+ $array[$store->getId()] = $store->getName();
316
+ }
317
+ return $array;
318
+ }
319
+
320
+
321
+ protected function reformatDataForCSV($data){
322
+ $tmp = array();
323
+ foreach ($data as $value){
324
+ if (!empty($value['product_id']) && !empty($value['product_name'])) {
325
+ $tmp[] = array(
326
+ $value['order_id'],
327
+ $value['email'],
328
+ $value['nom'],
329
+ $value['prenom'],
330
+ $value['date'],
331
+ $this->delay,
332
+ $value['id_shop'],
333
+ $value['amount_order'],
334
+ $value['status_order'],
335
+ $this->safeAccessAray($value,'product_id'),
336
+ $this->safeAccessAray($value,'sku'),
337
+ $this->safeAccessAray($value,'product_name'),
338
+ $this->safeAccessAray($value,'url'),
339
+ $this->safeAccessAray($value,'url_image'),
340
+ $this->safeAccessAray($value,'brand'),
341
+ $this->safeAccessAray($value,'category'),
342
+ $this->safeAccessAray($value,'gtin'),
343
+ $this->safeAccessAray($value,'mpn'),
344
+ $this->safeAccessAray($value,'info1'),
345
+ $this->safeAccessAray($value,'info2'),
346
+ $this->safeAccessAray($value,'info3'),
347
+ $this->safeAccessAray($value,'info4'),
348
+ $this->safeAccessAray($value,'info5'),
349
+ $this->safeAccessAray($value,'info6'),
350
+ $this->safeAccessAray($value,'info7'),
351
+ $this->safeAccessAray($value,'info8'),
352
+ $this->safeAccessAray($value,'info9'),
353
+ $this->safeAccessAray($value,'info10'),
354
+ );
355
+ }
356
+ else {
357
+ $tmp[$value['order_id']] = array(
358
+ $value['order_id'],
359
+ $value['email'],
360
+ $value['nom'],
361
+ $value['prenom'],
362
+ $value['date'],
363
+ $this->delay,
364
+ $value['id_shop'],
365
+ $value['amount_order'],
366
+ $value['status_order'],
367
+ );
368
+ }
369
+
370
+ }
371
+ return $tmp;
372
+ }
373
+
374
+ public function safeAccessAray($array,$index){
375
+ return isset($array[$index])? $array[$index] : '';
376
+ }
377
+
378
+ public function getProductUrlOrParentUrl($productId,$URL,$storeId,$baseURL = false){
379
+
380
+ if (!$this->forceParentId) {
381
+ $baseUrl = ($baseURL)? Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) : '';
382
+ return ($URL)? $baseUrl.$URL : '';
383
+ }
384
+ // get parent Id
385
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($productId);
386
+ if (count($parentIds) > 0) {
387
+ $product = Mage::getModel('catalog/product')->load($parentIds[0]);
388
+ return $product->getUrlInStore(array('_store' => $order->getStoreId()));
389
+ }
390
+ else {
391
+ $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($productId);
392
+ if (count($parentIds) > 0) {
393
+ $product = Mage::getModel('catalog/product')->load($parentIds[0]);
394
+ return $product->getUrlInStore(array('_store' => $storeId));
395
+ }
396
+ }
397
+ // else
398
+ $product = Mage::getModel('catalog/product')->load($productId);
399
+ return $product->getUrlInStore(array('_store' => $storeId));
400
+ }
401
+
402
+ public function getProductImageOrParentImage($productId,$URL,$baseURL = false){
403
+
404
+ if (!$this->forceParentId) {
405
+ $baseUrl = ($baseURL)? Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."catalog/product" : '';
406
+ return ($URL)? $baseUrl.$URL : '';
407
+ }
408
+ // get parent Id
409
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($productId);
410
+ if (count($parentIds) > 0) {
411
+ $product = Mage::getModel('catalog/product')->load($parentIds[0]);
412
+ try {
413
+ return $product->getImageUrl();
414
+ }
415
+ catch(Exception $e) {
416
+ return '';
417
+ }
418
+ }
419
+ else {
420
+ $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($productId);
421
+ if (count($parentIds) > 0) {
422
+ $product = Mage::getModel('catalog/product')->load($parentIds[0]);
423
+ try {
424
+ return $product->getImageUrl();
425
+ }
426
+ catch(Exception $e) {
427
+ return '';
428
+ }
429
+ }
430
+ }
431
+ // else
432
+ $product = Mage::getModel('catalog/product')->load($productId);
433
+ try {
434
+ return $product->getImageUrl();
435
+ }
436
+ catch(Exception $e) {
437
+ return '';
438
+ }
439
+ }
440
+
441
+ }
app/code/local/Netreviews/Pla/controllers/Adminhtml/NetreviewsplaController.php ADDED
@@ -0,0 +1,181 @@
1
+ <?php
2
+ class Netreviews_Pla_Adminhtml_NetreviewsplaController extends Mage_Adminhtml_Controller_Action
3
+ {
4
+
5
+ public function exportProductAction()
6
+ {
7
+ $export = Mage::helper('netreviews_pla/Export');
8
+ $plaAll = $export->getAllPlaConfiguration();
9
+ $allShops = $export->getAllShopName();
10
+ $path = Mage::getBaseDir('var') . DS . 'export' . DS;
11
+ $mediaUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."catalog/product";
12
+
13
+ $allFiles = array();
14
+ foreach ($allShops as $storeId=>$storeName) {
15
+ $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
16
+ $data = array();
17
+ $collections = Mage::getModel('catalog/product')->getCollection();
18
+ $collections->addStoreFilter($storeId);
19
+ $collections->addAttributeToSelect('entity_id');
20
+ $collections->addAttributeToSelect('sku');
21
+ $collections->addAttributeToSelect('small_image');
22
+ $collections->addAttributeToSelect('url_path');
23
+ $collections->addAttributeToSelect('name');
24
+ // get product $data according to format pla
25
+ $tmp = array();
26
+ if (isset($plaAll[$storeId])) {
27
+ foreach($plaAll[$storeId] as $fields){
28
+ // first check if its the product id
29
+ $collections->addAttributeToSelect($fields['static_value']);
30
+ $tmp[] = $fields['static_value'];
31
+ }
32
+ }
33
+ $data[] = array_merge(array('storeName','storeId','productId','sku','productName','url','image','-----Pla Info-----'),$tmp);
34
+ foreach($collections as $collection) {
35
+ $array = $collection->getData();
36
+ $tmp = array();
37
+ $tmp[] = $storeName;
38
+ $tmp[] = $storeId;
39
+ $tmp[] = (isset($array['entity_id']))?$array['entity_id'] : "NULL";
40
+ $tmp[] = (isset($array['sku']))?$array['sku'] : "NULL";
41
+ $tmp[] = (isset($array['name']))?$array['name'] : "NULL";
42
+ $tmp[] = (isset($array['url_path']))? $baseUrl.$array['url_path'] : "NULL";
43
+ $tmp[] = (isset($array['small_image']) && $array['small_image'] != 'no_selection')?$mediaUrl.$array['small_image'] : "NULL";
44
+ $tmp[] = '-----';
45
+ // get product $data according to format pla
46
+ if (isset($plaAll[$storeId])) {
47
+ foreach($plaAll[$storeId] as $fields){
48
+ // first check if its the product id
49
+ $tmp[] = (isset($array[$fields['static_value']]))? $array[$fields['static_value']] : "NULL";
50
+ }
51
+ }
52
+ $data[] = $tmp;
53
+ }
54
+
55
+ $fileName = $allFiles[] = $path.'exportProduct_'.$storeId.'.csv';
56
+ $fp = fopen($fileName, 'w');
57
+ foreach ($data as $fields){
58
+ fputcsv($fp, $fields);
59
+ }
60
+ fclose($fp);
61
+ }
62
+
63
+
64
+ $tmpName = 'exportProduct'.date("ymdhis").'.zip';
65
+ $zipname = $path.$tmpName;
66
+ $zip = new ZipArchive;
67
+ $zip->open($zipname, ZipArchive::CREATE);
68
+ foreach ($allFiles as $file) {
69
+ $zip->addFile($file);
70
+ }
71
+ $zip->close();
72
+
73
+ ///Then download the zipped file.
74
+ header('Content-Type: application/zip');
75
+ header('Content-disposition: attachment; filename='.$tmpName);
76
+ header('Content-Length: ' . filesize($zipname));
77
+ readfile($zipname);
78
+ die;
79
+ }
80
+
81
+ public function plaAction()
82
+ {
83
+ $this->loadLayout();
84
+ $this->_addContent($this->getLayout()->createBlock('netreviews_pla/adminhtml_edit')) // save button
85
+ ->_addLeft($this->getLayout()->createBlock('netreviews_pla/adminhtml_tabs')); // tabs + content
86
+ $this->renderLayout();
87
+ }
88
+
89
+ public function saveAction()
90
+ {
91
+ // get current store id
92
+ $storeCode = Mage::app()->getRequest()->getParam('store');
93
+ $website = Mage::app()->getRequest()->getParam('website');
94
+
95
+ if (empty($storeCode)) {
96
+ Mage::getSingleton('core/session')->addError('Please select a store view');
97
+ $this->_redirect('*/*/pla');
98
+ return;
99
+ }
100
+ else {
101
+ $store = Mage::getModel('core/store')->load($storeCode);
102
+ $storeId = $store->getId();
103
+ }
104
+
105
+ $post = $this->getRequest()->getPost();
106
+ // first of all save the sku / id configuration
107
+ $test = $this->getDataField($post,'id');
108
+ // id is set to sku , then update the store config sku
109
+ if (empty($test['static_value'])) {
110
+ Mage::getSingleton('core/session')->addError('Please try again');
111
+ $this->_redirect('*/*/pla/website/'.$website.'/store/'.$storeCode);
112
+ return;
113
+ }
114
+
115
+ $mageselc = new Mage_Core_Model_Config();
116
+ /* Code Change
117
+ if ($test['static_value'] == 'sku') {
118
+ $mageselc->saveConfig('avisverifies/extra/use_product_sku',1,'stores',$storeId);
119
+ }
120
+ else {
121
+ $mageselc->saveConfig('avisverifies/extra/use_product_sku',NULL,'stores',$storeId);
122
+ }
123
+ */
124
+ // now the data filtered from empty values
125
+ $filtered = $this->getDataFiltered($post);
126
+ // now we loop over the eav to get the id
127
+ foreach($filtered as $index => $data){
128
+ $attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', $data['static_value']);
129
+ $filtered[$index]['attribute_id'] = $attributeModel->getData('attribute_id');
130
+ }
131
+ $mageselc->saveConfig('avisverifies/extra/pla_configuration', json_encode($filtered),'stores',$storeId);
132
+ $this->_redirect('*/*/pla/website/'.$website.'/store/'.$storeCode);
133
+ return;
134
+ }
135
+
136
+ /**
137
+ * Return if the admin allowed to access this controller.
138
+ * @return bool
139
+ */
140
+ protected function _isAllowed()
141
+ {
142
+ // Switch on action name
143
+ switch (strtolower($this->getRequest()->getActionName())) {
144
+ case 'save':
145
+ case 'exportproduct':
146
+ case 'pla':
147
+ $acl = 'admin/catalog/avisverifies/pla';
148
+ break;
149
+ default:
150
+ return false;
151
+ }
152
+
153
+ return Mage::getSingleton('admin/session')->isAllowed($acl);
154
+ }
155
+
156
+ protected function getDataField($array,$name){
157
+ if (empty($array['field'])) {
158
+ return array();
159
+ }
160
+ foreach ($array['field'] as $data) {
161
+ if ($data['name'] == $name) {
162
+ return $data;
163
+ }
164
+ }
165
+ return array();
166
+ }
167
+
168
+ protected function getDataFiltered($array){
169
+ if (empty($array['field'])) {
170
+ return array();
171
+ }
172
+ $tmp = array();
173
+ foreach ($array['field'] as $data) {
174
+ if (!empty($data['static_value'])) {
175
+ $tmp[] = $data;
176
+ }
177
+ }
178
+ return $tmp;
179
+ }
180
+
181
+ }
app/code/local/Netreviews/Pla/controllers/DialogController.php ADDED
@@ -0,0 +1,140 @@
1
+ <?php
2
+ require_once(Mage::getModuleDir('controllers','Netreviews_Avisverifies').DS.'DialogController.php');
3
+ class Netreviews_Pla_DialogController extends Netreviews_Avisverifies_DialogController
4
+ {
5
+ protected function getOrders($DATA,$API){
6
+ if (property_exists('Netreviews_Avisverifies_DialogController', 'plaModuleCompatibale')) {
7
+ return parent::getOrders($DATA,$API);
8
+ }
9
+ else {
10
+ return $this->_getOrders_($DATA,$API);
11
+ }
12
+ }
13
+
14
+ // FOR OLD MODULE
15
+ protected function _getOrders_($DATA,$API){
16
+ $helperData = Mage::helper('avisverifies/Export');
17
+ $helperData->createStoresIds($DATA->allShopIds);
18
+ $helperData->exportStruct($DATA->allowedProducts);
19
+
20
+ if ($API->msg('force') == 1) {
21
+ if ($API->msg('date_deb') && $API->msg('date_fin')) {
22
+ $from = date("Y-m-d H:i:s",strtotime($API->msg('date_deb')));
23
+ $to = date("Y-m-d H:i:s",strtotime($API->msg('date_fin')));
24
+ $helperData->createExportAPI(array('flag'=>true,'from'=>$from,'to'=>$to));
25
+ $reponse['debug']['mode'] = "[forcé] ".$helperData->count()." commandes récupérées en force du ".$from." au ".$to;
26
+ }
27
+ else { // en cas d'erreur
28
+ $reponse['debug'][] = "Aucune période renseignée pour la récupération des commandes en mode forcé";
29
+ return $reponse;
30
+ }
31
+ }
32
+ elseif ($DATA->processChoosen == 'onorder') {
33
+ $helperData->createExportAPI(array('flag'=>true));
34
+ $reponse['debug']['mode'] = "[onorder] ".$helperData->count()." commandes récupérées";
35
+ }
36
+ elseif ($DATA->processChoosen == 'onorderstatuschange') {
37
+ if (count($DATA->statusChoosen) >= 1) {
38
+ $helperData->createExportAPI(array('flag'=>true,'status'=>$DATA->statusChoosen));
39
+ $reponse['debug']['mode'] = "[onorderstatuschange] ".$helperData->count()." commandes récupérées avec statut ".implode(";", $DATA->statusChoosen);
40
+ }
41
+ else { // en cas d'erreur
42
+ $reponse['debug'][] = "Aucun statut n'a été renseigné pour la récupération des commandes en fonction de leur statut";
43
+ $reponse['return'] = 2;
44
+ return $reponse;
45
+ }
46
+ }
47
+ else { // en cas d'erreur
48
+ $reponse['debug'][] = "Aucun évènement onorder ou onorderstatuschange n'a été renseigné pour la récupération des commandes";
49
+ $reponse['return'] = 3;
50
+ return $reponse;
51
+ }
52
+ $ordersIdsMarketPlace = $ordersIds = $tmp = array();
53
+ foreach ($helperData->getDataExport() as $order) {
54
+ $customerEmailExtension = explode('@', $order['email']);
55
+ if (!in_array($customerEmailExtension[1],$DATA->forbiddenMailExtensions)) {
56
+ // save same order info once.
57
+ $id = (int)$order['entity_id'];
58
+ if (empty($tmp[$id])) {
59
+ $tmp[$id] = array(
60
+ 'id_order' => $order['order_id'],
61
+ 'date_order' => $order['timestamp'], //date timestamp de la table orders
62
+ 'amount_order' => $order['amount_order'], //date timestamp de la table orders
63
+ 'date_order_formatted' => $order['date'], //date de la table orders formatté
64
+ 'date_av_getted_order' => $order['date_av_getted_order'], //date de la table order_history de récup par AV
65
+ 'is_flag' => $order['is_flag'], //si la commande est déjà flaggué
66
+ 'state_order' => $order['status_order'], // we use the status and not the state.
67
+ 'firstname_customer' => $order['prenom'],
68
+ 'lastname_customer' => $order['nom'],
69
+ 'email_customer' => $order['email'],
70
+ );// add order products as array.
71
+ }
72
+ // if the product exist then do nothing
73
+ if (!$this->productExistInArray($tmp[$id],$order['product_id'])) {
74
+ // CODE UPDATED
75
+ $foo = array(
76
+ 'id_product' => $order['product_id'],
77
+ 'name_product' => $order['product_name'],
78
+ 'url' => $order['url'],
79
+ 'url_image' => $order['url_image'],
80
+ );
81
+ for($i=1;$i<11;$i++){
82
+ $name = 'info'.$i;
83
+ // product_mpn
84
+ if (!empty($order[$name])) {
85
+ $foo[$name] = $order[$name];
86
+ }
87
+ }
88
+ if (!empty($order['gtin'])) {
89
+ $foo['GTIN_UPC'] = $order['gtin'];
90
+ }
91
+ if (!empty($order['brand'])) {
92
+ $foo['brand_name'] = $order['brand'];
93
+ }
94
+ if (!empty($order['sku'])) {
95
+ $foo['sku'] = $order['sku'];
96
+ }
97
+ if (!empty($order['mpn'])) {
98
+ $foo['MPN'] = $order['mpn'];
99
+ }
100
+ if (!empty($order['category'])) {
101
+ $foo['category'] = $order['category'];
102
+ }
103
+ // CODE UPDATED END HERE
104
+ $tmp[$id]['products'][] = $foo;
105
+ }
106
+ $ordersIds[] = $id;
107
+ }
108
+ else {
109
+ $reponse['message']['Emails_Interdits'][] = 'Commande n°'.$order['order_id'].' Email:'.$order['email'];
110
+ $id = (int)$order['entity_id'];
111
+ $ordersIdsMarketPlace[] = $id;
112
+ }
113
+ }
114
+ // always change marketplace orders to 1
115
+ $array_chunk = array_chunk($ordersIdsMarketPlace, 50, true);
116
+ foreach($array_chunk as $array_chunk_ordersIdsMarketPlace){
117
+ $helperData->updateFlag($array_chunk_ordersIdsMarketPlace);
118
+ }
119
+ // update Flag db;
120
+ $noFlag = $API->msg('no_flag');
121
+ if(isset($noFlag) && $noFlag == 0){
122
+ $array_chunk = array_chunk($ordersIds, 50, true);
123
+ foreach($array_chunk as $array_chunk_ordersIds){
124
+ $helperData->updateFlag($array_chunk_ordersIds);
125
+ }
126
+ }
127
+ // return value
128
+
129
+ $reponse['return'] = 1;
130
+ $reponse['query'] = $this->getRequest()->getPost('query'); // get request post
131
+ $reponse['message']['nb_orders'] = count($tmp);
132
+ $reponse['message']['delay'] = $DATA->delay;
133
+ $reponse['message']['nb_orders_bloques'] = 0;
134
+ $reponse['message']['list_orders'] = $tmp;
135
+ $reponse['debug']['force'] = $API->msg('force');
136
+ $reponse['debug']['produit'] = $DATA->allowedProducts;
137
+ $reponse['debug']['no_flag'] = $API->msg('no_flag');
138
+ return $reponse;
139
+ }
140
+ }
app/code/local/Netreviews/Pla/etc/config.xml ADDED
@@ -0,0 +1,89 @@
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Netreviews_Pla>
5
+ <version>1.0.0</version>
6
+ </Netreviews_Pla>
7
+ </modules>
8
+ <global>
9
+ <helpers>
10
+ <avisverifies>
11
+ <rewrite>
12
+ <Export>Netreviews_Pla_Helper_Export</Export>
13
+ </rewrite>
14
+ </avisverifies>
15
+ <netreviews_pla>
16
+ <class>Netreviews_Pla_Helper</class>
17
+ </netreviews_pla>
18
+ </helpers>
19
+ <blocks>
20
+ <netreviews_pla>
21
+ <class>Netreviews_Pla_Block</class>
22
+ </netreviews_pla>
23
+ <avisverifies>
24
+ <rewrite>
25
+ <adminhtml_form_export_export>Netreviews_Pla_Block_Adminhtml_Form_Export_Export</adminhtml_form_export_export>
26
+ </rewrite>
27
+ </avisverifies>
28
+ </blocks>
29
+ </global>
30
+ <frontend>
31
+ <routers>
32
+ <avisverifies>
33
+ <args>
34
+ <modules>
35
+ <Netreviews_Pla before="Netreviews_Avisverifies">Netreviews_Pla</Netreviews_Pla>
36
+ </modules>
37
+ </args>
38
+ </avisverifies>
39
+ </routers>
40
+ </frontend>
41
+ <admin>
42
+ <routers>
43
+ <adminhtml>
44
+ <args>
45
+ <modules>
46
+ <Netreviews_Pla after="Mage_Adminhtml">Netreviews_Pla_Adminhtml</Netreviews_Pla>
47
+ </modules>
48
+ </args>
49
+ </adminhtml>
50
+ </routers>
51
+ </admin>
52
+ <adminhtml>
53
+ <menu>
54
+ <catalog>
55
+ <children>
56
+ <avisverifies>
57
+ <children>
58
+ <pla>
59
+ <title>Product Format : API + Export CSV</title>
60
+ <sort_order>30</sort_order>
61
+ <action>adminhtml/netreviewspla/pla</action>
62
+ </pla>
63
+ </children>
64
+ </avisverifies>
65
+ </children>
66
+ </catalog>
67
+ </menu>
68
+ <acl>
69
+ <resources>
70
+ <admin>
71
+ <children>
72
+ <catalog>
73
+ <children>
74
+ <avisverifies>
75
+ <children>
76
+ <pla>
77
+ <title>Product Format : API + Export CSV</title>
78
+ <sort_order>30</sort_order>
79
+ </pla>
80
+ </children>
81
+ </avisverifies>
82
+ </children>
83
+ </catalog>
84
+ </children>
85
+ </admin>
86
+ </resources>
87
+ </acl>
88
+ </adminhtml>
89
+ </config>
app/code/local/Netreviews/Pla/etc/system.xml ADDED
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <sections>
4
+ <avisverifies>
5
+ <groups>
6
+ <extra>
7
+ <fields>
8
+ <use_product_sku>
9
+ <show_in_default>0</show_in_default>
10
+ <show_in_website>0</show_in_website>
11
+ <show_in_store>0</show_in_store>
12
+ </use_product_sku>
13
+ <force_product_parent_id>
14
+ <label>Use parent product URL And Images</label>
15
+ <comment></comment>
16
+ </force_product_parent_id>
17
+ </fields>
18
+ </extra>
19
+ </groups>
20
+ </avisverifies>
21
+ </sections>
22
+ </config>
app/design/adminhtml/base/default/template/netreviews/pla/content.phtml ADDED
@@ -0,0 +1,58 @@
1
+ <style>
2
+ .grid table td {
3
+ vertical-align:middle;
4
+ text-align: center;
5
+ }
6
+ .aefeaf{
7
+ padding: 3px 0px;
8
+ }
9
+ .rutyeg{
10
+ width: 200px;
11
+ padding: 0px 5px;
12
+ border-color: #AAAAAA #C8C8C8 #C8C8C8 #AAAAAA;
13
+ border-style: solid;
14
+ border-width: 1px;
15
+ display: block;
16
+ }
17
+ .grid tr:hover {
18
+ background-color: #d9edf7 !important;
19
+ }
20
+
21
+ </style>
22
+ <div class="entry-edit">
23
+ <div class="entry-edit-head">
24
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Fields Mapping')?></h4>
25
+ </div>
26
+ <div id="content_fieldset" class="fieldset ">
27
+ <?php echo Mage::app()->getLayout()->createBlock('adminhtml/system_config_switcher')->setTemplate('netreviews/pla/switcher.phtml')->toHtml() ?>
28
+ <div class="grid" style="clear:both">
29
+ <table cellspacing="0" cellpadding="0" class="data" style="width:100%;">
30
+ <thead>
31
+ <tr class="headings">
32
+ <th style="width:160px;"><?php echo $this->__('Field Name')?></th>
33
+ <th width="40%"><?php echo $this->__('Value')?></th>
34
+ </tr>
35
+ </thead>
36
+ <tbody id="mapping-table-body">
37
+ <?php
38
+ echo $this->getLayout()->createBlock('adminhtml/template')
39
+ ->setTemplate('netreviews/pla/mapping.phtml')->toHtml();
40
+ ?>
41
+ </tbody>
42
+ </table>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
app/design/adminhtml/base/default/template/netreviews/pla/mapping.phtml ADDED
@@ -0,0 +1,20 @@
1
+ <?php
2
+ $data = Mage::helper('netreviews_pla')->getGoogleContentArray();
3
+ $rows_count = count($data);
4
+ Netreviews_Pla_Block_Adminhtml_Edit_Content::loadFeed();
5
+ ?>
6
+ <?php for($i=0;$i<$rows_count;$i++):?>
7
+ <tr class="<?php echo ($i % 2 == 0)? 'even' : 'odd' ?>">
8
+ <td>
9
+ <div class="aefeaf">
10
+ <input readonly="readonly" class="rutyeg" type="text" class="input-text" name="field[<?php echo $i;?>][name]" value="<?php echo $data[$i]['name'];?>" />
11
+ </div>
12
+ </td>
13
+ <td>
14
+ <select style="width: 200px" id="mapping-<?php echo $i;?>-static-value" type="text" class="input-text" name="field[<?php echo $i;?>][static_value]" >
15
+ <?php echo Netreviews_Pla_Block_Adminhtml_Edit_Content::getAttributeSelect($data[$i]['name'])?>
16
+ </select>
17
+ </td>
18
+ </tr>
19
+ <?php endfor;?>
20
+
app/design/adminhtml/base/default/template/netreviews/pla/switcher.phtml ADDED
@@ -0,0 +1,53 @@
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ /* @var $this Mage_Core_Block_Template */ ?>
27
+ <div class="switcher">
28
+ <label for="store_switcher"><?php echo $this->__('Current Configuration Scope:') ?></label>
29
+ <?php echo $this->getHintHtml() ?>
30
+ <select id="store_switcher" class="system-config-store-switcher" onchange="location.href=this.options[this.selectedIndex].getAttribute('url')">
31
+ <option><?php echo $this->__('Please select a store view') ?></option>
32
+ <?php foreach ($this->getStoreSelectOptions() as $_value => $_option): ?>
33
+ <?php if (isset($_option['is_group'])): ?>
34
+ <?php if ($_option['is_close']): ?>
35
+ </optgroup>
36
+ <?php else: ?>
37
+ <optgroup label="<?php echo $this->escapeHtml($_option['label']) ?>" style="<?php echo $_option['style'] ?>">
38
+ <?php endif; ?>
39
+ <?php continue ?>
40
+ <?php endif; ?>
41
+ <?php if (strpos($_option['url'], 'store') !== false): ?>
42
+ <option value="<?php echo $this->escapeHtml($_value) ?>" url="<?php echo $_option['url'] ?>" <?php echo $_option['selected'] ? 'selected="selected"' : '' ?> style="<?php echo $_option['style'] ?>">
43
+ <?php echo $this->escapeHtml($_option['label']) ?>
44
+ </option>
45
+ <?php endif; ?>
46
+ <?php endforeach ?>
47
+ </select>
48
+ <?php if (Mage::getSingleton('admin/session')->isAllowed('system/store')): ?>
49
+ <p style="margin:10px 0 0;">
50
+ <a href="<?php echo $this->getUrl('*/system_store') ?>"><?php echo $this->__('Manage Stores') ?></a>
51
+ </p>
52
+ <?php endif; ?>
53
+ </div>
app/design/adminhtml/default/default/template/avisverifies/checkinstallation.phtml CHANGED
File without changes
app/design/adminhtml/default/default/template/avisverifies/checkinstallation_tab.phtml CHANGED
File without changes
app/design/adminhtml/default/default/template/avisverifies/export.phtml CHANGED
File without changes
app/design/adminhtml/default/default/template/avisverifies/export_tab.phtml CHANGED
File without changes
app/design/adminhtml/default/default/template/netreviews/pla/content.phtml ADDED
@@ -0,0 +1,58 @@
1
+ <style>
2
+ .grid table td {
3
+ vertical-align:middle;
4
+ text-align: center;
5
+ }
6
+ .aefeaf{
7
+ padding: 3px 0px;
8
+ }
9
+ .rutyeg{
10
+ width: 200px;
11
+ padding: 0px 5px;
12
+ border-color: #AAAAAA #C8C8C8 #C8C8C8 #AAAAAA;
13
+ border-style: solid;
14
+ border-width: 1px;
15
+ display: block;
16
+ }
17
+ .grid tr:hover {
18
+ background-color: #d9edf7 !important;
19
+ }
20
+
21
+ </style>
22
+ <div class="entry-edit">
23
+ <div class="entry-edit-head">
24
+ <h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__('Fields Mapping')?></h4>
25
+ </div>
26
+ <div id="content_fieldset" class="fieldset ">
27
+ <?php echo Mage::app()->getLayout()->createBlock('adminhtml/system_config_switcher')->setTemplate('netreviews/pla/switcher.phtml')->toHtml() ?>
28
+ <div class="grid" style="clear:both">
29
+ <table cellspacing="0" cellpadding="0" class="data" style="width:100%;">
30
+ <thead>
31
+ <tr class="headings">
32
+ <th style="width:160px;"><?php echo $this->__('Field Name')?></th>
33
+ <th width="40%"><?php echo $this->__('Value')?></th>
34
+ </tr>
35
+ </thead>
36
+ <tbody id="mapping-table-body">
37
+ <?php
38
+ echo $this->getLayout()->createBlock('adminhtml/template')
39
+ ->setTemplate('netreviews/pla/mapping.phtml')->toHtml();
40
+ ?>
41
+ </tbody>
42
+ </table>
43
+ </div>
44
+ </div>
45
+ </div>
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+
app/design/adminhtml/default/default/template/netreviews/pla/mapping.phtml ADDED
@@ -0,0 +1,20 @@
1
+ <?php
2
+ $data = Mage::helper('netreviews_pla')->getGoogleContentArray();
3
+ $rows_count = count($data);
4
+ Netreviews_Pla_Block_Adminhtml_Edit_Content::loadFeed();
5
+ ?>
6
+ <?php for($i=0;$i<$rows_count;$i++):?>
7
+ <tr class="<?php echo ($i % 2 == 0)? 'even' : 'odd' ?>">
8
+ <td>
9
+ <div class="aefeaf">
10
+ <input readonly="readonly" class="rutyeg" type="text" class="input-text" name="field[<?php echo $i;?>][name]" value="<?php echo $data[$i]['name'];?>" />
11
+ </div>
12
+ </td>
13
+ <td>
14
+ <select style="width: 200px" id="mapping-<?php echo $i;?>-static-value" type="text" class="input-text" name="field[<?php echo $i;?>][static_value]" >
15
+ <?php echo Netreviews_Pla_Block_Adminhtml_Edit_Content::getAttributeSelect($data[$i]['name'])?>
16
+ </select>
17
+ </td>
18
+ </tr>
19
+ <?php endfor;?>
20
+