AvisVerifies - Version 2.6.5

Version Notes

La version 2.6.5 est stable.

Download this release

Release Info

Developer Magento Core Team
Extension AvisVerifies
Version 2.6.5
Comparing to
See all releases


Code changes from version 2.6.4 to 2.6.5

Files changed (78) hide show
  1. app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/Edit/Form.php +1 -1
  2. app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/Edit/Tabs.php +0 -22
  3. app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/{Edit/Tab → Export}/Export.php +80 -39
  4. app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/Export/Tabs.php +27 -0
  5. app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/{Edit.php → Export/index.php} +2 -3
  6. app/code/local/Netreviews/Avisverifies/Block/Catalog/Product/List.php +0 -42
  7. app/code/local/Netreviews/Avisverifies/Block/Catalog/Product/View.php +0 -42
  8. app/code/local/Netreviews/Avisverifies/Block/Entity/Detailed.php +0 -44
  9. app/code/local/Netreviews/Avisverifies/Block/Review/Helper.php +35 -1
  10. app/code/local/Netreviews/Avisverifies/Block/Review/Product/View.php +7 -22
  11. app/code/local/Netreviews/Avisverifies/Helper/Data.php +91 -10
  12. app/code/local/Netreviews/Avisverifies/Helper/Export.php +32 -18
  13. app/code/local/Netreviews/Avisverifies/Helper/Install.php +131 -0
  14. app/code/local/Netreviews/Avisverifies/Model/Observers/Product/List.php +13 -0
  15. app/code/local/Netreviews/Avisverifies/Model/Observers/System.php +76 -0
  16. app/code/local/Netreviews/Avisverifies/Model/Reviews.php +72 -34
  17. app/code/local/Netreviews/Avisverifies/controllers/Adminhtml/AvisverifiesController.php +106 -39
  18. app/code/local/Netreviews/Avisverifies/controllers/DialogController.php +58 -28
  19. app/code/local/Netreviews/Avisverifies/etc/config.xml +250 -242
  20. app/code/local/Netreviews/Avisverifies/etc/system.xml +77 -15
  21. app/code/local/Netreviews/Avisverifies/sql/avisverifies_setup/mysql4-install-2.0.0.php +2 -62
  22. app/design/frontend/base/default/layout/avisverifies.xml +68 -0
  23. app/design/frontend/base/default/template/avisverifies/admin/checkinstallation.phtml +151 -0
  24. app/design/frontend/base/default/template/avisverifies/admin/checkinstallation_tab.phtml +13 -0
  25. app/design/frontend/base/default/template/avisverifies/catalogProductList.phtml +89 -0
  26. app/design/frontend/base/default/template/avisverifies/css.phtml +214 -0
  27. app/design/frontend/base/default/template/avisverifies/float.phtml +7 -0
  28. app/design/frontend/base/default/template/avisverifies/js.phtml +79 -0
  29. app/design/frontend/base/default/template/avisverifies/left.phtml +10 -0
  30. app/design/frontend/base/default/template/avisverifies/observers/checkout.phtml +12 -0
  31. app/design/frontend/base/default/template/avisverifies/pagination.phtml +72 -0
  32. app/design/frontend/base/default/template/avisverifies/review/helper/summary.phtml +54 -0
  33. app/design/frontend/base/default/template/avisverifies/review/helper/summary_short.phtml +54 -0
  34. app/design/frontend/{default/default/template/avisverifies/list.phtml → base/default/template/avisverifies/reviewProductList.phtml} +0 -1
  35. app/design/frontend/base/default/template/avisverifies/right.phtml +10 -0
  36. app/design/frontend/base/default/template/avisverifies/wrapper.phtml +7 -0
  37. app/design/frontend/default/default/layout/avisverifies.xml +14 -15
  38. app/design/frontend/default/default/template/avisverifies/admin/checkinstallation.phtml +81 -7
  39. app/design/frontend/default/default/template/avisverifies/admin/checkinstallation_tab.phtml +1 -1
  40. app/design/frontend/default/default/template/avisverifies/catalogProductList.phtml +89 -0
  41. app/design/frontend/default/default/template/avisverifies/js.phtml +22 -31
  42. app/design/frontend/default/default/template/avisverifies/pagination.phtml +6 -6
  43. app/design/frontend/default/default/template/avisverifies/review/helper/summary.phtml +9 -3
  44. app/design/frontend/default/default/template/avisverifies/review/helper/summary_short.phtml +7 -2
  45. app/design/frontend/default/default/template/avisverifies/reviewProductList.phtml +133 -0
  46. package.xml +5 -5
  47. skin/frontend/base/default/images/avisverifies/Sceau_100.png +0 -0
  48. skin/frontend/base/default/images/avisverifies/Sceau_100de_DE.png +0 -0
  49. skin/frontend/base/default/images/avisverifies/Sceau_100en_GB.png +0 -0
  50. skin/frontend/base/default/images/avisverifies/Sceau_100en_US.png +0 -0
  51. skin/frontend/base/default/images/avisverifies/Sceau_100es_CO.png +0 -0
  52. skin/frontend/base/default/images/avisverifies/Sceau_100es_ES.png +0 -0
  53. skin/frontend/base/default/images/avisverifies/Sceau_100fr_FR.png +0 -0
  54. skin/frontend/base/default/images/avisverifies/Sceau_100it_IT.png +0 -0
  55. skin/frontend/base/default/images/avisverifies/Sceau_100nl_NL.png +0 -0
  56. skin/frontend/base/default/images/avisverifies/Sceau_100pt_PT.png +0 -0
  57. skin/frontend/base/default/images/avisverifies/Sceau_45.png +0 -0
  58. skin/frontend/base/default/images/avisverifies/Sceau_45_ES.png +0 -0
  59. skin/frontend/base/default/images/avisverifies/Sceau_45_fr.png +0 -0
  60. skin/frontend/base/default/images/avisverifies/Sceau_45de_DE.png +0 -0
  61. skin/frontend/base/default/images/avisverifies/Sceau_45en_GB.png +0 -0
  62. skin/frontend/base/default/images/avisverifies/Sceau_45en_US.png +0 -0
  63. skin/frontend/base/default/images/avisverifies/Sceau_45es_CO.png +0 -0
  64. skin/frontend/base/default/images/avisverifies/Sceau_45es_ES.png +0 -0
  65. skin/frontend/base/default/images/avisverifies/Sceau_45fr_FR.png +0 -0
  66. skin/frontend/base/default/images/avisverifies/Sceau_45it_IT.png +0 -0
  67. skin/frontend/base/default/images/avisverifies/Sceau_45nl_NL.png +0 -0
  68. skin/frontend/base/default/images/avisverifies/Sceau_45pt_PT.png +0 -0
  69. skin/frontend/base/default/images/avisverifies/avisverifies.png +0 -0
  70. skin/frontend/base/default/images/avisverifies/etoile0.png +0 -0
  71. skin/frontend/base/default/images/avisverifies/etoile1.png +0 -0
  72. skin/frontend/base/default/images/avisverifies/etoile2.png +0 -0
  73. skin/frontend/base/default/images/avisverifies/etoile3.png +0 -0
  74. skin/frontend/base/default/images/avisverifies/etoile4.png +0 -0
  75. skin/frontend/base/default/images/avisverifies/etoile5.png +0 -0
  76. skin/frontend/base/default/images/avisverifies/mini_etoile_empty.png +0 -0
  77. skin/frontend/base/default/images/avisverifies/mini_etoile_full.png +0 -0
  78. skin/frontend/base/default/images/avisverifies/pagination-loader.gif +0 -0
