AvisVerifies - Version 2.6.16

Version Notes

La version 2.6.16 est stable.

Download this release

Release Info

Developer Johnny
Extension AvisVerifies
Version 2.6.16
Comparing to
See all releases


Code changes from version 2.6.7 to 2.6.16

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 +15 -1
  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 +2 -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 +6 -6
  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 +41 -42
  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 +451 -0
  33. app/code/local/Netreviews/Pla/controllers/Adminhtml/NetreviewsplaController.php +185 -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 +27 -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 +27 -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 +6 -6
  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
@@ -67,6 +67,19 @@ class Netreviews_Avisverifies_Helper_API{
67
}
68
// Diffirent column structure according to diffirent query.
69
protected function column($column){
70
return array(
71
'query' => $column[0],
72
'id_product_av' => $column[2],
@@ -74,8 +87,9 @@ class Netreviews_Avisverifies_Helper_API{
74
'rate' => $column[7],
75
'review' => urlencode(($column[6])),
76
'horodate' => $column[5],
77
- 'customer_name' => urlencode((ucfirst($column[8][0]).". " .ucfirst($column[9]))),
78
);
79
}
80
81
protected function discussion($column){
67
}
68
// Diffirent column structure according to diffirent query.
69
protected function column($column){
70
+
71
+ $customername = "";
72
+ // Si le nom de famille n'est pas vide
73
+ if (!empty($column[8][0])) {
74
+ $customername .= ucfirst($column[8][0]).". ";
75
+ }
76
+ // Si le prenom n'est pas vide
77
+ if (!empty($column[9])) {
78
+ $customername .= ucfirst($column[9]);
79
+ }
80
+
81
+
82
+
83
return array(
84
'query' => $column[0],
85
'id_product_av' => $column[2],
87
'rate' => $column[7],
88
'review' => urlencode(($column[6])),
89
'horodate' => $column[5],
90
+ 'customer_name' => urlencode($customername)
91
);
92
+
93
}
94
95
protected function discussion($column){
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
@@ -145,6 +145,8 @@ class Netreviews_Avisverifies_Helper_Install {
145
$resource = Mage::getSingleton('core/resource');
146
$write = $resource->getConnection('core_write');
147
// Install Tables, RUN Query.
148
$write->query("
149
CREATE TABLE IF NOT EXISTS `{$resource->getTableName('avisverifies_products_reviews')}` (
150
`id_product_av` varchar(36) NOT NULL,
145
$resource = Mage::getSingleton('core/resource');
146
$write = $resource->getConnection('core_write');
147
// Install Tables, RUN Query.
148
+ $write->query("DROP TABLE IF EXISTS `{$resource->getTableName('avisverifies_products_reviews')}`;");
149
+ $write->query("DROP TABLE IF EXISTS `{$resource->getTableName('avisverifies_products_average')}`;");
150
$write->query("
151
CREATE TABLE IF NOT EXISTS `{$resource->getTableName('avisverifies_products_reviews')}` (
152
`id_product_av` varchar(36) NOT NULL,
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
@@ -29,7 +29,7 @@ class Netreviews_Avisverifies_Model_Observers_System {
29
$enabledwebsite = (isset($POST['groups']['system']['fields']['enabledwebsite']['value']))? $POST['groups']['system']['fields']['enabledwebsite']['value'] : NULL ;
30
$forceParentIds = (isset($POST['groups']['extra']['fields']['force_product_parent_id']['value']))? $POST['groups']['extra']['fields']['force_product_parent_id']['value'] : NULL ;
31
$addReviewToProductPage = (isset($POST['groups']['extra']['fields']['add_review_to_product_page']['value']))? $POST['groups']['extra']['fields']['add_review_to_product_page']['value'] : NULL ;
32
- $useProductSKU = (isset($POST['groups']['extra']['fields']['use_product_sku']['value']))? $POST['groups']['extra']['fields']['use_product_sku']['value'] : NULL ;
33
$productLightWidget = (isset($POST['groups']['extra']['fields']['product_light_widget']['value']))? $POST['groups']['extra']['fields']['product_light_widget']['value'] : NULL ;
34
$hasjQuery = (isset($POST['groups']['extra']['fields']['has_jquery']['value']))? $POST['groups']['extra']['fields']['has_jquery']['value'] : NULL ;
35
$useProductUrl = (isset($POST['groups']['extra']['fields']['use_product_url']['value']))? $POST['groups']['extra']['fields']['use_product_url']['value'] : NULL ;
@@ -44,7 +44,7 @@ class Netreviews_Avisverifies_Model_Observers_System {
44
$mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'websites',$website->getId());
45
$mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'websites',$website->getId());
46
$mageselc->saveConfig('avisverifies/extra/add_review_to_product_page',$addReviewToProductPage,'websites',$website->getId());
47
- $mageselc->saveConfig('avisverifies/extra/use_product_sku',$useProductSKU,'websites',$website->getId());
48
$mageselc->saveConfig('avisverifies/extra/product_light_widget',$productLightWidget,'websites',$website->getId());
49
$mageselc->saveConfig('avisverifies/extra/has_jquery',$hasjQuery,'websites',$website->getId());
50
$mageselc->saveConfig('avisverifies/extra/use_product_url',$useProductUrl,'websites',$website->getId());
@@ -57,7 +57,7 @@ class Netreviews_Avisverifies_Model_Observers_System {
57
$mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'stores',$store->getId());
58
$mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'stores',$store->getId());
59
$mageselc->saveConfig('avisverifies/extra/add_review_to_product_page',$addReviewToProductPage,'stores',$store->getId());
60
- $mageselc->saveConfig('avisverifies/extra/use_product_sku',$useProductSKU,'stores',$store->getId());
61
$mageselc->saveConfig('avisverifies/extra/product_light_widget',$productLightWidget,'stores',$store->getId());
62
$mageselc->saveConfig('avisverifies/extra/has_jquery',$hasjQuery,'stores',$store->getId());
63
$mageselc->saveConfig('avisverifies/extra/use_product_url',$useProductUrl,'stores',$store->getId());
@@ -72,7 +72,7 @@ class Netreviews_Avisverifies_Model_Observers_System {
72
$mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'websites',$websiteId);
73
$mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'websites',$websiteId);
74
$mageselc->saveConfig('avisverifies/extra/add_review_to_product_page',$addReviewToProductPage,'websites',$websiteId);
75
- $mageselc->saveConfig('avisverifies/extra/use_product_sku',$useProductSKU,'websites',$websiteId);
76
$mageselc->saveConfig('avisverifies/extra/product_light_widget',$productLightWidget,'websites',$websiteId);
77
$mageselc->saveConfig('avisverifies/extra/has_jquery',$hasjQuery,'websites',$websiteId);
78
$mageselc->saveConfig('avisverifies/extra/use_product_url',$useProductUrl,'websites',$websiteId);
@@ -87,7 +87,7 @@ class Netreviews_Avisverifies_Model_Observers_System {
87
$mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'stores',$storeId);
88
$mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'stores',$storeId);
89
$mageselc->saveConfig('avisverifies/extra/add_review_to_product_page',$addReviewToProductPage,'stores',$storeId);
90
- $mageselc->saveConfig('avisverifies/extra/use_product_sku',$useProductSKU,'stores',$storeId);
91
$mageselc->saveConfig('avisverifies/extra/product_light_widget',$productLightWidget,'stores',$storeId);
92
$mageselc->saveConfig('avisverifies/extra/has_jquery',$hasjQuery,'stores',$storeId);
93
$mageselc->saveConfig('avisverifies/extra/use_product_url',$useProductUrl,'stores',$storeId);
@@ -102,7 +102,7 @@ class Netreviews_Avisverifies_Model_Observers_System {
102
$mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'stores',$storeId);
103
$mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'stores',$storeId);
104
$mageselc->saveConfig('avisverifies/extra/add_review_to_product_page',$addReviewToProductPage,'stores',$storeId);
105
- $mageselc->saveConfig('avisverifies/extra/use_product_sku',$useProductSKU,'stores',$storeId);
106
$mageselc->saveConfig('avisverifies/extra/product_light_widget',$productLightWidget,'stores',$storeId);
107
$mageselc->saveConfig('avisverifies/extra/has_jquery',$hasjQuery,'stores',$storeId);
108
$mageselc->saveConfig('avisverifies/extra/use_product_url',$useProductUrl,'stores',$storeId);
29
$enabledwebsite = (isset($POST['groups']['system']['fields']['enabledwebsite']['value']))? $POST['groups']['system']['fields']['enabledwebsite']['value'] : NULL ;
30
$forceParentIds = (isset($POST['groups']['extra']['fields']['force_product_parent_id']['value']))? $POST['groups']['extra']['fields']['force_product_parent_id']['value'] : NULL ;
31
$addReviewToProductPage = (isset($POST['groups']['extra']['fields']['add_review_to_product_page']['value']))? $POST['groups']['extra']['fields']['add_review_to_product_page']['value'] : NULL ;
32
+ //$useProductSKU = (isset($POST['groups']['extra']['fields']['use_product_sku']['value']))? $POST['groups']['extra']['fields']['use_product_sku']['value'] : NULL ;
33
$productLightWidget = (isset($POST['groups']['extra']['fields']['product_light_widget']['value']))? $POST['groups']['extra']['fields']['product_light_widget']['value'] : NULL ;
34
$hasjQuery = (isset($POST['groups']['extra']['fields']['has_jquery']['value']))? $POST['groups']['extra']['fields']['has_jquery']['value'] : NULL ;
35
$useProductUrl = (isset($POST['groups']['extra']['fields']['use_product_url']['value']))? $POST['groups']['extra']['fields']['use_product_url']['value'] : NULL ;
44
$mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'websites',$website->getId());
45
$mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'websites',$website->getId());
46
$mageselc->saveConfig('avisverifies/extra/add_review_to_product_page',$addReviewToProductPage,'websites',$website->getId());
47
+ //$mageselc->saveConfig('avisverifies/extra/use_product_sku',$useProductSKU,'websites',$website->getId());
48
$mageselc->saveConfig('avisverifies/extra/product_light_widget',$productLightWidget,'websites',$website->getId());
49
$mageselc->saveConfig('avisverifies/extra/has_jquery',$hasjQuery,'websites',$website->getId());
50
$mageselc->saveConfig('avisverifies/extra/use_product_url',$useProductUrl,'websites',$website->getId());
57
$mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'stores',$store->getId());
58
$mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'stores',$store->getId());
59
$mageselc->saveConfig('avisverifies/extra/add_review_to_product_page',$addReviewToProductPage,'stores',$store->getId());
60
+ //$mageselc->saveConfig('avisverifies/extra/use_product_sku',$useProductSKU,'stores',$store->getId());
61
$mageselc->saveConfig('avisverifies/extra/product_light_widget',$productLightWidget,'stores',$store->getId());
62
$mageselc->saveConfig('avisverifies/extra/has_jquery',$hasjQuery,'stores',$store->getId());
63
$mageselc->saveConfig('avisverifies/extra/use_product_url',$useProductUrl,'stores',$store->getId());
72
$mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'websites',$websiteId);
73
$mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'websites',$websiteId);
74
$mageselc->saveConfig('avisverifies/extra/add_review_to_product_page',$addReviewToProductPage,'websites',$websiteId);
75
+ //$mageselc->saveConfig('avisverifies/extra/use_product_sku',$useProductSKU,'websites',$websiteId);
76
$mageselc->saveConfig('avisverifies/extra/product_light_widget',$productLightWidget,'websites',$websiteId);
77
$mageselc->saveConfig('avisverifies/extra/has_jquery',$hasjQuery,'websites',$websiteId);
78
$mageselc->saveConfig('avisverifies/extra/use_product_url',$useProductUrl,'websites',$websiteId);
87
$mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'stores',$storeId);
88
$mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'stores',$storeId);
89
$mageselc->saveConfig('avisverifies/extra/add_review_to_product_page',$addReviewToProductPage,'stores',$storeId);
90
+ //$mageselc->saveConfig('avisverifies/extra/use_product_sku',$useProductSKU,'stores',$storeId);
91
$mageselc->saveConfig('avisverifies/extra/product_light_widget',$productLightWidget,'stores',$storeId);
92
$mageselc->saveConfig('avisverifies/extra/has_jquery',$hasjQuery,'stores',$storeId);
93
$mageselc->saveConfig('avisverifies/extra/use_product_url',$useProductUrl,'stores',$storeId);
102
$mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'stores',$storeId);
103
$mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'stores',$storeId);
104
$mageselc->saveConfig('avisverifies/extra/add_review_to_product_page',$addReviewToProductPage,'stores',$storeId);
105
+ //$mageselc->saveConfig('avisverifies/extra/use_product_sku',$useProductSKU,'stores',$storeId);
106
$mageselc->saveConfig('avisverifies/extra/product_light_widget',$productLightWidget,'stores',$storeId);
107
$mageselc->saveConfig('avisverifies/extra/has_jquery',$hasjQuery,'stores',$storeId);
108
$mageselc->saveConfig('avisverifies/extra/use_product_url',$useProductUrl,'stores',$storeId);
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: *
@@ -247,17 +249,20 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
247
}
248
249
protected function truncateTables($DATA,$API){
250
- $reponse['return'] = 1;
251
- $reponse['debug'] = "Tables vidées";
252
- $reponse['message'] = "Tables vidées";
253
-
254
$resource = Mage::getSingleton('core/resource');
255
$write = $resource->getConnection('core_write');
256
$write->delete($resource->getTableName('avisverifies/reviews'));
257
$write->delete($resource->getTableName('avisverifies/average'));
258
-
259
- $reponse['query'] = $this->getRequest()->getPost('query'); // get request post
260
Mage::app()->cleanCache();
261
return $reponse;
262
}
263
@@ -372,12 +377,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 +446,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
}
@@ -456,7 +486,7 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
456
// skip
457
continue;
458
}
459
- elseif ($data['query'] == "NEW") {
460
// now we check for the parent - child relationship
461
$productListIds = $DATA->parentChildRelationship($data['ref_product']);
462
@@ -674,35 +704,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: *
249
}
250
251
protected function truncateTables($DATA,$API){
252
$resource = Mage::getSingleton('core/resource');
253
$write = $resource->getConnection('core_write');
254
$write->delete($resource->getTableName('avisverifies/reviews'));
255
$write->delete($resource->getTableName('avisverifies/average'));
256
+
257
+ Mage::helper('avisverifies/Install')->addUpdateFields();
258
+
259
Mage::app()->cleanCache();
260
+
261
+ $reponse['return'] = 1;
262
+ $reponse['debug'] = "Tables vidées and Primary Key fixed";
263
+ $reponse['message'] = "Tables vidées and Primary Key fixed";
264
+ $reponse['query'] = $this->getRequest()->getPost('query'); // get request post
265
+
266
return $reponse;
267
}
268
377
}
378
// if the product exist then do nothing
379
if (!$this->productExistInArray($tmp[$id],$order['product_id'])) {
380
+ // CODE UPDATED
381
+ $foo = array(
382
'id_product' => $order['product_id'],
383
'name_product' => $order['product_name'],
384
'url' => $order['url'],
385
'url_image' => $order['url_image'],
386
);
387
+ for($i=1;$i<11;$i++){
388
+ $name = 'info'.$i;
389
+ // product_mpn
390
+ if (!empty($order[$name])) {
391
+ $foo[$name] = $order[$name];
392
+ }
393
+ }
394
+ if (!empty($order['gtin'])) {
395
+ $foo['GTIN_UPC'] = $order['gtin'];
396
+ }
397
+ if (!empty($order['brand'])) {
398
+ $foo['brand_name'] = $order['brand'];
399
+ }
400
+ if (!empty($order['sku'])) {
401
+ $foo['sku'] = $order['sku'];
402
+ }
403
+ if (!empty($order['mpn'])) {
404
+ $foo['MPN'] = $order['mpn'];
405
+ }
406
+ if (!empty($order['category'])) {
407
+ $foo['category'] = $order['category'];
408
+ }
409
+ // CODE UPDATED END HERE
410
+ $tmp[$id]['products'][] = $foo;
411
}
412
$ordersIds[] = $id;
413
}
446
447
protected function productExistInArray($array,$id) {
448
// first test if product array exist
449
+ if (empty($array['products'])) {
450
return false;
451
}
452
// else
453
+ foreach ($array['products'] as $prod) {
454
if ($prod['id_product'] == $id) {
455
return true;
456
}
486
// skip
487
continue;
488
}
489
+ elseif ($data['query'] == "NEW" || $data['query'] == "UPDATE") {
490
// now we check for the parent - child relationship
491
$productListIds = $DATA->parentChildRelationship($data['ref_product']);
492
704
->addFieldToFilter('path','avisverifies/system/idwebsite')->getFirstItem();
705
return $storeConfig->getData('value');
706
}
707
}
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.16</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,451 @@
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
+
210
+ // If selectbox $_val is number so rather get Text.
211
+ if ( is_numeric( $_val ) ) {
212
+ $_val = $full_product -> getAttributeText( $attribute['static_value'] );
213
+ }
214
+ $product_data['brand'] = ( $_val ) ? $_val : '';
215
+ }
216
+ // product_category
217
+ if ($attribute['name'] == 'category') {
218
+ $_val = $full_product->getData($attribute['static_value']);
219
+
220
+ // If selectbox $_val is number so rather get Text.
221
+ if ( is_numeric( $_val ) ) {
222
+ $_val = $full_product -> getAttributeText( $attribute['static_value'] );
223
+ }
224
+ $product_data['category'] = ( $_val ) ? $_val : '';
225
+ }
226
+ // product_gtin
227
+ if ($attribute['name'] == 'gtin') {
228
+ $_val = $full_product->getData($attribute['static_value']);
229
+ $product_data['gtin'] = ($_val)? $_val : '';
230
+ }
231
+ // product_mpn
232
+ if ($attribute['name'] == 'mpn') {
233
+ $_val = $full_product->getData($attribute['static_value']);
234
+ $product_data['mpn'] = ($_val)? $_val : '';
235
+ }
236
+ // extra info 1 to 10
237
+ for($i=1;$i<11;$i++){
238
+ $name = 'Extra Info'.$i;
239
+ // product_mpn
240
+ if ($attribute['name'] == $name) {
241
+ $_val = $full_product->getData($attribute['static_value']);
242
+ $product_data['info'.$i] = ($_val)? $_val : '';
243
+ }
244
+ }
245
+ }
246
+
247
+ // now test if basic value are present , if not the add them
248
+ // product_id
249
+ if (empty($product_data['product_id'])) {
250
+ $product_data['product_id'] = $tmp_product->getId();
251
+ }
252
+ // product_description
253
+ if (empty($product_data['product_name'])) {
254
+ $product_data['product_name'] = utf8_decode(str_replace(",", " - ", $tmp_product->getName()));
255
+ }
256
+ // product_link
257
+ if (empty($product_data['url'])) {
258
+ $product_data['url'] = $this->getProductUrlOrParentUrl($productId,$tmp_product->getUrlInStore(array('_store' => $order->getStoreId())),$order->getStoreId());
259
+ }
260
+ // product_image_link
261
+ if (empty($product_data['url_image'])) {
262
+ try{
263
+ $product_data['url_image'] = $this->getProductImageOrParentImage($productId,$tmp_product->getImageUrl());
264
+
265
+ }catch(Exception $e) {
266
+ $product_data['url_image'] = '';
267
+ };
268
+ }
269
+ // product_sku
270
+ if (empty($product_data['sku'])) {
271
+ $product_data['sku'] = $full_product->getSku();
272
+ }
273
+ $products_arr[] = $this->plaProducts[$productId] = $product_data;
274
+ }
275
+ }
276
+ return $products_arr;
277
+ }
278
+
279
+ protected function defaultProductsData($order){
280
+ $products = $order->getAllVisibleItems(); //filter out simple products
281
+ $products_arr = array();
282
+ foreach ($products as $product) {
283
+ $productId = $product->getProductId();
284
+ if (!empty($this->defaultProducts[$productId])) {
285
+ $products_arr[] = $this->defaultProducts[$productId];
286
+ }
287
+ else {
288
+ $full_product = Mage::getModel('catalog/product')->load($productId);
289
+ $product_data = array();
290
+ $product_data['product_name'] = utf8_decode(str_replace(",", " - ", $full_product->getName()));
291
+ $product_data['product_id'] = $full_product->getId();
292
+ $product_data['sku'] = $full_product->getSku();
293
+ $product_data['url'] = '';
294
+ $product_data['url_image'] = '';
295
+ try
296
+ {
297
+ $product_data['url'] = $this->getProductUrlOrParentUrl($productId,$full_product->getUrlInStore(array('_store' => $order->getStoreId())),$order->getStoreId());
298
+ $product_data['url_image'] = $this->getProductImageOrParentImage($productId,$full_product->getImageUrl());
299
+ } catch(Exception $e) {}
300
+
301
+ $products_arr[] = $this->defaultProducts[$productId] = $product_data;
302
+ }
303
+
304
+ }
305
+ return $products_arr;
306
+ }
307
+
308
+ public function getAllPlaConfiguration(){
309
+ $resource = Mage::getModel("core/config_data")->getCollection()
310
+ ->addFieldToFilter('scope','stores')
311
+ ->addFieldToFilter('path','avisverifies/extra/pla_configuration');
312
+ $array = array();
313
+ foreach ($resource as $store) {
314
+ $json = json_decode($store->getData('value'),true);
315
+ if (is_array($json)) {
316
+ $array[$store->getData('scope_id')] = $json;
317
+ }
318
+ }
319
+ return $array;
320
+ }
321
+
322
+ public function getAllShopName(){
323
+ $array = array();
324
+ foreach (Mage::getModel('core/store')->getCollection() as $store) {
325
+ $array[$store->getId()] = $store->getName();
326
+ }
327
+ return $array;
328
+ }
329
+
330
+
331
+ protected function reformatDataForCSV($data){
332
+ $tmp = array();
333
+ foreach ($data as $value){
334
+ if (!empty($value['product_id']) && !empty($value['product_name'])) {
335
+ $tmp[] = array(
336
+ $value['order_id'],
337
+ $value['email'],
338
+ $value['nom'],
339
+ $value['prenom'],
340
+ $value['date'],
341
+ $this->delay,
342
+ $value['id_shop'],
343
+ $value['amount_order'],
344
+ $value['status_order'],
345
+ $this->safeAccessAray($value,'product_id'),
346
+ $this->safeAccessAray($value,'sku'),
347
+ $this->safeAccessAray($value,'product_name'),
348
+ $this->safeAccessAray($value,'url'),
349
+ $this->safeAccessAray($value,'url_image'),
350
+ $this->safeAccessAray($value,'brand'),
351
+ $this->safeAccessAray($value,'category'),
352
+ $this->safeAccessAray($value,'gtin'),
353
+ $this->safeAccessAray($value,'mpn'),
354
+ $this->safeAccessAray($value,'info1'),
355
+ $this->safeAccessAray($value,'info2'),
356
+ $this->safeAccessAray($value,'info3'),
357
+ $this->safeAccessAray($value,'info4'),
358
+ $this->safeAccessAray($value,'info5'),
359
+ $this->safeAccessAray($value,'info6'),
360
+ $this->safeAccessAray($value,'info7'),
361
+ $this->safeAccessAray($value,'info8'),
362
+ $this->safeAccessAray($value,'info9'),
363
+ $this->safeAccessAray($value,'info10'),
364
+ );
365
+ }
366
+ else {
367
+ $tmp[$value['order_id']] = array(
368
+ $value['order_id'],
369
+ $value['email'],
370
+ $value['nom'],
371
+ $value['prenom'],
372
+ $value['date'],
373
+ $this->delay,
374
+ $value['id_shop'],
375
+ $value['amount_order'],
376
+ $value['status_order'],
377
+ );
378
+ }
379
+
380
+ }
381
+ return $tmp;
382
+ }
383
+
384
+ public function safeAccessAray($array,$index){
385
+ return isset($array[$index])? $array[$index] : '';
386
+ }
387
+
388
+ public function getProductUrlOrParentUrl($productId,$URL,$storeId,$baseURL = false){
389
+
390
+ if (!$this->forceParentId) {
391
+ $baseUrl = ($baseURL)? Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) : '';
392
+ return ($URL)? $baseUrl.$URL : '';
393
+ }
394
+ // get parent Id
395
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($productId);
396
+ if (count($parentIds) > 0) {
397
+ $product = Mage::getModel('catalog/product')->load($parentIds[0]);
398
+ return $product->getUrlInStore(array('_store' => $storeId));
399
+ }
400
+ else {
401
+ $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($productId);
402
+ if (count($parentIds) > 0) {
403
+ $product = Mage::getModel('catalog/product')->load($parentIds[0]);
404
+ return $product->getUrlInStore(array('_store' => $storeId));
405
+ }
406
+ }
407
+ // else
408
+ $product = Mage::getModel('catalog/product')->load($productId);
409
+ return $product->getUrlInStore(array('_store' => $storeId));
410
+ }
411
+
412
+ public function getProductImageOrParentImage($productId,$URL,$baseURL = false){
413
+
414
+ if (!$this->forceParentId) {
415
+ $baseUrl = ($baseURL)? Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."catalog/product" : '';
416
+ return ($URL)? $baseUrl.$URL : '';
417
+ }
418
+ // get parent Id
419
+ $parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($productId);
420
+ if (count($parentIds) > 0) {
421
+ $product = Mage::getModel('catalog/product')->load($parentIds[0]);
422
+ try {
423
+ return $product->getImageUrl();
424
+ }
425
+ catch(Exception $e) {
426
+ return '';
427
+ }
428
+ }
429
+ else {
430
+ $parentIds = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild($productId);
431
+ if (count($parentIds) > 0) {
432
+ $product = Mage::getModel('catalog/product')->load($parentIds[0]);
433
+ try {
434
+ return $product->getImageUrl();
435
+ }
436
+ catch(Exception $e) {
437
+ return '';
438
+ }
439
+ }
440
+ }
441
+ // else
442
+ $product = Mage::getModel('catalog/product')->load($productId);
443
+ try {
444
+ return $product->getImageUrl();
445
+ }
446
+ catch(Exception $e) {
447
+ return '';
448
+ }
449
+ }
450
+
451
+ }
app/code/local/Netreviews/Pla/controllers/Adminhtml/NetreviewsplaController.php ADDED
@@ -0,0 +1,185 @@
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
+ $message = $this -> __('Please select a store view');
97
+ Mage::getSingleton('core/session') -> addError( $message );
98
+ $this->_redirect('*/*/pla');
99
+ return;
100
+ }
101
+ else {
102
+ $store = Mage::getModel('core/store')->load($storeCode);
103
+ $storeId = $store->getId();
104
+ }
105
+
106
+ $post = $this->getRequest()->getPost();
107
+ // first of all save the sku / id configuration
108
+ $test = $this->getDataField($post,'id');
109
+ // id is set to sku , then update the store config sku
110
+ if (empty($test['static_value'])) {
111
+ $message = $this -> __('Please select the value for ID field');
112
+ Mage::getSingleton('core/session') -> addError( $message );
113
+ $this->_redirect('*/*/pla/website/'.$website.'/store/'.$storeCode);
114
+ return;
115
+ }
116
+
117
+ $mageselc = new Mage_Core_Model_Config();
118
+ /* Code Change
119
+ if ($test['static_value'] == 'sku') {
120
+ $mageselc->saveConfig('avisverifies/extra/use_product_sku',1,'stores',$storeId);
121
+ }
122
+ else {
123
+ $mageselc->saveConfig('avisverifies/extra/use_product_sku',NULL,'stores',$storeId);
124
+ }
125
+ */
126
+ // now the data filtered from empty values
127
+ $filtered = $this->getDataFiltered($post);
128
+ // now we loop over the eav to get the id
129
+ foreach($filtered as $index => $data){
130
+ $attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', $data['static_value']);
131
+ $filtered[$index]['attribute_id'] = $attributeModel->getData('attribute_id');
132
+ }
133
+ $mageselc->saveConfig('avisverifies/extra/pla_configuration', json_encode($filtered),'stores',$storeId);
134
+ $message = $this -> __('Your settings have been submitted successfully.');
135
+ Mage::getSingleton('core/session') -> addSuccess( $message );
136
+ $this->_redirect('*/*/pla/website/'.$website.'/store/'.$storeCode);
137
+ return;
138
+ }
139
+
140
+ /**
141
+ * Return if the admin allowed to access this controller.
142
+ * @return bool
143
+ */
144
+ protected function _isAllowed()
145
+ {
146
+ // Switch on action name
147
+ switch (strtolower($this->getRequest()->getActionName())) {
148
+ case 'save':
149
+ case 'exportproduct':
150
+ case 'pla':
151
+ $acl = 'admin/catalog/avisverifies/pla';
152
+ break;
153
+ default:
154
+ return false;
155
+ }
156
+
157
+ return Mage::getSingleton('admin/session')->isAllowed($acl);
158
+ }
159
+
160
+ protected function getDataField($array,$name){
161
+ if (empty($array['field'])) {
162
+ return array();
163
+ }
164
+ foreach ($array['field'] as $data) {
165
+ if ($data['name'] == $name) {
166
+ return $data;
167
+ }
168
+ }
169
+ return array();
170
+ }
171
+
172
+ protected function getDataFiltered($array){
173
+ if (empty($array['field'])) {
174
+ return array();
175
+ }
176
+ $tmp = array();
177
+ foreach ($array['field'] as $data) {
178
+ if (!empty($data['static_value'])) {
179
+ $tmp[] = $data;
180
+ }
181
+ }
182
+ return $tmp;
183
+ }
184
+
185
+ }
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,27 @@