Version Notes
Auto approves product reviews based on customer type.
Download this release
Release Info
Developer | BrainSINS |
Extension | Auto_Reviews |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Exinent/Autoapprovereviews/Helper/Data.php +21 -0
- app/code/community/Exinent/Autoapprovereviews/Model/Adminhtml/System/Config/Source/Customer/Group/Multiselect.php +16 -0
- app/code/community/Exinent/Autoapprovereviews/Model/Adminhtml/System/Config/Source/Customer/Group/Multiselect.php~ +16 -0
- app/code/community/Exinent/Autoapprovereviews/controllers/AutoController.php~ +279 -0
- app/code/community/Exinent/Autoapprovereviews/controllers/ProductController.php +388 -0
- app/code/community/Exinent/Autoapprovereviews/controllers/ProductController.php~ +288 -0
- app/code/community/Exinent/Autoapprovereviews/etc/config.xml +76 -0
- app/code/community/Exinent/Autoapprovereviews/etc/config.xml~ +74 -0
- app/code/community/Exinent/Autoapprovereviews/etc/system.xml +44 -0
- app/code/community/Exinent/Autoapprovereviews/etc/system.xml~ +70 -0
- app/etc/modules/Exinent_Autoapprovereviews.xml +9 -0
- package.xml +18 -0
app/code/community/Exinent/Autoapprovereviews/Helper/Data.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Exinent_Autoapprovereviews_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
const XML_REVIEW_REG_ALLOW = 'autoapprovereviews_settings/autoapprovegroup/autoapprove_enabled';
|
7 |
+
const XML_REVIEW_CUSTOMER_LOGGEDIN = 'autoapprovereviews_settings/autoapprovegroup/login_review';
|
8 |
+
public function isAutoApproveEnabled() {
|
9 |
+
|
10 |
+
return Mage::getStoreConfigFlag(self::XML_REVIEW_REG_ALLOW);
|
11 |
+
|
12 |
+
}
|
13 |
+
|
14 |
+
public function customerGroup() {
|
15 |
+
|
16 |
+
$groups = explode(',', Mage::getStoreConfig(self::XML_REVIEW_CUSTOMER_LOGGEDIN));
|
17 |
+
|
18 |
+
return $groups;
|
19 |
+
|
20 |
+
}
|
21 |
+
}
|
app/code/community/Exinent/Autoapprovereviews/Model/Adminhtml/System/Config/Source/Customer/Group/Multiselect.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Exinent_Autoapprovereviews_Model_Adminhtml_System_Config_Source_Customer_Group_Multiselect
|
3 |
+
{
|
4 |
+
protected $_options;
|
5 |
+
|
6 |
+
public function toOptionArray() {
|
7 |
+
if (!$this->_options) {
|
8 |
+
$this->_options = Mage::getResourceModel('customer/group_collection')
|
9 |
+
->setRealGroupsFilter()
|
10 |
+
->loadData()->toOptionArray();
|
11 |
+
array_unshift($this->_options, array('value' => '', 'label' => Mage::helper('adminhtml')->__('No Group Selected')));
|
12 |
+
}
|
13 |
+
return $this->_options;
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Exinent/Autoapprovereviews/Model/Adminhtml/System/Config/Source/Customer/Group/Multiselect.php~
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Exinent_Autoapprovereviews_Model_Adminhtml_System_Config_Source_Customer_Group_Multiselect
|
3 |
+
{
|
4 |
+
protected $_options;
|
5 |
+
|
6 |
+
public function toOptionArray() {
|
7 |
+
if (!$this->_options) {
|
8 |
+
$this->_options = Mage::getResourceModel('customer/group_collection')
|
9 |
+
->setRealGroupsFilter()
|
10 |
+
->loadData()->toOptionArray();
|
11 |
+
array_unshift($this->_options, array('value' => '', 'label' => Mage::helper('adminhtml')->__('No Group Selected')));
|
12 |
+
}
|
13 |
+
return $this->_options;
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/community/Exinent/Autoapprovereviews/controllers/AutoController.php~
ADDED
@@ -0,0 +1,279 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Exinent_Autoapprovereviews_AutoController extends Mage_Core_Controller_Front_Action {
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Action list where need check enabled cookie
|
6 |
+
*
|
7 |
+
* @var array
|
8 |
+
*/
|
9 |
+
protected $_cookieCheckActions = array('post');
|
10 |
+
|
11 |
+
public function preDispatch()
|
12 |
+
{
|
13 |
+
parent::preDispatch();
|
14 |
+
|
15 |
+
$allowGuest = Mage::helper('review')->getIsGuestAllowToWrite();
|
16 |
+
if (!$this->getRequest()->isDispatched()) {
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
$action = $this->getRequest()->getActionName();
|
21 |
+
if (!$allowGuest && $action == 'post' && $this->getRequest()->isPost()) {
|
22 |
+
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
|
23 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
24 |
+
Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_current' => true)));
|
25 |
+
Mage::getSingleton('review/session')->setFormData($this->getRequest()->getPost())
|
26 |
+
->setRedirectUrl($this->_getRefererUrl());
|
27 |
+
$this->_redirectUrl(Mage::helper('customer')->getLoginUrl());
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
/**
|
34 |
+
* Initialize and check product
|
35 |
+
*
|
36 |
+
* @return Mage_Catalog_Model_Product
|
37 |
+
*/
|
38 |
+
protected function _initProduct()
|
39 |
+
{
|
40 |
+
Mage::dispatchEvent('review_controller_product_init_before', array('controller_action'=>$this));
|
41 |
+
$categoryId = (int) $this->getRequest()->getParam('category', false);
|
42 |
+
$productId = (int) $this->getRequest()->getParam('id');
|
43 |
+
|
44 |
+
$product = $this->_loadProduct($productId);
|
45 |
+
if (!$product) {
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
if ($categoryId) {
|
50 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
51 |
+
Mage::register('current_category', $category);
|
52 |
+
}
|
53 |
+
|
54 |
+
try {
|
55 |
+
Mage::dispatchEvent('review_controller_product_init', array('product'=>$product));
|
56 |
+
Mage::dispatchEvent('review_controller_product_init_after', array(
|
57 |
+
'product' => $product,
|
58 |
+
'controller_action' => $this
|
59 |
+
));
|
60 |
+
} catch (Mage_Core_Exception $e) {
|
61 |
+
Mage::logException($e);
|
62 |
+
return false;
|
63 |
+
}
|
64 |
+
|
65 |
+
return $product;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Load product model with data by passed id.
|
70 |
+
* Return false if product was not loaded or has incorrect status.
|
71 |
+
*
|
72 |
+
* @param int $productId
|
73 |
+
* @return bool|Mage_Catalog_Model_Product
|
74 |
+
*/
|
75 |
+
protected function _loadProduct($productId)
|
76 |
+
{
|
77 |
+
if (!$productId) {
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
$product = Mage::getModel('catalog/product')
|
82 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
83 |
+
->load($productId);
|
84 |
+
/* @var $product Mage_Catalog_Model_Product */
|
85 |
+
if (!$product->getId() || !$product->isVisibleInCatalog() || !$product->isVisibleInSiteVisibility()) {
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
|
89 |
+
Mage::register('current_product', $product);
|
90 |
+
Mage::register('product', $product);
|
91 |
+
|
92 |
+
return $product;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Load review model with data by passed id.
|
97 |
+
* Return false if review was not loaded or review is not approved.
|
98 |
+
*
|
99 |
+
* @param int $productId
|
100 |
+
* @return bool|Mage_Review_Model_Review
|
101 |
+
*/
|
102 |
+
protected function _loadReview($reviewId)
|
103 |
+
{
|
104 |
+
if (!$reviewId) {
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
|
108 |
+
$review = Mage::getModel('review/review')->load($reviewId);
|
109 |
+
/* @var $review Mage_Review_Model_Review */
|
110 |
+
if (!$review->getId() || !$review->isApproved() || !$review->isAvailableOnStore(Mage::app()->getStore())) {
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
|
114 |
+
Mage::register('current_review', $review);
|
115 |
+
|
116 |
+
return $review;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Submit new review action
|
121 |
+
*
|
122 |
+
*/
|
123 |
+
public function postAction()
|
124 |
+
{
|
125 |
+
|
126 |
+
echo "phani";
|
127 |
+
if (!$this->_validateFormKey()) {
|
128 |
+
// returns to the product item page
|
129 |
+
$this->_redirectReferer();
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
|
133 |
+
if ($data = Mage::getSingleton('review/session')->getFormData(true)) {
|
134 |
+
$rating = array();
|
135 |
+
if (isset($data['ratings']) && is_array($data['ratings'])) {
|
136 |
+
$rating = $data['ratings'];
|
137 |
+
}
|
138 |
+
} else {
|
139 |
+
$data = $this->getRequest()->getPost();
|
140 |
+
$rating = $this->getRequest()->getParam('ratings', array());
|
141 |
+
}
|
142 |
+
|
143 |
+
if (($product = $this->_initProduct()) && !empty($data)) {
|
144 |
+
$session = Mage::getSingleton('core/session');
|
145 |
+
/* @var $session Mage_Core_Model_Session */
|
146 |
+
$review = Mage::getModel('review/review')->setData($data);
|
147 |
+
/* @var $review Mage_Review_Model_Review */
|
148 |
+
|
149 |
+
$validate = $review->validate();
|
150 |
+
if ($validate === true) {
|
151 |
+
try {
|
152 |
+
$review->setEntityId($review->getEntityIdByCode(Mage_Review_Model_Review::ENTITY_PRODUCT_CODE))
|
153 |
+
->setEntityPkValue($product->getId())
|
154 |
+
->setStatusId(Mage_Review_Model_Review::STATUS_PENDING)
|
155 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
156 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
157 |
+
->setStores(array(Mage::app()->getStore()->getId()))
|
158 |
+
->save();
|
159 |
+
|
160 |
+
foreach ($rating as $ratingId => $optionId) {
|
161 |
+
Mage::getModel('rating/rating')
|
162 |
+
->setRatingId($ratingId)
|
163 |
+
->setReviewId($review->getId())
|
164 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
165 |
+
->addOptionVote($optionId, $product->getId());
|
166 |
+
}
|
167 |
+
|
168 |
+
$review->aggregate();
|
169 |
+
$session->addSuccess($this->__('Your review has been accepted for moderation.'));
|
170 |
+
}
|
171 |
+
catch (Exception $e) {
|
172 |
+
$session->setFormData($data);
|
173 |
+
$session->addError($this->__('Unable to post the review.'));
|
174 |
+
}
|
175 |
+
}
|
176 |
+
else {
|
177 |
+
$session->setFormData($data);
|
178 |
+
if (is_array($validate)) {
|
179 |
+
foreach ($validate as $errorMessage) {
|
180 |
+
$session->addError($errorMessage);
|
181 |
+
}
|
182 |
+
}
|
183 |
+
else {
|
184 |
+
$session->addError($this->__('Unable to post the review.'));
|
185 |
+
}
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
if ($redirectUrl = Mage::getSingleton('review/session')->getRedirectUrl(true)) {
|
190 |
+
$this->_redirectUrl($redirectUrl);
|
191 |
+
return;
|
192 |
+
}
|
193 |
+
$this->_redirectReferer();
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Show list of product's reviews
|
198 |
+
*
|
199 |
+
*/
|
200 |
+
public function listAction()
|
201 |
+
{
|
202 |
+
if ($product = $this->_initProduct()) {
|
203 |
+
Mage::register('productId', $product->getId());
|
204 |
+
|
205 |
+
$design = Mage::getSingleton('catalog/design');
|
206 |
+
$settings = $design->getDesignSettings($product);
|
207 |
+
if ($settings->getCustomDesign()) {
|
208 |
+
$design->applyCustomDesign($settings->getCustomDesign());
|
209 |
+
}
|
210 |
+
$this->_initProductLayout($product);
|
211 |
+
|
212 |
+
// update breadcrumbs
|
213 |
+
if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
|
214 |
+
$breadcrumbsBlock->addCrumb('product', array(
|
215 |
+
'label' => $product->getName(),
|
216 |
+
'link' => $product->getProductUrl(),
|
217 |
+
'readonly' => true,
|
218 |
+
));
|
219 |
+
$breadcrumbsBlock->addCrumb('reviews', array('label' => Mage::helper('review')->__('Product Reviews')));
|
220 |
+
}
|
221 |
+
|
222 |
+
$this->renderLayout();
|
223 |
+
} elseif (!$this->getResponse()->isRedirect()) {
|
224 |
+
$this->_forward('noRoute');
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Show details of one review
|
230 |
+
*
|
231 |
+
*/
|
232 |
+
public function viewAction()
|
233 |
+
{
|
234 |
+
$review = $this->_loadReview((int) $this->getRequest()->getParam('id'));
|
235 |
+
if (!$review) {
|
236 |
+
$this->_forward('noroute');
|
237 |
+
return;
|
238 |
+
}
|
239 |
+
|
240 |
+
$product = $this->_loadProduct($review->getEntityPkValue());
|
241 |
+
if (!$product) {
|
242 |
+
$this->_forward('noroute');
|
243 |
+
return;
|
244 |
+
}
|
245 |
+
|
246 |
+
$this->loadLayout();
|
247 |
+
$this->_initLayoutMessages('review/session');
|
248 |
+
$this->_initLayoutMessages('catalog/session');
|
249 |
+
$this->renderLayout();
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* Load specific layout handles by product type id
|
254 |
+
*
|
255 |
+
*/
|
256 |
+
protected function _initProductLayout($product)
|
257 |
+
{
|
258 |
+
$update = $this->getLayout()->getUpdate();
|
259 |
+
|
260 |
+
$update->addHandle('default');
|
261 |
+
$this->addActionLayoutHandles();
|
262 |
+
|
263 |
+
|
264 |
+
$update->addHandle('PRODUCT_TYPE_'.$product->getTypeId());
|
265 |
+
|
266 |
+
if ($product->getPageLayout()) {
|
267 |
+
$this->getLayout()->helper('page/layout')
|
268 |
+
->applyHandle($product->getPageLayout());
|
269 |
+
}
|
270 |
+
|
271 |
+
$this->loadLayoutUpdates();
|
272 |
+
if ($product->getPageLayout()) {
|
273 |
+
$this->getLayout()->helper('page/layout')
|
274 |
+
->applyTemplate($product->getPageLayout());
|
275 |
+
}
|
276 |
+
$update->addUpdate($product->getCustomLayoutUpdate());
|
277 |
+
$this->generateLayoutXml()->generateLayoutBlocks();
|
278 |
+
}
|
279 |
+
}
|
app/code/community/Exinent/Autoapprovereviews/controllers/ProductController.php
ADDED
@@ -0,0 +1,388 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Exinent_Autoapprovereviews_ProductController extends Mage_Core_Controller_Front_Action {
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Action list where need check enabled cookie
|
6 |
+
*
|
7 |
+
* @var array
|
8 |
+
*/
|
9 |
+
protected $_cookieCheckActions = array('post');
|
10 |
+
|
11 |
+
public function preDispatch()
|
12 |
+
{
|
13 |
+
parent::preDispatch();
|
14 |
+
|
15 |
+
$allowGuest = Mage::helper('review')->getIsGuestAllowToWrite();
|
16 |
+
if (!$this->getRequest()->isDispatched()) {
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
$action = $this->getRequest()->getActionName();
|
21 |
+
if (!$allowGuest && $action == 'post' && $this->getRequest()->isPost()) {
|
22 |
+
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
|
23 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
24 |
+
Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_current' => true)));
|
25 |
+
Mage::getSingleton('review/session')->setFormData($this->getRequest()->getPost())
|
26 |
+
->setRedirectUrl($this->_getRefererUrl());
|
27 |
+
$this->_redirectUrl(Mage::helper('customer')->getLoginUrl());
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
/**
|
34 |
+
* Initialize and check product
|
35 |
+
*
|
36 |
+
* @return Mage_Catalog_Model_Product
|
37 |
+
*/
|
38 |
+
protected function _initProduct()
|
39 |
+
{
|
40 |
+
Mage::dispatchEvent('review_controller_product_init_before', array('controller_action'=>$this));
|
41 |
+
$categoryId = (int) $this->getRequest()->getParam('category', false);
|
42 |
+
$productId = (int) $this->getRequest()->getParam('id');
|
43 |
+
|
44 |
+
$product = $this->_loadProduct($productId);
|
45 |
+
if (!$product) {
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
if ($categoryId) {
|
50 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
51 |
+
Mage::register('current_category', $category);
|
52 |
+
}
|
53 |
+
|
54 |
+
try {
|
55 |
+
Mage::dispatchEvent('review_controller_product_init', array('product'=>$product));
|
56 |
+
Mage::dispatchEvent('review_controller_product_init_after', array(
|
57 |
+
'product' => $product,
|
58 |
+
'controller_action' => $this
|
59 |
+
));
|
60 |
+
} catch (Mage_Core_Exception $e) {
|
61 |
+
Mage::logException($e);
|
62 |
+
return false;
|
63 |
+
}
|
64 |
+
|
65 |
+
return $product;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Load product model with data by passed id.
|
70 |
+
* Return false if product was not loaded or has incorrect status.
|
71 |
+
*
|
72 |
+
* @param int $productId
|
73 |
+
* @return bool|Mage_Catalog_Model_Product
|
74 |
+
*/
|
75 |
+
protected function _loadProduct($productId)
|
76 |
+
{
|
77 |
+
if (!$productId) {
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
$product = Mage::getModel('catalog/product')
|
82 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
83 |
+
->load($productId);
|
84 |
+
/* @var $product Mage_Catalog_Model_Product */
|
85 |
+
if (!$product->getId() || !$product->isVisibleInCatalog() || !$product->isVisibleInSiteVisibility()) {
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
|
89 |
+
Mage::register('current_product', $product);
|
90 |
+
Mage::register('product', $product);
|
91 |
+
|
92 |
+
return $product;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Load review model with data by passed id.
|
97 |
+
* Return false if review was not loaded or review is not approved.
|
98 |
+
*
|
99 |
+
* @param int $productId
|
100 |
+
* @return bool|Mage_Review_Model_Review
|
101 |
+
*/
|
102 |
+
protected function _loadReview($reviewId)
|
103 |
+
{
|
104 |
+
if (!$reviewId) {
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
|
108 |
+
$review = Mage::getModel('review/review')->load($reviewId);
|
109 |
+
/* @var $review Mage_Review_Model_Review */
|
110 |
+
if (!$review->getId() || !$review->isApproved() || !$review->isAvailableOnStore(Mage::app()->getStore())) {
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
|
114 |
+
Mage::register('current_review', $review);
|
115 |
+
|
116 |
+
return $review;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Submit new review action
|
121 |
+
*
|
122 |
+
*/
|
123 |
+
public function postAction()
|
124 |
+
{
|
125 |
+
if (!$this->_validateFormKey()) {
|
126 |
+
// returns to the product item page
|
127 |
+
$this->_redirectReferer();
|
128 |
+
return;
|
129 |
+
}
|
130 |
+
|
131 |
+
if ($data = Mage::getSingleton('review/session')->getFormData(true)) {
|
132 |
+
$rating = array();
|
133 |
+
if (isset($data['ratings']) && is_array($data['ratings'])) {
|
134 |
+
$rating = $data['ratings'];
|
135 |
+
}
|
136 |
+
} else {
|
137 |
+
$data = $this->getRequest()->getPost();
|
138 |
+
$rating = $this->getRequest()->getParam('ratings', array());
|
139 |
+
}
|
140 |
+
|
141 |
+
$regulerLogin = Mage::helper('autoapprovereviews')->isAutoApproveEnabled();
|
142 |
+
$customerLogin = Mage::helper('autoapprovereviews')->customerGroup();
|
143 |
+
$groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
|
144 |
+
//print_r($customerLogin);die();
|
145 |
+
//$phani =Mage::getConfig()->getNode('autoapprovereviews_settings/autoapprovegroup/login_review');
|
146 |
+
//var_dump($phani[0]);die();
|
147 |
+
if(!$regulerLogin) {
|
148 |
+
|
149 |
+
if (($product = $this->_initProduct()) && !empty($data)) {
|
150 |
+
$session = Mage::getSingleton('core/session');
|
151 |
+
/* @var $session Mage_Core_Model_Session */
|
152 |
+
$review = Mage::getModel('review/review')->setData($data);
|
153 |
+
/* @var $review Mage_Review_Model_Review */
|
154 |
+
|
155 |
+
$validate = $review->validate();
|
156 |
+
if ($validate === true) {
|
157 |
+
try {
|
158 |
+
$review->setEntityId($review->getEntityIdByCode(Mage_Review_Model_Review::ENTITY_PRODUCT_CODE))
|
159 |
+
->setEntityPkValue($product->getId())
|
160 |
+
->setStatusId(Mage_Review_Model_Review::STATUS_PENDING)
|
161 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
162 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
163 |
+
->setStores(array(Mage::app()->getStore()->getId()))
|
164 |
+
->save();
|
165 |
+
|
166 |
+
foreach ($rating as $ratingId => $optionId) {
|
167 |
+
Mage::getModel('rating/rating')
|
168 |
+
->setRatingId($ratingId)
|
169 |
+
->setReviewId($review->getId())
|
170 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
171 |
+
->addOptionVote($optionId, $product->getId());
|
172 |
+
}
|
173 |
+
|
174 |
+
$review->aggregate();
|
175 |
+
$session->addSuccess($this->__('Your review has been accepted for moderation.'));
|
176 |
+
}
|
177 |
+
catch (Exception $e) {
|
178 |
+
$session->setFormData($data);
|
179 |
+
$session->addError($this->__('Unable to post the review.'));
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
else {
|
184 |
+
$session->setFormData($data);
|
185 |
+
if (is_array($validate)) {
|
186 |
+
foreach ($validate as $errorMessage) {
|
187 |
+
$session->addError($errorMessage);
|
188 |
+
}
|
189 |
+
}
|
190 |
+
else {
|
191 |
+
$session->addError($this->__('Unable to post the review.'));
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
}
|
197 |
+
else if( Mage::getSingleton( 'customer/session' )->isLoggedIn() && in_array($groupId, $customerLogin) ) {
|
198 |
+
|
199 |
+
|
200 |
+
if (($product = $this->_initProduct()) && !empty($data)) {
|
201 |
+
$session = Mage::getSingleton('core/session');
|
202 |
+
/* @var $session Mage_Core_Model_Session */
|
203 |
+
$review = Mage::getModel('review/review')->setData($data);
|
204 |
+
/* @var $review Mage_Review_Model_Review */
|
205 |
+
|
206 |
+
$validate = $review->validate();
|
207 |
+
if ($validate === true) {
|
208 |
+
try {
|
209 |
+
$review->setEntityId($review->getEntityIdByCode(Mage_Review_Model_Review::ENTITY_PRODUCT_CODE))
|
210 |
+
->setEntityPkValue($product->getId())
|
211 |
+
->setStatusId(Mage_Review_Model_Review::STATUS_APPROVED)
|
212 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
213 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
214 |
+
->setStores(array(Mage::app()->getStore()->getId()))
|
215 |
+
->save();
|
216 |
+
|
217 |
+
foreach ($rating as $ratingId => $optionId) {
|
218 |
+
Mage::getModel('rating/rating')
|
219 |
+
->setRatingId($ratingId)
|
220 |
+
->setReviewId($review->getId())
|
221 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
222 |
+
->addOptionVote($optionId, $product->getId());
|
223 |
+
}
|
224 |
+
|
225 |
+
$review->aggregate();
|
226 |
+
$session->addSuccess($this->__('Your review has been posted.'));
|
227 |
+
}
|
228 |
+
catch (Exception $e) {
|
229 |
+
$session->setFormData($data);
|
230 |
+
$session->addError($this->__('Unable to post the review.'));
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
else {
|
235 |
+
$session->setFormData($data);
|
236 |
+
if (is_array($validate)) {
|
237 |
+
foreach ($validate as $errorMessage) {
|
238 |
+
$session->addError($errorMessage);
|
239 |
+
}
|
240 |
+
}
|
241 |
+
else {
|
242 |
+
$session->addError($this->__('Unable to post the review.'));
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
}
|
248 |
+
|
249 |
+
else if(Mage::getSingleton( 'customer/session' )->isLoggedIn()) {
|
250 |
+
if (($product = $this->_initProduct()) && !empty($data)) {
|
251 |
+
$session = Mage::getSingleton('core/session');
|
252 |
+
/* @var $session Mage_Core_Model_Session */
|
253 |
+
$review = Mage::getModel('review/review')->setData($data);
|
254 |
+
/* @var $review Mage_Review_Model_Review */
|
255 |
+
|
256 |
+
$validate = $review->validate();
|
257 |
+
if ($validate === true) {
|
258 |
+
try {
|
259 |
+
$review->setEntityId($review->getEntityIdByCode(Mage_Review_Model_Review::ENTITY_PRODUCT_CODE))
|
260 |
+
->setEntityPkValue($product->getId())
|
261 |
+
->setStatusId(Mage_Review_Model_Review::STATUS_PENDING)
|
262 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
263 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
264 |
+
->setStores(array(Mage::app()->getStore()->getId()))
|
265 |
+
->save();
|
266 |
+
|
267 |
+
foreach ($rating as $ratingId => $optionId) {
|
268 |
+
Mage::getModel('rating/rating')
|
269 |
+
->setRatingId($ratingId)
|
270 |
+
->setReviewId($review->getId())
|
271 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
272 |
+
->addOptionVote($optionId, $product->getId());
|
273 |
+
}
|
274 |
+
|
275 |
+
$review->aggregate();
|
276 |
+
$session->addSuccess($this->__('Your review has been accepted for moderation.'));
|
277 |
+
}
|
278 |
+
catch (Exception $e) {
|
279 |
+
$session->setFormData($data);
|
280 |
+
$session->addError($this->__('Unable to post the review.'));
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
else {
|
285 |
+
$session->setFormData($data);
|
286 |
+
if (is_array($validate)) {
|
287 |
+
foreach ($validate as $errorMessage) {
|
288 |
+
$session->addError($errorMessage);
|
289 |
+
}
|
290 |
+
}
|
291 |
+
else {
|
292 |
+
$session->addError($this->__('Unable to post the review.'));
|
293 |
+
}
|
294 |
+
}
|
295 |
+
}
|
296 |
+
|
297 |
+
}
|
298 |
+
if ($redirectUrl = Mage::getSingleton('review/session')->getRedirectUrl(true)) {
|
299 |
+
$this->_redirectUrl($redirectUrl);
|
300 |
+
return;
|
301 |
+
}
|
302 |
+
$this->_redirectReferer();
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Show list of product's reviews
|
307 |
+
*
|
308 |
+
*/
|
309 |
+
public function listAction()
|
310 |
+
{
|
311 |
+
if ($product = $this->_initProduct()) {
|
312 |
+
Mage::register('productId', $product->getId());
|
313 |
+
|
314 |
+
$design = Mage::getSingleton('catalog/design');
|
315 |
+
$settings = $design->getDesignSettings($product);
|
316 |
+
if ($settings->getCustomDesign()) {
|
317 |
+
$design->applyCustomDesign($settings->getCustomDesign());
|
318 |
+
}
|
319 |
+
$this->_initProductLayout($product);
|
320 |
+
|
321 |
+
// update breadcrumbs
|
322 |
+
if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
|
323 |
+
$breadcrumbsBlock->addCrumb('product', array(
|
324 |
+
'label' => $product->getName(),
|
325 |
+
'link' => $product->getProductUrl(),
|
326 |
+
'readonly' => true,
|
327 |
+
));
|
328 |
+
$breadcrumbsBlock->addCrumb('reviews', array('label' => Mage::helper('review')->__('Product Reviews')));
|
329 |
+
}
|
330 |
+
|
331 |
+
$this->renderLayout();
|
332 |
+
} elseif (!$this->getResponse()->isRedirect()) {
|
333 |
+
$this->_forward('noRoute');
|
334 |
+
}
|
335 |
+
}
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Show details of one review
|
339 |
+
*
|
340 |
+
*/
|
341 |
+
public function viewAction()
|
342 |
+
{
|
343 |
+
$review = $this->_loadReview((int) $this->getRequest()->getParam('id'));
|
344 |
+
if (!$review) {
|
345 |
+
$this->_forward('noroute');
|
346 |
+
return;
|
347 |
+
}
|
348 |
+
|
349 |
+
$product = $this->_loadProduct($review->getEntityPkValue());
|
350 |
+
if (!$product) {
|
351 |
+
$this->_forward('noroute');
|
352 |
+
return;
|
353 |
+
}
|
354 |
+
|
355 |
+
$this->loadLayout();
|
356 |
+
$this->_initLayoutMessages('review/session');
|
357 |
+
$this->_initLayoutMessages('catalog/session');
|
358 |
+
$this->renderLayout();
|
359 |
+
}
|
360 |
+
|
361 |
+
/**
|
362 |
+
* Load specific layout handles by product type id
|
363 |
+
*
|
364 |
+
*/
|
365 |
+
protected function _initProductLayout($product)
|
366 |
+
{
|
367 |
+
$update = $this->getLayout()->getUpdate();
|
368 |
+
|
369 |
+
$update->addHandle('default');
|
370 |
+
$this->addActionLayoutHandles();
|
371 |
+
|
372 |
+
|
373 |
+
$update->addHandle('PRODUCT_TYPE_'.$product->getTypeId());
|
374 |
+
|
375 |
+
if ($product->getPageLayout()) {
|
376 |
+
$this->getLayout()->helper('page/layout')
|
377 |
+
->applyHandle($product->getPageLayout());
|
378 |
+
}
|
379 |
+
|
380 |
+
$this->loadLayoutUpdates();
|
381 |
+
if ($product->getPageLayout()) {
|
382 |
+
$this->getLayout()->helper('page/layout')
|
383 |
+
->applyTemplate($product->getPageLayout());
|
384 |
+
}
|
385 |
+
$update->addUpdate($product->getCustomLayoutUpdate());
|
386 |
+
$this->generateLayoutXml()->generateLayoutBlocks();
|
387 |
+
}
|
388 |
+
}
|
app/code/community/Exinent/Autoapprovereviews/controllers/ProductController.php~
ADDED
@@ -0,0 +1,288 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Exinent_Autoapprovereviews_ProductController extends Mage_Core_Controller_Front_Action {
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Action list where need check enabled cookie
|
6 |
+
*
|
7 |
+
* @var array
|
8 |
+
*/
|
9 |
+
protected $_cookieCheckActions = array('post');
|
10 |
+
|
11 |
+
public function preDispatch()
|
12 |
+
{
|
13 |
+
parent::preDispatch();
|
14 |
+
|
15 |
+
$allowGuest = Mage::helper('review')->getIsGuestAllowToWrite();
|
16 |
+
if (!$this->getRequest()->isDispatched()) {
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
$action = $this->getRequest()->getActionName();
|
21 |
+
if (!$allowGuest && $action == 'post' && $this->getRequest()->isPost()) {
|
22 |
+
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
|
23 |
+
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
24 |
+
Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_current' => true)));
|
25 |
+
Mage::getSingleton('review/session')->setFormData($this->getRequest()->getPost())
|
26 |
+
->setRedirectUrl($this->_getRefererUrl());
|
27 |
+
$this->_redirectUrl(Mage::helper('customer')->getLoginUrl());
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
return $this;
|
32 |
+
}
|
33 |
+
/**
|
34 |
+
* Initialize and check product
|
35 |
+
*
|
36 |
+
* @return Mage_Catalog_Model_Product
|
37 |
+
*/
|
38 |
+
protected function _initProduct()
|
39 |
+
{
|
40 |
+
Mage::dispatchEvent('review_controller_product_init_before', array('controller_action'=>$this));
|
41 |
+
$categoryId = (int) $this->getRequest()->getParam('category', false);
|
42 |
+
$productId = (int) $this->getRequest()->getParam('id');
|
43 |
+
|
44 |
+
$product = $this->_loadProduct($productId);
|
45 |
+
if (!$product) {
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
|
49 |
+
if ($categoryId) {
|
50 |
+
$category = Mage::getModel('catalog/category')->load($categoryId);
|
51 |
+
Mage::register('current_category', $category);
|
52 |
+
}
|
53 |
+
|
54 |
+
try {
|
55 |
+
Mage::dispatchEvent('review_controller_product_init', array('product'=>$product));
|
56 |
+
Mage::dispatchEvent('review_controller_product_init_after', array(
|
57 |
+
'product' => $product,
|
58 |
+
'controller_action' => $this
|
59 |
+
));
|
60 |
+
} catch (Mage_Core_Exception $e) {
|
61 |
+
Mage::logException($e);
|
62 |
+
return false;
|
63 |
+
}
|
64 |
+
|
65 |
+
return $product;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Load product model with data by passed id.
|
70 |
+
* Return false if product was not loaded or has incorrect status.
|
71 |
+
*
|
72 |
+
* @param int $productId
|
73 |
+
* @return bool|Mage_Catalog_Model_Product
|
74 |
+
*/
|
75 |
+
protected function _loadProduct($productId)
|
76 |
+
{
|
77 |
+
if (!$productId) {
|
78 |
+
return false;
|
79 |
+
}
|
80 |
+
|
81 |
+
$product = Mage::getModel('catalog/product')
|
82 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
83 |
+
->load($productId);
|
84 |
+
/* @var $product Mage_Catalog_Model_Product */
|
85 |
+
if (!$product->getId() || !$product->isVisibleInCatalog() || !$product->isVisibleInSiteVisibility()) {
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
|
89 |
+
Mage::register('current_product', $product);
|
90 |
+
Mage::register('product', $product);
|
91 |
+
|
92 |
+
return $product;
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Load review model with data by passed id.
|
97 |
+
* Return false if review was not loaded or review is not approved.
|
98 |
+
*
|
99 |
+
* @param int $productId
|
100 |
+
* @return bool|Mage_Review_Model_Review
|
101 |
+
*/
|
102 |
+
protected function _loadReview($reviewId)
|
103 |
+
{
|
104 |
+
if (!$reviewId) {
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
|
108 |
+
$review = Mage::getModel('review/review')->load($reviewId);
|
109 |
+
/* @var $review Mage_Review_Model_Review */
|
110 |
+
if (!$review->getId() || !$review->isApproved() || !$review->isAvailableOnStore(Mage::app()->getStore())) {
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
|
114 |
+
Mage::register('current_review', $review);
|
115 |
+
|
116 |
+
return $review;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Submit new review action
|
121 |
+
*
|
122 |
+
*/
|
123 |
+
public function postAction()
|
124 |
+
{
|
125 |
+
|
126 |
+
|
127 |
+
if (!$this->_validateFormKey()) {
|
128 |
+
// returns to the product item page
|
129 |
+
$this->_redirectReferer();
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
|
133 |
+
if ($data = Mage::getSingleton('review/session')->getFormData(true)) {
|
134 |
+
$rating = array();
|
135 |
+
if (isset($data['ratings']) && is_array($data['ratings'])) {
|
136 |
+
$rating = $data['ratings'];
|
137 |
+
}
|
138 |
+
} else {
|
139 |
+
$data = $this->getRequest()->getPost();
|
140 |
+
$rating = $this->getRequest()->getParam('ratings', array());
|
141 |
+
}
|
142 |
+
|
143 |
+
if (($product = $this->_initProduct()) && !empty($data)) {
|
144 |
+
$session = Mage::getSingleton('core/session');
|
145 |
+
/* @var $session Mage_Core_Model_Session */
|
146 |
+
$review = Mage::getModel('review/review')->setData($data);
|
147 |
+
/* @var $review Mage_Review_Model_Review */
|
148 |
+
|
149 |
+
//$notAllowRegisterd = Mage::helper('review')->IsAutoApproveEnabled();
|
150 |
+
|
151 |
+
$regulerLogin = Mage::helper('autoapprovereviews')->IsAutoApproveEnabled();
|
152 |
+
if(!$regulerLogin) {
|
153 |
+
$validate = $review->validate();
|
154 |
+
if ($validate === true) {
|
155 |
+
try {
|
156 |
+
$review->setEntityId($review->getEntityIdByCode(Mage_Review_Model_Review::ENTITY_PRODUCT_CODE))
|
157 |
+
->setEntityPkValue($product->getId())
|
158 |
+
->setStatusId(Mage_Review_Model_Review::STATUS_PENDING)
|
159 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
160 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
161 |
+
->setStores(array(Mage::app()->getStore()->getId()))
|
162 |
+
->save();
|
163 |
+
|
164 |
+
foreach ($rating as $ratingId => $optionId) {
|
165 |
+
Mage::getModel('rating/rating')
|
166 |
+
->setRatingId($ratingId)
|
167 |
+
->setReviewId($review->getId())
|
168 |
+
->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId())
|
169 |
+
->addOptionVote($optionId, $product->getId());
|
170 |
+
}
|
171 |
+
|
172 |
+
$review->aggregate();
|
173 |
+
$session->addSuccess($this->__('Your review has been accepted for moderation.'));
|
174 |
+
}
|
175 |
+
catch (Exception $e) {
|
176 |
+
$session->setFormData($data);
|
177 |
+
$session->addError($this->__('Unable to post the review.'));
|
178 |
+
}
|
179 |
+
}
|
180 |
+
else {
|
181 |
+
$session->setFormData($data);
|
182 |
+
if (is_array($validate)) {
|
183 |
+
foreach ($validate as $errorMessage) {
|
184 |
+
$session->addError($errorMessage);
|
185 |
+
}
|
186 |
+
}
|
187 |
+
else {
|
188 |
+
$session->addError($this->__('Unable to post the review.'));
|
189 |
+
}
|
190 |
+
}
|
191 |
+
}
|
192 |
+
}
|
193 |
+
else if (1) {
|
194 |
+
|
195 |
+
echo "phani";die();
|
196 |
+
}
|
197 |
+
|
198 |
+
if ($redirectUrl = Mage::getSingleton('review/session')->getRedirectUrl(true)) {
|
199 |
+
$this->_redirectUrl($redirectUrl);
|
200 |
+
return;
|
201 |
+
}
|
202 |
+
$this->_redirectReferer();
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Show list of product's reviews
|
207 |
+
*
|
208 |
+
*/
|
209 |
+
public function listAction()
|
210 |
+
{
|
211 |
+
if ($product = $this->_initProduct()) {
|
212 |
+
Mage::register('productId', $product->getId());
|
213 |
+
|
214 |
+
$design = Mage::getSingleton('catalog/design');
|
215 |
+
$settings = $design->getDesignSettings($product);
|
216 |
+
if ($settings->getCustomDesign()) {
|
217 |
+
$design->applyCustomDesign($settings->getCustomDesign());
|
218 |
+
}
|
219 |
+
$this->_initProductLayout($product);
|
220 |
+
|
221 |
+
// update breadcrumbs
|
222 |
+
if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) {
|
223 |
+
$breadcrumbsBlock->addCrumb('product', array(
|
224 |
+
'label' => $product->getName(),
|
225 |
+
'link' => $product->getProductUrl(),
|
226 |
+
'readonly' => true,
|
227 |
+
));
|
228 |
+
$breadcrumbsBlock->addCrumb('reviews', array('label' => Mage::helper('review')->__('Product Reviews')));
|
229 |
+
}
|
230 |
+
|
231 |
+
$this->renderLayout();
|
232 |
+
} elseif (!$this->getResponse()->isRedirect()) {
|
233 |
+
$this->_forward('noRoute');
|
234 |
+
}
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Show details of one review
|
239 |
+
*
|
240 |
+
*/
|
241 |
+
public function viewAction()
|
242 |
+
{
|
243 |
+
$review = $this->_loadReview((int) $this->getRequest()->getParam('id'));
|
244 |
+
if (!$review) {
|
245 |
+
$this->_forward('noroute');
|
246 |
+
return;
|
247 |
+
}
|
248 |
+
|
249 |
+
$product = $this->_loadProduct($review->getEntityPkValue());
|
250 |
+
if (!$product) {
|
251 |
+
$this->_forward('noroute');
|
252 |
+
return;
|
253 |
+
}
|
254 |
+
|
255 |
+
$this->loadLayout();
|
256 |
+
$this->_initLayoutMessages('review/session');
|
257 |
+
$this->_initLayoutMessages('catalog/session');
|
258 |
+
$this->renderLayout();
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Load specific layout handles by product type id
|
263 |
+
*
|
264 |
+
*/
|
265 |
+
protected function _initProductLayout($product)
|
266 |
+
{
|
267 |
+
$update = $this->getLayout()->getUpdate();
|
268 |
+
|
269 |
+
$update->addHandle('default');
|
270 |
+
$this->addActionLayoutHandles();
|
271 |
+
|
272 |
+
|
273 |
+
$update->addHandle('PRODUCT_TYPE_'.$product->getTypeId());
|
274 |
+
|
275 |
+
if ($product->getPageLayout()) {
|
276 |
+
$this->getLayout()->helper('page/layout')
|
277 |
+
->applyHandle($product->getPageLayout());
|
278 |
+
}
|
279 |
+
|
280 |
+
$this->loadLayoutUpdates();
|
281 |
+
if ($product->getPageLayout()) {
|
282 |
+
$this->getLayout()->helper('page/layout')
|
283 |
+
->applyTemplate($product->getPageLayout());
|
284 |
+
}
|
285 |
+
$update->addUpdate($product->getCustomLayoutUpdate());
|
286 |
+
$this->generateLayoutXml()->generateLayoutBlocks();
|
287 |
+
}
|
288 |
+
}
|
app/code/community/Exinent/Autoapprovereviews/etc/config.xml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Exinent_Autoapprovereviews>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Exinent_Autoapprovereviews>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<autoapprovereviews>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Exinent_Autoapprovereviews</module>
|
14 |
+
<frontName>autoapprovereviews</frontName>
|
15 |
+
</args>
|
16 |
+
</autoapprovereviews>
|
17 |
+
</routers>
|
18 |
+
</frontend>
|
19 |
+
<global>
|
20 |
+
<helpers>
|
21 |
+
<autoapprovereviews>
|
22 |
+
<class>Exinent_Autoapprovereviews_Helper</class>
|
23 |
+
</autoapprovereviews>
|
24 |
+
</helpers>
|
25 |
+
<models>
|
26 |
+
<autoapprovereviews>
|
27 |
+
<class>Exinent_Autoapprovereviews_Model</class>
|
28 |
+
<resourceModel>autoapprovereviews_resource</resourceModel>
|
29 |
+
</autoapprovereviews>
|
30 |
+
<autoapprovereviews_resource>
|
31 |
+
<class>Exinent_Autoapprovereviews_Model_Resource</class>
|
32 |
+
</autoapprovereviews_resource>
|
33 |
+
</models>
|
34 |
+
<!-- This rewrite rule could be added to the database instead -->
|
35 |
+
<rewrite>
|
36 |
+
<!-- This is an identifier for your rewrite that should be unique -->
|
37 |
+
<!-- THIS IS THE CLASSNAME IN YOUR OWN CONTROLLER -->
|
38 |
+
<autoapprovereviews>
|
39 |
+
<from><![CDATA[#^/review/product/#]]></from>
|
40 |
+
<!--
|
41 |
+
- mymodule matches the router frontname below
|
42 |
+
- matches the path to your controller
|
43 |
+
|
44 |
+
Considering the router below, "/customcontacts/index/" will be
|
45 |
+
"translated" to "app/code/local/Amit/Customcontacts/controllers/IndexController.php" (?)
|
46 |
+
-->
|
47 |
+
<to>/autoapprovereviews/product/</to>
|
48 |
+
</autoapprovereviews>
|
49 |
+
</rewrite>
|
50 |
+
</global>
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
+
<adminhtml>
|
56 |
+
<acl>
|
57 |
+
<resources>
|
58 |
+
<admin>
|
59 |
+
<children>
|
60 |
+
<system>
|
61 |
+
<children>
|
62 |
+
<config>
|
63 |
+
<children>
|
64 |
+
<autoapprovereviews_settings>
|
65 |
+
<title>Review Settings</title>
|
66 |
+
</autoapprovereviews_settings>
|
67 |
+
</children>
|
68 |
+
</config>
|
69 |
+
</children>
|
70 |
+
</system>
|
71 |
+
</children>
|
72 |
+
</admin>
|
73 |
+
</resources>
|
74 |
+
</acl>
|
75 |
+
</adminhtml>
|
76 |
+
</config>
|
app/code/community/Exinent/Autoapprovereviews/etc/config.xml~
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<config>
|
2 |
+
<modules>
|
3 |
+
<Exinent_Autoapprovereviews>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
</Exinent_Autoapprovereviews>
|
6 |
+
</modules>
|
7 |
+
<frontend>
|
8 |
+
<routers>
|
9 |
+
<autoapprovereviews>
|
10 |
+
<use>standard</use>
|
11 |
+
<args>
|
12 |
+
<module>Exinent_Autoapprovereviews</module>
|
13 |
+
<frontName>autoapprovereviews</frontName>
|
14 |
+
</args>
|
15 |
+
</autoapprovereviews>
|
16 |
+
</routers>
|
17 |
+
</frontend>
|
18 |
+
<global>
|
19 |
+
<helpers>
|
20 |
+
<autoapprovereviews>
|
21 |
+
<class>Exinent_Autoapprovereviews_Helper</class>
|
22 |
+
</autoapprovereviews>
|
23 |
+
</helpers>
|
24 |
+
<models>
|
25 |
+
<autoapprovereviews>
|
26 |
+
<class>Exinent_Autoapprovereviews_Model</class>
|
27 |
+
<resourceModel>autoapprovereviews_resource</resourceModel>
|
28 |
+
</autoapprovereviews>
|
29 |
+
<autoapprovereviews_resource>
|
30 |
+
<class>Exinent_Autoapprovereviews_Model_Resource</class>
|
31 |
+
</autoapprovereviews_resource>
|
32 |
+
</models>
|
33 |
+
</global>
|
34 |
+
|
35 |
+
<!-- This rewrite rule could be added to the database instead -->
|
36 |
+
<rewrite>
|
37 |
+
<!-- This is an identifier for your rewrite that should be unique -->
|
38 |
+
<!-- THIS IS THE CLASSNAME IN YOUR OWN CONTROLLER -->
|
39 |
+
<customcontactsunique>
|
40 |
+
<from><![CDATA[#^/review/product/#]]></from>
|
41 |
+
<!--
|
42 |
+
- mymodule matches the router frontname below
|
43 |
+
- matches the path to your controller
|
44 |
+
|
45 |
+
Considering the router below, "/customcontacts/index/" will be
|
46 |
+
"translated" to "app/code/local/Amit/Customcontacts/controllers/IndexController.php" (?)
|
47 |
+
-->
|
48 |
+
<to>/autoapprovereviews/product/</to>
|
49 |
+
</customcontactsunique>
|
50 |
+
</rewrite>
|
51 |
+
|
52 |
+
- See more at: http://www.amitbera.com/how-to-override-a-controller-in-magento/#sthash.bNyssa8b.dpuf
|
53 |
+
<adminhtml>
|
54 |
+
<acl>
|
55 |
+
<resources>
|
56 |
+
<admin>
|
57 |
+
<children>
|
58 |
+
<system>
|
59 |
+
<children>
|
60 |
+
<config>
|
61 |
+
<children>
|
62 |
+
<autoapprovereviews_settings>
|
63 |
+
<title>Review Settings</title>
|
64 |
+
</autoapprovereviews_settings>
|
65 |
+
</children>
|
66 |
+
</config>
|
67 |
+
</children>
|
68 |
+
</system>
|
69 |
+
</children>
|
70 |
+
</admin>
|
71 |
+
</resources>
|
72 |
+
</acl>
|
73 |
+
</adminhtml>
|
74 |
+
</config>
|
app/code/community/Exinent/Autoapprovereviews/etc/system.xml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<autoapprovereviews_settings translate="label" module="autoapprovereviews">
|
5 |
+
<label>Product Review Settings</label>
|
6 |
+
<tab>catalog</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>120</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<autoapprovegroup translate="label">
|
14 |
+
<label>Review Settings for logged in Users</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>1</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<autoapprove_enabled translate="label">
|
22 |
+
<label>Enabled</label>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
25 |
+
<sort_order>1</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
</autoapprove_enabled>
|
30 |
+
<login_review>
|
31 |
+
<label>Require Activation for Groups</label>
|
32 |
+
<frontend_type>multiselect</frontend_type>
|
33 |
+
<source_model>autoapprovereviews/adminhtml_system_config_source_customer_group_multiselect</source_model>
|
34 |
+
<sort_order>12</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</login_review>
|
39 |
+
</fields>
|
40 |
+
</autoapprovegroup>
|
41 |
+
</groups>
|
42 |
+
</autoapprovereviews_settings>
|
43 |
+
</sections>
|
44 |
+
</config>
|
app/code/community/Exinent/Autoapprovereviews/etc/system.xml~
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Mage
|
23 |
+
* @package Mage_Sendfriend
|
24 |
+
* @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<sections>
|
30 |
+
<autoapprovereviews_settings translate="label" module="autoapprovereviews">
|
31 |
+
<label>Product Review Settings</label>
|
32 |
+
<tab>catalog</tab>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>120</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
<groups>
|
39 |
+
<autoapprovegroup translate="label">
|
40 |
+
<label>Review Settings for logged in Users</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>1</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>1</show_in_store>
|
46 |
+
<fields>
|
47 |
+
<autoapprove_enabled translate="label">
|
48 |
+
<label>Enabled</label>
|
49 |
+
<frontend_type>select</frontend_type>
|
50 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
51 |
+
<sort_order>1</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
</autoapprove_enabled>
|
56 |
+
<login_review>
|
57 |
+
<label>Require Activation for Groups</label>
|
58 |
+
<frontend_type>multiselect</frontend_type>
|
59 |
+
<source_model>adminhtml/system_config_source_customer_group_multiselect</source_model>
|
60 |
+
<sort_order>12</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</login_review>
|
65 |
+
</fields>
|
66 |
+
</autoapprovegroup>
|
67 |
+
</groups>
|
68 |
+
</autoapprovereviews_settings>
|
69 |
+
</sections>
|
70 |
+
</config>
|
app/etc/modules/Exinent_Autoapprovereviews.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Exinent_Autoapprovereviews>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Exinent_Autoapprovereviews>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Auto_Reviews</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Open Software License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary> Auto approves product reviews based on customer type.</summary>
|
10 |
+
<description> Auto approves product reviews based on customer type.</description>
|
11 |
+
<notes> Auto approves product reviews based on customer type.</notes>
|
12 |
+
<authors><author><name>Exinent Dev Team</name><user>Developer</user><email>support@exinent.com</email></author></authors>
|
13 |
+
<date>2015-04-17</date>
|
14 |
+
<time>13:28:21</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Exinent"><dir name="Autoapprovereviews"><dir name="controllers"><file name="AutoController.php~" hash="f237b0ee979a0103194018cb1782b077"/><file name="ProductController.php" hash="4c157fedaa9882fc7f1c599b967228d6"/><file name="ProductController.php~" hash="98c5f74dd6ec1d9d5ee099d75cfdc1b8"/></dir><dir name="etc"><file name="config.xml" hash="f50c98a0dc06526d87a9e6c53be0a767"/><file name="config.xml~" hash="79d44957391580a5c08e5c0d534aec3f"/><file name="system.xml" hash="5748381712c0c4cd285b3f54a2360519"/><file name="system.xml~" hash="d3e3d408f4a723c9bfc36c517159fb0f"/></dir><dir name="Helper"><file name="Data.php" hash="c066b27a7d0c243ef6910e0d11ee9a05"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Customer"><dir name="Group"><file name="Multiselect.php" hash="a77f750f58703d8c551c9ec95cf3a154"/><file name="Multiselect.php~" hash="a77f750f58703d8c551c9ec95cf3a154"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Exinent_Autoapprovereviews.xml" hash="b468d55a398b1dd70240269b4bae9997"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|