app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/Edit/Form.php CHANGED
@@ -10,7 +10,7 @@ class Netreviews_Avisverifies_Block_Adminhtml_Form_Edit_Form extends Mage_Adminh
10
'method' => 'post',
11
)
12
);
13
-
14
$form->setUseContainer(true);
15
$this->setForm($form);
16
return parent::_prepareForm();
10
'method' => 'post',
11
)
12
);
13
+
14
$form->setUseContainer(true);
15
$this->setForm($form);
16
return parent::_prepareForm();
app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/Edit/Tabs.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
- class Netreviews_Avisverifies_Block_Adminhtml_Form_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
- {
4
- public function __construct()
5
- {
6
- parent::__construct();
7
- $this->setId('edit_home_tabs');
8
- $this->setDestElementId('edit_form');
9
- $this->setTitle(Mage::helper('avisverifies')->__('Verified Reviews Tabs'));
10
- }
11
-
12
- protected function _beforeToHtml()
13
- {
14
- $this->addTab('export', array(
15
- 'label' => Mage::helper('avisverifies')->__('Export'),
16
- 'title' => Mage::helper('avisverifies')->__('Export'),
17
- 'content' => $this->getLayout()->createBlock('avisverifies/adminhtml_form_edit_tab_export')->toHtml(),
18
- ));
19
-
20
- return parent::_beforeToHtml();
21
- }
22
- }
app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/{Edit/Tab → Export}/Export.php RENAMED
@@ -1,5 +1,5 @@
1
<?php
2
- class Netreviews_Avisverifies_Block_Adminhtml_Form_Edit_Tab_Export extends Mage_Adminhtml_Block_Widget_Form
3
{
4
protected function _prepareForm()
5
{
@@ -7,23 +7,91 @@ class Netreviews_Avisverifies_Block_Adminhtml_Form_Edit_Tab_Export extends Mage_
7
$form = new Varien_Data_Form();
8
$form->setHtmlIdPrefix('export_');
9
$form->setFieldNameSuffix('export');
10
- $websites = Mage::app()->getWebsites();
11
12
- foreach ($websites as $website) {
13
- $arra_websites[] = array('value' => $website->getId(), 'label' => $website->getName());
14
- }
15
-
16
$fieldset = $form->addFieldset('export', array(
17
'legend' => $helper->__('Export Settings'),
18
'class' => 'fieldset-wide',
19
));
20
21
- $fieldset->addField('websitetoexport', 'select', array(
22
- 'label' => Mage::helper('avisverifies')->__('Choose the website to export these orders'),
23
- 'name' => 'websitetoexport',
24
- 'values' => $arra_websites
25
- ));
26
27
$fieldset->addField('csv', 'select', array(
28
'label' => Mage::helper('avisverifies')->__('Run Export CSV'),
29
'name' => 'csv',
@@ -37,7 +105,7 @@ class Netreviews_Avisverifies_Block_Adminhtml_Form_Edit_Tab_Export extends Mage_
37
'label' => Mage::helper('avisverifies')->__('No'),
38
),
39
),
40
- ));
41
42
$fieldset->addField('until', 'select', array(
43
'label' => Mage::helper('avisverifies')->__('Until'),
@@ -116,34 +184,7 @@ class Netreviews_Avisverifies_Block_Adminhtml_Form_Edit_Tab_Export extends Mage_
116
),
117
),
118
));
119
- /*
120
- $all_status = Mage::getModel('sales/order_status')->getResourceCollection()->getData();
121
- foreach($all_status as $value){
122
- $status[] = array('value'=>$value['status'],'label'=>$value['label']);
123
- }
124
-
125
- $fieldset->addField('order_status', 'multiselect', array(
126
- 'label' => Mage::helper('avisverifies')->__('Choose your order status ?'),
127
- 'name' => 'order_status[]',
128
- 'values' => $status
129
- ));
130
131
- $fieldset->addField('csv_semicolon', 'select', array(
132
- 'label' => Mage::helper('avisverifies')->__('Use a semicolon CSV seperator ?'),
133
- 'name' => 'csv_semicolon',
134
- 'values' => array(
135
- array(
136
- 'value' => ',',
137
- 'label' => Mage::helper('avisverifies')->__('No'),
138
- ),
139
- array(
140
- 'value' => ';',
141
- 'label' => Mage::helper('avisverifies')->__('Yes'),
142
- ),
143
- ),
144
- ));
145
- */
146
-
147
if (Mage::registry('avisverifies')) {
148
$form->setValues(Mage::registry('avisverifies')->getData());
149
}
1
<?php
2
+ class Netreviews_Avisverifies_Block_Adminhtml_Form_Export_Export extends Mage_Adminhtml_Block_Widget_Form
3
{
4
protected function _prepareForm()
5
{
7
$form = new Varien_Data_Form();
8
$form->setHtmlIdPrefix('export_');
9
$form->setFieldNameSuffix('export');
10
11
$fieldset = $form->addFieldset('export', array(
12
'legend' => $helper->__('Export Settings'),
13
'class' => 'fieldset-wide',
14
));
15
+
16
+ // -----------------------------------------------------------------------------------------------------------
17
+
18
+ $websites = Mage::app()->getWebsites();
19
+ $arra_websites[10000] = array('value' => 10000, 'label' => Mage::helper('avisverifies')->__('All websites'));
20
+ foreach ($websites as $website) {
21
+ $arra_websites[$website->getId()] = array('value' => $website->getId(), 'label' => $website->getName());
22
+ }
23
24
+ $websiteCode = Mage::app()->getRequest()->getParam('website');
25
+ if ($websiteCode) {
26
+ $website = Mage::getModel('core/website')->load($websiteCode);
27
+ $websiteId = $website->getId();
28
+ //do your magic with $websiteId
29
+ $useProductSKU = $website->getConfig('avisverifies/extra/useProductSKU');
30
+ }
31
+ else {
32
+ $websiteId = 10000;
33
+ $website = Mage::getModel('core/website')->load('default');
34
+ $useProductSKU = $website->getConfig('avisverifies/extra/useProductSKU');
35
+ }
36
37
+ $fieldset->addField('websitetoexport', 'text', array(
38
+ 'label' => Mage::helper('avisverifies')->__('Choosen website to export orders from'),
39
+ 'name' => 'websitetoexport',
40
+ 'value' => $arra_websites[$websiteId]['label'],
41
+ 'readonly' => true,
42
+ ));
43
+ $fieldset->addField('websiteIdHidden', 'hidden', array(
44
+ 'required' => true,
45
+ 'name' => 'websiteIdHidden',
46
+ 'value' => $websiteId,
47
+ ));
48
+ // -----------------------------------------------------------------------------------------------------------
49
+
50
+ $stores = Mage::app()->getStores();
51
+ $arra_stores[10000] = array('value' => 10000, 'label' => Mage::helper('avisverifies')->__('All Stores'));
52
+ foreach ($stores as $store) {
53
+ $arra_stores[$store->getId()] = array('value' => $store->getId(), 'label' => $store->getName());
54
+ }
55
+
56
+ $storeCode = Mage::app()->getRequest()->getParam('store');
57
+ if ($storeCode) {
58
+ $store = Mage::getModel('core/store')->load($storeCode);
59
+ $storeId = $store->getId();
60
+ $useProductSKU = $store->getConfig('avisverifies/extra/useProductSKU');
61
+ }
62
+ else {
63
+ $storeId = 10000;
64
+ }
65
+
66
+ $fieldset->addField('storetoexport', 'text', array(
67
+ 'label' => Mage::helper('avisverifies')->__('Choosen store from the website above to export orders from'),
68
+ 'name' => 'websitetoexport',
69
+ 'value' => $arra_stores[$storeId]['label'],
70
+ 'readonly' => true,
71
+ ));
72
+ $fieldset->addField('storeIdHidden', 'hidden', array(
73
+ 'required' => true,
74
+ 'name' => 'storeIdHidden',
75
+ 'value' => $storeId,
76
+ ));
77
+ // -----------------------------------------------------------------------------------------------------------
78
+
79
+ $fieldset->addField('sku', 'select', array(
80
+ 'label' => Mage::helper('avisverifies')->__('Use product sku'),
81
+ 'name' => 'sku',
82
+ 'value' => $useProductSKU,
83
+ 'values' => array(
84
+ array(
85
+ 'value' => 1,
86
+ 'label' => Mage::helper('avisverifies')->__('Yes'),
87
+ ),
88
+ array(
89
+ 'value' => 0,
90
+ 'label' => Mage::helper('avisverifies')->__('No'),
91
+ ),
92
+ ),
93
+ ));
94
+ // -----------------------------------------------------------------------------------------------------------
95
$fieldset->addField('csv', 'select', array(
96
'label' => Mage::helper('avisverifies')->__('Run Export CSV'),
97
'name' => 'csv',
105
'label' => Mage::helper('avisverifies')->__('No'),
106
),
107
),
108
+ ));
109
110
$fieldset->addField('until', 'select', array(
111
'label' => Mage::helper('avisverifies')->__('Until'),
184
),
185
),
186
));
187
188
if (Mage::registry('avisverifies')) {
189
$form->setValues(Mage::registry('avisverifies')->getData());
190
}
app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/Export/Tabs.php ADDED
@@ -0,0 +1,27 @@
1
+ <?php
2
+ class Netreviews_Avisverifies_Block_Adminhtml_Form_Export_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
3
+ {
4
+ public function __construct()
5
+ {
6
+ parent::__construct();
7
+ $this->setId('edit_home_tabs');
8
+ $this->setDestElementId('edit_form');
9
+ $this->setTitle(Mage::helper('avisverifies')->__('Verified Reviews Tabs'));
10
+ }
11
+
12
+ protected function _beforeToHtml()
13
+ {
14
+ $style = '<style>';
15
+ $style .= '#export_storetoexport{width: 274px !important;background-color: #DBDBDB;}';
16
+ $style .= '#export_websitetoexport{width: 274px !important;background-color: #DBDBDB;}';
17
+ $style .= '</style>';
18
+ $this->addTab('export', array(
19
+ 'label' => Mage::helper('avisverifies')->__('Export'),
20
+ 'title' => Mage::helper('avisverifies')->__('Export'),
21
+ 'content' => $this->getLayout()->createBlock('adminhtml/system_config_switcher')->toHtml().
22
+ $this->getLayout()->createBlock('avisverifies/adminhtml_form_export_export')->toHtml().$style,
23
+ ));
24
+
25
+ return parent::_beforeToHtml();
26
+ }
27
+ }
app/code/local/Netreviews/Avisverifies/Block/Adminhtml/Form/{Edit.php → Export/index.php} RENAMED
@@ -1,5 +1,5 @@
1
<?php
2
- class Netreviews_Avisverifies_Block_Adminhtml_Form_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
3
{
4
public function __construct()
5
{
@@ -7,7 +7,6 @@ class Netreviews_Avisverifies_Block_Adminhtml_Form_Edit extends Mage_Adminhtml_B
7
$this->_blockGroup = 'avisverifies';
8
$this->_controller = 'adminhtml_form';
9
$version = Mage::getConfig()->getNode()->modules->Netreviews_Avisverifies->version;
10
- $this->_headerText = Mage::helper('avisverifies')->__('Verified Reviews Form').
11
- '<br> <small style="font-size:9px;">'.Mage::helper('avisverifies')->__('version').': '.$version.'</small>';
12
}
13
}
1
<?php
2
+ class Netreviews_Avisverifies_Block_Adminhtml_Form_Export_Index extends Mage_Adminhtml_Block_Widget_Form_Container
3
{
4
public function __construct()
5
{
7
$this->_blockGroup = 'avisverifies';
8
$this->_controller = 'adminhtml_form';
9
$version = Mage::getConfig()->getNode()->modules->Netreviews_Avisverifies->version;
10
+ $this->_headerText = Mage::helper('avisverifies')->__('Verified Reviews Form');
11
}
12
}
app/code/local/Netreviews/Avisverifies/Block/Catalog/Product/List.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
- class Netreviews_Avisverifies_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List
3
- {
4
- // function override changing $templateType = false to $templateType = 'short'.
5
- public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = 'short',$displayIfNoReviews = false)
6
- {
7
- // load avis verifiee product
8
- $id = $product->getId();
9
- $_newProduct = Mage::getModel('avisverifies/product')->load($id);
10
- // the $templateType fix is handled in block - review - helper code.
11
- if ($this->_initReviewsHelperBlock()) {
12
- return $this->_reviewsHelperBlock->getSummaryHtml($_newProduct, $templateType, $displayIfNoReviews);
13
- }
14
- return '';
15
- }
16
-
17
- // copy of the code for 1.3 older version compatibility
18
- protected function _initReviewsHelperBlock()
19
- {
20
- if (!$this->_reviewsHelperBlock) {
21
- if (!$this->isModuleEnabled('Mage_Review')) {
22
- return false;
23
- } else {
24
- $this->_reviewsHelperBlock = $this->getLayout()->createBlock('review/helper');
25
- }
26
- }
27
- return true;
28
- }
29
-
30
- protected function isModuleEnabled($moduleName)
31
- {
32
- if (!Mage::getConfig()->getNode('modules/' . $moduleName)) {
33
- return false;
34
- }
35
- $isActive = Mage::getConfig()->getNode('modules/' . $moduleName . '/active');
36
- if (!$isActive || !in_array((string)$isActive, array('true', '1'))) {
37
- return false;
38
- }
39
- return true;
40
- }
41
- // copy of the code for 1.3 older version compatibility
42
- }
app/code/local/Netreviews/Avisverifies/Block/Catalog/Product/View.php DELETED
@@ -1,42 +0,0 @@
1
- <?php
2
- class Netreviews_Avisverifies_Block_Catalog_Product_View extends Mage_Catalog_Block_Product_View
3
- {
4
- // function override changing $templateType = false to $templateType = 'short'.
5
- public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = 'short',$displayIfNoReviews = false)
6
- {
7
- // load avis verifiee product
8
- $id = $product->getId();
9
- $_newProduct = Mage::getModel('avisverifies/product')->load($id);
10
- // the $templateType fix is handled in block - review - helper code.
11
- if ($this->_initReviewsHelperBlock()) {
12
- return $this->_reviewsHelperBlock->getSummaryHtml($_newProduct, $templateType, $displayIfNoReviews);
13
- }
14
- return '';
15
- }
16
-
17
- // copy of the code for 1.3 older version compatibility
18
- protected function _initReviewsHelperBlock()
19
- {
20
- if (!$this->_reviewsHelperBlock) {
21
- if (!$this->isModuleEnabled('Mage_Review')) {
22
- return false;
23
- } else {
24
- $this->_reviewsHelperBlock = $this->getLayout()->createBlock('review/helper');
25
- }
26
- }
27
- return true;
28
- }
29
-
30
- protected function isModuleEnabled($moduleName)
31
- {
32
- if (!Mage::getConfig()->getNode('modules/' . $moduleName)) {
33
- return false;
34
- }
35
- $isActive = Mage::getConfig()->getNode('modules/' . $moduleName . '/active');
36
- if (!$isActive || !in_array((string)$isActive, array('true', '1'))) {
37
- return false;
38
- }
39
- return true;
40
- }
41
- // copy of the code for 1.3 older version compatibility
42
- }
app/code/local/Netreviews/Avisverifies/Block/Entity/Detailed.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
- class Netreviews_Avisverifies_Block_Entity_Detailed extends Mage_Rating_Block_Entity_Detailed
3
- {
4
- public function __construct()
5
- {
6
- Mage_Core_Block_Template::__construct();
7
- $this->setTemplate('rating/detailed.phtml');
8
- $entityId = Mage::app()->getRequest()->getParam('id');
9
- $this->NbAvis = Mage::getModel('avisverifies/reviews')->getNbAvis($entityId);
10
- $this->Note = Mage::getModel('avisverifies/reviews')->getNote($entityId);
11
- }
12
-
13
- function _toHtml()
14
- {
15
- $entityId = Mage::app()->getRequest()->getParam('id');
16
- if (intval($entityId) <= 0) {
17
- return '';
18
- }
19
-
20
- $NbAvis = Mage::getModel('avisverifies/reviews')->getNbAvis($entityId);
21
- $reviewsCount = Mage::getModel('avisverifies/reviews')
22
- ->getTotalReviews($entityId, true);
23
-
24
- if (Mage::getStoreConfig('avisverifies/system/product') == 1) {
25
- $this->setTemplate('avisverifies/review/helper/counter.phtml');
26
- return Mage_Core_Block_Template::_toHtml();
27
- }
28
-
29
- $ratingCollection = Mage::getModel('rating/rating')
30
- ->getResourceCollection()
31
- ->addEntityFilter('product') # TOFIX
32
- ->setPositionOrder()
33
- ->setStoreFilter(Mage::app()->getStore()->getId())
34
- ->addRatingPerStoreName(Mage::app()->getStore()->getId())
35
- ->load();
36
-
37
- if ($entityId) {
38
- $ratingCollection->addEntitySummaryToItem($entityId, Mage::app()->getStore()->getId());
39
- }
40
-
41
- $this->assign('collection', $ratingCollection);
42
- return Mage_Core_Block_Template::_toHtml();
43
- }
44
- }
app/code/local/Netreviews/Avisverifies/Block/Review/Helper.php CHANGED
@@ -6,11 +6,45 @@ class Netreviews_Avisverifies_Block_Review_Helper extends Mage_Review_Block_Help
6
'default' => 'avisverifies/review/helper/summary.phtml',
7
'short' => 'avisverifies/review/helper/summary_short.phtml'
8
);
9
-
10
// add shorcut function for product id.
11
public function getProductId()
12
{
13
return $this->getProduct()->getId();
14
}
15
16
}
6
'default' => 'avisverifies/review/helper/summary.phtml',
7
'short' => 'avisverifies/review/helper/summary_short.phtml'
8
);
9
+
10
+ public function getSummaryHtml($product, $templateType, $displayIfNoReviews)
11
+ {
12
+ if (Netreviews_Avisverifies_Helper_Data::isActive()) {
13
+ // pick template among available
14
+ if (empty($this->_availableTemplates[$templateType])) {
15
+ $templateType = 'default';
16
+ }
17
+ $isProductList = Mage::registry('netreview_isProductlist');
18
+ if (!empty($isProductList)) {
19
+ $templateType = 'short';
20
+ }
21
+ // admin config
22
+ $isLightWidget = Mage::getStoreConfig('avisverifies/extra/productLightWidget');
23
+ if ($isLightWidget) {
24
+ $templateType = 'short';
25
+ }
26
+
27
+ $this->setProduct($product);
28
+ // we can add our own logic here
29
+ $this->setTemplate($this->_availableTemplates[$templateType]);
30
+ return $this->toHtml();
31
+ }
32
+ else {
33
+ return parent::getSummaryHtml($product, $templateType, $displayIfNoReviews);
34
+ }
35
+ }
36
+
37
// add shorcut function for product id.
38
public function getProductId()
39
{
40
return $this->getProduct()->getId();
41
}
42
43
+ public function getProductSKU()
44
+ {
45
+ return $this->getProduct()->getSku();
46
+ }
47
+
48
+
49
+
50
}
app/code/local/Netreviews/Avisverifies/Block/Review/Product/View.php CHANGED
@@ -1,30 +1,15 @@
1
<?php
2
class Netreviews_Avisverifies_Block_Review_Product_View extends Mage_Review_Block_Product_View
3
{
4
- // function override changing $templateType = false to $templateType = 'short'.
5
- public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = 'short',$displayIfNoReviews = false)
6
{
7
- // load avis verifiee product
8
- $id = $product->getId();
9
- $_newProduct = Mage::getModel('avisverifies/product')->load($id);
10
- // the $templateType fix is handled in block - review - helper code.
11
- if ($this->_initReviewsHelperBlock()) {
12
- return $this->_reviewsHelperBlock->getSummaryHtml($_newProduct, $templateType, $displayIfNoReviews);
13
}
14
- return '';
15
- }
16
-
17
- // copy of the code for older version compatibility
18
- protected function _initReviewsHelperBlock()
19
- {
20
- if (!$this->_reviewsHelperBlock) {
21
- if (!Mage::helper('catalog')->isModuleEnabled('Mage_Review')) {
22
- return false;
23
- } else {
24
- $this->_reviewsHelperBlock = $this->getLayout()->createBlock('review/helper');
25
- }
26
}
27
-
28
- return true;
29
}
30
}
1
<?php
2
class Netreviews_Avisverifies_Block_Review_Product_View extends Mage_Review_Block_Product_View
3
{
4
+ // function override for review page widget
5
+ public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = false,$displayIfNoReviews = false)
6
{
7
+ if (Netreviews_Avisverifies_Helper_Data::isActive()) {
8
+ return $this->getLayout()->createBlock('review/helper')->getSummaryHtml($product, $templateType, $displayIfNoReviews);
9
}
10
+ else {
11
+ return parent::getReviewsSummaryHtml($product, $templateType,$displayIfNoReviews);
12
}
13
+
14
}
15
}
app/code/local/Netreviews/Avisverifies/Helper/Data.php CHANGED
@@ -5,7 +5,6 @@
5
*/
6
class Netreviews_Avisverifies_Helper_Data extends Mage_Core_Helper_Abstract{
7
8
- public $shopId = 1;
9
public $idwebsite;
10
public $secretkey;
11
public $statusChoosen;
@@ -15,18 +14,17 @@ class Netreviews_Avisverifies_Helper_Data extends Mage_Core_Helper_Abstract{
15
public $forbiddenMailExtensions;
16
public $delay;
17
public $SHA1;
18
-
19
- protected $config;
20
21
public function setup(array $config){
22
- $this->config = $config;
23
// Magento Shop Info
24
- $this->shopId = (isset($config['idShop']))? $config['idShop'] : $this->shopId;
25
// shop configuration
26
- $magesel = Mage::getModel("core/website")->load($this->shopId);
27
- $this->idwebsite = $magesel->getConfig('avisverifies/system/idwebsite');
28
- $this->secretkey = $magesel->getConfig('avisverifies/system/secretkey');
29
- $this->enabledwebsite = $magesel->getConfig('avisverifies/system/enabledwebsite');//reglage par defaut
30
// order config.
31
$this->allowedProducts = $magesel->getConfig(strtolower('AVISVERIFIES/system/GETPRODREVIEWS')); //récupérer les avis produits ou non
32
$this->processChoosen = $magesel->getConfig(strtolower('AVISVERIFIES/system/PROCESSINIT')); //onorder or onorderstatuschange
@@ -38,6 +36,58 @@ class Netreviews_Avisverifies_Helper_Data extends Mage_Core_Helper_Abstract{
38
$this->SHA1 = SHA1($config['query'].$this->idwebsite.$this->secretkey);
39
}
40
41
// Check if the module is active
42
public static function isActive(){
43
return (Mage::getStoreConfig('avisverifies/system/enabledwebsite') == 1 &&
@@ -48,6 +98,37 @@ class Netreviews_Avisverifies_Helper_Data extends Mage_Core_Helper_Abstract{
48
public static function isDefaultDisplay() {
49
// defaultReviews / 1 to hide and 0 to show
50
// so we need to retun !defaultReviews
51
- return !Mage::getStoreConfig('avisverifies/system/defaultReviews');
52
}
53
}
5
*/
6
class Netreviews_Avisverifies_Helper_Data extends Mage_Core_Helper_Abstract{
7
8
public $idwebsite;
9
public $secretkey;
10
public $statusChoosen;
14
public $forbiddenMailExtensions;
15
public $delay;
16
public $SHA1;
17
+ public $allShopIds;
18
19
public function setup(array $config){
20
// Magento Shop Info
21
+ $this->idwebsite = $config['idWebsite'];
22
+ $this->secretkey = static::getModuleSecretKey($config['idWebsite']);
23
+ $this->enabledwebsite = (empty($this->secretkey))? 0 : 1;
24
+ $this->allShopIds = static::getModuleActiveStoresIds($config['idWebsite']);
25
// shop configuration
26
+ $magesel = Mage::getModel("core/store")->load(reset($this->allShopIds));
27
+
28
// order config.
29
$this->allowedProducts = $magesel->getConfig(strtolower('AVISVERIFIES/system/GETPRODREVIEWS')); //récupérer les avis produits ou non
30
$this->processChoosen = $magesel->getConfig(strtolower('AVISVERIFIES/system/PROCESSINIT')); //onorder or onorderstatuschange
36
$this->SHA1 = SHA1($config['query'].$this->idwebsite.$this->secretkey);
37
}
38
39
+ // we are going to filter by idWebsite and is active
40
+ public static function getModuleActiveStoresIds($idWebsite){
41
+ // get config by id
42
+ // get config by id
43
+ $resource = Mage::getModel("core/config_data")->getCollection()
44
+ ->addFieldToFilter('scope','stores')
45
+ ->addFieldToFilter('value',$idWebsite);
46
+ // now filter again by is active
47
+ $scope_id = array();
48
+ foreach ($resource as $val) {
49
+ $scope_id[] = $val->getData('scope_id');
50
+ }
51
+ // now filter with the config set to enabledwebsite = 1
52
+ $resource = Mage::getModel("core/config_data")->getCollection()
53
+ ->addFieldToFilter('scope','stores')
54
+ ->addFieldToFilter('scope_id',array("in"=>$scope_id))
55
+ ->addFieldToFilter('path','avisverifies/system/enabledwebsite')
56
+ ->addFieldToFilter('value','1');
57
+
58
+ $usedSotersIds = array();
59
+ foreach ($resource as $val) {
60
+ $usedSotersIds[] = $val->getData('scope_id');
61
+ }
62
+ return $usedSotersIds;
63
+ }
64
+
65
+ public static function getModuleSecretKey($idWebsite){
66
+ // get config by id
67
+ $resource = Mage::getModel("core/config_data")->getCollection()
68
+ ->addFieldToFilter('scope','stores')
69
+ ->addFieldToFilter('value',$idWebsite);
70
+ // now filter again by is active
71
+ $scope_id = array();
72
+ foreach ($resource as $val) {
73
+ $scope_id[] = $val->getData('scope_id');
74
+ }
75
+ // now filter with the config set to enabledwebsite = 1
76
+ $resource = Mage::getModel("core/config_data")->getCollection()
77
+ ->addFieldToFilter('scope','stores')
78
+ ->addFieldToFilter('scope_id',array("in"=>$scope_id))
79
+ ->addFieldToFilter('path','avisverifies/system/enabledwebsite')
80
+ ->addFieldToFilter('value','1')->getFirstItem();
81
+ // use the first element to get the config
82
+ $resource = Mage::getModel("core/config_data")->getCollection()
83
+ ->addFieldToFilter('scope','stores')
84
+ ->addFieldToFilter('path','avisverifies/system/secretkey')
85
+ ->addFieldToFilter('scope_id',$resource->getData('scope_id'))
86
+ ->getFirstItem();
87
+
88
+ return $resource->getData('value');
89
+ }
90
+
91
// Check if the module is active
92
public static function isActive(){
93
return (Mage::getStoreConfig('avisverifies/system/enabledwebsite') == 1 &&
98
public static function isDefaultDisplay() {
99
// defaultReviews / 1 to hide and 0 to show
100
// so we need to retun !defaultReviews
101
+ return !Mage::getStoreConfig('avisverifies/extra/defaultReviews');
102
+ }
103
+
104
+ public static function addReviewToProductPage() {
105
+ // default false , change to true
106
+ return Mage::getStoreConfig('avisverifies/extra/addReviewToProductPage');
107
+ }
108
+
109
+ public static function hasjQuery() {
110
+ // default to No = 0
111
+ return (boolean)Mage::getStoreConfig('avisverifies/extra/hasjQuery');
112
}
113
+
114
+ public static function removeLinkWidget() {
115
+ $addReviewToProductPage = Mage::getStoreConfig('avisverifies/extra/addReviewToProductPage');
116
+ $pageType = Mage::app()->getRequest()->getControllerName();
117
+ $moduleName = Mage::app()->getRequest()->getModuleName();
118
+
119
+ if ($pageType == 'product' && $moduleName = 'product' && $addReviewToProductPage) {
120
+ return true;
121
+ }
122
+ elseif($pageType == 'review' && $moduleName = 'review') {
123
+ return true;
124
+ }
125
+ elseif($pageType == 'product' && $moduleName = 'review') {
126
+ return true;
127
+ }
128
+ else {
129
+ return false;
130
+ }
131
+
132
+ }
133
+
134
}
app/code/local/Netreviews/Avisverifies/Helper/Export.php CHANGED
@@ -66,6 +66,7 @@ class Netreviews_Avisverifies_Helper_Export{
66
public function __construct(){
67
$this->resource = Mage::getSingleton('core/resource');
68
$this->collection = Mage::getResourceModel('sales/order_collection');
69
// check for sale order module version
70
$version = Mage::getConfig()->getModuleConfig("Mage_Sales")->version;
71
$version = $this->convertVersion($version);
@@ -86,22 +87,14 @@ class Netreviews_Avisverifies_Helper_Export{
86
$this->isProductExport = ($isProductExport == 1 || $isProductExport == 'yes');
87
}
88
89
- public function createStoresIds($websitetoexport){
90
- $magesel = Mage::getModel('core/website')->load($websitetoexport);
91
$delay = $magesel->getConfig(strtolower('AVISVERIFIES/system/DELAY'));
92
$this->delay = (isset($delay))? $delay : 0;
93
-
94
- $website = $magesel;
95
- $this->idShop = trim($website->getCode());
96
-
97
- $arrStores = array();
98
- foreach ($website->getStores() as $key => $store) {
99
- $arrStores[] = $store->getData('store_id');
100
- }
101
$this->arrStoresIds = $arrStores;
102
-
103
// Force Parent Id
104
- $this->forceParentId = ($magesel->getConfig(strtolower('avisverifies/system/FORCE_PRODUCT_PARENT_ID')) == 'true');
105
$this->configuredWebsiteId = true ;
106
107
}
@@ -184,7 +177,11 @@ class Netreviews_Avisverifies_Helper_Export{
184
$collection->getSelect()->joinLeft(
185
array('url'=>"(SELECT * FROM {$resource->getTableName('core/url_rewrite')} GROUP BY product_id)"),
186
'product.product_id = url.product_id',
187
- array('product.*'));
188
}
189
190
protected function querySelectFixVersion13(){
@@ -210,8 +207,14 @@ class Netreviews_Avisverifies_Helper_Export{
210
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS)->columns($this->mainTable.'.entity_id')
211
->columns($this->mainTable.'.increment_id')
212
->columns("DATE_FORMAT({$this->mainTable}.created_at,'%d/%m/%Y %H:%i') as created_at")
213
- ->columns('product.product_id')->columns('product.name')
214
->columns('url.request_path as url')->columns('media.value as url_image');
215
if ($this->API) {
216
$collection->getSelect()
217
->columns($this->mainTable.'.av_flag')
@@ -343,7 +346,7 @@ class Netreviews_Avisverifies_Helper_Export{
343
$this->customer['prenom'] = utf8_decode($item['firstname']);
344
$this->customer['date'] = $item['created_at'];
345
$this->customer['delay'] = $this->delay;
346
- $this->customer["id_shop"] = $this->idShop;
347
$this->customer['product_id'] = ($this->isProductExport)? $item['product_id'] : "";
348
$this->customer['product_name'] = ($this->isProductExport)? utf8_decode($item['name']) : "";
349
$this->customer['product_name'] = str_replace(",", " - ", $this->customer['product_name']);
@@ -374,6 +377,7 @@ class Netreviews_Avisverifies_Helper_Export{
374
// Get product parent id
375
$resource = $this->resource;
376
$readConnection = $resource->getConnection('core_read');
377
$table = $resource->getTableName('catalog/product_super_link');
378
$query = "SELECT * FROM $table";
379
$collection = $readConnection->fetchAll($query);
@@ -381,6 +385,15 @@ class Netreviews_Avisverifies_Helper_Export{
381
if (isset($this->mapProductId[$val['product_id']]))
382
$this->mapProductId[$val['product_id']] = (int) $val['parent_id'];
383
}
384
$tmp = $this->dataExport;
385
unset($tmp[0]); // 0 contain header info
386
// now loop over the array and change id to parent id.
@@ -397,12 +410,13 @@ class Netreviews_Avisverifies_Helper_Export{
397
}
398
399
protected function throwExecption(){
400
- if ($this->isProductExport === null)
401
Mage::throwException('Please specify "exportStruct()" before creating items. ');
402
403
- if ($this->configuredWebsiteId !== true)
404
Mage::throwException('Please specify "createStoresIds()" before creating items. ');
405
-
406
}
407
408
66
public function __construct(){
67
$this->resource = Mage::getSingleton('core/resource');
68
$this->collection = Mage::getResourceModel('sales/order_collection');
69
+
70
// check for sale order module version
71
$version = Mage::getConfig()->getModuleConfig("Mage_Sales")->version;
72
$version = $this->convertVersion($version);
87
$this->isProductExport = ($isProductExport == 1 || $isProductExport == 'yes');
88
}
89
90
+ public function createStoresIds($arrStores){
91
+ $magesel = Mage::getModel('core/store')->load(reset($arrStores));
92
$delay = $magesel->getConfig(strtolower('AVISVERIFIES/system/DELAY'));
93
$this->delay = (isset($delay))? $delay : 0;
94
$this->arrStoresIds = $arrStores;
95
// Force Parent Id
96
+ $this->forceParentId = ($magesel->getConfig('avisverifies/extra/force_product_parent_id') == '1');
97
+ $this->useSKU = ($magesel->getConfig('avisverifies/extra/useProductSKU') == '1');
98
$this->configuredWebsiteId = true ;
99
100
}
177
$collection->getSelect()->joinLeft(
178
array('url'=>"(SELECT * FROM {$resource->getTableName('core/url_rewrite')} GROUP BY product_id)"),
179
'product.product_id = url.product_id',
180
+ array('product.*'));
181
+ $collection->getSelect()->joinLeft(
182
+ array('viewstore'=>$resource->getTableName('core/store')),
183
+ $this->mainTable.'.store_id = viewstore.store_id ',
184
+ array('viewstore.*'));
185
}
186
187
protected function querySelectFixVersion13(){
207
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS)->columns($this->mainTable.'.entity_id')
208
->columns($this->mainTable.'.increment_id')
209
->columns("DATE_FORMAT({$this->mainTable}.created_at,'%d/%m/%Y %H:%i') as created_at")
210
+ ->columns('product.name')->columns('viewstore.code AS id_shop')
211
->columns('url.request_path as url')->columns('media.value as url_image');
212
+ if ($this->useSKU) {
213
+ $collection->getSelect()->columns('product.sku as product_id');
214
+ }
215
+ else {
216
+ $collection->getSelect()->columns('product.product_id');
217
+ }
218
if ($this->API) {
219
$collection->getSelect()
220
->columns($this->mainTable.'.av_flag')
346
$this->customer['prenom'] = utf8_decode($item['firstname']);
347
$this->customer['date'] = $item['created_at'];
348
$this->customer['delay'] = $this->delay;
349
+ $this->customer['id_shop'] = $item['id_shop'];
350
$this->customer['product_id'] = ($this->isProductExport)? $item['product_id'] : "";
351
$this->customer['product_name'] = ($this->isProductExport)? utf8_decode($item['name']) : "";
352
$this->customer['product_name'] = str_replace(",", " - ", $this->customer['product_name']);
377
// Get product parent id
378
$resource = $this->resource;
379
$readConnection = $resource->getConnection('core_read');
380
+ // super link
381
$table = $resource->getTableName('catalog/product_super_link');
382
$query = "SELECT * FROM $table";
383
$collection = $readConnection->fetchAll($query);
385
if (isset($this->mapProductId[$val['product_id']]))
386
$this->mapProductId[$val['product_id']] = (int) $val['parent_id'];
387
}
388
+ // product link
389
+ $table = $resource->getTableName('catalog/product_link');
390
+ $query = "SELECT * FROM $table";
391
+ $collection = $readConnection->fetchAll($query);
392
+ foreach ($collection as $val) {
393
+ if (isset($this->mapProductId[$val['product_id']]))
394
+ $this->mapProductId[$val['product_id']] = (int) $val['linked_product_id'];
395
+ }
396
+ // continue algo
397
$tmp = $this->dataExport;
398
unset($tmp[0]); // 0 contain header info
399
// now loop over the array and change id to parent id.
410
}
411
412
protected function throwExecption(){
413
+ if ($this->isProductExport === null) {
414
Mage::throwException('Please specify "exportStruct()" before creating items. ');
415
+ }
416
417
+ if ($this->configuredWebsiteId !== true) {
418
Mage::throwException('Please specify "createStoresIds()" before creating items. ');
419
+ }
420
}
421
422
app/code/local/Netreviews/Avisverifies/Helper/Install.php ADDED
@@ -0,0 +1,131 @@
1
+ <?php
2
+ class Netreviews_Avisverifies_Helper_Install {
3
+
4
+
5
+ public static function checkOrder($orderId){
6
+ try {
7
+ return static::_checkOrder($orderId);
8
+ } catch (Exception $exc) {
9
+ // do nothing
10
+ return array();
11
+ }
12
+ }
13
+
14
+ protected static function _checkOrder($orderId) {
15
+ $resource = Mage::getSingleton('core/resource');
16
+ $read = $resource->getConnection('core_read');
17
+ $orderId = (is_null($orderId))? NULL : (int) stripcslashes(urlencode($orderId));
18
+ $table3 = $resource->getTableName('sales/order');
19
+ $checkOrders = array();
20
+ if ($orderId) {
21
+ $table4 = $resource->getTableName('sales/order_item');
22
+ $query = " SELECT "
23
+ . "`t3`.`increment_id`,`t4`.`item_id`, `t4`.`order_id`, `t4`.`parent_item_id`,"
24
+ . " `t4`.`quote_item_id`, `t4`.`store_id`, `t4`.`created_at`, `t4`.`updated_at`, `t4`.`product_id`,"
25
+ . " `t4`.`product_type`, `t4`.`is_virtual`, `t4`.`sku`, `t4`.`name` "
26
+ . " FROM $table4 t4 LEFT JOIN $table3 t3 ON t3.entity_id = t4.order_id "
27
+ . " WHERE t3.increment_id = :orderId ";
28
+ $bind = array('orderId' => $orderId);
29
+ return $read->query($query, $bind)->fetchAll();
30
+ }
31
+ }
32
+
33
+ public static function flagAll(){
34
+ try {
35
+ static::_flagAll();
36
+ } catch (Exception $exc) {
37
+ // do nothing
38
+ }
39
+ }
40
+
41
+ protected static function _flagAll(){
42
+ $resource = Mage::getSingleton('core/resource');
43
+ $write = $resource->getConnection('core_write');
44
+ $order = $resource->getTableName('sales/order');
45
+ $write->query("UPDATE `{$order}` SET `av_flag` = 1;");
46
+ }
47
+
48
+ public static function addFields(){
49
+ try {
50
+ static::_addFields();
51
+ } catch (Exception $exc) {
52
+ // do nothing
53
+ }
54
+ }
55
+
56
+ protected static function _addFields(){
57
+ $resource = Mage::getSingleton('core/resource');
58
+ $write = $resource->getConnection('core_write');
59
+ $read = $resource->getConnection('core_read');
60
+ $order = $resource->getTableName('sales/order');
61
+
62
+ // Flag
63
+ $avFlag = $read->query('SELECT COUNT(*) as flag
64
+ FROM INFORMATION_SCHEMA.COLUMNS
65
+ WHERE table_name = "'.$order.'"
66
+ AND table_schema = DATABASE()
67
+ AND column_name = "av_flag"')->fetchAll();
68
+ $avFlag = $avFlag[0]['flag'];
69
+ if ($avFlag == 0) {
70
+ $write->query("ALTER TABLE `{$order}` add av_flag tinyint default 0;");
71
+ $write->query("UPDATE `{$order}` SET `av_flag` = 1;");
72
+ }
73
+ else {
74
+ $write->query("UPDATE `{$order}` SET `av_flag` = 1;");
75
+ }
76
+ // horodate
77
+ $horodate = $read->query('SELECT COUNT(*) as horodate
78
+ FROM INFORMATION_SCHEMA.COLUMNS
79
+ WHERE table_name = "'.$order.'"
80
+ AND table_schema = DATABASE()
81
+ AND column_name = "av_horodate_get"')->fetchAll();
82
+ $horodate = $horodate[0]['horodate'];
83
+ if ($horodate == 0) {
84
+ $write->query("ALTER TABLE `{$order}` add av_horodate_get varchar(32);");
85
+ }
86
+
87
+ }
88
+
89
+ public static function createTables(){
90
+ try {
91
+ static::_createTables();
92
+ } catch (Exception $exc) {
93
+ // do nothing
94
+ }
95
+ }
96
+
97
+ public static function _createTables(){
98
+ $resource = Mage::getSingleton('core/resource');
99
+ $write = $resource->getConnection('core_write');
100
+ // Install Tables, RUN Query.
101
+ $write->query("
102
+ CREATE TABLE IF NOT EXISTS `{$resource->getTableName('avisverifies_products_reviews')}` (
103
+ `id_product_av` varchar(36) NOT NULL,
104
+ `ref_product` varchar(20) NOT NULL,
105
+ `rate` varchar(5) NOT NULL,
106
+ `review` text NOT NULL,
107
+ `customer_name` varchar(30) NOT NULL,
108
+ `horodate` varchar(32) NOT NULL,
109
+ `discussion` text,
110
+ `lang` varchar(5),
111
+ `website_id` smallint(5) not null default 0,
112
+ PRIMARY KEY (`id_product_av`)
113
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
114
+ ");
115
+ $write->query("
116
+ CREATE TABLE IF NOT EXISTS `{$resource->getTableName('avisverifies_products_average')}` (
117
+ `id_product_av` varchar(36) NOT NULL,
118
+ `ref_product` varchar(20) NOT NULL,
119
+ `rate` varchar(5) NOT NULL,
120
+ `nb_reviews` int(10) NOT NULL,
121
+ `horodate_update` varchar(32) NOT NULL,
122
+ `id_lang` varchar(5) DEFAULT NULL,
123
+ `website_id` smallint(5) not null default 0,
124
+ PRIMARY KEY (`ref_product`)
125
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
126
+ ");
127
+
128
+ }
129
+
130
+ }
131
+
app/code/local/Netreviews/Avisverifies/Model/Observers/Product/List.php ADDED
@@ -0,0 +1,13 @@
1
+ <?php
2
+ class Netreviews_Avisverifies_Model_Observers_Product_List {
3
+ public function updateProductRatingSummary(Varien_Event_Observer $observer){
4
+ if (Netreviews_Avisverifies_Helper_Data::isActive()) {
5
+ Mage::register('netreview_isProductlist',true);
6
+ $_productCollection = $observer->getData('collection');
7
+ foreach ($_productCollection as $_product) {
8
+ $_product->setData('rating_summary',true);
9
+ }
10
+ }
11
+ }
12
+ }
13
+
app/code/local/Netreviews/Avisverifies/Model/Observers/System.php ADDED
@@ -0,0 +1,76 @@
1
+ <?php
2
+
3
+ class Netreviews_Avisverifies_Model_Observers_System {
4
+
5
+ public function save(Varien_Event_Observer $observer) {
6
+
7
+ $curWebsite = Mage::app()->getRequest()->getParam('website');
8
+ $curStore = Mage::app()->getRequest()->getParam('store');
9
+
10
+ $storeModel = Mage::getSingleton('adminhtml/system_store');
11
+ $mageselc = new Mage_Core_Model_Config();
12
+ $POST = Mage::app()->getRequest()->getPost();
13
+ $secretkey = $POST['groups']['system']['fields']['secretkey']['value'];
14
+ $idwebsite = $POST['groups']['system']['fields']['idwebsite']['value'];
15
+ $enabledwebsite = $POST['groups']['system']['fields']['enabledwebsite']['value'];
16
+ $defaultReviews = $POST['groups']['extra']['fields']['defaultReviews']['value'];
17
+ $forceParentIds = $POST['groups']['extra']['fields']['force_product_parent_id']['value'];
18
+ $addReviewToProductPage = $POST['groups']['extra']['fields']['addReviewToProductPage']['value'];
19
+ $useProductSKU = $POST['groups']['extra']['fields']['useProductSKU']['value'];
20
+ $productLightWidget = $POST['groups']['extra']['fields']['productLightWidget']['value'];
21
+ $hasjQuery = $POST['groups']['extra']['fields']['hasjQuery']['value'];
22
+
23
+ foreach ($storeModel->getWebsiteCollection() as $website) {
24
+ if (is_null($curWebsite) || ($curWebsite == $website->getCode() && is_null($curStore))) {
25
+ $mageselc->saveConfig('avisverifies/system/secretkey',$secretkey,'websites',$website->getId());
26
+ $mageselc->saveConfig('avisverifies/system/idwebsite',$idwebsite,'websites',$website->getId());
27
+ $mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'websites',$website->getId());
28
+ $mageselc->saveConfig('avisverifies/extra/defaultReviews',$defaultReviews,'websites',$website->getId());
29
+ $mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'websites',$website->getId());
30
+ $mageselc->saveConfig('avisverifies/extra/addReviewToProductPage',$addReviewToProductPage,'websites',$website->getId());
31
+ $mageselc->saveConfig('avisverifies/extra/useProductSKU',$useProductSKU,'websites',$website->getId());
32
+ $mageselc->saveConfig('avisverifies/extra/productLightWidget',$productLightWidget,'websites',$website->getId());
33
+ $mageselc->saveConfig('avisverifies/extra/hasjQuery',$hasjQuery,'websites',$website->getId());
34
+ }
35
+ }
36
+
37
+ foreach ($storeModel->getStoreCollection() as $store) {
38
+ if (is_null($curStore) || $curStore == $store->getCode()) {
39
+ $mageselc->saveConfig('avisverifies/system/secretkey',$secretkey,'stores',$store->getId());
40
+ $mageselc->saveConfig('avisverifies/system/idwebsite',$idwebsite,'stores',$store->getId());
41
+ $mageselc->saveConfig('avisverifies/system/enabledwebsite',$enabledwebsite,'stores',$store->getId());
42
+ $mageselc->saveConfig('avisverifies/extra/defaultReviews',$defaultReviews,'stores',$store->getId());
43
+ $mageselc->saveConfig('avisverifies/extra/force_product_parent_id',$forceParentIds,'stores',$store->getId());
44
+ $mageselc->saveConfig('avisverifies/extra/addReviewToProductPage',$addReviewToProductPage,'stores',$store->getId());
45
+ $mageselc->saveConfig('avisverifies/extra/useProductSKU',$useProductSKU,'stores',$store->getId());
46
+ $mageselc->saveConfig('avisverifies/extra/productLightWidget',$productLightWidget,'stores',$store->getId());
47
+ $mageselc->saveConfig('avisverifies/extra/hasjQuery',$hasjQuery,'stores',$store->getId());
48
+ }
49
+ }
50
+
51
+ // first loop on the disactive stores, an disactive store can not be related to other stores.
52
+ $resource = Mage::getModel("core/config_data")->getCollection()
53
+ ->addFieldToFilter('scope','stores')
54
+ ->addFieldToFilter('path','avisverifies/system/enabledwebsite')
55
+ ->addFieldToFilter('value','0');
56
+ foreach ($resource as $store) {
57
+ $mageselc->saveConfig('avisverifies/extra/relatedstoreslist','','stores',$store->getData('scope_id'));
58
+ }
59
+ // i need to get all the idWebsite from database and then update accordingly
60
+ $resource = Mage::getModel("core/config_data")->getCollection()
61
+ ->addFieldToFilter('path','avisverifies/system/idwebsite');
62
+ $allIdwebsite = array();
63
+ foreach ($resource as $value) {
64
+ $allIdwebsite[$value->getData('value')] = 1;
65
+ }
66
+ $allIdwebsite = array_keys($allIdwebsite);
67
+ foreach ($allIdwebsite as $idwebsite) {
68
+ // now we get the related stores list
69
+ $relatedstoreslist = Netreviews_Avisverifies_Helper_Data::getModuleActiveStoresIds($idwebsite);
70
+ foreach ($relatedstoreslist as $storeId) {
71
+ $mageselc->saveConfig('avisverifies/extra/relatedstoreslist',implode(';',$relatedstoreslist),'stores',$storeId);
72
+ }
73
+ }
74
+ }
75
+ }
76
+
app/code/local/Netreviews/Avisverifies/Model/Reviews.php CHANGED
@@ -1,7 +1,8 @@
1
<?php // Our Custome Class . different then Magento Review class.
2
class Netreviews_Avisverifies_Model_Reviews extends Mage_Core_Model_Abstract{
3
4
- public $idProduct = null;
5
public $page;
6
7
protected $idWebsite;
@@ -9,20 +10,38 @@ class Netreviews_Avisverifies_Model_Reviews extends Mage_Core_Model_Abstract{
9
10
public function _construct() {
11
$this->_init('avisverifies/reviews');
12
- $this->idWebsite = Mage::app()->getWebsite()->getId();
13
$this->limit = 5;
14
$this->page = 1;
15
}
16
17
protected function throwException() {
18
- if ($this->idProduct === null)
19
- Mage::throwException('Please specify: "idProduct" -> ($your_object->idProduct = $idProduct).');
20
}
21
-
22
public function getReviewsCount() {
23
$this->throwException();
24
- $magesel = Mage::getModel("core/website")->load($this->idWebsite);
25
- $active = $magesel->getConfig(strtolower('AVISVERIFIES/system/GETPRODREVIEWS')); //récupérer les avis produits ou non
26
27
$stats = $this->getStatsProduct();
28
if (($stats !== NULL) && ($stats->getData('nb_reviews') > 1 && $active == 'yes')) {
@@ -35,39 +54,54 @@ class Netreviews_Avisverifies_Model_Reviews extends Mage_Core_Model_Abstract{
35
36
public function getStatsProduct() {
37
$this->throwException();
38
- $collection = Mage::getModel('avisverifies/average')->getCollection()
39
- ->addFieldToFilter('website_id',$this->idWebsite)
40
- ->addFieldToFilter('ref_product',$this->idProduct);
41
- return ($collection)? $collection->getFirstItem() : Null;
42
}
43
44
public function getProductReviews() {
45
$this->throwException();
46
- $collection = Mage::getModel('avisverifies/reviews')->getCollection()
47
- ->addFieldToFilter('website_id',$this->idWebsite)
48
- ->addFieldToFilter('ref_product',$this->idProduct)
49
->addAttributeToSort('horodate','desc')
50
->setPageSize($this->limit)
51
->setCurPage($this->page);
52
- $maxPages = $collection->getLastPageNumber();
53
- if($this->page > $maxPages)
54
return array();
55
- else
56
- return $collection;
57
}
58
59
public function getNbAvis() {
60
$this->throwException();
61
- $collection = Mage::getModel('avisverifies/average')->getCollection()
62
- ->addFieldToFilter('website_id',$this->idWebsite)
63
- ->addFieldToFilter('ref_product',$this->idProduct);
64
- if ($collection) {
65
- $first = $collection->getFirstItem();
66
- return $first->getData('nb_reviews');
67
- }
68
- else {
69
return NULL;
70
- }
71
}
72
73
// for Backward compatibility.
@@ -77,15 +111,19 @@ class Netreviews_Avisverifies_Model_Reviews extends Mage_Core_Model_Abstract{
77
78
public function getReviewNote() {
79
$this->throwException();
80
- $collection = Mage::getModel('avisverifies/reviews')->getCollection()
81
- ->addFieldToFilter('website_id',$this->idWebsite)
82
- ->addFieldToFilter('ref_product',$this->idProduct)
83
->addAttributeToSort('horodate','desc')
84
;
85
- //get the first item of the collection (load will be called automatically)
86
- $first = $collection->getFirstItem();
87
- //look at the data in the first item
88
- return $first->getData('rate');
89
}
90
91
public function discussion($discussion,$review){
1
<?php // Our Custome Class . different then Magento Review class.
2
class Netreviews_Avisverifies_Model_Reviews extends Mage_Core_Model_Abstract{
3
4
+ public $idProduct = null;
5
+ public $skuProduct = '';
6
public $page;
7
8
protected $idWebsite;
10
11
public function _construct() {
12
$this->_init('avisverifies/reviews');
13
+ $string = Mage::getStoreConfig('avisverifies/extra/relatedstoreslist');
14
+ $string = (empty($string))? '' : $string;
15
+ $this->idWebsite = explode(';', $string);
16
$this->limit = 5;
17
$this->page = 1;
18
}
19
20
protected function throwException() {
21
+ if ($this->idProduct === null) {
22
+ echo '<!-- Please specify: "idProduct" -> ($your_object->idProduct = $idProduct). -->';
23
+ }
24
+ if (empty($this->skuProduct)) {
25
+ $this->skuAndId();
26
+ }
27
}
28
+
29
+ protected function skuAndId(){
30
+ if (is_numeric($this->idProduct)) {
31
+ $product = Mage::getModel('catalog/product')->load($this->idProduct);
32
+ $this->idProduct = $product->getId();
33
+ $this->skuProduct = $product->getSku();
34
+ }
35
+ else {
36
+ $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $this->idProduct);
37
+ $this->idProduct = $product->getId();
38
+ $this->skuProduct = $product->getSku();
39
+ }
40
+ }
41
+
42
public function getReviewsCount() {
43
$this->throwException();
44
+ $active = Mage::getStoreConfig(strtolower('AVISVERIFIES/system/GETPRODREVIEWS')); //récupérer les avis produits ou non
45
46
$stats = $this->getStatsProduct();
47
if (($stats !== NULL) && ($stats->getData('nb_reviews') > 1 && $active == 'yes')) {
54
55
public function getStatsProduct() {
56
$this->throwException();
57
+ try {
58
+ $collection = Mage::getModel('avisverifies/average')->getCollection()
59
+ ->addFieldToFilter('website_id',array("in"=>$this->idWebsite))
60
+ ->addFieldToFilter('ref_product',array("in"=>array($this->idProduct,$this->skuProduct)));
61
+ return ($collection)? $collection->getFirstItem() : Null;
62
+ } catch (Exception $ex) {
63
+ return NULL;
64
+ }
65
+
66
}
67
68
public function getProductReviews() {
69
$this->throwException();
70
+ try {
71
+ $collection = Mage::getModel('avisverifies/reviews')->getCollection()
72
+ ->addFieldToFilter('website_id',array("in"=>$this->idWebsite))
73
+ ->addFieldToFilter('ref_product',array("in"=>array($this->idProduct,$this->skuProduct)))
74
->addAttributeToSort('horodate','desc')
75
->setPageSize($this->limit)
76
->setCurPage($this->page);
77
+ $maxPages = $collection->getLastPageNumber();
78
+ if ($this->page > $maxPages) {
79
+ return array();
80
+ }
81
+ else {
82
+ return $collection;
83
+ }
84
+ } catch (Exception $ex) {
85
return array();
86
+ }
87
}
88
89
public function getNbAvis() {
90
$this->throwException();
91
+ try {
92
+ $collection = Mage::getModel('avisverifies/average')->getCollection()
93
+ ->addFieldToFilter('website_id',array("in"=>$this->idWebsite))
94
+ ->addFieldToFilter('ref_product',array("in"=>array($this->idProduct,$this->skuProduct)));
95
+ if ($collection) {
96
+ $first = $collection->getFirstItem();
97
+ return $first->getData('nb_reviews');
98
+ }
99
+ else {
100
+ return NULL;
101
+ }
102
+ } catch (Exception $ex) {
103
return NULL;
104
+ }
105
}
106
107
// for Backward compatibility.
111
112
public function getReviewNote() {
113
$this->throwException();
114
+ try {
115
+ $collection = Mage::getModel('avisverifies/reviews')->getCollection()
116
+ ->addFieldToFilter('website_id',array("in"=>$this->idWebsite))
117
+ ->addFieldToFilter('ref_product',array("in"=>array($this->idProduct,$this->skuProduct)))
118
->addAttributeToSort('horodate','desc')
119
;
120
+ //get the first item of the collection (load will be called automatically)
121
+ $first = $collection->getFirstItem();
122
+ //look at the data in the first item
123
+ return $first->getData('rate');
124
+ } catch (Exception $ex) {
125
+ return NULL;
126
+ }
127
}
128
129
public function discussion($discussion,$review){
app/code/local/Netreviews/Avisverifies/controllers/Adminhtml/AvisverifiesController.php CHANGED
@@ -10,10 +10,10 @@ class Netreviews_Avisverifies_Adminhtml_AvisverifiesController extends Mage_Admi
10
$this->_addBreadcrumb(Mage::helper('avisverifies')->__('Form'), Mage::helper('avisverifies')->__('Form'));
11
12
// add block to layout
13
- $block = $this->getLayout()->createBlock('avisverifies/adminhtml_form_edit','avisverifies_index');
14
$this->getLayout()->getBlock('content')->append($block);
15
16
- $block = $this->getLayout()->createBlock('avisverifies/adminhtml_form_edit_tabs','avisverifies_index_tabs');
17
$this->getLayout()->getBlock('left')->append($block);
18
19
$this->renderLayout();
@@ -23,6 +23,33 @@ class Netreviews_Avisverifies_Adminhtml_AvisverifiesController extends Mage_Admi
23
$result = $this->getRequest()->getParams();
24
$isExport = (isset($result['export']) && isset($result['export']['csv']) && $result['export']['csv'] == 1);
25
26
if ($isExport) {
27
$type = substr($result['export']['until'], -1);
28
// casting to int, for sql injection.
@@ -30,16 +57,9 @@ class Netreviews_Avisverifies_Adminhtml_AvisverifiesController extends Mage_Admi
30
$type = ($type == "m")? 'MONTH' : 'WEEK';
31
$from = "DATE_SUB(CURDATE(), INTERVAL $period $type)";
32
$to = "DATE_ADD(curdate(),INTERVAL 1 DAY)";
33
- //Liste des stores appartenant au website choisi par le user
34
-
35
- $websitetoexport = $result['export']['websitetoexport'];
36
$helperData = Mage::helper('avisverifies/Export');
37
-
38
- $helperData->createStoresIds($websitetoexport);
39
$helperData->exportStruct($result['export']['product']);
40
-
41
- // Mage::getSingleton('core/session')->setExportSeperator($result['export']['csv_semicolon']);
42
- // $status = ($result['export']['order_status'] == 'all')? array() : $result['export']['order_status'];
43
//construction du CSV
44
$helperData->createExportCSV($from,$to);
45
$content = $helperData->getCSVFile();
@@ -52,8 +72,32 @@ class Netreviews_Avisverifies_Adminhtml_AvisverifiesController extends Mage_Admi
52
}
53
}
54
55
public function checkInstallationAction() {
56
57
$resource = Mage::getSingleton('core/resource');
58
$read = $resource->getConnection('core_read');
59
$table = $resource->getTableName('avisverifies_products_reviews');
@@ -83,17 +127,20 @@ class Netreviews_Avisverifies_Adminhtml_AvisverifiesController extends Mage_Admi
83
}
84
}
85
86
- $res = $read->query("SELECT COUNT(*) FROM $table")->fetch();
87
- $count['Reviews'] = $res['COUNT(*)'];
88
- $res = $read->query("SELECT COUNT(*) FROM $table2")->fetch();
89
- $count['Average'] = $res['COUNT(*)'];
90
91
- ## added orders missing field. code is commented to be used in case of need. ##
92
- // $write = $resource->getConnection('core_write');
93
- // $write->query("ALTER TABLE `{$table3}` add av_horodate_get varchar(32);");
94
- // $write->query("ALTER TABLE `{$table3}` add av_flag tinyint default 0;");
95
- // $write->query("UPDATE `{$table3}` SET `av_flag` = 1;");
96
- ## added orders missing field. code is commented to be used in case of need. ##
97
98
if ($orders['AV_Flag']) {
99
$res = $read->query("SELECT COUNT(*) FROM $table3 WHERE av_flag = 1")->fetch();
@@ -102,24 +149,17 @@ class Netreviews_Avisverifies_Adminhtml_AvisverifiesController extends Mage_Admi
102
$count['Order_Set_Flag_0'] = $res['COUNT(*)'];
103
}
104
105
- ## check sales_flat_order_item. code is commented to be used in case of need. ##
106
- $orderId = (isset($_GET['checkOrders']))? (int) $_GET['checkOrders'] : NULL;
107
- $orderId = (is_null($orderId))? NULL : (int) stripcslashes(urlencode($orderId));
108
- $checkOrders = array();
109
- if ($orderId) {
110
- $table4 = $resource->getTableName('sales/order_item');
111
- $query = " SELECT "
112
- . "`t3`.`increment_id`,`t4`.`item_id`, `t4`.`order_id`, `t4`.`parent_item_id`,"
113
- . " `t4`.`quote_item_id`, `t4`.`store_id`, `t4`.`created_at`, `t4`.`updated_at`, `t4`.`product_id`,"
114
- . " `t4`.`product_type`, `t4`.`is_virtual`, `t4`.`sku`, `t4`.`name` "
115
- . " FROM $table4 t4 LEFT JOIN $table3 t3 ON t3.entity_id = t4.order_id "
116
- . " WHERE t3.increment_id = :orderId ";
117
- $bind = array('orderId' => $orderId);
118
- $checkOrders = $read->query($query, $bind)->fetchAll();
119
- }
120
-
121
- ## check sales_flat_order_item. code is commented to be used in case of need. ##
122
123
$this->loadLayout();
124
$layout = $this->getLayout();
125
@@ -127,19 +167,46 @@ class Netreviews_Avisverifies_Adminhtml_AvisverifiesController extends Mage_Admi
127
$block = $layout->createBlock('core/template');
128
$block->setData('area','frontend');
129
$block->setTemplate('avisverifies/admin/checkinstallation.phtml');
130
- // $block = $layout->createBlock('avisverifies/adminhtml_checkInstallation_index','avisverifies_checkinstallation');
131
$block->setData('tables',$tables);
132
$block->setData('orders',$orders);
133
$block->setData('checkOrders',$checkOrders);
134
$block->setData('count',$count);
135
$layout->getBlock('content')->append($block);
136
137
$block = $layout->createBlock('core/template');
138
$block->setData('area','frontend');
139
$block->setTemplate('avisverifies/admin/checkinstallation_tab.phtml');
140
- // $block = $layout->createBlock('avisverifies/adminhtml_checkInstallation_tab','avisverifies_checkinstallation_tab');
141
$layout->getBlock('left')->append($block);
142
143
$this->renderLayout();
144
}
145
}
10
$this->_addBreadcrumb(Mage::helper('avisverifies')->__('Form'), Mage::helper('avisverifies')->__('Form'));
11
12
// add block to layout
13
+ $block = $this->getLayout()->createBlock('avisverifies/adminhtml_form_export_index','avisverifies_index');
14
$this->getLayout()->getBlock('content')->append($block);
15
16
+ $block = $this->getLayout()->createBlock('avisverifies/adminhtml_form_export_tabs','avisverifies_index_tabs');
17
$this->getLayout()->getBlock('left')->append($block);
18
19
$this->renderLayout();
23
$result = $this->getRequest()->getParams();
24
$isExport = (isset($result['export']) && isset($result['export']['csv']) && $result['export']['csv'] == 1);
25
26
+ $curWebsite = ($result['export']['websiteIdHidden'] == 10000)? NULL : $result['export']['websiteIdHidden'];
27
+ $curStore = ($result['export']['storeIdHidden'] == 10000)? NULL : $result['export']['storeIdHidden'];
28
+ $useProductSKU = $result['export']['sku'];
29
+ // all config
30
+ if (is_null($curWebsite) && is_null($curStore)) {
31
+ $stores = Mage::app()->getStores();
32
+ foreach($stores as $store){
33
+ $arrStores[] = $store->getData('store_id');
34
+ $this->updateSKUConfig($curWebsite,$curStore,$useProductSKU);
35
+ }
36
+ }
37
+ elseif ($curWebsite && is_null($curStore)) {
38
+ $webiste = Mage::getModel('core/website')->load($curWebsite);
39
+ foreach ($webiste->getStores() as $key => $store) {
40
+ $arrStores[] = $store->getData('store_id');
41
+ $this->updateSKUConfig($curWebsite,$curStore,$useProductSKU);
42
+ }
43
+ }
44
+ elseif ($curWebsite && $curStore ) {
45
+ $store = Mage::getModel('core/store')->load($curStore);
46
+ $arrStores[] = $store->getData('store_id');
47
+ $this->updateSKUConfig($curWebsite,$curStore,$useProductSKU);
48
+ }
49
+ else {
50
+ $isExport = false;
51
+ }
52
+
53
if ($isExport) {
54
$type = substr($result['export']['until'], -1);
55
// casting to int, for sql injection.
57
$type = ($type == "m")? 'MONTH' : 'WEEK';
58
$from = "DATE_SUB(CURDATE(), INTERVAL $period $type)";
59
$to = "DATE_ADD(curdate(),INTERVAL 1 DAY)";
60
$helperData = Mage::helper('avisverifies/Export');
61
+ $helperData->createStoresIds($arrStores);
62
$helperData->exportStruct($result['export']['product']);
63
//construction du CSV
64
$helperData->createExportCSV($from,$to);
65
$content = $helperData->getCSVFile();
72
}
73
}
74
75
+ protected function updateSKUConfig ($curWebsite,$curStore,$useProductSKU) {
76
+ $storeModel = Mage::getSingleton('adminhtml/system_store');
77
+ $mageselc = new Mage_Core_Model_Config();
78
+
79
+ if (is_null($curWebsite) && is_null($curStore)) {
80
+ $mageselc->saveConfig('avisverifies/extra/useProductSKU',$useProductSKU,'default',0);
81
+ }
82
+
83
+ foreach ($storeModel->getWebsiteCollection() as $website) {
84
+ if (is_null($curWebsite) || ($curWebsite == $website->getCode() && is_null($curStore))) {
85
+ $mageselc->saveConfig('avisverifies/extra/useProductSKU',$useProductSKU,'websites',$website->getId());
86
+ }
87
+ }
88
+ foreach ($storeModel->getStoreCollection() as $store) {
89
+ if (is_null($curStore) || $curStore == $store->getCode()) {
90
+ $mageselc->saveConfig('avisverifies/extra/useProductSKU',$useProductSKU,'websites',$store->getId());
91
+ }
92
+ }
93
+ }
94
+
95
+
96
public function checkInstallationAction() {
97
98
+ $old_Version = array('1.3.3.0');
99
+ $is_old_version = (in_array(Mage::getVersion(), $old_Version));
100
+
101
$resource = Mage::getSingleton('core/resource');
102
$read = $resource->getConnection('core_read');
103
$table = $resource->getTableName('avisverifies_products_reviews');
127
}
128
}
129
130
+ try{
131
+ $res = $read->query("SELECT COUNT(*) FROM $table")->fetch();
132
+ $count['Reviews'] = $res['COUNT(*)'];
133
+ } catch (Exception $ex) {
134
+
135
+ }
136
+
137
+ try{
138
+ $res = $read->query("SELECT COUNT(*) FROM $table2")->fetch();
139
+ $count['Average'] = $res['COUNT(*)'];
140
+ } catch (Exception $ex) {
141
+
142
+ }
143
144
145
if ($orders['AV_Flag']) {
146
$res = $read->query("SELECT COUNT(*) FROM $table3 WHERE av_flag = 1")->fetch();
149
$count['Order_Set_Flag_0'] = $res['COUNT(*)'];
150
}
151
152
+ $orderSess = Mage::getSingleton('admin/session')->getNetReviewsDebugOrder();
153
154
+ if (!empty($orderSess)) {
155
+ $checkOrders = Netreviews_Avisverifies_Helper_Install::checkOrder($orderSess);
156
+ Mage::getSingleton('admin/session')->setNetReviewsDebugOrder(NULL);
157
+ }
158
+ else {
159
+ $checkOrders = array();
160
+ }
161
+
162
+
163
$this->loadLayout();
164
$layout = $this->getLayout();
165
167
$block = $layout->createBlock('core/template');
168
$block->setData('area','frontend');
169
$block->setTemplate('avisverifies/admin/checkinstallation.phtml');
170
$block->setData('tables',$tables);
171
$block->setData('orders',$orders);
172
$block->setData('checkOrders',$checkOrders);
173
$block->setData('count',$count);
174
+ $block->setData('isOldVersion',$is_old_version);
175
$layout->getBlock('content')->append($block);
176
177
$block = $layout->createBlock('core/template');
178
$block->setData('area','frontend');
179
$block->setTemplate('avisverifies/admin/checkinstallation_tab.phtml');
180
$layout->getBlock('left')->append($block);
181
182
$this->renderLayout();
183
}
184
+
185
+ public function postAction()
186
+ {
187
+ $post = $this->getRequest()->getPost();
188
+ try {
189
+ if (empty($post)) {
190
+ Mage::throwException($this->__('Invalid form data.'));
191
+ }
192
+ if (isset($post['debug']['reinstall']) && $post['debug']['reinstall'] == 'yes') {
193
+ Netreviews_Avisverifies_Helper_Install::createTables();
194
+ }
195
+ if (isset($post['debug']['flag']) && $post['debug']['flag'] == 'yes') {
196
+ Netreviews_Avisverifies_Helper_Install::flagAll();
197
+ }
198
+ if (isset($post['debug']['fields']) && $post['debug']['fields'] == 'yes') {
199
+ Netreviews_Avisverifies_Helper_Install::addFields();
200
+ }
201
+ if (!empty($post['debug']['order'])) {
202
+ Mage::getSingleton('admin/session')->setNetReviewsDebugOrder($post['debug']['order']);
203
+ }
204
+ $message = $this->__('Your form has been submitted successfully.');
205
+ Mage::getSingleton('adminhtml/session')->addSuccess($message);
206
+ } catch (Exception $e) {
207
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
208
+ }
209
+ $this->_redirect('AvisVerifies/adminhtml_avisverifies/checkInstallation');
210
+ }
211
+
212
}
app/code/local/Netreviews/Avisverifies/controllers/DialogController.php CHANGED
@@ -19,7 +19,7 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
19
// check for post
20
if ($request->getPost()) {
21
// load magento configuration
22
- $DATA->setup(array('idShop'=>$API->msg('id_shop'),'query'=>$API->msg('query')));
23
// check if active
24
$IsActiveVar = $this->isActiveModule($DATA,$API->msg('query'));
25
// if not active return error.
@@ -147,25 +147,27 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
147
protected function setModuleConfiguration($DATA,$API) {
148
$mageselc = new Mage_Core_Model_Config();
149
$mageselc->cleanCache(); // remove cache
150
- $idShop = $DATA->shopId;
151
- $mageselc->saveConfig(strtolower('avisverifies/system/PROCESSINIT'),$API->msg('init_reviews_process'),'websites',$idShop);
152
- //Implode si plusieurs éléments donc is_array
153
- $ORDERSTATESCHOOSEN = (is_array($API->msg('id_order_status_choosen'))) ? implode(';',$API->msg('id_order_status_choosen')) : $API->msg('id_order_status_choosen');
154
- $mageselc->saveConfig(strtolower('avisverifies/system/ORDERSTATESCHOOSEN'), $ORDERSTATESCHOOSEN,'websites',$idShop);
155
- $mageselc->saveConfig(strtolower('avisverifies/system/DELAY'), $API->msg('delay'),'websites',$idShop);
156
- $mageselc->saveConfig(strtolower('avisverifies/system/GETPRODREVIEWS'),$API->msg('get_product_reviews'),'websites',$idShop);
157
- $mageselc->saveConfig(strtolower('avisverifies/system/DISPLAYPRODREVIEWS'),$API->msg('display_product_reviews'),'websites',$idShop);
158
- $mageselc->saveConfig(strtolower('avisverifies/system/SCRIPTFIXE_ALLOWED'),$API->msg('display_fixe_widget'),'websites',$idShop);
159
- $mageselc->saveConfig(strtolower('avisverifies/system/SCRIPTFIXE_POSITION'),$API->msg('position_fixe_widget'),'websites',$idShop);
160
- $mageselc->saveConfig(strtolower('avisverifies/system/SCRIPTFLOAT_ALLOWED'),$API->msg('display_float_widget'),'websites',$idShop);
161
- $mageselc->saveConfig(strtolower('avisverifies/system/URLCERTIFICAT'),$API->msg('url_certificat'),'websites',$idShop);
162
- //Implode si plusieurs éléments donc is_array
163
- $FORBIDDENEMAIL = (is_array($API->msg('forbidden_mail_extension'))) ? implode(';',$API->msg('forbidden_mail_extension')) : $API->msg('forbidden_mail_extension');
164
- $mageselc->saveConfig(strtolower('avisverifies/system/FORBIDDEN_EMAIL'), $FORBIDDENEMAIL,'websites',$idShop);
165
- $mageselc->saveConfig(strtolower('avisverifies/system/SCRIPTFIXE'),str_replace(array("\r\n", "\n"), '', stripslashes(str_replace('\"','"',$API->msg('script_fixe_widget')))),'websites',$idShop);
166
- $mageselc->saveConfig(strtolower('avisverifies/system/SCRIPTFLOAT'),str_replace(array("\r\n", "\n"), '', stripslashes(str_replace('\"','"',$API->msg('script_float_widget')))),'websites',$idShop);
167
- // Force Product Parent ID.
168
- $mageselc->saveConfig(strtolower('avisverifies/system/FORCE_PRODUCT_PARENT_ID'),$API->msg('force_product_parent_id'),'websites',$idShop);
169
Mage::app()->cleanCache(); // remove cache
170
$mageselc->cleanCache(); // remove cache
171
@@ -216,7 +218,7 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
216
}
217
218
219
- protected function isActiveModule($DATA,$query){
220
if ($DATA->enabledwebsite) {
221
if ($DATA->enabledwebsite != 1) {
222
$reponse['debug'] = "Modulé Désactivé";
@@ -246,7 +248,7 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
246
247
protected function getOrders($DATA,$API){
248
$helperData = Mage::helper('avisverifies/Export');
249
- $helperData->createStoresIds($DATA->shopId);
250
$helperData->exportStruct($DATA->allowedProducts);
251
252
if ($API->msg('force') == 1) {
@@ -361,7 +363,8 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
361
362
protected function setProductsReviews($DATA,$API) {
363
$microtime_deb = microtime();
364
- $reviews = $API->productReviews($DATA->shopId);
365
foreach ($reviews as $data) {
366
if ($data['error']) continue;
367
if ($data['query'] == "DELETE") {
@@ -417,7 +420,6 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
417
$salesModule = "".Mage::getConfig()->getModuleConfig("Mage_Sales")->version; // object to string
418
$orderStatutList = Mage::getSingleton('sales/order_config')->getStatuses();
419
420
- $explode_secret_key = explode('-',$DATA->secretkey);
421
$temp = array(
422
'Version_PS' => $Magento,
423
'Version_Sales' => $salesModule,
@@ -439,15 +441,43 @@ class Netreviews_Avisverifies_DialogController extends Mage_Core_Controller_Fron
439
'Position_Widget_Fixe'=>'SCRIPTFIXE_POSITION',
440
'Script_Widget_Fixe'=>'SCRIPTFIXE',
441
'Emails_Interdits'=>'FORBIDDEN_EMAIL',
442
- 'Enabled_Website'=>'ENABLEDWEBSITE',
443
- 'Force_Parent_id'=>'FORCE_PRODUCT_PARENT_ID');
444
// load our configuration
445
- $magesel = Mage::getModel("core/website")->load($DATA->shopId);
446
447
foreach($champ as $key=>$champsname) {
448
$temp[$key]=$magesel->getConfig('avisverifies/system/'.strtolower($champsname));
449
}
450
- $temp['Liste_des_statuts']= $orderStatutList;
451
$temp['Dossier_CSV'] = 'media\avisverifies';
452
$temp['Date_Recuperation_Config']= date('Y-m-d H:i:s');
453
19
// check for post
20
if ($request->getPost()) {
21
// load magento configuration
22
+ $DATA->setup(array('idWebsite'=>$API->msg('idWebsite'),'query'=>$API->msg('query')));
23
// check if active
24
$IsActiveVar = $this->isActiveModule($DATA,$API->msg('query'));
25
// if not active return error.
147
protected function setModuleConfiguration($DATA,$API) {
148
$mageselc = new Mage_Core_Model_Config();
149
$mageselc->cleanCache(); // remove cache
150
+ $allIdShops = $DATA->allShopIds;
151
+ foreach ($allIdShops as $idShop) {
152
+ $mageselc->saveConfig(strtolower('avisverifies/system/PROCESSINIT'),$API->msg('init_reviews_process'),'stores',$idShop);
153
+ //Implode si plusieurs éléments donc is_array
154
+ $ORDERSTATESCHOOSEN = (is_array($API->msg('id_order_status_choosen'))) ? implode(';',$API->msg('id_order_status_choosen')) : $API->msg('id_order_status_choosen');
155
+ $mageselc->saveConfig(strtolower('avisverifies/system/ORDERSTATESCHOOSEN'), $ORDERSTATESCHOOSEN,'stores',$idShop);
156
+ $mageselc->saveConfig(strtolower('avisverifies/system/DELAY'), $API->msg('delay'),'stores',$idShop);
157
+ $mageselc->saveConfig(strtolower('avisverifies/system/GETPRODREVIEWS'),$API->msg('get_product_reviews'),'stores',$idShop);
158
+ $mageselc->saveConfig(strtolower('avisverifies/system/DISPLAYPRODREVIEWS'),$API->msg('display_product_reviews'),'stores',$idShop);
159
+ $mageselc->saveConfig(strtolower('avisverifies/system/SCRIPTFIXE_ALLOWED'),$API->msg('display_fixe_widget'),'stores',$idShop);
160
+ $mageselc->saveConfig(strtolower('avisverifies/system/SCRIPTFIXE_POSITION'),$API->msg('position_fixe_widget'),'stores',$idShop);
161
+ $mageselc->saveConfig(strtolower('avisverifies/system/SCRIPTFLOAT_ALLOWED'),$API->msg('display_float_widget'),'stores',$idShop);
162
+ $mageselc->saveConfig(strtolower('avisverifies/system/URLCERTIFICAT'),$API->msg('url_certificat'),'stores',$idShop);
163
+ //Implode si plusieurs éléments donc is_array
164
+ $FORBIDDENEMAIL = (is_array($API->msg('forbidden_mail_extension'))) ? implode(';',$API->msg('forbidden_mail_extension')) : $API->msg('forbidden_mail_extension');
165
+ $mageselc->saveConfig(strtolower('avisverifies/system/FORBIDDEN_EMAIL'), $FORBIDDENEMAIL,'stores',$idShop);
166
+ $mageselc->saveConfig(strtolower('avisverifies/system/SCRIPTFIXE'),str_replace(array("\r\n", "\n"), '', stripslashes(str_replace('\"','"',$API->msg('script_fixe_widget')))),'stores',$idShop);
167
+ $mageselc->saveConfig(strtolower('avisverifies/system/SCRIPTFLOAT'),str_replace(array("\r\n", "\n"), '', stripslashes(str_replace('\"','"',$API->msg('script_float_widget')))),'stores',$idShop);
168
+ // Force Product Parent ID.
169
+ $mageselc->saveConfig(strtolower('avisverifies/extra/FORCE_PRODUCT_PARENT_ID'),$API->msg('force_product_parent_id'),'stores',$idShop);
170
+ }
171
Mage::app()->cleanCache(); // remove cache
172
$mageselc->cleanCache(); // remove cache
173
218
}
219
220
221
+ protected function isActiveModule($DATA,$query){
222
if ($DATA->enabledwebsite) {
223
if ($DATA->enabledwebsite != 1) {
224
$reponse['debug'] = "Modulé Désactivé";
248
249
protected function getOrders($DATA,$API){
250
$helperData = Mage::helper('avisverifies/Export');
251
+ $helperData->createStoresIds($DATA->allShopIds);
252
$helperData->exportStruct($DATA->allowedProducts);
253
254
if ($API->msg('force') == 1) {
363
364
protected function setProductsReviews($DATA,$API) {
365
$microtime_deb = microtime();
366
+ // we send 1 store view config, we use in_array to check if product is in all stores config
367
+ $reviews = $API->productReviews(reset($DATA->allShopIds));
368
foreach ($reviews as $data) {
369
if ($data['error']) continue;
370
if ($data['query'] == "DELETE") {
420
$salesModule = "".Mage::getConfig()->getModuleConfig("Mage_Sales")->version; // object to string
421
$orderStatutList = Mage::getSingleton('sales/order_config')->getStatuses();
422
423
$temp = array(
424
'Version_PS' => $Magento,
425
'Version_Sales' => $salesModule,
441
'Position_Widget_Fixe'=>'SCRIPTFIXE_POSITION',
442
'Script_Widget_Fixe'=>'SCRIPTFIXE',
443
'Emails_Interdits'=>'FORBIDDEN_EMAIL',
444
+ 'Enabled_Website'=>'ENABLEDWEBSITE',);
445
// load our configuration
446
+ $magesel = Mage::getModel("core/store")->load(reset($DATA->allShopIds));
447
448
foreach($champ as $key=>$champsname) {
449
$temp[$key]=$magesel->getConfig('avisverifies/system/'.strtolower($champsname));
450
}
451
+ $temp['Force_Parent_id'] = $magesel->getConfig('avisverifies/extra/'.strtolower('FORCE_PRODUCT_PARENT_ID'));
452
+ // JUDO CODE //
453
+ // get all stores + idwebsite
454
+ $mapConfiguration = array('all'=>false,'webistes'=>array());
455
+ $default = Mage::getModel("core/config_data")->getCollection()
456
+ ->addFieldToFilter('scope','default')
457
+ ->addFieldToFilter('path','avisverifies/system/enabledwebsite')
458
+ ->addFieldToFilter('value','1')->getFirstItem();
459
+ $mapConfiguration['all'] = ($default->getData('value') == 1)? true : false;
460
+ $webistes = Mage::getModel("core/website")->getCollection();
461
+ foreach ($webistes as $web) {
462
+ $mapConfiguration['webistes'][$web->getData('website_id')]['name'] = $web->getData('name');
463
+ $config = Mage::getModel("core/config_data")->getCollection()
464
+ ->addFieldToFilter('scope','websites')
465
+ ->addFieldToFilter('scope_id',$web->getData('website_id'))
466
+ ->addFieldToFilter('path','avisverifies/system/enabledwebsite')->getFirstItem();
467
+ $mapConfiguration['webistes'][$web->getData('website_id')]['is_active'] = ($config->getData('value') == 1)? true : false;
468
+ $stores = Mage::getModel("core/store")->getCollection()->addFieldToFilter('website_id',$web->getData('website_id'));
469
+ foreach ($stores as $store) {
470
+ $mapConfiguration['webistes'][$web->getData('website_id')]['stores'][$store->getData('store_id')]['name'] = $store->getData('name');
471
+ $storeConfig = Mage::getModel("core/config_data")->getCollection()
472
+ ->addFieldToFilter('scope','stores')
473
+ ->addFieldToFilter('scope_id',$store->getData('store_id'))
474
+ ->addFieldToFilter('path','avisverifies/system/enabledwebsite')->getFirstItem();
475
+ $mapConfiguration['webistes'][$web->getData('website_id')]['stores'][$store->getData('store_id')]['is_active'] = ($storeConfig->getData('value') == 1)? true : false;;
476
+ }
477
+ }
478
+ // JUDO CODE //
479
+ $temp['Map_Configuration'] = $mapConfiguration;
480
+ $temp['Liste_des_statuts'] = $orderStatutList;
481
$temp['Dossier_CSV'] = 'media\avisverifies';
482
$temp['Date_Recuperation_Config']= date('Y-m-d H:i:s');
483
app/code/local/Netreviews/Avisverifies/etc/config.xml CHANGED
@@ -1,247 +1,255 @@
1
<?xml version="1.0"?>
2
<config>
3
- <!-- General Config -->
4
- <modules>
5
- <Netreviews_Avisverifies>
6
- <version>2.6.4</version>
7
- </Netreviews_Avisverifies>
8
- </modules>
9
- <!-- General Config -->
10
- <!-- Default -->
11
- <default>
12
- <avisverifies>
13
- <system>
14
- <request>0</request>
15
- <connect>interne.avis-verifies.local</connect>
16
- </system>
17
- </avisverifies>
18
- </default>
19
- <!-- Default -->
20
- <!-- Global -->
21
- <global>
22
- <blocks>
23
- <avisverifies>
24
- <class>Netreviews_Avisverifies_Block</class>
25
- </avisverifies>
26
- <review>
27
- <rewrite>
28
- <helper>Netreviews_Avisverifies_Block_Review_Helper</helper>
29
- <!-- product_view is causing white page Error on EE1.12 AND CE 1.5.1.0 -->
30
- <product_view>Netreviews_Avisverifies_Block_Review_Product_View</product_view>
31
- </rewrite>
32
- </review>
33
- <catalog>
34
- <rewrite>
35
- <!-- product_view is causing white page Error on EE1.12 AND CE 1.5.1.0 -->
36
- <product_view>Netreviews_Avisverifies_Block_Catalog_Product_View</product_view>
37
- <product_list>Netreviews_Avisverifies_Block_Catalog_Product_List</product_list>
38
- </rewrite>
39
- </catalog>
40
- </blocks>
41
- <models>
42
- <avisverifies>
43
- <class>Netreviews_Avisverifies_Model</class>
44
- <resourceModel>avisverifies_mysql4</resourceModel>
45
- </avisverifies>
46
- <avisverifies_mysql4>
47
- <class>Netreviews_Avisverifies_Model_Mysql4</class>
48
- <entities>
49
- <reviews>
50
- <table>avisverifies_products_reviews</table>
51
- </reviews>
52
- <average>
53
- <table>avisverifies_products_average</table>
54
- </average>
55
- </entities>
56
- </avisverifies_mysql4>
57
- <catalog>
58
- <rewrite>
59
- <product>Netreviews_Avisverifies_Model_Product</product>
60
- </rewrite>
61
- </catalog>
62
- </models>
63
- <resources>
64
- <avisverifies_setup>
65
- <setup>
66
- <module>Netreviews_Avisverifies</module>
67
- </setup>
68
- <connection>
69
- <use>core_setup</use>
70
- </connection>
71
- </avisverifies_setup>
72
- <avisverifies_write>
73
- <connection>
74
- <use>core_write</use>
75
- </connection>
76
- </avisverifies_write>
77
- <avisverifies_read>
78
- <connection>
79
- <use>core_read</use>
80
- </connection>
81
- </avisverifies_read>
82
- </resources>
83
<!-- Data Helper -->
84
- <helpers>
85
- <avisverifies>
86
- <class>Netreviews_Avisverifies_Helper</class>
87
- </avisverifies>
88
- </helpers>
89
- <!-- Observers -->
90
- <events>
91
- <!-- Event: Checkout\controllers\OnepageController.php:273 -->
92
- <checkout_onepage_controller_success_action>
93
- <observers>
94
- <avisverifies_checkout_observer>
95
- <type>singleton</type>
96
- <class>Netreviews_Avisverifies_Model_Observers_Checkout_Track</class>
97
- <method>trackCheckout</method>
98
- </avisverifies_checkout_observer>
99
- </observers>
100
- </checkout_onepage_controller_success_action>
101
- <!-- Event: Checkout\controllers\MultishippingController.php:545 -->
102
- <checkout_multishipping_controller_success_action>
103
- <observers>
104
- <avisverifies_checkout_observer>
105
- <type>singleton</type>
106
- <class>Netreviews_Avisverifies_Model_Observers_Checkout_Track</class>
107
- <method>trackCheckout</method>
108
- </avisverifies_checkout_observer>
109
- </observers>
110
- </checkout_multishipping_controller_success_action>
111
</events>
112
- </global>
113
- <!-- Global -->
114
- <!-- Frontend -->
115
- <frontend>
116
- <routers>
117
- <avisverifies>
118
- <use>standard</use>
119
- <args>
120
- <module>Netreviews_Avisverifies</module>
121
- <frontName>AvisVerifies</frontName>
122
- </args>
123
- </avisverifies>
124
- </routers>
125
- <layout>
126
- <updates>
127
- <avisverifies>
128
- <file>avisverifies.xml</file>
129
- </avisverifies>
130
- </updates>
131
- </layout>
132
- <translate>
133
- <modules>
134
- <avisverifies>
135
- <files>
136
- <default>avisverifies.csv</default>
137
- </files>
138
- </avisverifies>
139
- </modules>
140
- </translate>
141
- </frontend>
142
- <!-- Frontend -->
143
- <!-- Admin -->
144
- <admin>
145
- <routers>
146
- <avisverifies>
147
- <use>admin</use>
148
- <args>
149
- <module>Netreviews_Avisverifies</module>
150
- <frontName>AvisVerifies</frontName>
151
- </args>
152
- </avisverifies>
153
- </routers>
154
- </admin>
155
- <!-- Admin -->
156
- <!-- AdminHtml -->
157
- <adminhtml>
158
- <menu>
159
- <catalog>
160
- <children>
161
- <avisverifies module="avisverifies" translate="title">
162
- <title>VerifiedReviews</title>
163
- <sort_order>100</sort_order>
164
- <children>
165
- <form module="avisverifies" translate="title">
166
- <title>Management</title>
167
- <sort_order>0</sort_order>
168
- <action>avisverifies/adminhtml_avisverifies</action>
169
- </form>
170
- <config module="avisverifies" translate="title">
171
- <title>Configuration</title>
172
- <sort_order>10</sort_order>
173
- <action>adminhtml/system_config/edit/section/avisverifies/</action>
174
- </config>
175
- <check module="avisverifies" translate="title">
176
- <title>Check Installation</title>
177
- <sort_order>20</sort_order>
178
- <action>avisverifies/adminhtml_avisverifies/checkInstallation</action>
179
- </check>
180
- </children>
181
- </avisverifies>
182
- </children>
183
- </catalog>
184
- </menu>
185
- <translate>
186
- <modules>
187
- <avisverifies>
188
- <files>
189
- <default>avisverifies.csv</default>
190
- </files>
191
- </avisverifies>
192
- </modules>
193
- </translate>
194
- <acl>
195
- <resources>
196
- <admin>
197
- <children>
198
- <system>
199
- <children>
200
- <config>
201
- <children>
202
- <avisverifies module="avisverifies" translate="title">
203
- <title>VerifiedReviews</title>
204
- </avisverifies>
205
- </children>
206
- </config>
207
- </children>
208
- </system>
209
- <catalog>
210
- <children>
211
- <avisverifies module="avisverifies" translate="title">
212
- <title>VerifiedReviews</title>
213
- <sort_order>100</sort_order>
214
- <children>
215
- <form module="avisverifies" translate="title">
216
- <title>Management</title>
217
- <sort_order>0</sort_order>
218
- <action>avisverifies/adminhtml_avisverifies</action>
219
- </form>
220
- <config module="avisverifies" translate="title">
221
- <title>Configuration</title>
222
- <sort_order>10</sort_order>
223
- <action>adminhtml/system_config/edit/section/avisverifies/</action>
224
- </config>
225
- <check module="avisverifies" translate="title">
226
- <title>Check Installation</title>
227
- <sort_order>20</sort_order>
228
- <action>avisverifies/adminhtml_avisverifies/checkInstallation</action>
229
- </check>
230
- </children>
231
- </avisverifies>
232
- </children>
233
- </catalog>
234
- </children>
235
- </admin>
236
- </resources>
237
- </acl>
238
- <layout>
239
- <updates>
240
- <avisverifies>
241
- <file>avisverifies.xml</file>
242
- </avisverifies>
243
- </updates>
244
- </layout>
245
- </adminhtml>
246
- <!-- AdminHtml -->
247
</config>
1
<?xml version="1.0"?>
2
<config>
3
+ <!-- General Config -->
4
+ <modules>
5
+ <Netreviews_Avisverifies>
6
+ <version>2.6.4</version>
7
+ </Netreviews_Avisverifies>
8
+ </modules>
9
+ <!-- General Config -->
10
+ <!-- Default -->
11
+ <default>
12
+ <avisverifies>
13
+ <system>
14
+ <request>0</request>
15
+ <connect>interne.avis-verifies.local</connect>
16
+ </system>
17
+ </avisverifies>
18
+ </default>
19
+ <!-- Default -->
20
+ <!-- Global -->
21
+ <global>
22
+ <blocks>
23
+ <avisverifies>
24
+ <class>Netreviews_Avisverifies_Block</class>
25
+ </avisverifies>
26
+ <review>
27
+ <rewrite>
28
+ <helper>Netreviews_Avisverifies_Block_Review_Helper</helper>
29
+ <product_view>Netreviews_Avisverifies_Block_Review_Product_View</product_view>
30
+ </rewrite>
31
+ </review>
32
+ </blocks>
33
+ <models>
34
+ <avisverifies>
35
+ <class>Netreviews_Avisverifies_Model</class>
36
+ <resourceModel>avisverifies_mysql4</resourceModel>
37
+ </avisverifies>
38
+ <avisverifies_mysql4>
39
+ <class>Netreviews_Avisverifies_Model_Mysql4</class>
40
+ <!-- used by the api -->
41
+ <entities>
42
+ <reviews>
43
+ <table>avisverifies_products_reviews</table>
44
+ </reviews>
45
+ <average>
46
+ <table>avisverifies_products_average</table>
47
+ </average>
48
+ </entities>
49
+ </avisverifies_mysql4>
50
+ </models>
51
+ <resources>
52
+ <avisverifies_setup>
53
+ <setup>
54
+ <module>Netreviews_Avisverifies</module>
55
+ </setup>
56
+ <connection>
57
+ <use>core_setup</use>
58
+ </connection>
59
+ </avisverifies_setup>
60
+ <avisverifies_write>
61
+ <connection>
62
+ <use>core_write</use>
63
+ </connection>
64
+ </avisverifies_write>
65
+ <avisverifies_read>
66
+ <connection>
67
+ <use>core_read</use>
68
+ </connection>
69
+ </avisverifies_read>
70
+ </resources>
71
<!-- Data Helper -->
72
+ <helpers>
73
+ <avisverifies>
74
+ <class>Netreviews_Avisverifies_Helper</class>
75
+ </avisverifies>
76
+ </helpers>
77
+ <!-- Observers -->
78
+ <events>
79
+ <!-- Event: Checkout\controllers\OnepageController.php:273 -->
80
+ <checkout_onepage_controller_success_action>
81
+ <observers>
82
+ <avisverifies_checkout_observer>
83
+ <type>singleton</type>
84
+ <class>Netreviews_Avisverifies_Model_Observers_Checkout_Track</class>
85
+ <method>trackCheckout</method>
86
+ </avisverifies_checkout_observer>
87
+ </observers>
88
+ </checkout_onepage_controller_success_action>
89
+ <!-- Event: Checkout\controllers\MultishippingController.php:545 -->
90
+ <checkout_multishipping_controller_success_action>
91
+ <observers>
92
+ <avisverifies_checkout_observer_multi>
93
+ <type>singleton</type>
94
+ <class>Netreviews_Avisverifies_Model_Observers_Checkout_Track</class>
95
+ <method>trackCheckout</method>
96
+ </avisverifies_checkout_observer_multi>
97
+ </observers>
98
+ </checkout_multishipping_controller_success_action>
99
+ <!-- Event: /app/code/core/Mage/Catalog/Block/Product/List.php:162 -->
100
+ <catalog_block_product_list_collection>
101
+ <observers>
102
+ <avisverifies_product_Observer>
103
+ <type>singleton</type>
104
+ <class>Netreviews_Avisverifies_Model_Observers_Product_List</class>
105
+ <method>updateProductRatingSummary</method>
106
+ </avisverifies_product_Observer>
107
+ </observers>
108
+ </catalog_block_product_list_collection>
109
+ <!-- module system config save -->
110
+ <admin_system_config_changed_section_avisverifies>
111
+ <observers>
112
+ <avisverifies>
113
+ <type>singleton</type>
114
+ <class>avisverifies/observers_system</class>
115
+ <method>save</method>
116
+ </avisverifies>
117
+ </observers>
118
+ </admin_system_config_changed_section_avisverifies>
119
</events>
120
+ </global>
121
+ <!-- Global -->
122
+ <!-- Frontend -->
123
+ <frontend>
124
+ <routers>
125
+ <avisverifies>
126
+ <use>standard</use>
127
+ <args>
128
+ <module>Netreviews_Avisverifies</module>
129
+ <frontName>AvisVerifies</frontName>
130
+ </args>
131
+ </avisverifies>
132
+ </routers>
133
+ <layout>
134
+ <updates>
135
+ <avisverifies>
136
+ <file>avisverifies.xml</file>
137
+ </avisverifies>
138
+ </updates>
139
+ </layout>
140
+ <translate>
141
+ <modules>
142
+ <avisverifies>
143
+ <files>
144
+ <default>avisverifies.csv</default>
145
+ </files>
146
+ </avisverifies>
147
+ </modules>
148
+ </translate>
149
+ </frontend>
150
+ <!-- Frontend -->
151
+ <!-- Admin -->
152
+ <admin>
153
+ <routers>
154
+ <avisverifies>
155
+ <use>admin</use>
156
+ <args>
157
+ <module>Netreviews_Avisverifies</module>
158
+ <frontName>AvisVerifies</frontName>
159
+ </args>
160
+ </avisverifies>
161
+ </routers>
162
+ </admin>
163
+ <!-- Admin -->
164
+ <!-- AdminHtml -->
165
+ <adminhtml>
166
+ <menu>
167
+ <catalog>
168
+ <children>
169
+ <avisverifies module="avisverifies" translate="title">
170
+ <title>VerifiedReviews</title>
171
+ <sort_order>100</sort_order>
172
+ <children>
173
+ <form module="avisverifies" translate="title">
174
+ <title>Management</title>
175
+ <sort_order>0</sort_order>
176
+ <action>avisverifies/adminhtml_avisverifies</action>
177
+ </form>
178
+ <config module="avisverifies" translate="title">
179
+ <title>Configuration</title>
180
+ <sort_order>10</sort_order>
181
+ <action>adminhtml/system_config/edit/section/avisverifies/</action>
182
+ </config>
183
+ <check module="avisverifies" translate="title">
184
+ <title>Check Installation</title>
185
+ <sort_order>20</sort_order>
186
+ <action>avisverifies/adminhtml_avisverifies/checkInstallation</action>
187
+ </check>
188
+ </children>
189
+ </avisverifies>
190
+ </children>
191
+ </catalog>
192
+ </menu>
193
+ <translate>
194
+ <modules>
195
+ <avisverifies>
196
+ <files>
197
+ <default>avisverifies.csv</default>
198
+ </files>
199
+ </avisverifies>
200
+ </modules>
201
+ </translate>
202
+ <acl>
203
+ <resources>
204
+ <admin>
205
+ <children>
206
+ <system>
207
+ <children>
208
+ <config>
209
+ <children>
210
+ <avisverifies module="avisverifies" translate="title">
211
+ <title>VerifiedReviews</title>
212
+ </avisverifies>
213
+ </children>
214
+ </config>
215
+ </children>
216
+ </system>
217
+ <catalog>
218
+ <children>
219
+ <avisverifies module="avisverifies" translate="title">
220
+ <title>VerifiedReviews</title>
221
+ <sort_order>100</sort_order>
222
+ <children>
223
+ <form module="avisverifies" translate="title">
224
+ <title>Management</title>
225
+ <sort_order>0</sort_order>
226
+ <action>avisverifies/adminhtml_avisverifies</action>
227
+ </form>
228
+ <config module="avisverifies" translate="title">
229
+ <title>Configuration</title>
230
+ <sort_order>10</sort_order>
231
+ <action>adminhtml/system_config/edit/section/avisverifies/</action>
232
+ </config>
233
+ <check module="avisverifies" translate="title">
234
+ <title>Check Installation</title>
235
+ <sort_order>20</sort_order>
236
+ <action>avisverifies/adminhtml_avisverifies/checkInstallation</action>
237
+ </check>
238
+ </children>
239
+ </avisverifies>
240
+ </children>
241
+ </catalog>
242
+ </children>
243
+ </admin>
244
+ </resources>
245
+ </acl>
246
+ <layout>
247
+ <updates>
248
+ <avisverifies>
249
+ <file>avisverifies.xml</file>
250
+ </avisverifies>
251
+ </updates>
252
+ </layout>
253
+ </adminhtml>
254
+ <!-- AdminHtml -->
255
</config>
app/code/local/Netreviews/Avisverifies/etc/system.xml CHANGED
@@ -17,19 +17,20 @@
17
<show_in_store>1</show_in_store>
18
<groups>
19
<introtext translate="label">
20
- <label>You must set the configuration VerifiedReviews according to a website module. Select from the list on the left, the website that you want to set</label>
21
<show_in_default>1</show_in_default>
22
- <show_in_website>0</show_in_website>
23
<show_in_store>1</show_in_store>
24
<sort_order>1</sort_order>
25