Version Notes
Better support for reminder emails. It's possible to select which order status triggers a reminder email.
Download this release
Release Info
Developer | Henning Frettem |
Extension | lipscore |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.33 to 1.3.0
- app/code/community/Lipscore/RatingsReviews/Block/Catalog/Product/Reviews.php +26 -26
- app/code/community/Lipscore/RatingsReviews/Block/Catalog/Product/View.php +18 -18
- app/code/community/Lipscore/RatingsReviews/Block/Init.php +45 -45
- app/code/community/Lipscore/RatingsReviews/Block/Purchase/Abstract.php +42 -42
- app/code/community/Lipscore/RatingsReviews/Block/Purchase/Multishipping.php +49 -49
- app/code/community/Lipscore/RatingsReviews/Block/Purchase/Onepage.php +52 -52
- app/code/community/Lipscore/RatingsReviews/Block/Review/Helper.php +63 -63
- app/code/community/Lipscore/RatingsReviews/Block/Review/Single.php +6 -6
- app/code/community/Lipscore/RatingsReviews/Block/Review/Tabtitle.php +6 -6
- app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Coupons.php +26 -26
- app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Field/Abstract.php +31 -31
- app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Field/Apikey.php +25 -25
- app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Field/Reminderperiod.php +107 -107
- app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Fieldset/Coupons.php +11 -11
- app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Fieldset/Dashboardlink.php +9 -9
- app/code/community/Lipscore/RatingsReviews/Helper/Abstract.php +19 -19
- app/code/community/Lipscore/RatingsReviews/Helper/Config.php +12 -12
- app/code/community/Lipscore/RatingsReviews/Helper/Coupon.php +50 -50
- app/code/community/Lipscore/RatingsReviews/Helper/Data.php +3 -3
- app/code/community/Lipscore/RatingsReviews/Helper/Locale.php +64 -44
- app/code/community/Lipscore/RatingsReviews/Helper/Module.php +52 -19
- app/code/community/Lipscore/RatingsReviews/Helper/Price.php +102 -102
- app/code/community/Lipscore/RatingsReviews/Helper/Product.php +145 -145
- app/code/community/Lipscore/RatingsReviews/Helper/Purchase.php +59 -59
- app/code/community/Lipscore/RatingsReviews/Helper/Reminder.php +85 -87
- app/code/community/Lipscore/RatingsReviews/Helper/Widget.php +60 -60
- app/code/community/Lipscore/RatingsReviews/Logger.php +66 -66
- app/code/community/Lipscore/RatingsReviews/Model/Api/Request.php +65 -60
- app/code/community/Lipscore/RatingsReviews/Model/Config.php +116 -102
- app/code/community/Lipscore/RatingsReviews/Model/Config/Env.php +49 -49
- app/code/community/Lipscore/RatingsReviews/Model/Coupon/Generator.php +66 -66
- app/code/community/Lipscore/RatingsReviews/Model/Observer/Abstract.php +17 -0
- app/code/community/Lipscore/RatingsReviews/Model/Observer/Module.php +22 -0
- app/code/community/Lipscore/RatingsReviews/Model/Observer/Order/Status.php +110 -0
- app/code/community/Lipscore/RatingsReviews/Model/{Observer.php → Observer/Output.php} +131 -114
- app/code/community/Lipscore/RatingsReviews/Model/Purchase/Reminder.php +39 -39
- app/code/community/Lipscore/RatingsReviews/Model/Shop.php +52 -52
- app/code/community/Lipscore/RatingsReviews/Model/System/Config/Backend/Apikey.php +72 -72
- app/code/community/Lipscore/RatingsReviews/Model/System/Config/Source/Locale.php +23 -23
- app/code/community/Lipscore/RatingsReviews/Model/System/Config/Source/Order/Status.php +30 -17
- app/code/community/Lipscore/RatingsReviews/Model/System/Config/Source/Pricerule.php +45 -45
- app/code/community/Lipscore/RatingsReviews/Model/System/Config/Source/Productattr/Brand.php +40 -40
- app/code/community/Lipscore/RatingsReviews/Model/System/Config/Source/Reminderperiod.php +13 -13
- app/code/community/Lipscore/RatingsReviews/Model/Tracker/Action.php +29 -29
- app/code/community/Lipscore/RatingsReviews/Model/Tracker/Installation.php +79 -79
- app/code/community/Lipscore/RatingsReviews/controllers/Purchases/RemindersController.php +152 -152
- app/code/community/Lipscore/RatingsReviews/data/lipscore_ratingsreviews_setup/data-install-1.2.21.0.php +9 -9
- app/code/community/Lipscore/RatingsReviews/etc/adminhtml.xml +26 -26
- app/code/community/Lipscore/RatingsReviews/etc/config.xml +180 -161
- app/code/community/Lipscore/RatingsReviews/etc/environments/production.xml +5 -5
- app/code/community/Lipscore/RatingsReviews/etc/system.xml +248 -224
- app/design/adminhtml/default/default/layout/lipscore_ratingsreviews.xml +10 -10
- app/design/frontend/base/default/layout/lipscore_ratingsreviews.xml +24 -46
- app/design/frontend/base/default/template/lipscore/init.phtml +24 -24
- app/design/frontend/base/default/template/lipscore/purchase/view.phtml +15 -15
- app/design/frontend/base/default/template/lipscore/rating/view.phtml +10 -10
- app/design/frontend/base/default/template/lipscore/reviews/tab_title.phtml +3 -3
- app/design/frontend/base/default/template/lipscore/reviews/view.phtml +7 -7
- app/design/frontend/base/default/template/lipscore/reviews/view_single.phtml +4 -4
- app/etc/modules/Lipscore_RatingsReviews.xml +18 -18
- package.xml +5 -5
- skin/adminhtml/default/default/js/lipscore.js +60 -60
- skin/adminhtml/default/default/lipscore.css +5 -5
- skin/frontend/base/default/css/lipscore.css +6 -6
- skin/frontend/base/default/js/lipscore.js +24 -24
app/code/community/Lipscore/RatingsReviews/Block/Catalog/Product/Reviews.php
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Block_Catalog_Product_Reviews extends Mage_Catalog_Block_Product_View
|
4 |
-
{
|
5 |
-
protected function _beforeToHtml()
|
6 |
-
{
|
7 |
-
try {
|
8 |
-
$this->prepareWidgetAttrs();
|
9 |
-
} catch (Exception $e) {
|
10 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
11 |
-
}
|
12 |
-
|
13 |
-
return parent::_beforeToHtml();
|
14 |
-
}
|
15 |
-
|
16 |
-
protected function prepareWidgetAttrs()
|
17 |
-
{
|
18 |
-
$widgetHelper = $this->helper('lipscore_ratingsreviews/widget');
|
19 |
-
$productHelper = $this->helper('lipscore_ratingsreviews/product');
|
20 |
-
|
21 |
-
$productData = $productHelper->getProductData($this->getProduct());
|
22 |
-
$productAttrs = $widgetHelper->getProductAttrs($productData);
|
23 |
-
|
24 |
-
$this->setLsProductAttrs($productAttrs);
|
25 |
-
}
|
26 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Block_Catalog_Product_Reviews extends Mage_Catalog_Block_Product_View
|
4 |
+
{
|
5 |
+
protected function _beforeToHtml()
|
6 |
+
{
|
7 |
+
try {
|
8 |
+
$this->prepareWidgetAttrs();
|
9 |
+
} catch (Exception $e) {
|
10 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
11 |
+
}
|
12 |
+
|
13 |
+
return parent::_beforeToHtml();
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function prepareWidgetAttrs()
|
17 |
+
{
|
18 |
+
$widgetHelper = $this->helper('lipscore_ratingsreviews/widget');
|
19 |
+
$productHelper = $this->helper('lipscore_ratingsreviews/product');
|
20 |
+
|
21 |
+
$productData = $productHelper->getProductData($this->getProduct());
|
22 |
+
$productAttrs = $widgetHelper->getProductAttrs($productData);
|
23 |
+
|
24 |
+
$this->setLsProductAttrs($productAttrs);
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/Catalog/Product/View.php
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Block_Catalog_Product_View extends Mage_Catalog_Block_Product_View
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* Get product reviews summary
|
7 |
-
*
|
8 |
-
* @param Mage_Catalog_Model_Product $product
|
9 |
-
* @param bool $templateType
|
10 |
-
* @param bool $displayIfNoReviews
|
11 |
-
* @return string
|
12 |
-
*/
|
13 |
-
public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = false,
|
14 |
-
$displayIfNoReviews = false)
|
15 |
-
{
|
16 |
-
return parent::getReviewsSummaryHtml($product, 'long', $displayIfNoReviews);
|
17 |
-
}
|
18 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Block_Catalog_Product_View extends Mage_Catalog_Block_Product_View
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* Get product reviews summary
|
7 |
+
*
|
8 |
+
* @param Mage_Catalog_Model_Product $product
|
9 |
+
* @param bool $templateType
|
10 |
+
* @param bool $displayIfNoReviews
|
11 |
+
* @return string
|
12 |
+
*/
|
13 |
+
public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = false,
|
14 |
+
$displayIfNoReviews = false)
|
15 |
+
{
|
16 |
+
return parent::getReviewsSummaryHtml($product, 'long', $displayIfNoReviews);
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/Init.php
CHANGED
@@ -1,45 +1,45 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Block_Init extends Mage_Core_Block_Template
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* @var Lipscore_RatingsReviews_Model_Config
|
7 |
-
*/
|
8 |
-
protected $_lipscoreConfig;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* @var Lipscore_RatingsReviews_Model_Config_Env
|
12 |
-
*/
|
13 |
-
protected $_envConfig;
|
14 |
-
|
15 |
-
public function __construct()
|
16 |
-
{
|
17 |
-
$this->_lipscoreConfig = Mage::getModel('lipscore_ratingsreviews/config');
|
18 |
-
$this->_envConfig = Mage::getModel('lipscore_ratingsreviews/config_env');
|
19 |
-
|
20 |
-
parent::_construct();
|
21 |
-
}
|
22 |
-
|
23 |
-
protected function _beforeToHtml()
|
24 |
-
{
|
25 |
-
try {
|
26 |
-
$this->setLipscoreApiKey($this->_lipscoreConfig->apiKey());
|
27 |
-
$this->setAssetsUrl($this->_envConfig->assetsUrl());
|
28 |
-
} catch (Exception $e) {
|
29 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
30 |
-
}
|
31 |
-
|
32 |
-
return parent::_beforeToHtml();
|
33 |
-
}
|
34 |
-
|
35 |
-
protected function getLipscoreLocale()
|
36 |
-
{
|
37 |
-
$locale = null;
|
38 |
-
try {
|
39 |
-
$locale = Mage::helper('lipscore_ratingsreviews/locale')->getLipscoreLocale();
|
40 |
-
} catch (Exception $e) {
|
41 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
42 |
-
}
|
43 |
-
return $locale ? $locale . '/' : '';
|
44 |
-
}
|
45 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Block_Init extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Lipscore_RatingsReviews_Model_Config
|
7 |
+
*/
|
8 |
+
protected $_lipscoreConfig;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var Lipscore_RatingsReviews_Model_Config_Env
|
12 |
+
*/
|
13 |
+
protected $_envConfig;
|
14 |
+
|
15 |
+
public function __construct()
|
16 |
+
{
|
17 |
+
$this->_lipscoreConfig = Mage::getModel('lipscore_ratingsreviews/config');
|
18 |
+
$this->_envConfig = Mage::getModel('lipscore_ratingsreviews/config_env');
|
19 |
+
|
20 |
+
parent::_construct();
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _beforeToHtml()
|
24 |
+
{
|
25 |
+
try {
|
26 |
+
$this->setLipscoreApiKey($this->_lipscoreConfig->apiKey());
|
27 |
+
$this->setAssetsUrl($this->_envConfig->assetsUrl());
|
28 |
+
} catch (Exception $e) {
|
29 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
30 |
+
}
|
31 |
+
|
32 |
+
return parent::_beforeToHtml();
|
33 |
+
}
|
34 |
+
|
35 |
+
protected function getLipscoreLocale()
|
36 |
+
{
|
37 |
+
$locale = null;
|
38 |
+
try {
|
39 |
+
$locale = Mage::helper('lipscore_ratingsreviews/locale')->getLipscoreLocale();
|
40 |
+
} catch (Exception $e) {
|
41 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
42 |
+
}
|
43 |
+
return $locale ? $locale . '/' : '';
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/Purchase/Abstract.php
CHANGED
@@ -1,42 +1,42 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
abstract class Lipscore_RatingsReviews_Block_Purchase_Abstract extends Mage_Core_Block_Template
|
4 |
-
{
|
5 |
-
protected function _beforeToHtml()
|
6 |
-
{
|
7 |
-
try {
|
8 |
-
$this->_prepareProductsInOrder();
|
9 |
-
$this->_preparePurchaseInfo();
|
10 |
-
} catch (Exception $e) {
|
11 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
12 |
-
}
|
13 |
-
|
14 |
-
return parent::_beforeToHtml();
|
15 |
-
}
|
16 |
-
|
17 |
-
protected abstract function _prepareProductsInOrder();
|
18 |
-
protected abstract function _preparePurchaseInfo();
|
19 |
-
|
20 |
-
protected function _prepareCouponInfo()
|
21 |
-
{
|
22 |
-
$couponHelper = $this->helper('lipscore_ratingsreviews/coupon');
|
23 |
-
$coupon = $couponHelper->generateCoupon();
|
24 |
-
|
25 |
-
if ($coupon) {
|
26 |
-
$this->setCouponCode($coupon->getCode());
|
27 |
-
$this->setCouponDescription($couponHelper->getCouponDescription());
|
28 |
-
}
|
29 |
-
}
|
30 |
-
|
31 |
-
protected function _getProductFromOrderItem($item)
|
32 |
-
{
|
33 |
-
$superProductConfig = $item->getBuyRequest()->getSuperProductConfig();
|
34 |
-
if (!empty($superProductConfig['product_id'])) {
|
35 |
-
$productId = $superProductConfig['product_id'];
|
36 |
-
} else {
|
37 |
-
$productId = $item->getProductId();
|
38 |
-
}
|
39 |
-
|
40 |
-
return Mage::getModel('catalog/product')->load($productId);
|
41 |
-
}
|
42 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Lipscore_RatingsReviews_Block_Purchase_Abstract extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
protected function _beforeToHtml()
|
6 |
+
{
|
7 |
+
try {
|
8 |
+
$this->_prepareProductsInOrder();
|
9 |
+
$this->_preparePurchaseInfo();
|
10 |
+
} catch (Exception $e) {
|
11 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
12 |
+
}
|
13 |
+
|
14 |
+
return parent::_beforeToHtml();
|
15 |
+
}
|
16 |
+
|
17 |
+
protected abstract function _prepareProductsInOrder();
|
18 |
+
protected abstract function _preparePurchaseInfo();
|
19 |
+
|
20 |
+
protected function _prepareCouponInfo()
|
21 |
+
{
|
22 |
+
$couponHelper = $this->helper('lipscore_ratingsreviews/coupon');
|
23 |
+
$coupon = $couponHelper->generateCoupon();
|
24 |
+
|
25 |
+
if ($coupon) {
|
26 |
+
$this->setCouponCode($coupon->getCode());
|
27 |
+
$this->setCouponDescription($couponHelper->getCouponDescription());
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function _getProductFromOrderItem($item)
|
32 |
+
{
|
33 |
+
$superProductConfig = $item->getBuyRequest()->getSuperProductConfig();
|
34 |
+
if (!empty($superProductConfig['product_id'])) {
|
35 |
+
$productId = $superProductConfig['product_id'];
|
36 |
+
} else {
|
37 |
+
$productId = $item->getProductId();
|
38 |
+
}
|
39 |
+
|
40 |
+
return Mage::getModel('catalog/product')->load($productId);
|
41 |
+
}
|
42 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/Purchase/Multishipping.php
CHANGED
@@ -1,49 +1,49 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Block_Purchase_Multishipping extends Lipscore_RatingsReviews_Block_Purchase_Abstract
|
4 |
-
{
|
5 |
-
protected $_orders = array();
|
6 |
-
|
7 |
-
protected function _construct()
|
8 |
-
{
|
9 |
-
try {
|
10 |
-
$orderIds = Mage::getSingleton('checkout/type_multishipping')->getOrderIds();
|
11 |
-
if ($orderIds) {
|
12 |
-
$this->_orders = Mage::getModel('sales/order')
|
13 |
-
->getCollection()
|
14 |
-
->addFieldToFilter('entity_id', array('in' => $orderIds));
|
15 |
-
}
|
16 |
-
} catch (Exception $e) {
|
17 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
18 |
-
}
|
19 |
-
|
20 |
-
parent::_construct();
|
21 |
-
}
|
22 |
-
|
23 |
-
protected function _prepareProductsInOrder()
|
24 |
-
{
|
25 |
-
$productsData = array();
|
26 |
-
|
27 |
-
$productHelper = $this->helper('lipscore_ratingsreviews/product');
|
28 |
-
|
29 |
-
foreach ($this->_orders as $order) {
|
30 |
-
$orderItems = $order->getAllVisibleItems();
|
31 |
-
foreach ($orderItems as $item) {
|
32 |
-
$product = $this->_getProductFromOrderItem($item);
|
33 |
-
$productsData[$product->getId()] = $productHelper->getProductData($product);
|
34 |
-
}
|
35 |
-
}
|
36 |
-
|
37 |
-
$this->setProductsData($productsData);
|
38 |
-
}
|
39 |
-
|
40 |
-
protected function _preparePurchaseInfo()
|
41 |
-
{
|
42 |
-
$purchaseHelper = $this->helper('lipscore_ratingsreviews/purchase');
|
43 |
-
$this->setCustomerEmail($purchaseHelper->getEmail());
|
44 |
-
$this->setCustomerName($purchaseHelper->getName());
|
45 |
-
|
46 |
-
// coupon
|
47 |
-
$this->_prepareCouponInfo();
|
48 |
-
}
|
49 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Block_Purchase_Multishipping extends Lipscore_RatingsReviews_Block_Purchase_Abstract
|
4 |
+
{
|
5 |
+
protected $_orders = array();
|
6 |
+
|
7 |
+
protected function _construct()
|
8 |
+
{
|
9 |
+
try {
|
10 |
+
$orderIds = Mage::getSingleton('checkout/type_multishipping')->getOrderIds();
|
11 |
+
if ($orderIds) {
|
12 |
+
$this->_orders = Mage::getModel('sales/order')
|
13 |
+
->getCollection()
|
14 |
+
->addFieldToFilter('entity_id', array('in' => $orderIds));
|
15 |
+
}
|
16 |
+
} catch (Exception $e) {
|
17 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
18 |
+
}
|
19 |
+
|
20 |
+
parent::_construct();
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _prepareProductsInOrder()
|
24 |
+
{
|
25 |
+
$productsData = array();
|
26 |
+
|
27 |
+
$productHelper = $this->helper('lipscore_ratingsreviews/product');
|
28 |
+
|
29 |
+
foreach ($this->_orders as $order) {
|
30 |
+
$orderItems = $order->getAllVisibleItems();
|
31 |
+
foreach ($orderItems as $item) {
|
32 |
+
$product = $this->_getProductFromOrderItem($item);
|
33 |
+
$productsData[$product->getId()] = $productHelper->getProductData($product);
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
$this->setProductsData($productsData);
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function _preparePurchaseInfo()
|
41 |
+
{
|
42 |
+
$purchaseHelper = $this->helper('lipscore_ratingsreviews/purchase');
|
43 |
+
$this->setCustomerEmail($purchaseHelper->getEmail());
|
44 |
+
$this->setCustomerName($purchaseHelper->getName());
|
45 |
+
|
46 |
+
// coupon
|
47 |
+
$this->_prepareCouponInfo();
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/Purchase/Onepage.php
CHANGED
@@ -1,52 +1,52 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Block_Purchase_Onepage extends Lipscore_RatingsReviews_Block_Purchase_Abstract
|
4 |
-
{
|
5 |
-
protected $_order = null;
|
6 |
-
|
7 |
-
protected function _construct()
|
8 |
-
{
|
9 |
-
try {
|
10 |
-
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
11 |
-
if ($orderId) {
|
12 |
-
$this->_order = Mage::getModel('sales/order')->load($orderId);
|
13 |
-
}
|
14 |
-
} catch (Exception $e) {
|
15 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
16 |
-
}
|
17 |
-
|
18 |
-
parent::_construct();
|
19 |
-
}
|
20 |
-
|
21 |
-
protected function _prepareProductsInOrder()
|
22 |
-
{
|
23 |
-
$productsData = array();
|
24 |
-
|
25 |
-
if ($this->_order) {
|
26 |
-
$productHelper = $this->helper('lipscore_ratingsreviews/product');
|
27 |
-
|
28 |
-
$orderItems = $this->_order->getAllVisibleItems();
|
29 |
-
foreach ($orderItems as $item) {
|
30 |
-
$product = $this->_getProductFromOrderItem($item);
|
31 |
-
$productsData[$product->getId()] = $productHelper->getProductData($product);
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
$this->setProductsData($productsData);
|
36 |
-
}
|
37 |
-
|
38 |
-
protected function _preparePurchaseInfo()
|
39 |
-
{
|
40 |
-
if (!$this->_order) {
|
41 |
-
return;
|
42 |
-
}
|
43 |
-
|
44 |
-
$purchaseHelper = $this->helper('lipscore_ratingsreviews/purchase');
|
45 |
-
|
46 |
-
$this->setCustomerEmail($purchaseHelper->getEmail($this->_order));
|
47 |
-
$this->setCustomerName($purchaseHelper->getName($this->_order));
|
48 |
-
|
49 |
-
// coupon
|
50 |
-
$this->_prepareCouponInfo();
|
51 |
-
}
|
52 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Block_Purchase_Onepage extends Lipscore_RatingsReviews_Block_Purchase_Abstract
|
4 |
+
{
|
5 |
+
protected $_order = null;
|
6 |
+
|
7 |
+
protected function _construct()
|
8 |
+
{
|
9 |
+
try {
|
10 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
11 |
+
if ($orderId) {
|
12 |
+
$this->_order = Mage::getModel('sales/order')->load($orderId);
|
13 |
+
}
|
14 |
+
} catch (Exception $e) {
|
15 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
16 |
+
}
|
17 |
+
|
18 |
+
parent::_construct();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareProductsInOrder()
|
22 |
+
{
|
23 |
+
$productsData = array();
|
24 |
+
|
25 |
+
if ($this->_order) {
|
26 |
+
$productHelper = $this->helper('lipscore_ratingsreviews/product');
|
27 |
+
|
28 |
+
$orderItems = $this->_order->getAllVisibleItems();
|
29 |
+
foreach ($orderItems as $item) {
|
30 |
+
$product = $this->_getProductFromOrderItem($item);
|
31 |
+
$productsData[$product->getId()] = $productHelper->getProductData($product);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
$this->setProductsData($productsData);
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function _preparePurchaseInfo()
|
39 |
+
{
|
40 |
+
if (!$this->_order) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
|
44 |
+
$purchaseHelper = $this->helper('lipscore_ratingsreviews/purchase');
|
45 |
+
|
46 |
+
$this->setCustomerEmail($purchaseHelper->getEmail($this->_order));
|
47 |
+
$this->setCustomerName($purchaseHelper->getName($this->_order));
|
48 |
+
|
49 |
+
// coupon
|
50 |
+
$this->_prepareCouponInfo();
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/Review/Helper.php
CHANGED
@@ -1,63 +1,63 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Block_Review_Helper extends Mage_Review_Block_Helper
|
4 |
-
{
|
5 |
-
protected $_template = 'lipscore/rating/view.phtml';
|
6 |
-
protected static $_availableTypes = array(
|
7 |
-
'long' => 'id="lipscore-rating"',
|
8 |
-
'short' => 'class="lipscore-rating-small"'
|
9 |
-
);
|
10 |
-
|
11 |
-
public function getSummaryHtml($product, $templateType, $displayIfNoReviews)
|
12 |
-
{
|
13 |
-
try {
|
14 |
-
$templateType = $this->getTemplateType($templateType);
|
15 |
-
} catch (Exception $e) {
|
16 |
-
$templateType = 'short';
|
17 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
18 |
-
}
|
19 |
-
|
20 |
-
$this->setRatingType(self::$_availableTypes[$templateType]);
|
21 |
-
$this->setProduct($product);
|
22 |
-
|
23 |
-
try {
|
24 |
-
$this->setWidgetAttrs($product, $templateType);
|
25 |
-
} catch (Exception $e) {
|
26 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
27 |
-
}
|
28 |
-
|
29 |
-
return $this->toHtml();
|
30 |
-
}
|
31 |
-
|
32 |
-
protected function getTemplateType($templateType)
|
33 |
-
{
|
34 |
-
$layoutHandles = $this->getLayout()->getUpdate()->getHandles();
|
35 |
-
$isProductView = in_array('catalog_product_view', $layoutHandles);
|
36 |
-
|
37 |
-
if ($isProductView) {
|
38 |
-
return 'long';
|
39 |
-
}
|
40 |
-
|
41 |
-
if (isset(self::$_availableTypes[$templateType])) {
|
42 |
-
return $templateType;
|
43 |
-
} else {
|
44 |
-
return 'short';
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
protected function setWidgetAttrs($product, $templateType)
|
49 |
-
{
|
50 |
-
$widgetHelper = $this->helper('lipscore_ratingsreviews/widget');
|
51 |
-
$productHelper = $this->helper('lipscore_ratingsreviews/product');
|
52 |
-
|
53 |
-
$productData = $productHelper->getProductData($product);
|
54 |
-
$productAttrs = $widgetHelper->getProductAttrs($productData);
|
55 |
-
$this->setLsProductAttrs($productAttrs);
|
56 |
-
|
57 |
-
if ($templateType == 'long') {
|
58 |
-
$rsProductData = $productHelper->getRichsnippetProductData($product);
|
59 |
-
$rsAttrs = $widgetHelper->getRichsnippetPproductAttrs($rsProductData);
|
60 |
-
$this->setRichsnippetAttrs($rsAttrs);
|
61 |
-
}
|
62 |
-
}
|
63 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Block_Review_Helper extends Mage_Review_Block_Helper
|
4 |
+
{
|
5 |
+
protected $_template = 'lipscore/rating/view.phtml';
|
6 |
+
protected static $_availableTypes = array(
|
7 |
+
'long' => 'id="lipscore-rating"',
|
8 |
+
'short' => 'class="lipscore-rating-small"'
|
9 |
+
);
|
10 |
+
|
11 |
+
public function getSummaryHtml($product, $templateType, $displayIfNoReviews)
|
12 |
+
{
|
13 |
+
try {
|
14 |
+
$templateType = $this->getTemplateType($templateType);
|
15 |
+
} catch (Exception $e) {
|
16 |
+
$templateType = 'short';
|
17 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
18 |
+
}
|
19 |
+
|
20 |
+
$this->setRatingType(self::$_availableTypes[$templateType]);
|
21 |
+
$this->setProduct($product);
|
22 |
+
|
23 |
+
try {
|
24 |
+
$this->setWidgetAttrs($product, $templateType);
|
25 |
+
} catch (Exception $e) {
|
26 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
27 |
+
}
|
28 |
+
|
29 |
+
return $this->toHtml();
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function getTemplateType($templateType)
|
33 |
+
{
|
34 |
+
$layoutHandles = $this->getLayout()->getUpdate()->getHandles();
|
35 |
+
$isProductView = in_array('catalog_product_view', $layoutHandles);
|
36 |
+
|
37 |
+
if ($isProductView) {
|
38 |
+
return 'long';
|
39 |
+
}
|
40 |
+
|
41 |
+
if (isset(self::$_availableTypes[$templateType])) {
|
42 |
+
return $templateType;
|
43 |
+
} else {
|
44 |
+
return 'short';
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
protected function setWidgetAttrs($product, $templateType)
|
49 |
+
{
|
50 |
+
$widgetHelper = $this->helper('lipscore_ratingsreviews/widget');
|
51 |
+
$productHelper = $this->helper('lipscore_ratingsreviews/product');
|
52 |
+
|
53 |
+
$productData = $productHelper->getProductData($product);
|
54 |
+
$productAttrs = $widgetHelper->getProductAttrs($productData);
|
55 |
+
$this->setLsProductAttrs($productAttrs);
|
56 |
+
|
57 |
+
if ($templateType == 'long') {
|
58 |
+
$rsProductData = $productHelper->getRichsnippetProductData($product);
|
59 |
+
$rsAttrs = $widgetHelper->getRichsnippetPproductAttrs($rsProductData);
|
60 |
+
$this->setRichsnippetAttrs($rsAttrs);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/Review/Single.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Block_Review_Single extends Mage_Review_Block_Helper
|
4 |
-
{
|
5 |
-
protected $_template = 'lipscore/reviews/view_single.phtml';
|
6 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Block_Review_Single extends Mage_Review_Block_Helper
|
4 |
+
{
|
5 |
+
protected $_template = 'lipscore/reviews/view_single.phtml';
|
6 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/Review/Tabtitle.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Block_Review_Tabtitle extends Mage_Review_Block_Helper
|
4 |
-
{
|
5 |
-
protected $_template = 'lipscore/reviews/tab_title.phtml';
|
6 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Block_Review_Tabtitle extends Mage_Review_Block_Helper
|
4 |
+
{
|
5 |
+
protected $_template = 'lipscore/reviews/tab_title.phtml';
|
6 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Coupons.php
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Block_System_Config_Form_Coupons extends Mage_Adminhtml_Block_System_Config_Form
|
4 |
-
{
|
5 |
-
protected function _canShowField($field)
|
6 |
-
{
|
7 |
-
$generateCoupons = false;
|
8 |
-
try {
|
9 |
-
$generateCoupons = Mage::helper('lipscore_ratingsreviews/coupon')->isAutoGenerationSupported();
|
10 |
-
} catch (Exception $e) {
|
11 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
12 |
-
}
|
13 |
-
|
14 |
-
switch ($field->getName()) {
|
15 |
-
case 'coupons':
|
16 |
-
return $generateCoupons;
|
17 |
-
break;
|
18 |
-
case 'coupons_warning':
|
19 |
-
return !$generateCoupons;
|
20 |
-
break;
|
21 |
-
default:
|
22 |
-
return parent::_canShowField($field);
|
23 |
-
break;
|
24 |
-
}
|
25 |
-
}
|
26 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Block_System_Config_Form_Coupons extends Mage_Adminhtml_Block_System_Config_Form
|
4 |
+
{
|
5 |
+
protected function _canShowField($field)
|
6 |
+
{
|
7 |
+
$generateCoupons = false;
|
8 |
+
try {
|
9 |
+
$generateCoupons = Mage::helper('lipscore_ratingsreviews/coupon')->isAutoGenerationSupported();
|
10 |
+
} catch (Exception $e) {
|
11 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
12 |
+
}
|
13 |
+
|
14 |
+
switch ($field->getName()) {
|
15 |
+
case 'coupons':
|
16 |
+
return $generateCoupons;
|
17 |
+
break;
|
18 |
+
case 'coupons_warning':
|
19 |
+
return !$generateCoupons;
|
20 |
+
break;
|
21 |
+
default:
|
22 |
+
return parent::_canShowField($field);
|
23 |
+
break;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Field/Abstract.php
CHANGED
@@ -1,31 +1,31 @@
|
|
1 |
-
<?php
|
2 |
-
class Lipscore_RatingsReviews_Block_System_Config_Form_Field_Abstract
|
3 |
-
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
-
{
|
5 |
-
protected $lipscoreConfig = null;
|
6 |
-
|
7 |
-
protected function getLipscoreConfig()
|
8 |
-
{
|
9 |
-
if (!$this->lipscoreConfig) {
|
10 |
-
$this->lipscoreConfig = Mage::helper('lipscore_ratingsreviews/config')->getScoped(
|
11 |
-
$this->getWebsite(), $this->getStore()
|
12 |
-
);
|
13 |
-
}
|
14 |
-
return $this->lipscoreConfig;
|
15 |
-
}
|
16 |
-
|
17 |
-
protected function getSection()
|
18 |
-
{
|
19 |
-
return $this->getRequest()->getParam('section', '');
|
20 |
-
}
|
21 |
-
|
22 |
-
protected function getWebsite()
|
23 |
-
{
|
24 |
-
return $this->getRequest()->getParam('website', '');
|
25 |
-
}
|
26 |
-
|
27 |
-
protected function getStore()
|
28 |
-
{
|
29 |
-
return $this->getRequest()->getParam('store', '');
|
30 |
-
}
|
31 |
-
}
|
1 |
+
<?php
|
2 |
+
class Lipscore_RatingsReviews_Block_System_Config_Form_Field_Abstract
|
3 |
+
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
4 |
+
{
|
5 |
+
protected $lipscoreConfig = null;
|
6 |
+
|
7 |
+
protected function getLipscoreConfig()
|
8 |
+
{
|
9 |
+
if (!$this->lipscoreConfig) {
|
10 |
+
$this->lipscoreConfig = Mage::helper('lipscore_ratingsreviews/config')->getScoped(
|
11 |
+
$this->getWebsite(), $this->getStore()
|
12 |
+
);
|
13 |
+
}
|
14 |
+
return $this->lipscoreConfig;
|
15 |
+
}
|
16 |
+
|
17 |
+
protected function getSection()
|
18 |
+
{
|
19 |
+
return $this->getRequest()->getParam('section', '');
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function getWebsite()
|
23 |
+
{
|
24 |
+
return $this->getRequest()->getParam('website', '');
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function getStore()
|
28 |
+
{
|
29 |
+
return $this->getRequest()->getParam('store', '');
|
30 |
+
}
|
31 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Field/Apikey.php
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
<?php
|
2 |
-
class Lipscore_RatingsReviews_Block_System_Config_Form_Field_Apikey
|
3 |
-
extends Lipscore_RatingsReviews_Block_System_Config_Form_Field_Abstract
|
4 |
-
{
|
5 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
6 |
-
{
|
7 |
-
|
8 |
-
try {
|
9 |
-
$apiKey = $this->getLipscoreConfig()->apiKey();
|
10 |
-
$demoApiKey = $this->getLipscoreConfig()->demoApiKey();
|
11 |
-
} catch (Exception $e) {
|
12 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
13 |
-
return parent::render($element);
|
14 |
-
}
|
15 |
-
$comment = ($apiKey == $demoApiKey) ? $this->_commentHtml() : '';
|
16 |
-
|
17 |
-
return parent::render($element) . $comment;
|
18 |
-
}
|
19 |
-
|
20 |
-
protected function _commentHtml()
|
21 |
-
{
|
22 |
-
$comment = 'Your Lipscore installation is set up using a Demo Account. Please sign up with your own account on <a href="http://lipscore.com/" target="_blank">www.lipscore.com</a> to get access to all available features.';
|
23 |
-
return "<tr><td colspan='4'><span class='lipscore-notice-msg'>$comment</span></td></tr>";
|
24 |
-
}
|
25 |
-
}
|
1 |
+
<?php
|
2 |
+
class Lipscore_RatingsReviews_Block_System_Config_Form_Field_Apikey
|
3 |
+
extends Lipscore_RatingsReviews_Block_System_Config_Form_Field_Abstract
|
4 |
+
{
|
5 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
|
8 |
+
try {
|
9 |
+
$apiKey = $this->getLipscoreConfig()->apiKey();
|
10 |
+
$demoApiKey = $this->getLipscoreConfig()->demoApiKey();
|
11 |
+
} catch (Exception $e) {
|
12 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
13 |
+
return parent::render($element);
|
14 |
+
}
|
15 |
+
$comment = ($apiKey == $demoApiKey) ? $this->_commentHtml() : '';
|
16 |
+
|
17 |
+
return parent::render($element) . $comment;
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _commentHtml()
|
21 |
+
{
|
22 |
+
$comment = 'Your Lipscore installation is set up using a Demo Account. Please sign up with your own account on <a href="http://lipscore.com/" target="_blank">www.lipscore.com</a> to get access to all available features.';
|
23 |
+
return "<tr><td colspan='4'><span class='lipscore-notice-msg'>$comment</span></td></tr>";
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Field/Reminderperiod.php
CHANGED
@@ -1,107 +1,107 @@
|
|
1 |
-
<?php
|
2 |
-
class Lipscore_RatingsReviews_Block_System_Config_Form_Field_Reminderperiod
|
3 |
-
extends Lipscore_RatingsReviews_Block_System_Config_Form_Field_Abstract
|
4 |
-
{
|
5 |
-
protected static $_statusSelect = 'order_status';
|
6 |
-
|
7 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
8 |
-
{
|
9 |
-
$text = '';
|
10 |
-
try {
|
11 |
-
$text = '<div id="ls-reminder">' .
|
12 |
-
$this->getNote() .
|
13 |
-
$this->getStatusField() .
|
14 |
-
$this->getDateFields() .
|
15 |
-
$this->getReminderButton() .
|
16 |
-
'</div>';
|
17 |
-
} catch (Exception $e) {
|
18 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
19 |
-
}
|
20 |
-
return $text;
|
21 |
-
}
|
22 |
-
|
23 |
-
public function getLabel($targetId, $title)
|
24 |
-
{
|
25 |
-
return '<label for="' . $targetId . '" class="ls-reminder-label">' . $this->__($title) . '</label>';
|
26 |
-
}
|
27 |
-
|
28 |
-
public function getStatusField()
|
29 |
-
{
|
30 |
-
$label = $this->getLabel(self::$_statusSelect, '<span>Include orders in these statuses<br/>(Ctrl+click to add more)</span>');
|
31 |
-
|
32 |
-
$opts = Mage::getSingleton('lipscore_ratingsreviews/system_config_source_order_status')->toOptionArray();
|
33 |
-
|
34 |
-
$select = $this->getLayout()->createBlock('adminhtml/html_select')
|
35 |
-
->setName(self::$_statusSelect . '[]')
|
36 |
-
->setId(self::$_statusSelect)
|
37 |
-
->setClass('select multiselect')
|
38 |
-
->setOptions($opts)
|
39 |
-
->setExtraParams('multiple="multiple"');
|
40 |
-
|
41 |
-
return $label . $select->getHtml();
|
42 |
-
}
|
43 |
-
|
44 |
-
public function getDateFields()
|
45 |
-
{
|
46 |
-
$html = $this->getLabel($this->dateFieldId('from'), 'Include orders made between');
|
47 |
-
$html .= $this->getDateField('from', strtotime("-3 months"));
|
48 |
-
$html .= $this->getLabel($this->dateFieldId('to'), 'and');
|
49 |
-
$html .= $this->getDateField('to', time());
|
50 |
-
return $html;
|
51 |
-
}
|
52 |
-
|
53 |
-
public function getDateField($name, $defaultValue)
|
54 |
-
{
|
55 |
-
$element = new Varien_Data_Form_Element_Date(
|
56 |
-
array(
|
57 |
-
'name' => $name,
|
58 |
-
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
59 |
-
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
|
60 |
-
'time' => false
|
61 |
-
)
|
62 |
-
);
|
63 |
-
$element->setValue($defaultValue);
|
64 |
-
$element->setForm(new Varien_Data_Form());
|
65 |
-
$element->setId($this->dateFieldId($name));
|
66 |
-
|
67 |
-
return $element->getElementHtml();
|
68 |
-
}
|
69 |
-
|
70 |
-
public function dateFieldId($name)
|
71 |
-
{
|
72 |
-
return 'remind_' . $name;
|
73 |
-
}
|
74 |
-
|
75 |
-
public function getReminderButton()
|
76 |
-
{
|
77 |
-
$url = $this->getReminderUrl();
|
78 |
-
|
79 |
-
$apiKey = $this->getLipscoreConfig()->apiKey();
|
80 |
-
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
81 |
-
->setData(array(
|
82 |
-
'label' => $this->__('Send emails'),
|
83 |
-
'disabled' => empty($apiKey),
|
84 |
-
'title' => $this->__('Send Reminders'),
|
85 |
-
'onclick' => "sendLipscoreReminder('$url');",
|
86 |
-
'id' => 'ls-reminder-button'
|
87 |
-
));
|
88 |
-
return $button->toHtml();
|
89 |
-
}
|
90 |
-
|
91 |
-
public function getNote()
|
92 |
-
{
|
93 |
-
$linkToDasboard = 'https://members.lipscore.com/';
|
94 |
-
$linkToCoupons = Mage::getModel('adminhtml/url')->getUrl('*/*/*', array('section' => 'lipscore_coupons'));
|
95 |
-
|
96 |
-
$msg = "After installation of Lipscore you can send emails to recent customers asking them to write reviews of the purchases they have done. This is done automatically for all future customers but customers from before Lipscore was installed will not get these emails unless you invoke it below. They will be delivered according to <a href='$linkToDasboard'>reminder delay settings</a> and will only be done once.";
|
97 |
-
$coupons = "To increase the chance of getting reviews you can also add coupons to these emails. Set up coupons <a href='$linkToCoupons'>here</a>.";
|
98 |
-
$heading = '<h4>Send review emails to these customers:</h4>';
|
99 |
-
return "<p>$msg $coupons<p>$heading";
|
100 |
-
}
|
101 |
-
|
102 |
-
protected function getReminderUrl()
|
103 |
-
{
|
104 |
-
$scopeParams = "section/{$this->getSection()}/website/{$this->getWebsite()}/store/{$this->getStore()}";
|
105 |
-
return Mage::getModel('adminhtml/url')->getUrl("*/purchases_reminders/send/$scopeParams");
|
106 |
-
}
|
107 |
-
}
|
1 |
+
<?php
|
2 |
+
class Lipscore_RatingsReviews_Block_System_Config_Form_Field_Reminderperiod
|
3 |
+
extends Lipscore_RatingsReviews_Block_System_Config_Form_Field_Abstract
|
4 |
+
{
|
5 |
+
protected static $_statusSelect = 'order_status';
|
6 |
+
|
7 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
8 |
+
{
|
9 |
+
$text = '';
|
10 |
+
try {
|
11 |
+
$text = '<div id="ls-reminder">' .
|
12 |
+
$this->getNote() .
|
13 |
+
$this->getStatusField() .
|
14 |
+
$this->getDateFields() .
|
15 |
+
$this->getReminderButton() .
|
16 |
+
'</div>';
|
17 |
+
} catch (Exception $e) {
|
18 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
19 |
+
}
|
20 |
+
return $text;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function getLabel($targetId, $title)
|
24 |
+
{
|
25 |
+
return '<label for="' . $targetId . '" class="ls-reminder-label">' . $this->__($title) . '</label>';
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getStatusField()
|
29 |
+
{
|
30 |
+
$label = $this->getLabel(self::$_statusSelect, '<span>Include orders in these statuses<br/>(Ctrl+click to add more)</span>');
|
31 |
+
|
32 |
+
$opts = Mage::getSingleton('lipscore_ratingsreviews/system_config_source_order_status')->toOptionArray();
|
33 |
+
|
34 |
+
$select = $this->getLayout()->createBlock('adminhtml/html_select')
|
35 |
+
->setName(self::$_statusSelect . '[]')
|
36 |
+
->setId(self::$_statusSelect)
|
37 |
+
->setClass('select multiselect')
|
38 |
+
->setOptions($opts)
|
39 |
+
->setExtraParams('multiple="multiple"');
|
40 |
+
|
41 |
+
return $label . $select->getHtml();
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getDateFields()
|
45 |
+
{
|
46 |
+
$html = $this->getLabel($this->dateFieldId('from'), 'Include orders made between');
|
47 |
+
$html .= $this->getDateField('from', strtotime("-3 months"));
|
48 |
+
$html .= $this->getLabel($this->dateFieldId('to'), 'and');
|
49 |
+
$html .= $this->getDateField('to', time());
|
50 |
+
return $html;
|
51 |
+
}
|
52 |
+
|
53 |
+
public function getDateField($name, $defaultValue)
|
54 |
+
{
|
55 |
+
$element = new Varien_Data_Form_Element_Date(
|
56 |
+
array(
|
57 |
+
'name' => $name,
|
58 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
59 |
+
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
|
60 |
+
'time' => false
|
61 |
+
)
|
62 |
+
);
|
63 |
+
$element->setValue($defaultValue);
|
64 |
+
$element->setForm(new Varien_Data_Form());
|
65 |
+
$element->setId($this->dateFieldId($name));
|
66 |
+
|
67 |
+
return $element->getElementHtml();
|
68 |
+
}
|
69 |
+
|
70 |
+
public function dateFieldId($name)
|
71 |
+
{
|
72 |
+
return 'remind_' . $name;
|
73 |
+
}
|
74 |
+
|
75 |
+
public function getReminderButton()
|
76 |
+
{
|
77 |
+
$url = $this->getReminderUrl();
|
78 |
+
|
79 |
+
$apiKey = $this->getLipscoreConfig()->apiKey();
|
80 |
+
$button = $this->getLayout()->createBlock('adminhtml/widget_button')
|
81 |
+
->setData(array(
|
82 |
+
'label' => $this->__('Send emails'),
|
83 |
+
'disabled' => empty($apiKey),
|
84 |
+
'title' => $this->__('Send Reminders'),
|
85 |
+
'onclick' => "sendLipscoreReminder('$url');",
|
86 |
+
'id' => 'ls-reminder-button'
|
87 |
+
));
|
88 |
+
return $button->toHtml();
|
89 |
+
}
|
90 |
+
|
91 |
+
public function getNote()
|
92 |
+
{
|
93 |
+
$linkToDasboard = 'https://members.lipscore.com/';
|
94 |
+
$linkToCoupons = Mage::getModel('adminhtml/url')->getUrl('*/*/*', array('section' => 'lipscore_coupons'));
|
95 |
+
|
96 |
+
$msg = "After installation of Lipscore you can send emails to recent customers asking them to write reviews of the purchases they have done. This is done automatically for all future customers but customers from before Lipscore was installed will not get these emails unless you invoke it below. They will be delivered according to <a href='$linkToDasboard'>reminder delay settings</a> and will only be done once.";
|
97 |
+
$coupons = "To increase the chance of getting reviews you can also add coupons to these emails. Set up coupons <a href='$linkToCoupons'>here</a>.";
|
98 |
+
$heading = '<h4>Send review emails to these customers:</h4>';
|
99 |
+
return "<p>$msg $coupons<p>$heading";
|
100 |
+
}
|
101 |
+
|
102 |
+
protected function getReminderUrl()
|
103 |
+
{
|
104 |
+
$scopeParams = "section/{$this->getSection()}/website/{$this->getWebsite()}/store/{$this->getStore()}";
|
105 |
+
return Mage::getModel('adminhtml/url')->getUrl("*/purchases_reminders/send/$scopeParams");
|
106 |
+
}
|
107 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Fieldset/Coupons.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Block_System_Config_Form_Fieldset_Coupons extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
4 |
-
{
|
5 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
6 |
-
{
|
7 |
-
$warning = '<span class="critical">Warning!</span> ';
|
8 |
-
$message = 'This feature is unavailable: current Magento version doesn\'t support coupons auto generation.';
|
9 |
-
return '<div class="notification-global"><strong>' . $warning . $message . '</strong></div>';
|
10 |
-
}
|
11 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Block_System_Config_Form_Fieldset_Coupons extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
4 |
+
{
|
5 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
$warning = '<span class="critical">Warning!</span> ';
|
8 |
+
$message = 'This feature is unavailable: current Magento version doesn\'t support coupons auto generation.';
|
9 |
+
return '<div class="notification-global"><strong>' . $warning . $message . '</strong></div>';
|
10 |
+
}
|
11 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Block/System/Config/Form/Fieldset/Dashboardlink.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Block_System_Config_Form_Fieldset_Dashboardlink extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
4 |
-
{
|
5 |
-
public function render(Varien_Data_Form_Element_Abstract $element)
|
6 |
-
{
|
7 |
-
return 'Advanced settings are available on <a href="https://members.lipscore.com/">your Lipscore.com dashboard</a>';
|
8 |
-
}
|
9 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Block_System_Config_Form_Fieldset_Dashboardlink extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
|
4 |
+
{
|
5 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
6 |
+
{
|
7 |
+
return 'Advanced settings are available on <a href="https://members.lipscore.com/">your Lipscore.com dashboard</a>';
|
8 |
+
}
|
9 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Helper/Abstract.php
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
abstract class Lipscore_RatingsReviews_Helper_Abstract extends Mage_Core_Helper_Abstract
|
4 |
-
{
|
5 |
-
/**
|
6 |
-
* @var Lipscore_RatingsReviews_Model_Config
|
7 |
-
*/
|
8 |
-
protected $_lipscoreConfig;
|
9 |
-
|
10 |
-
public function __construct()
|
11 |
-
{
|
12 |
-
$this->_lipscoreConfig = Mage::getModel('lipscore_ratingsreviews/config');
|
13 |
-
}
|
14 |
-
|
15 |
-
public function setLipscoreConfig($lipscoreConfig)
|
16 |
-
{
|
17 |
-
$this->_lipscoreConfig = $lipscoreConfig;
|
18 |
-
}
|
19 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Lipscore_RatingsReviews_Helper_Abstract extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
/**
|
6 |
+
* @var Lipscore_RatingsReviews_Model_Config
|
7 |
+
*/
|
8 |
+
protected $_lipscoreConfig;
|
9 |
+
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->_lipscoreConfig = Mage::getModel('lipscore_ratingsreviews/config');
|
13 |
+
}
|
14 |
+
|
15 |
+
public function setLipscoreConfig($lipscoreConfig)
|
16 |
+
{
|
17 |
+
$this->_lipscoreConfig = $lipscoreConfig;
|
18 |
+
}
|
19 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Helper/Config.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Helper_Config extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
-
{
|
5 |
-
public function getScoped($websiteCode, $storeCode)
|
6 |
-
{
|
7 |
-
$website = $websiteCode ? Mage::getModel('core/website')->load($websiteCode) : null;
|
8 |
-
$store = $storeCode ? Mage::getModel('core/store')->load($storeCode) : null;
|
9 |
-
|
10 |
-
return Mage::getModel('lipscore_ratingsreviews/config', array('store' => $store, 'website' => $website));
|
11 |
-
}
|
12 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Helper_Config extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
+
{
|
5 |
+
public function getScoped($websiteCode, $storeCode)
|
6 |
+
{
|
7 |
+
$website = $websiteCode ? Mage::getModel('core/website')->load($websiteCode) : null;
|
8 |
+
$store = $storeCode ? Mage::getModel('core/store')->load($storeCode) : null;
|
9 |
+
|
10 |
+
return Mage::getModel('lipscore_ratingsreviews/config', array('store' => $store, 'website' => $website));
|
11 |
+
}
|
12 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Helper/Coupon.php
CHANGED
@@ -1,50 +1,50 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Helper_Coupon extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
-
{
|
5 |
-
protected $_rule;
|
6 |
-
protected $_ruleModel;
|
7 |
-
|
8 |
-
public function __construct()
|
9 |
-
{
|
10 |
-
parent::__construct();
|
11 |
-
|
12 |
-
$this->_ruleModel = Mage::getModel('salesrule/rule');
|
13 |
-
$ruleId = $this->_lipscoreConfig->get('rule_id', 'coupon');
|
14 |
-
if ($ruleId) {
|
15 |
-
$this->_rule = $this->_ruleModel->load($ruleId);
|
16 |
-
}
|
17 |
-
}
|
18 |
-
|
19 |
-
function generateCoupon()
|
20 |
-
{
|
21 |
-
$coupon = null;
|
22 |
-
|
23 |
-
if ($this->_rule) {
|
24 |
-
$params = array(
|
25 |
-
'rule_id' => $this->_rule->getId(),
|
26 |
-
'qty' => 1,
|
27 |
-
'length' => $this->_lipscoreConfig->get('length', 'coupon'),
|
28 |
-
'format' => $this->_lipscoreConfig->get('format', 'coupon'),
|
29 |
-
'prefix' => $this->_lipscoreConfig->get('prefix', 'coupon'),
|
30 |
-
'suffix' => $this->_lipscoreConfig->get('suffix', 'coupon'),
|
31 |
-
'dash' => $this->_lipscoreConfig->get('dash', 'coupon'),
|
32 |
-
);
|
33 |
-
|
34 |
-
$generator = Mage::getModel('lipscore_ratingsreviews/coupon_generator');
|
35 |
-
$coupon = $generator->generate($this->_rule, $params);
|
36 |
-
}
|
37 |
-
|
38 |
-
return $coupon;
|
39 |
-
}
|
40 |
-
|
41 |
-
public function getCouponDescription()
|
42 |
-
{
|
43 |
-
return $this->_rule ? $this->_rule->getDescription() : '';
|
44 |
-
}
|
45 |
-
|
46 |
-
public function isAutoGenerationSupported()
|
47 |
-
{
|
48 |
-
return method_exists($this->_ruleModel, 'getCouponMassGenerator');
|
49 |
-
}
|
50 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Helper_Coupon extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
+
{
|
5 |
+
protected $_rule;
|
6 |
+
protected $_ruleModel;
|
7 |
+
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
parent::__construct();
|
11 |
+
|
12 |
+
$this->_ruleModel = Mage::getModel('salesrule/rule');
|
13 |
+
$ruleId = $this->_lipscoreConfig->get('rule_id', 'coupon');
|
14 |
+
if ($ruleId) {
|
15 |
+
$this->_rule = $this->_ruleModel->load($ruleId);
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
function generateCoupon()
|
20 |
+
{
|
21 |
+
$coupon = null;
|
22 |
+
|
23 |
+
if ($this->_rule) {
|
24 |
+
$params = array(
|
25 |
+
'rule_id' => $this->_rule->getId(),
|
26 |
+
'qty' => 1,
|
27 |
+
'length' => $this->_lipscoreConfig->get('length', 'coupon'),
|
28 |
+
'format' => $this->_lipscoreConfig->get('format', 'coupon'),
|
29 |
+
'prefix' => $this->_lipscoreConfig->get('prefix', 'coupon'),
|
30 |
+
'suffix' => $this->_lipscoreConfig->get('suffix', 'coupon'),
|
31 |
+
'dash' => $this->_lipscoreConfig->get('dash', 'coupon'),
|
32 |
+
);
|
33 |
+
|
34 |
+
$generator = Mage::getModel('lipscore_ratingsreviews/coupon_generator');
|
35 |
+
$coupon = $generator->generate($this->_rule, $params);
|
36 |
+
}
|
37 |
+
|
38 |
+
return $coupon;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getCouponDescription()
|
42 |
+
{
|
43 |
+
return $this->_rule ? $this->_rule->getDescription() : '';
|
44 |
+
}
|
45 |
+
|
46 |
+
public function isAutoGenerationSupported()
|
47 |
+
{
|
48 |
+
return method_exists($this->_ruleModel, 'getCouponMassGenerator');
|
49 |
+
}
|
50 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Helper/Data.php
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Helper_Data extends Mage_Core_Helper_Abstract {}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Helper_Data extends Mage_Core_Helper_Abstract {}
|
app/code/community/Lipscore/RatingsReviews/Helper/Locale.php
CHANGED
@@ -1,44 +1,64 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Helper_Locale extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
-
{
|
5 |
-
protected static $_availableLocales = array('en', 'it', 'no', 'es', 'br', 'ru', 'se', 'cz', 'nl', 'dk', 'ja', 'de');
|
6 |
-
|
7 |
-
public function getLipscoreLocale()
|
8 |
-
{
|
9 |
-
$locale = null;
|
10 |
-
try {
|
11 |
-
$locale = $this->_lipscoreConfig->locale();
|
12 |
-
} catch (Exception $e) {
|
13 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
14 |
-
}
|
15 |
-
|
16 |
-
if ($locale == 'auto') {
|
17 |
-
$locale = null;
|
18 |
-
try {
|
19 |
-
$locale = $this->getFromStore();
|
20 |
-
} catch (Exception $e) {
|
21 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
22 |
-
}
|
23 |
-
}
|
24 |
-
return $locale;
|
25 |
-
}
|
26 |
-
|
27 |
-
|
28 |
-
{
|
29 |
-
$
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Helper_Locale extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
+
{
|
5 |
+
protected static $_availableLocales = array('en', 'it', 'no', 'es', 'br', 'ru', 'se', 'cz', 'nl', 'dk', 'ja', 'de');
|
6 |
+
|
7 |
+
public function getLipscoreLocale()
|
8 |
+
{
|
9 |
+
$locale = null;
|
10 |
+
try {
|
11 |
+
$locale = $this->_lipscoreConfig->locale();
|
12 |
+
} catch (Exception $e) {
|
13 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
14 |
+
}
|
15 |
+
|
16 |
+
if ($locale == 'auto') {
|
17 |
+
$locale = null;
|
18 |
+
try {
|
19 |
+
$locale = $this->getFromStore();
|
20 |
+
} catch (Exception $e) {
|
21 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
22 |
+
}
|
23 |
+
}
|
24 |
+
return $locale;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getStoreLocale()
|
28 |
+
{
|
29 |
+
$locale = '';
|
30 |
+
try {
|
31 |
+
$locale = $this->getLipscoreLocale();
|
32 |
+
if (!$locale) {
|
33 |
+
$localeCode = $this->getStoreLocaleCode();
|
34 |
+
list($locale, $region) = explode('_', $localeCode);
|
35 |
+
}
|
36 |
+
} catch (Exception $e) {
|
37 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
38 |
+
}
|
39 |
+
return $locale ? $locale : 'en';
|
40 |
+
}
|
41 |
+
|
42 |
+
protected function getFromStore()
|
43 |
+
{
|
44 |
+
$localeCode = $this->getStoreLocaleCode();
|
45 |
+
list($language, $region) = explode('_', $localeCode);
|
46 |
+
|
47 |
+
$locale = $this->getAvailableLocale($language);
|
48 |
+
if (is_null($locale)) {
|
49 |
+
$locale = $this->getAvailableLocale($region);
|
50 |
+
}
|
51 |
+
return $locale;
|
52 |
+
}
|
53 |
+
|
54 |
+
protected function getStoreLocaleCode()
|
55 |
+
{
|
56 |
+
return $this->_lipscoreConfig->getMageConfig('general/locale/code');
|
57 |
+
}
|
58 |
+
|
59 |
+
protected function getAvailableLocale($storeLocale)
|
60 |
+
{
|
61 |
+
$storeLocale = strtolower($storeLocale);
|
62 |
+
return in_array($storeLocale, self::$_availableLocales) ? $storeLocale : null;
|
63 |
+
}
|
64 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Helper/Module.php
CHANGED
@@ -1,19 +1,52 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Helper_Module extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
-
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
$
|
15 |
-
$
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Helper_Module extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
+
{
|
5 |
+
const MODULE_NAME = 'Lipscore_RatingsReviews';
|
6 |
+
|
7 |
+
public function getVersion()
|
8 |
+
{
|
9 |
+
return (string) Mage::getConfig()->getNode('modules/Lipscore_RatingsReviews/version');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function isNewVersion()
|
13 |
+
{
|
14 |
+
$website = Mage::app()->getWebsite();
|
15 |
+
$lipscoreConfig = Mage::getModel('lipscore_ratingsreviews/config', array('website' => $website));
|
16 |
+
$oldVersion = (string) $lipscoreConfig->lastTrackedVersion();
|
17 |
+
$newVersion = $this->getVersion();
|
18 |
+
|
19 |
+
return strcmp($oldVersion, $newVersion) < 0;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function isLipscoreActive()
|
23 |
+
{
|
24 |
+
try {
|
25 |
+
return $this->isLipscoreModuleEnabled() && $this->isLipscoreOutputEnabled();
|
26 |
+
} catch (Exception $e) {
|
27 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
28 |
+
return false;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
|
32 |
+
public function isLipscoreModuleEnabled()
|
33 |
+
{
|
34 |
+
try {
|
35 |
+
return $this->isModuleEnabled(self::MODULE_NAME) && $this->isLipscoreEnabledByConfig();
|
36 |
+
} catch (Exception $e) {
|
37 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
38 |
+
return false;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
protected function isLipscoreOutputEnabled()
|
43 |
+
{
|
44 |
+
return $this->isModuleOutputEnabled(self::MODULE_NAME) && $this->isLipscoreEnabledByConfig();
|
45 |
+
}
|
46 |
+
|
47 |
+
protected function isLipscoreEnabledByConfig()
|
48 |
+
{
|
49 |
+
#return $this->_lipscoreConfig->enabled();
|
50 |
+
return true;
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Helper/Price.php
CHANGED
@@ -1,102 +1,102 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Helper_Price extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
-
{
|
5 |
-
public function getProductPrice(Mage_Catalog_Model_Product $product)
|
6 |
-
{
|
7 |
-
$price = 0;
|
8 |
-
try {
|
9 |
-
$price = $this->_getProductPrice($product);
|
10 |
-
} catch (Exception $e) {
|
11 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
12 |
-
}
|
13 |
-
return $price;
|
14 |
-
}
|
15 |
-
|
16 |
-
protected function _getProductPrice(Mage_Catalog_Model_Product $product)
|
17 |
-
{
|
18 |
-
$price = 0;
|
19 |
-
|
20 |
-
if ($this->isMsrpAppliable($product)) {
|
21 |
-
return $price;
|
22 |
-
}
|
23 |
-
|
24 |
-
if ($this->isBundleProduct($product)) {
|
25 |
-
$price = $this->getBundlePrice($product);
|
26 |
-
} elseif ($product->isGrouped()) {
|
27 |
-
$price = $this->getGroupedPrice($product);
|
28 |
-
} else {
|
29 |
-
$price = $this->getSimplePrice($product);
|
30 |
-
}
|
31 |
-
|
32 |
-
return round($price, 2);
|
33 |
-
}
|
34 |
-
|
35 |
-
protected function isBundleProduct(Mage_Catalog_Model_Product $product)
|
36 |
-
{
|
37 |
-
return $product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE;
|
38 |
-
}
|
39 |
-
|
40 |
-
protected function getBundlePrice(Mage_Catalog_Model_Product $product)
|
41 |
-
{
|
42 |
-
$price = 0;
|
43 |
-
$priceModel = $product->getPriceModel();
|
44 |
-
$taxHelper = $this->taxHelper();
|
45 |
-
|
46 |
-
$options = $product->getTypeInstance(true)->getOptions($product);
|
47 |
-
foreach ($options as $option) {
|
48 |
-
$selectionProduct = $option->getDefaultSelection();
|
49 |
-
if ($selectionProduct) {
|
50 |
-
$qty = $selectionProduct->getSelectionQty();
|
51 |
-
$val = $priceModel->getSelectionPreFinalPrice($product, $selectionProduct, $qty);
|
52 |
-
$price += $taxHelper->getPrice($selectionProduct, $val, true);
|
53 |
-
}
|
54 |
-
}
|
55 |
-
|
56 |
-
if (!$price) {
|
57 |
-
if (method_exists($priceModel, 'getTotalPrices')) {
|
58 |
-
$price = $priceModel->getTotalPrices($product, 'min', true);
|
59 |
-
} else {
|
60 |
-
// deprecated after 1.5.1.0
|
61 |
-
$price = $priceModel->getPricesDependingOnTax($product, 'min', true);
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
return $price;
|
66 |
-
}
|
67 |
-
|
68 |
-
protected function getGroupedPrice(Mage_Catalog_Model_Product $product)
|
69 |
-
{
|
70 |
-
$price = 0;
|
71 |
-
$taxHelper = $this->taxHelper();
|
72 |
-
|
73 |
-
$associated = $product->getTypeInstance(true)->getAssociatedProducts($product);
|
74 |
-
foreach ($associated as $product) {
|
75 |
-
$price += $taxHelper->getPrice($product, $product->getFinalPrice(), true);
|
76 |
-
}
|
77 |
-
|
78 |
-
return $price;
|
79 |
-
}
|
80 |
-
|
81 |
-
protected function getSimplePrice(Mage_Catalog_Model_Product $product)
|
82 |
-
{
|
83 |
-
return $this->taxHelper()->getPrice($product, $product->getFinalPrice(), true);
|
84 |
-
}
|
85 |
-
|
86 |
-
protected function isMsrpAppliable(Mage_Catalog_Model_Product $product)
|
87 |
-
{
|
88 |
-
$catalogHelper = Mage::helper('catalog');
|
89 |
-
if (method_exists($catalogHelper, 'canApplyMsrp')) {
|
90 |
-
return (int) $catalogHelper->canApplyMsrp($product, null, false);
|
91 |
-
}
|
92 |
-
return 0;
|
93 |
-
}
|
94 |
-
|
95 |
-
protected function taxHelper()
|
96 |
-
{
|
97 |
-
if (!isset($this->taxHelper)) {
|
98 |
-
$this->taxHelper = Mage::helper('tax');
|
99 |
-
}
|
100 |
-
return $this->taxHelper;
|
101 |
-
}
|
102 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Helper_Price extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
+
{
|
5 |
+
public function getProductPrice(Mage_Catalog_Model_Product $product)
|
6 |
+
{
|
7 |
+
$price = 0;
|
8 |
+
try {
|
9 |
+
$price = $this->_getProductPrice($product);
|
10 |
+
} catch (Exception $e) {
|
11 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
12 |
+
}
|
13 |
+
return $price;
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function _getProductPrice(Mage_Catalog_Model_Product $product)
|
17 |
+
{
|
18 |
+
$price = 0;
|
19 |
+
|
20 |
+
if ($this->isMsrpAppliable($product)) {
|
21 |
+
return $price;
|
22 |
+
}
|
23 |
+
|
24 |
+
if ($this->isBundleProduct($product)) {
|
25 |
+
$price = $this->getBundlePrice($product);
|
26 |
+
} elseif ($product->isGrouped()) {
|
27 |
+
$price = $this->getGroupedPrice($product);
|
28 |
+
} else {
|
29 |
+
$price = $this->getSimplePrice($product);
|
30 |
+
}
|
31 |
+
|
32 |
+
return round($price, 2);
|
33 |
+
}
|
34 |
+
|
35 |
+
protected function isBundleProduct(Mage_Catalog_Model_Product $product)
|
36 |
+
{
|
37 |
+
return $product->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE;
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function getBundlePrice(Mage_Catalog_Model_Product $product)
|
41 |
+
{
|
42 |
+
$price = 0;
|
43 |
+
$priceModel = $product->getPriceModel();
|
44 |
+
$taxHelper = $this->taxHelper();
|
45 |
+
|
46 |
+
$options = $product->getTypeInstance(true)->getOptions($product);
|
47 |
+
foreach ($options as $option) {
|
48 |
+
$selectionProduct = $option->getDefaultSelection();
|
49 |
+
if ($selectionProduct) {
|
50 |
+
$qty = $selectionProduct->getSelectionQty();
|
51 |
+
$val = $priceModel->getSelectionPreFinalPrice($product, $selectionProduct, $qty);
|
52 |
+
$price += $taxHelper->getPrice($selectionProduct, $val, true);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
if (!$price) {
|
57 |
+
if (method_exists($priceModel, 'getTotalPrices')) {
|
58 |
+
$price = $priceModel->getTotalPrices($product, 'min', true);
|
59 |
+
} else {
|
60 |
+
// deprecated after 1.5.1.0
|
61 |
+
$price = $priceModel->getPricesDependingOnTax($product, 'min', true);
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
return $price;
|
66 |
+
}
|
67 |
+
|
68 |
+
protected function getGroupedPrice(Mage_Catalog_Model_Product $product)
|
69 |
+
{
|
70 |
+
$price = 0;
|
71 |
+
$taxHelper = $this->taxHelper();
|
72 |
+
|
73 |
+
$associated = $product->getTypeInstance(true)->getAssociatedProducts($product);
|
74 |
+
foreach ($associated as $product) {
|
75 |
+
$price += $taxHelper->getPrice($product, $product->getFinalPrice(), true);
|
76 |
+
}
|
77 |
+
|
78 |
+
return $price;
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function getSimplePrice(Mage_Catalog_Model_Product $product)
|
82 |
+
{
|
83 |
+
return $this->taxHelper()->getPrice($product, $product->getFinalPrice(), true);
|
84 |
+
}
|
85 |
+
|
86 |
+
protected function isMsrpAppliable(Mage_Catalog_Model_Product $product)
|
87 |
+
{
|
88 |
+
$catalogHelper = Mage::helper('catalog');
|
89 |
+
if (method_exists($catalogHelper, 'canApplyMsrp')) {
|
90 |
+
return (int) $catalogHelper->canApplyMsrp($product, null, false);
|
91 |
+
}
|
92 |
+
return 0;
|
93 |
+
}
|
94 |
+
|
95 |
+
protected function taxHelper()
|
96 |
+
{
|
97 |
+
if (!isset($this->taxHelper)) {
|
98 |
+
$this->taxHelper = Mage::helper('tax');
|
99 |
+
}
|
100 |
+
return $this->taxHelper;
|
101 |
+
}
|
102 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Helper/Product.php
CHANGED
@@ -1,145 +1,145 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Product helper
|
5 |
-
*
|
6 |
-
* @author oivanova
|
7 |
-
*/
|
8 |
-
|
9 |
-
class Lipscore_RatingsReviews_Helper_Product extends Lipscore_RatingsReviews_Helper_Abstract
|
10 |
-
{
|
11 |
-
public function getProductData(Mage_Catalog_Model_Product $product = null)
|
12 |
-
{
|
13 |
-
$data = array();
|
14 |
-
try {
|
15 |
-
$data = $this->_getProductData($product);
|
16 |
-
} catch (Exception $e) {
|
17 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
18 |
-
}
|
19 |
-
return $data;
|
20 |
-
}
|
21 |
-
|
22 |
-
public function getRichsnippetProductData(Mage_Catalog_Model_Product $product = null)
|
23 |
-
{
|
24 |
-
$data = array();
|
25 |
-
try {
|
26 |
-
$data = $this->_getRichsnippetProductData($product);
|
27 |
-
} catch (Exception $e) {
|
28 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
29 |
-
}
|
30 |
-
return $data;
|
31 |
-
}
|
32 |
-
|
33 |
-
protected function _getProductData(Mage_Catalog_Model_Product $product = null)
|
34 |
-
{
|
35 |
-
$product or $product = Mage::registry('product');
|
36 |
-
|
37 |
-
$brandAttr = $this->_lipscoreConfig->brandAttr();
|
38 |
-
|
39 |
-
return array(
|
40 |
-
'name' => $product->getName(),
|
41 |
-
'brand' => $this->getAttributeValue($product, $brandAttr),
|
42 |
-
'sku_values' => array($this->getSku($product)),
|
43 |
-
'internal_id' => "{$product->getId()}",
|
44 |
-
'url' => $product->getProductUrl(),
|
45 |
-
'image_url' => $this->getImageUrl($product),
|
46 |
-
'price' => $this->getPrice($product),
|
47 |
-
'currency' => $this->getCurrency(),
|
48 |
-
'category' => $this->getCategory($product)
|
49 |
-
);
|
50 |
-
}
|
51 |
-
|
52 |
-
public function _getRichsnippetProductData(Mage_Catalog_Model_Product $product = null)
|
53 |
-
{
|
54 |
-
$product or $product = Mage::registry('product');
|
55 |
-
|
56 |
-
return array(
|
57 |
-
'description' => $this->getDescription($product),
|
58 |
-
'availability' => $this->getAvailability($product)
|
59 |
-
);
|
60 |
-
}
|
61 |
-
|
62 |
-
protected function getImageUrl(Mage_Catalog_Model_Product $product)
|
63 |
-
{
|
64 |
-
$url = '';
|
65 |
-
try {
|
66 |
-
$url = (string) Mage::helper('catalog/image')->init($product, 'image');
|
67 |
-
} catch (Exception $e) {
|
68 |
-
Mage::logException($e);
|
69 |
-
}
|
70 |
-
return $url;
|
71 |
-
}
|
72 |
-
|
73 |
-
protected function getCategory($product)
|
74 |
-
{
|
75 |
-
$category = Mage::registry('current_category');
|
76 |
-
if (!$category) {
|
77 |
-
$categoryIds = $product->getCategoryIds();
|
78 |
-
if (isset($categoryIds[0])) {
|
79 |
-
$category = Mage::getModel('catalog/category')->load($categoryIds[0]);
|
80 |
-
}
|
81 |
-
}
|
82 |
-
return $category ? $category->getName() : '';
|
83 |
-
}
|
84 |
-
|
85 |
-
protected function getAvailability(Mage_Catalog_Model_Product $product)
|
86 |
-
{
|
87 |
-
$isAvailable = $product->isAvailable();
|
88 |
-
if ($product->isGrouped()) {
|
89 |
-
$associated = $product->getTypeInstance(true)->getAssociatedProducts($product);
|
90 |
-
$isAvailable = $isAvailable && count($associated);
|
91 |
-
}
|
92 |
-
return (int) $isAvailable;
|
93 |
-
}
|
94 |
-
|
95 |
-
protected function getDescription(Mage_Catalog_Model_Product $product)
|
96 |
-
{
|
97 |
-
$description = $product->getShortDescription();
|
98 |
-
if (!$description) {
|
99 |
-
$description = $product->getDescription();
|
100 |
-
}
|
101 |
-
return $description;
|
102 |
-
}
|
103 |
-
|
104 |
-
protected function getPrice($product)
|
105 |
-
{
|
106 |
-
return $this->priceHelper()->getProductPrice($product);
|
107 |
-
}
|
108 |
-
|
109 |
-
protected function getCurrency()
|
110 |
-
{
|
111 |
-
return Mage::app()->getStore()->getCurrentCurrencyCode();
|
112 |
-
}
|
113 |
-
|
114 |
-
protected function getSku($product)
|
115 |
-
{
|
116 |
-
$sku = $product->getSku();
|
117 |
-
if (!$sku) {
|
118 |
-
$sku = Mage::getModel('catalog/product')->load($product->getId())->getSku();
|
119 |
-
}
|
120 |
-
return $sku;
|
121 |
-
}
|
122 |
-
|
123 |
-
protected function getAttributeValue(Mage_Catalog_Model_Product $product, $attrCode)
|
124 |
-
{
|
125 |
-
$attr = $product->getResource()->getAttribute($attrCode);
|
126 |
-
|
127 |
-
if (!$attr) {
|
128 |
-
return null;
|
129 |
-
}
|
130 |
-
|
131 |
-
if ('select' == $attr->getFrontendInput()) {
|
132 |
-
return $attr->getSource()->getOptionText($product->getData($attrCode));
|
133 |
-
} else {
|
134 |
-
return $product->getData($attrCode);
|
135 |
-
}
|
136 |
-
}
|
137 |
-
|
138 |
-
protected function priceHelper()
|
139 |
-
{
|
140 |
-
if (!isset($this->priceHelper)) {
|
141 |
-
$this->priceHelper = Mage::helper('lipscore_ratingsreviews/price');
|
142 |
-
}
|
143 |
-
return $this->priceHelper;
|
144 |
-
}
|
145 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Product helper
|
5 |
+
*
|
6 |
+
* @author oivanova
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Lipscore_RatingsReviews_Helper_Product extends Lipscore_RatingsReviews_Helper_Abstract
|
10 |
+
{
|
11 |
+
public function getProductData(Mage_Catalog_Model_Product $product = null)
|
12 |
+
{
|
13 |
+
$data = array();
|
14 |
+
try {
|
15 |
+
$data = $this->_getProductData($product);
|
16 |
+
} catch (Exception $e) {
|
17 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
18 |
+
}
|
19 |
+
return $data;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function getRichsnippetProductData(Mage_Catalog_Model_Product $product = null)
|
23 |
+
{
|
24 |
+
$data = array();
|
25 |
+
try {
|
26 |
+
$data = $this->_getRichsnippetProductData($product);
|
27 |
+
} catch (Exception $e) {
|
28 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
29 |
+
}
|
30 |
+
return $data;
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _getProductData(Mage_Catalog_Model_Product $product = null)
|
34 |
+
{
|
35 |
+
$product or $product = Mage::registry('product');
|
36 |
+
|
37 |
+
$brandAttr = $this->_lipscoreConfig->brandAttr();
|
38 |
+
|
39 |
+
return array(
|
40 |
+
'name' => $product->getName(),
|
41 |
+
'brand' => $this->getAttributeValue($product, $brandAttr),
|
42 |
+
'sku_values' => array($this->getSku($product)),
|
43 |
+
'internal_id' => "{$product->getId()}",
|
44 |
+
'url' => $product->getProductUrl(),
|
45 |
+
'image_url' => $this->getImageUrl($product),
|
46 |
+
'price' => $this->getPrice($product),
|
47 |
+
'currency' => $this->getCurrency(),
|
48 |
+
'category' => $this->getCategory($product)
|
49 |
+
);
|
50 |
+
}
|
51 |
+
|
52 |
+
public function _getRichsnippetProductData(Mage_Catalog_Model_Product $product = null)
|
53 |
+
{
|
54 |
+
$product or $product = Mage::registry('product');
|
55 |
+
|
56 |
+
return array(
|
57 |
+
'description' => $this->getDescription($product),
|
58 |
+
'availability' => $this->getAvailability($product)
|
59 |
+
);
|
60 |
+
}
|
61 |
+
|
62 |
+
protected function getImageUrl(Mage_Catalog_Model_Product $product)
|
63 |
+
{
|
64 |
+
$url = '';
|
65 |
+
try {
|
66 |
+
$url = (string) Mage::helper('catalog/image')->init($product, 'image');
|
67 |
+
} catch (Exception $e) {
|
68 |
+
Mage::logException($e);
|
69 |
+
}
|
70 |
+
return $url;
|
71 |
+
}
|
72 |
+
|
73 |
+
protected function getCategory($product)
|
74 |
+
{
|
75 |
+
$category = Mage::registry('current_category');
|
76 |
+
if (!$category) {
|
77 |
+
$categoryIds = $product->getCategoryIds();
|
78 |
+
if (isset($categoryIds[0])) {
|
79 |
+
$category = Mage::getModel('catalog/category')->load($categoryIds[0]);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
return $category ? $category->getName() : '';
|
83 |
+
}
|
84 |
+
|
85 |
+
protected function getAvailability(Mage_Catalog_Model_Product $product)
|
86 |
+
{
|
87 |
+
$isAvailable = $product->isAvailable();
|
88 |
+
if ($product->isGrouped()) {
|
89 |
+
$associated = $product->getTypeInstance(true)->getAssociatedProducts($product);
|
90 |
+
$isAvailable = $isAvailable && count($associated);
|
91 |
+
}
|
92 |
+
return (int) $isAvailable;
|
93 |
+
}
|
94 |
+
|
95 |
+
protected function getDescription(Mage_Catalog_Model_Product $product)
|
96 |
+
{
|
97 |
+
$description = $product->getShortDescription();
|
98 |
+
if (!$description) {
|
99 |
+
$description = $product->getDescription();
|
100 |
+
}
|
101 |
+
return $description;
|
102 |
+
}
|
103 |
+
|
104 |
+
protected function getPrice($product)
|
105 |
+
{
|
106 |
+
return $this->priceHelper()->getProductPrice($product);
|
107 |
+
}
|
108 |
+
|
109 |
+
protected function getCurrency()
|
110 |
+
{
|
111 |
+
return Mage::app()->getStore()->getCurrentCurrencyCode();
|
112 |
+
}
|
113 |
+
|
114 |
+
protected function getSku($product)
|
115 |
+
{
|
116 |
+
$sku = $product->getSku();
|
117 |
+
if (!$sku) {
|
118 |
+
$sku = Mage::getModel('catalog/product')->load($product->getId())->getSku();
|
119 |
+
}
|
120 |
+
return $sku;
|
121 |
+
}
|
122 |
+
|
123 |
+
protected function getAttributeValue(Mage_Catalog_Model_Product $product, $attrCode)
|
124 |
+
{
|
125 |
+
$attr = $product->getResource()->getAttribute($attrCode);
|
126 |
+
|
127 |
+
if (!$attr) {
|
128 |
+
return null;
|
129 |
+
}
|
130 |
+
|
131 |
+
if ('select' == $attr->getFrontendInput()) {
|
132 |
+
return $attr->getSource()->getOptionText($product->getData($attrCode));
|
133 |
+
} else {
|
134 |
+
return $product->getData($attrCode);
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
protected function priceHelper()
|
139 |
+
{
|
140 |
+
if (!isset($this->priceHelper)) {
|
141 |
+
$this->priceHelper = Mage::helper('lipscore_ratingsreviews/price');
|
142 |
+
}
|
143 |
+
return $this->priceHelper;
|
144 |
+
}
|
145 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Helper/Purchase.php
CHANGED
@@ -1,59 +1,59 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Helper_Purchase extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
-
{
|
5 |
-
public function getEmail(Mage_Sales_Model_Order $order = null)
|
6 |
-
{
|
7 |
-
$email = null;
|
8 |
-
|
9 |
-
if ($order) {
|
10 |
-
$email = $order->getBillingAddress()->getEmail();
|
11 |
-
if (!$email) {
|
12 |
-
$email = $order->getCustomerEmail();
|
13 |
-
}
|
14 |
-
} else {
|
15 |
-
$customer = $this->getCustomer();
|
16 |
-
if ($customer) {
|
17 |
-
$email = $customer->getEmail();
|
18 |
-
}
|
19 |
-
}
|
20 |
-
|
21 |
-
return $email;
|
22 |
-
}
|
23 |
-
|
24 |
-
public function getName(Mage_Sales_Model_Order $order = null)
|
25 |
-
{
|
26 |
-
$name = null;
|
27 |
-
|
28 |
-
if ($order) {
|
29 |
-
$addr = $order->getBillingAddress();
|
30 |
-
$name = $addr->getFirstname() . ' ' . $addr->getLastname();
|
31 |
-
|
32 |
-
if (!trim($name)) {
|
33 |
-
$name = $order->getCustomerFirstname() . ' ' . $order->getCustomerLastname();
|
34 |
-
}
|
35 |
-
} else {
|
36 |
-
$customer = $this->getCustomer();
|
37 |
-
if ($customer) {
|
38 |
-
$name = $customer->getName();
|
39 |
-
}
|
40 |
-
}
|
41 |
-
|
42 |
-
return $name;
|
43 |
-
}
|
44 |
-
|
45 |
-
protected function getCustomer()
|
46 |
-
{
|
47 |
-
return Mage::getSingleton('customer/session')->getCustomer();
|
48 |
-
}
|
49 |
-
|
50 |
-
public function getWidget($type)
|
51 |
-
{
|
52 |
-
$layout = $this->getLayout();
|
53 |
-
|
54 |
-
$layout->getUpdate()->load("checkout_{$type}_success");
|
55 |
-
$layout->generateXml()->generateBlocks();
|
56 |
-
|
57 |
-
return $layout->getBlock("lipscore.purchase.$type")->toHtml();
|
58 |
-
}
|
59 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Helper_Purchase extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
+
{
|
5 |
+
public function getEmail(Mage_Sales_Model_Order $order = null)
|
6 |
+
{
|
7 |
+
$email = null;
|
8 |
+
|
9 |
+
if ($order) {
|
10 |
+
$email = $order->getBillingAddress()->getEmail();
|
11 |
+
if (!$email) {
|
12 |
+
$email = $order->getCustomerEmail();
|
13 |
+
}
|
14 |
+
} else {
|
15 |
+
$customer = $this->getCustomer();
|
16 |
+
if ($customer) {
|
17 |
+
$email = $customer->getEmail();
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
return $email;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function getName(Mage_Sales_Model_Order $order = null)
|
25 |
+
{
|
26 |
+
$name = null;
|
27 |
+
|
28 |
+
if ($order) {
|
29 |
+
$addr = $order->getBillingAddress();
|
30 |
+
$name = $addr->getFirstname() . ' ' . $addr->getLastname();
|
31 |
+
|
32 |
+
if (!trim($name)) {
|
33 |
+
$name = $order->getCustomerFirstname() . ' ' . $order->getCustomerLastname();
|
34 |
+
}
|
35 |
+
} else {
|
36 |
+
$customer = $this->getCustomer();
|
37 |
+
if ($customer) {
|
38 |
+
$name = $customer->getName();
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
return $name;
|
43 |
+
}
|
44 |
+
|
45 |
+
protected function getCustomer()
|
46 |
+
{
|
47 |
+
return Mage::getSingleton('customer/session')->getCustomer();
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getWidget($type)
|
51 |
+
{
|
52 |
+
$layout = $this->getLayout();
|
53 |
+
|
54 |
+
$layout->getUpdate()->load("checkout_{$type}_success");
|
55 |
+
$layout->generateXml()->generateBlocks();
|
56 |
+
|
57 |
+
return $layout->getBlock("lipscore.purchase.$type")->toHtml();
|
58 |
+
}
|
59 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Helper/Reminder.php
CHANGED
@@ -1,87 +1,85 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Helper_Reminder extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
-
{
|
5 |
-
protected $productHelper = null;
|
6 |
-
protected $purchaseHelper = null;
|
7 |
-
protected $couponHelper = null;
|
8 |
-
protected $localeHelper = null;
|
9 |
-
|
10 |
-
public function __construct()
|
11 |
-
{
|
12 |
-
$this->productHelper = Mage::helper('lipscore_ratingsreviews/product');
|
13 |
-
$this->purchaseHelper = Mage::helper('lipscore_ratingsreviews/purchase');
|
14 |
-
$this->couponHelper = Mage::helper('lipscore_ratingsreviews/coupon');
|
15 |
-
$this->localeHelper = Mage::helper('lipscore_ratingsreviews/locale');
|
16 |
-
|
17 |
-
parent::__construct();
|
18 |
-
}
|
19 |
-
|
20 |
-
public function orderData(Mage_Sales_Model_Order $order)
|
21 |
-
{
|
22 |
-
$this->initConfig($order->getStoreId());
|
23 |
-
return array(
|
24 |
-
'purchase' => $this->_purchaseData($order),
|
25 |
-
'products' => $this->_productsData($order)
|
26 |
-
);
|
27 |
-
}
|
28 |
-
|
29 |
-
protected function _productsData($order)
|
30 |
-
{
|
31 |
-
$orderItems = $order->getAllVisibleItems();
|
32 |
-
$productIds = array();
|
33 |
-
foreach ($orderItems as $item) {
|
34 |
-
$productIds[] = $item->getProductId();
|
35 |
-
}
|
36 |
-
|
37 |
-
$products = Mage::getModel('catalog/product')->getCollection()
|
38 |
-
->addAttributeToFilter('entity_id', array('in' => $productIds))
|
39 |
-
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes());
|
40 |
-
|
41 |
-
$productsData = array();
|
42 |
-
$
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
$
|
59 |
-
$
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
'
|
65 |
-
'
|
66 |
-
'
|
67 |
-
'
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
$
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
$this->
|
83 |
-
$this->
|
84 |
-
|
85 |
-
|
86 |
-
}
|
87 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Helper_Reminder extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
+
{
|
5 |
+
protected $productHelper = null;
|
6 |
+
protected $purchaseHelper = null;
|
7 |
+
protected $couponHelper = null;
|
8 |
+
protected $localeHelper = null;
|
9 |
+
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->productHelper = Mage::helper('lipscore_ratingsreviews/product');
|
13 |
+
$this->purchaseHelper = Mage::helper('lipscore_ratingsreviews/purchase');
|
14 |
+
$this->couponHelper = Mage::helper('lipscore_ratingsreviews/coupon');
|
15 |
+
$this->localeHelper = Mage::helper('lipscore_ratingsreviews/locale');
|
16 |
+
|
17 |
+
parent::__construct();
|
18 |
+
}
|
19 |
+
|
20 |
+
public function orderData(Mage_Sales_Model_Order $order)
|
21 |
+
{
|
22 |
+
$this->initConfig($order->getStoreId());
|
23 |
+
return array(
|
24 |
+
'purchase' => $this->_purchaseData($order),
|
25 |
+
'products' => $this->_productsData($order)
|
26 |
+
);
|
27 |
+
}
|
28 |
+
|
29 |
+
protected function _productsData($order)
|
30 |
+
{
|
31 |
+
$orderItems = $order->getAllVisibleItems();
|
32 |
+
$productIds = array();
|
33 |
+
foreach ($orderItems as $item) {
|
34 |
+
$productIds[] = $item->getProductId();
|
35 |
+
}
|
36 |
+
|
37 |
+
$products = Mage::getModel('catalog/product')->getCollection()
|
38 |
+
->addAttributeToFilter('entity_id', array('in' => $productIds))
|
39 |
+
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes());
|
40 |
+
|
41 |
+
$productsData = array();
|
42 |
+
foreach ($products as $product) {
|
43 |
+
$productsData[] = $this->_productData($product);
|
44 |
+
}
|
45 |
+
|
46 |
+
return $productsData;
|
47 |
+
}
|
48 |
+
|
49 |
+
protected function _productData($product)
|
50 |
+
{
|
51 |
+
return $this->productHelper->getProductData($product);
|
52 |
+
}
|
53 |
+
|
54 |
+
protected function _purchaseData(Mage_Sales_Model_Order $order)
|
55 |
+
{
|
56 |
+
$coupon = $this->couponHelper->generateCoupon();
|
57 |
+
$email = $this->purchaseHelper->getEmail($order);
|
58 |
+
$name = $this->purchaseHelper->getName($order);
|
59 |
+
$lang = $this->localeHelper->getStoreLocale();
|
60 |
+
|
61 |
+
return array(
|
62 |
+
'buyer_email' => $email,
|
63 |
+
'buyer_name' => $name,
|
64 |
+
'discount_descr' => $coupon ? $this->couponHelper->getCouponDescription() : '',
|
65 |
+
'discount_voucher' => $coupon ? $coupon->getCode() : '',
|
66 |
+
'purchased_at' => (int) $order->getCreatedAtDate()->get(),
|
67 |
+
'lang' => $lang
|
68 |
+
);
|
69 |
+
}
|
70 |
+
|
71 |
+
public function initConfig($storeId)
|
72 |
+
{
|
73 |
+
$config = Mage::helper('lipscore_ratingsreviews/config')->getScoped(null, $storeId);
|
74 |
+
$this->setLipscoreConfig($config);
|
75 |
+
$this->updateHelpersConfig();
|
76 |
+
}
|
77 |
+
|
78 |
+
protected function updateHelpersConfig()
|
79 |
+
{
|
80 |
+
$this->productHelper->setLipscoreConfig($this->_lipscoreConfig);
|
81 |
+
$this->purchaseHelper->setLipscoreConfig($this->_lipscoreConfig);
|
82 |
+
$this->couponHelper->setLipscoreConfig($this->_lipscoreConfig);
|
83 |
+
$this->localeHelper->setLipscoreConfig($this->_lipscoreConfig);
|
84 |
+
}
|
85 |
+
}
|
Â
|
|
Â
|
app/code/community/Lipscore/RatingsReviews/Helper/Widget.php
CHANGED
@@ -1,60 +1,60 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Helper_Widget extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
-
{
|
5 |
-
public function getProductAttrs($productData)
|
6 |
-
{
|
7 |
-
$attrs = '';
|
8 |
-
try {
|
9 |
-
$attrs = $this->_getProductAttrs($productData);
|
10 |
-
} catch (Exception $e) {
|
11 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
12 |
-
}
|
13 |
-
return $attrs;
|
14 |
-
}
|
15 |
-
|
16 |
-
public function getRichsnippetPproductAttrs($productData)
|
17 |
-
{
|
18 |
-
$attrs = '';
|
19 |
-
try {
|
20 |
-
$attrs = $this->_getRichsnippetPproductAttrs($productData);
|
21 |
-
} catch (Exception $e) {
|
22 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
23 |
-
}
|
24 |
-
return $attrs;
|
25 |
-
}
|
26 |
-
|
27 |
-
protected function _getProductAttrs($productData)
|
28 |
-
{
|
29 |
-
$attrs = array(
|
30 |
-
'ls-product-name' => $productData['name'],
|
31 |
-
'ls-brand' => $productData['brand'],
|
32 |
-
'ls-sku' => implode(';', $productData['sku_values']),
|
33 |
-
'ls-product-id' => $productData['internal_id'],
|
34 |
-
'ls-image-url' => $productData['image_url'],
|
35 |
-
'ls-price' => $productData['price'],
|
36 |
-
'ls-price-currency' => $productData['currency'],
|
37 |
-
'ls-category' => $productData['category']
|
38 |
-
);
|
39 |
-
return $this->_toString($attrs);
|
40 |
-
}
|
41 |
-
|
42 |
-
protected function _getRichsnippetPproductAttrs($productData)
|
43 |
-
{
|
44 |
-
$attrs = array(
|
45 |
-
'ls-description' => $productData['description'],
|
46 |
-
'ls-availability' => $productData['availability']
|
47 |
-
);
|
48 |
-
return $this->_toString($attrs);
|
49 |
-
}
|
50 |
-
|
51 |
-
protected function _toString($attrs)
|
52 |
-
{
|
53 |
-
$strAttrs = array();
|
54 |
-
foreach ($attrs as $attr => $value) {
|
55 |
-
$value = htmlspecialchars($value);
|
56 |
-
$strAttrs[] = "$attr=\"$value\"";
|
57 |
-
}
|
58 |
-
return implode($strAttrs, ' ');
|
59 |
-
}
|
60 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Helper_Widget extends Lipscore_RatingsReviews_Helper_Abstract
|
4 |
+
{
|
5 |
+
public function getProductAttrs($productData)
|
6 |
+
{
|
7 |
+
$attrs = '';
|
8 |
+
try {
|
9 |
+
$attrs = $this->_getProductAttrs($productData);
|
10 |
+
} catch (Exception $e) {
|
11 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
12 |
+
}
|
13 |
+
return $attrs;
|
14 |
+
}
|
15 |
+
|
16 |
+
public function getRichsnippetPproductAttrs($productData)
|
17 |
+
{
|
18 |
+
$attrs = '';
|
19 |
+
try {
|
20 |
+
$attrs = $this->_getRichsnippetPproductAttrs($productData);
|
21 |
+
} catch (Exception $e) {
|
22 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
23 |
+
}
|
24 |
+
return $attrs;
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function _getProductAttrs($productData)
|
28 |
+
{
|
29 |
+
$attrs = array(
|
30 |
+
'ls-product-name' => $productData['name'],
|
31 |
+
'ls-brand' => $productData['brand'],
|
32 |
+
'ls-sku' => implode(';', $productData['sku_values']),
|
33 |
+
'ls-product-id' => $productData['internal_id'],
|
34 |
+
'ls-image-url' => $productData['image_url'],
|
35 |
+
'ls-price' => $productData['price'],
|
36 |
+
'ls-price-currency' => $productData['currency'],
|
37 |
+
'ls-category' => $productData['category']
|
38 |
+
);
|
39 |
+
return $this->_toString($attrs);
|
40 |
+
}
|
41 |
+
|
42 |
+
protected function _getRichsnippetPproductAttrs($productData)
|
43 |
+
{
|
44 |
+
$attrs = array(
|
45 |
+
'ls-description' => $productData['description'],
|
46 |
+
'ls-availability' => $productData['availability']
|
47 |
+
);
|
48 |
+
return $this->_toString($attrs);
|
49 |
+
}
|
50 |
+
|
51 |
+
protected function _toString($attrs)
|
52 |
+
{
|
53 |
+
$strAttrs = array();
|
54 |
+
foreach ($attrs as $attr => $value) {
|
55 |
+
$value = htmlspecialchars($value);
|
56 |
+
$strAttrs[] = "$attr=\"$value\"";
|
57 |
+
}
|
58 |
+
return implode($strAttrs, ' ');
|
59 |
+
}
|
60 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Logger.php
CHANGED
@@ -1,66 +1,66 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Logger
|
4 |
-
{
|
5 |
-
public static function logException(Exception $e)
|
6 |
-
{
|
7 |
-
Mage::logException($e);
|
8 |
-
|
9 |
-
$store = null;
|
10 |
-
$storeInfo = $url = $to = '';
|
11 |
-
|
12 |
-
try {
|
13 |
-
$store = Mage::app()->getStore();
|
14 |
-
} catch (Exception $e) {}
|
15 |
-
|
16 |
-
if ($store) {
|
17 |
-
$storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
18 |
-
$storeInfo = $store->getFrontendName() . ', ' . self::_url($storeUrl);
|
19 |
-
$url = $store->getCurrentUrl();
|
20 |
-
} else {
|
21 |
-
$storeInfo = 'N/A';
|
22 |
-
}
|
23 |
-
|
24 |
-
if (!$url && isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) {
|
25 |
-
$url = isset($_SERVER['HTTPS']) ? 'https' : 'http';
|
26 |
-
$url .= '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
|
27 |
-
}
|
28 |
-
|
29 |
-
$errMsg = $e->getMessage();
|
30 |
-
$trace = $e->getTraceAsString();
|
31 |
-
$link = self::_url($url);
|
32 |
-
$version = Mage::getVersion();
|
33 |
-
$sbj = "Magento extension error: $errMsg";
|
34 |
-
$msg = "STORE: $storeInfo, $version\n\nERROR MESSAGE: $errMsg\n\nURL: $link\n\nSTACK TRACE: $trace";
|
35 |
-
|
36 |
-
try {
|
37 |
-
$config = Mage::getModel('lipscore_ratingsreviews/config_env');
|
38 |
-
$to = (string) $config->errorsEmail();
|
39 |
-
} catch (Exception $e) {}
|
40 |
-
|
41 |
-
if (!empty($to)) {
|
42 |
-
try {
|
43 |
-
self::_sendEmail($to, $sbj, $msg);
|
44 |
-
} catch (Exception $e) {}
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
protected static function _url($url)
|
49 |
-
{
|
50 |
-
return $url ? $url : 'N/A';
|
51 |
-
}
|
52 |
-
|
53 |
-
protected static function _sendEmail($to, $sbj, $msg)
|
54 |
-
{
|
55 |
-
$fromEmail = Mage::getStoreConfig('trans_email/ident_general/email');
|
56 |
-
$fromName = Mage::getStoreConfig('trans_email/ident_general/name');
|
57 |
-
|
58 |
-
$mail = Mage::getModel('core/email')
|
59 |
-
->setFromEmail($fromEmail)
|
60 |
-
->setFromName($fromName)
|
61 |
-
->setToEmail($to)
|
62 |
-
->setSubject($sbj)
|
63 |
-
->setBody($msg)
|
64 |
-
->send();
|
65 |
-
}
|
66 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Logger
|
4 |
+
{
|
5 |
+
public static function logException(Exception $e)
|
6 |
+
{
|
7 |
+
Mage::logException($e);
|
8 |
+
|
9 |
+
$store = null;
|
10 |
+
$storeInfo = $url = $to = '';
|
11 |
+
|
12 |
+
try {
|
13 |
+
$store = Mage::app()->getStore();
|
14 |
+
} catch (Exception $e) {}
|
15 |
+
|
16 |
+
if ($store) {
|
17 |
+
$storeUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
18 |
+
$storeInfo = $store->getFrontendName() . ', ' . self::_url($storeUrl);
|
19 |
+
$url = $store->getCurrentUrl();
|
20 |
+
} else {
|
21 |
+
$storeInfo = 'N/A';
|
22 |
+
}
|
23 |
+
|
24 |
+
if (!$url && isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) {
|
25 |
+
$url = isset($_SERVER['HTTPS']) ? 'https' : 'http';
|
26 |
+
$url .= '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
|
27 |
+
}
|
28 |
+
|
29 |
+
$errMsg = $e->getMessage();
|
30 |
+
$trace = $e->getTraceAsString();
|
31 |
+
$link = self::_url($url);
|
32 |
+
$version = Mage::getVersion();
|
33 |
+
$sbj = "Magento extension error: $errMsg";
|
34 |
+
$msg = "STORE: $storeInfo, $version\n\nERROR MESSAGE: $errMsg\n\nURL: $link\n\nSTACK TRACE: $trace";
|
35 |
+
|
36 |
+
try {
|
37 |
+
$config = Mage::getModel('lipscore_ratingsreviews/config_env');
|
38 |
+
$to = (string) $config->errorsEmail();
|
39 |
+
} catch (Exception $e) {}
|
40 |
+
|
41 |
+
if (!empty($to)) {
|
42 |
+
try {
|
43 |
+
self::_sendEmail($to, $sbj, $msg);
|
44 |
+
} catch (Exception $e) {}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
protected static function _url($url)
|
49 |
+
{
|
50 |
+
return $url ? $url : 'N/A';
|
51 |
+
}
|
52 |
+
|
53 |
+
protected static function _sendEmail($to, $sbj, $msg)
|
54 |
+
{
|
55 |
+
$fromEmail = Mage::getStoreConfig('trans_email/ident_general/email');
|
56 |
+
$fromName = Mage::getStoreConfig('trans_email/ident_general/name');
|
57 |
+
|
58 |
+
$mail = Mage::getModel('core/email')
|
59 |
+
->setFromEmail($fromEmail)
|
60 |
+
->setFromName($fromName)
|
61 |
+
->setToEmail($to)
|
62 |
+
->setSubject($sbj)
|
63 |
+
->setBody($msg)
|
64 |
+
->send();
|
65 |
+
}
|
66 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Api/Request.php
CHANGED
@@ -1,60 +1,65 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Model_Api_Request
|
4 |
-
{
|
5 |
-
protected $lipscoreConfig;
|
6 |
-
protected $path;
|
7 |
-
protected $requestType;
|
8 |
-
protected $
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
$this->checkParameter($params, '
|
14 |
-
|
15 |
-
|
16 |
-
$this->
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
}
|
27 |
-
|
28 |
-
public function
|
29 |
-
{
|
30 |
-
$
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
);
|
36 |
-
$
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
$
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
}
|
60 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_Api_Request
|
4 |
+
{
|
5 |
+
protected $lipscoreConfig;
|
6 |
+
protected $path;
|
7 |
+
protected $requestType;
|
8 |
+
protected $timeout = 10;
|
9 |
+
protected $response;
|
10 |
+
|
11 |
+
public function __construct($params)
|
12 |
+
{
|
13 |
+
$this->checkParameter($params, 'lipscoreConfig');
|
14 |
+
$this->checkParameter($params, 'path');
|
15 |
+
|
16 |
+
$this->lipscoreConfig = $params['lipscoreConfig'];
|
17 |
+
$this->path = $params['path'];
|
18 |
+
|
19 |
+
if (!empty($params['timeout'])) {
|
20 |
+
$this->timeout = $params['timeout'];
|
21 |
+
}
|
22 |
+
|
23 |
+
if (!empty($params['requestType'])) {
|
24 |
+
$this->requestType = $params['requestType'];
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getResponseMsg()
|
29 |
+
{
|
30 |
+
return $this->response ? $this->response->__toString() : '';
|
31 |
+
}
|
32 |
+
|
33 |
+
public function send($data)
|
34 |
+
{
|
35 |
+
$apiKey = $this->lipscoreConfig->apiKey();
|
36 |
+
$apiUrl = Mage::getModel('lipscore_ratingsreviews/config_env')->apiUrl();
|
37 |
+
|
38 |
+
$client = new Zend_Http_Client(
|
39 |
+
"http://$apiUrl/{$this->path}?api_key=$apiKey", array('timeout' => $this->timeout)
|
40 |
+
);
|
41 |
+
$client->setRawData(json_encode($data), 'application/json')
|
42 |
+
->setMethod($this->getRequestType());
|
43 |
+
|
44 |
+
$this->response = $client->request();
|
45 |
+
|
46 |
+
$result = $this->response->isSuccessful();
|
47 |
+
if ($result) {
|
48 |
+
$result = json_decode($this->response->getBody(), true);
|
49 |
+
}
|
50 |
+
|
51 |
+
return $result;
|
52 |
+
}
|
53 |
+
|
54 |
+
protected function checkParameter($params, $name)
|
55 |
+
{
|
56 |
+
if (empty($params[$name])) {
|
57 |
+
throw new Exception("$name parameter is empty");
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
protected function getRequestType()
|
62 |
+
{
|
63 |
+
return $this->requestType ? $this->requestType : Zend_Http_Client::POST;
|
64 |
+
}
|
65 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Config.php
CHANGED
@@ -1,102 +1,116 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Model_Config
|
4 |
-
{
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
'
|
9 |
-
'
|
10 |
-
'
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
if ($this->
|
40 |
-
return $this->
|
41 |
-
}
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
$scope
|
52 |
-
$
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_Config
|
4 |
+
{
|
5 |
+
const DEFAULT_SINGLE_REMINDER_TIMEOUT = 10;
|
6 |
+
|
7 |
+
protected static $_systemConfigs = array(
|
8 |
+
'coupon' => 'lipscore_coupons/coupons/',
|
9 |
+
'brand' => 'lipscore_general/product_brand/',
|
10 |
+
'apiKey' => 'lipscore_general/api_key/',
|
11 |
+
'locale' => 'lipscore_general/locale/',
|
12 |
+
'emails' => 'lipscore_general/emails/',
|
13 |
+
'tracking' => 'lipscore_plugin/',
|
14 |
+
);
|
15 |
+
|
16 |
+
protected $store = null;
|
17 |
+
protected $website = null;
|
18 |
+
|
19 |
+
public function __construct($params = array())
|
20 |
+
{
|
21 |
+
!empty($params['store']) and $this->store = $params['store'];
|
22 |
+
!empty($params['website']) and $this->website = $params['website'];
|
23 |
+
}
|
24 |
+
|
25 |
+
public function get($param, $type)
|
26 |
+
{
|
27 |
+
$key = $this->getKey($param, $type);
|
28 |
+
return $this->getMageConfig($key);
|
29 |
+
}
|
30 |
+
|
31 |
+
public function set($param, $type, $value)
|
32 |
+
{
|
33 |
+
$key = $this->getKey($param, $type);
|
34 |
+
return $this->setMageConfig($key, $value);
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getMageConfig($path)
|
38 |
+
{
|
39 |
+
if ($this->store) {
|
40 |
+
return $this->store->getConfig($path);
|
41 |
+
}
|
42 |
+
if ($this->website) {
|
43 |
+
return $this->website->getConfig($path);
|
44 |
+
}
|
45 |
+
return Mage::getStoreConfig($path);
|
46 |
+
}
|
47 |
+
|
48 |
+
public function setMageConfig($path, $value)
|
49 |
+
{
|
50 |
+
if ($this->website) {
|
51 |
+
$scope = 'websites';
|
52 |
+
$scopeId = $this->website->getId();
|
53 |
+
} else {
|
54 |
+
$scope = 'stores';
|
55 |
+
$store = $this->store ? $this->store : Mage::app()->getStore();
|
56 |
+
$scopeId = $store->getId();
|
57 |
+
}
|
58 |
+
return Mage::getConfig()->saveConfig($path, $value, $scope, $scopeId);
|
59 |
+
}
|
60 |
+
|
61 |
+
public function apiKey()
|
62 |
+
{
|
63 |
+
return $this->get('api_key', 'apiKey');
|
64 |
+
}
|
65 |
+
|
66 |
+
public function demoApiKey()
|
67 |
+
{
|
68 |
+
return $this->get('demo_api_key', 'apiKey');
|
69 |
+
}
|
70 |
+
|
71 |
+
public function locale()
|
72 |
+
{
|
73 |
+
return $this->get('locale', 'locale');
|
74 |
+
}
|
75 |
+
|
76 |
+
public function brandAttr()
|
77 |
+
{
|
78 |
+
return $this->get('attr', 'brand');
|
79 |
+
}
|
80 |
+
|
81 |
+
public function lastTrackedVersion()
|
82 |
+
{
|
83 |
+
return $this->get('last_tracked_version', 'tracking');
|
84 |
+
}
|
85 |
+
|
86 |
+
public function pluginInstallationId()
|
87 |
+
{
|
88 |
+
return $this->get('plugin_installation_id', 'tracking');
|
89 |
+
}
|
90 |
+
|
91 |
+
public function singleReminderTimeout()
|
92 |
+
{
|
93 |
+
$timeout = getenv('SINGLE_REMINDER_TIMEOUT');
|
94 |
+
return $timeout ? $timeout : static::DEFAULT_SINGLE_REMINDER_TIMEOUT;
|
95 |
+
}
|
96 |
+
|
97 |
+
public function singleReminderStatus()
|
98 |
+
{
|
99 |
+
return $this->get('order_status', 'emails');
|
100 |
+
}
|
101 |
+
|
102 |
+
public function setLastTrackedVersion($value)
|
103 |
+
{
|
104 |
+
return $this->set('last_tracked_version', 'tracking', $value);
|
105 |
+
}
|
106 |
+
|
107 |
+
public function setPluginInstallationId($value)
|
108 |
+
{
|
109 |
+
return $this->set('plugin_installation_id', 'tracking', $value);
|
110 |
+
}
|
111 |
+
|
112 |
+
protected function getKey($param, $type)
|
113 |
+
{
|
114 |
+
return self::$_systemConfigs[$type] . $param;
|
115 |
+
}
|
116 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Config/Env.php
CHANGED
@@ -1,49 +1,49 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Model_Config_Env extends Varien_Simplexml_Config
|
4 |
-
{
|
5 |
-
const DEV_ENV = 'development';
|
6 |
-
const PROD_ENV = 'production';
|
7 |
-
|
8 |
-
const CACHE_TAG = 'config_lipscore_env';
|
9 |
-
const CACHE_ID = 'config_lipscore_env';
|
10 |
-
|
11 |
-
public function __construct()
|
12 |
-
{
|
13 |
-
$canUserCache = Mage::app()->useCache('config');
|
14 |
-
if ($canUserCache) {
|
15 |
-
$this->setCacheId(self::CACHE_ID)
|
16 |
-
->setCacheTags(array(self::CACHE_TAG))
|
17 |
-
->setCacheChecksum(null)
|
18 |
-
->setCache(Mage::app()->getCache());
|
19 |
-
|
20 |
-
if ($this->loadCache()) {
|
21 |
-
return;
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
$env = getenv('LIPSCORE_MAGE_ENV') == self::DEV_ENV ? self::DEV_ENV : self::PROD_ENV;
|
26 |
-
$configFile = Mage::getModuleDir('etc', 'Lipscore_RatingsReviews'). DS . 'environments' . DS . $env . '.xml';
|
27 |
-
|
28 |
-
parent::__construct($configFile);
|
29 |
-
|
30 |
-
if ($canUserCache) {
|
31 |
-
$this->saveCache();
|
32 |
-
}
|
33 |
-
}
|
34 |
-
|
35 |
-
public function apiUrl()
|
36 |
-
{
|
37 |
-
return $this->getNode('lipscore_api_url');
|
38 |
-
}
|
39 |
-
|
40 |
-
public function assetsUrl()
|
41 |
-
{
|
42 |
-
return $this->getNode('lipscore_assets_url');
|
43 |
-
}
|
44 |
-
|
45 |
-
public function errorsEmail()
|
46 |
-
{
|
47 |
-
return $this->getNode('lipscore_errors_email');
|
48 |
-
}
|
49 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_Config_Env extends Varien_Simplexml_Config
|
4 |
+
{
|
5 |
+
const DEV_ENV = 'development';
|
6 |
+
const PROD_ENV = 'production';
|
7 |
+
|
8 |
+
const CACHE_TAG = 'config_lipscore_env';
|
9 |
+
const CACHE_ID = 'config_lipscore_env';
|
10 |
+
|
11 |
+
public function __construct()
|
12 |
+
{
|
13 |
+
$canUserCache = Mage::app()->useCache('config');
|
14 |
+
if ($canUserCache) {
|
15 |
+
$this->setCacheId(self::CACHE_ID)
|
16 |
+
->setCacheTags(array(self::CACHE_TAG))
|
17 |
+
->setCacheChecksum(null)
|
18 |
+
->setCache(Mage::app()->getCache());
|
19 |
+
|
20 |
+
if ($this->loadCache()) {
|
21 |
+
return;
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
$env = getenv('LIPSCORE_MAGE_ENV') == self::DEV_ENV ? self::DEV_ENV : self::PROD_ENV;
|
26 |
+
$configFile = Mage::getModuleDir('etc', 'Lipscore_RatingsReviews'). DS . 'environments' . DS . $env . '.xml';
|
27 |
+
|
28 |
+
parent::__construct($configFile);
|
29 |
+
|
30 |
+
if ($canUserCache) {
|
31 |
+
$this->saveCache();
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
public function apiUrl()
|
36 |
+
{
|
37 |
+
return $this->getNode('lipscore_api_url');
|
38 |
+
}
|
39 |
+
|
40 |
+
public function assetsUrl()
|
41 |
+
{
|
42 |
+
return $this->getNode('lipscore_assets_url');
|
43 |
+
}
|
44 |
+
|
45 |
+
public function errorsEmail()
|
46 |
+
{
|
47 |
+
return $this->getNode('lipscore_errors_email');
|
48 |
+
}
|
49 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Coupon/Generator.php
CHANGED
@@ -1,66 +1,66 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Model_Coupon_Generator
|
4 |
-
{
|
5 |
-
public function generate($rule, $data)
|
6 |
-
{
|
7 |
-
$generator = $rule->getCouponMassGenerator();
|
8 |
-
|
9 |
-
if (!$generator->validateData($data)) {
|
10 |
-
return null;
|
11 |
-
}
|
12 |
-
|
13 |
-
$generator->setData($data);
|
14 |
-
$size = $generator->getQty();
|
15 |
-
|
16 |
-
$maxProbability = $generator->getMaxProbability() ? $generator->getMaxProbability() : $generator::MAX_PROBABILITY_OF_GUESSING;
|
17 |
-
$maxAttempts = $generator->getMaxAttempts() ? $generator->getMaxAttempts() : $generator::MAX_GENERATE_ATTEMPTS;
|
18 |
-
|
19 |
-
$coupon = Mage::getModel('salesrule/coupon');
|
20 |
-
|
21 |
-
$chars = count(Mage::helper('salesrule/coupon')->getCharset($generator->getFormat()));
|
22 |
-
$length = (int) $generator->getLength();
|
23 |
-
$maxCodes = pow($chars, $length);
|
24 |
-
$probability = $size / $maxCodes;
|
25 |
-
|
26 |
-
//increase the length of Code if probability is low
|
27 |
-
if ($probability > $maxProbability) {
|
28 |
-
do {
|
29 |
-
$length++;
|
30 |
-
$maxCodes = pow($chars, $length);
|
31 |
-
$probability = $size / $maxCodes;
|
32 |
-
} while ($probability > $maxProbability);
|
33 |
-
$generator->setLength($length);
|
34 |
-
}
|
35 |
-
|
36 |
-
$now = $generator->getResource()->formatDate(
|
37 |
-
Mage::getSingleton('core/date')->gmtTimestamp()
|
38 |
-
);
|
39 |
-
|
40 |
-
$attempt = 0;
|
41 |
-
do {
|
42 |
-
if ($attempt >= $maxAttempts) {
|
43 |
-
break;
|
44 |
-
}
|
45 |
-
$code = $generator->generateCode();
|
46 |
-
$attempt++;
|
47 |
-
} while ($generator->getResource()->exists($code));
|
48 |
-
|
49 |
-
$expirationDate = $generator->getToDate();
|
50 |
-
if ($expirationDate instanceof Zend_Date) {
|
51 |
-
$expirationDate = $expirationDate->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
|
52 |
-
}
|
53 |
-
|
54 |
-
$coupon->setId(null)
|
55 |
-
->setRuleId($generator->getRuleId())
|
56 |
-
->setUsageLimit($generator->getUsesPerCoupon())
|
57 |
-
->setUsagePerCustomer($generator->getUsesPerCustomer())
|
58 |
-
->setExpirationDate($expirationDate)
|
59 |
-
->setCreatedAt($now)
|
60 |
-
->setType(Mage_SalesRule_Helper_Coupon::COUPON_TYPE_SPECIFIC_AUTOGENERATED)
|
61 |
-
->setCode($code)
|
62 |
-
->save();
|
63 |
-
|
64 |
-
return $coupon;
|
65 |
-
}
|
66 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_Coupon_Generator
|
4 |
+
{
|
5 |
+
public function generate($rule, $data)
|
6 |
+
{
|
7 |
+
$generator = $rule->getCouponMassGenerator();
|
8 |
+
|
9 |
+
if (!$generator->validateData($data)) {
|
10 |
+
return null;
|
11 |
+
}
|
12 |
+
|
13 |
+
$generator->setData($data);
|
14 |
+
$size = $generator->getQty();
|
15 |
+
|
16 |
+
$maxProbability = $generator->getMaxProbability() ? $generator->getMaxProbability() : $generator::MAX_PROBABILITY_OF_GUESSING;
|
17 |
+
$maxAttempts = $generator->getMaxAttempts() ? $generator->getMaxAttempts() : $generator::MAX_GENERATE_ATTEMPTS;
|
18 |
+
|
19 |
+
$coupon = Mage::getModel('salesrule/coupon');
|
20 |
+
|
21 |
+
$chars = count(Mage::helper('salesrule/coupon')->getCharset($generator->getFormat()));
|
22 |
+
$length = (int) $generator->getLength();
|
23 |
+
$maxCodes = pow($chars, $length);
|
24 |
+
$probability = $size / $maxCodes;
|
25 |
+
|
26 |
+
//increase the length of Code if probability is low
|
27 |
+
if ($probability > $maxProbability) {
|
28 |
+
do {
|
29 |
+
$length++;
|
30 |
+
$maxCodes = pow($chars, $length);
|
31 |
+
$probability = $size / $maxCodes;
|
32 |
+
} while ($probability > $maxProbability);
|
33 |
+
$generator->setLength($length);
|
34 |
+
}
|
35 |
+
|
36 |
+
$now = $generator->getResource()->formatDate(
|
37 |
+
Mage::getSingleton('core/date')->gmtTimestamp()
|
38 |
+
);
|
39 |
+
|
40 |
+
$attempt = 0;
|
41 |
+
do {
|
42 |
+
if ($attempt >= $maxAttempts) {
|
43 |
+
break;
|
44 |
+
}
|
45 |
+
$code = $generator->generateCode();
|
46 |
+
$attempt++;
|
47 |
+
} while ($generator->getResource()->exists($code));
|
48 |
+
|
49 |
+
$expirationDate = $generator->getToDate();
|
50 |
+
if ($expirationDate instanceof Zend_Date) {
|
51 |
+
$expirationDate = $expirationDate->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
|
52 |
+
}
|
53 |
+
|
54 |
+
$coupon->setId(null)
|
55 |
+
->setRuleId($generator->getRuleId())
|
56 |
+
->setUsageLimit($generator->getUsesPerCoupon())
|
57 |
+
->setUsagePerCustomer($generator->getUsesPerCustomer())
|
58 |
+
->setExpirationDate($expirationDate)
|
59 |
+
->setCreatedAt($now)
|
60 |
+
->setType(Mage_SalesRule_Helper_Coupon::COUPON_TYPE_SPECIFIC_AUTOGENERATED)
|
61 |
+
->setCode($code)
|
62 |
+
->save();
|
63 |
+
|
64 |
+
return $coupon;
|
65 |
+
}
|
66 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Observer/Abstract.php
ADDED
@@ -0,0 +1,17 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
abstract class Lipscore_RatingsReviews_Model_Observer_Abstract
|
4 |
+
{
|
5 |
+
protected $moduleHelper;
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
$this->moduleHelper = Mage::helper('lipscore_ratingsreviews/module');
|
10 |
+
}
|
11 |
+
|
12 |
+
public function __call($method, $arguments) {
|
13 |
+
if ($this->moduleHelper->isLipscoreModuleEnabled()) {
|
14 |
+
call_user_func_array(array($this, $method), $arguments);
|
15 |
+
}
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Observer/Module.php
ADDED
@@ -0,0 +1,22 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_Observer_Module extends Lipscore_RatingsReviews_Model_Observer_Abstract
|
4 |
+
{
|
5 |
+
public function checkVersion(Varien_Event_Observer $observer)
|
6 |
+
{
|
7 |
+
try {
|
8 |
+
$this->_checkVersion($observer);
|
9 |
+
} catch (Exception $e) {
|
10 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
private function _checkVersion(Varien_Event_Observer $observer)
|
15 |
+
{
|
16 |
+
if ($this->moduleHelper->isNewVersion()) {
|
17 |
+
$website = Mage::app()->getWebsite();
|
18 |
+
$tracker = Mage::getModel('lipscore_ratingsreviews/tracker_installation');
|
19 |
+
$tracker->trackUpgrade($website);
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Observer/Order/Status.php
ADDED
@@ -0,0 +1,110 @@
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_Observer_Order_Status extends Lipscore_RatingsReviews_Model_Observer_Abstract
|
4 |
+
{
|
5 |
+
public function fetch(Varien_Event_Observer $observer)
|
6 |
+
{
|
7 |
+
try {
|
8 |
+
$this->_fetch($observer);
|
9 |
+
} catch (Exception $e) {
|
10 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
private function _fetch(Varien_Event_Observer $observer)
|
15 |
+
{
|
16 |
+
$this->log(date('Y-m-d H:i:s') . ' start fetch');
|
17 |
+
$order = $observer->getEvent()->getOrder();
|
18 |
+
|
19 |
+
$savedStatus = $this->fetchFromRegistery($order);
|
20 |
+
$this->log('saved status: ' . $savedStatus);
|
21 |
+
if (!$savedStatus) {
|
22 |
+
$this->saveToRegistery($order);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
public function check(Varien_Event_Observer $observer)
|
27 |
+
{
|
28 |
+
try {
|
29 |
+
$this->_check($observer);
|
30 |
+
} catch (Exception $e) {
|
31 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
private function _check(Varien_Event_Observer $observer)
|
36 |
+
{
|
37 |
+
$this->log(date('Y-m-d H:i:s') . ' start check');
|
38 |
+
$order = $observer->getEvent()->getOrder();
|
39 |
+
$storeId = $order->getStoreId();
|
40 |
+
|
41 |
+
$oldStatus = $this->fetchFromRegistery($order);
|
42 |
+
$this->log('old status: ' . $oldStatus);
|
43 |
+
$currentStatus = $observer->getOrder()->getStatus();
|
44 |
+
$this->log('current status: ' . $currentStatus);
|
45 |
+
$statusChanged = ($oldStatus != $currentStatus);
|
46 |
+
$this->log('status change: ' . (int) $statusChanged);
|
47 |
+
if (!$statusChanged) {
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
+
$properStatus = $this->isReminderableStatus($currentStatus, $storeId);
|
52 |
+
$this->log('proper status: ' . (int) $properStatus);
|
53 |
+
if ($properStatus) {
|
54 |
+
$this->log('SEND!');
|
55 |
+
$res = $this->reminder($storeId)->sendSingle($order);
|
56 |
+
$this->log($res);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
private function fetchFromRegistery($order)
|
61 |
+
{
|
62 |
+
$key = $this->statusKey($order);
|
63 |
+
$this->log('fetch key: ' . $key);
|
64 |
+
return $key ? Mage::registry($key) : '';
|
65 |
+
}
|
66 |
+
|
67 |
+
private function saveToRegistery($order)
|
68 |
+
{
|
69 |
+
$key = $this->statusKey($order);
|
70 |
+
$this->log('save key: ' . $key);
|
71 |
+
if ($key) {
|
72 |
+
return Mage::register($key, $order->getStatus());
|
73 |
+
}
|
74 |
+
}
|
75 |
+
|
76 |
+
private function statusKey($order)
|
77 |
+
{
|
78 |
+
$orderId = $order->getId();
|
79 |
+
return $orderId ? "lipscore_order_status_$orderId" : '';
|
80 |
+
}
|
81 |
+
|
82 |
+
private function isReminderableStatus($status, $storeId)
|
83 |
+
{
|
84 |
+
$reminderableStatus = $this->config($storeId)->singleReminderStatus();
|
85 |
+
$this->log('reminderable status: ' . $reminderableStatus);
|
86 |
+
if (!$reminderableStatus) {
|
87 |
+
return false;
|
88 |
+
} else {
|
89 |
+
return strtolower($status) == strtolower($reminderableStatus);
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
private function reminder($storeId)
|
94 |
+
{
|
95 |
+
return Mage::getModel(
|
96 |
+
'lipscore_ratingsreviews/purchase_reminder',
|
97 |
+
array('timeout' => $this->config($storeId)->singleReminderTimeout())
|
98 |
+
);
|
99 |
+
}
|
100 |
+
|
101 |
+
private function config($storeId)
|
102 |
+
{
|
103 |
+
return Mage::helper('lipscore_ratingsreviews/config')->getScoped(null, $storeId);
|
104 |
+
}
|
105 |
+
|
106 |
+
private function log($message)
|
107 |
+
{
|
108 |
+
//file_put_contents(Mage::getBaseDir('var') . '/log/order_status.log', print_r($message, true) . "\n", FILE_APPEND);
|
109 |
+
}
|
110 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/{Observer.php → Observer/Output.php}
RENAMED
@@ -1,114 +1,131 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class
|
4 |
-
{
|
5 |
-
const REVIEW_MODULE = 'Mage_Review';
|
6 |
-
const RATING_MODULE = 'Mage_Rating';
|
7 |
-
|
8 |
-
const REVIEW_TITLE_PLACEHOLDER = 'lipscore_reviews_placeholder';
|
9 |
-
|
10 |
-
public function
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
$this->
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
}
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
);
|
61 |
-
}
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
$
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
$
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_Observer_Output extends Lipscore_RatingsReviews_Model_Observer_Abstract
|
4 |
+
{
|
5 |
+
const REVIEW_MODULE = 'Mage_Review';
|
6 |
+
const RATING_MODULE = 'Mage_Rating';
|
7 |
+
|
8 |
+
const REVIEW_TITLE_PLACEHOLDER = 'lipscore_reviews_placeholder';
|
9 |
+
|
10 |
+
public function manageMageReviewModule(Varien_Event_Observer $observer)
|
11 |
+
{
|
12 |
+
try {
|
13 |
+
$this->_manageMageReviewModule($observer);
|
14 |
+
} catch (Exception $e) {
|
15 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function _manageMageReviewModule(Varien_Event_Observer $observer)
|
20 |
+
{
|
21 |
+
if (!Mage::helper('core/data')->isModuleEnabled(self::REVIEW_MODULE)) {
|
22 |
+
$nodePath = 'modules/' . self::REVIEW_MODULE . '/active';
|
23 |
+
Mage::getConfig()->setNode($nodePath, 'true', true);
|
24 |
+
}
|
25 |
+
|
26 |
+
$this->disableModuleOutput(self::REVIEW_MODULE);
|
27 |
+
$this->disableModuleOutput(self::RATING_MODULE);
|
28 |
+
|
29 |
+
$nodePath = 'global/blocks/review/rewrite/helper';
|
30 |
+
Mage::getConfig()->setNode($nodePath, 'Lipscore_RatingsReviews_Block_Review_Helper', true);
|
31 |
+
|
32 |
+
$nodePath = 'global/blocks/catalog/rewrite/product_view';
|
33 |
+
Mage::getConfig()->setNode($nodePath, 'Lipscore_RatingsReviews_Block_Catalog_Product_View', true);
|
34 |
+
}
|
35 |
+
|
36 |
+
public function addRatings(Varien_Event_Observer $observer)
|
37 |
+
{
|
38 |
+
try {
|
39 |
+
$this->_addRatings($observer);
|
40 |
+
} catch (Exception $e) {
|
41 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
protected function _addRatings(Varien_Event_Observer $observer)
|
46 |
+
{
|
47 |
+
$collection = $observer->getEvent()->getCollection();
|
48 |
+
if ($collection->count()) {
|
49 |
+
foreach ($collection as $product) {
|
50 |
+
$product->setData('rating_summary', 1);
|
51 |
+
}
|
52 |
+
}
|
53 |
+
|
54 |
+
return $this;
|
55 |
+
}
|
56 |
+
|
57 |
+
public function addReviewsTab(Varien_Event_Observer $observer)
|
58 |
+
{
|
59 |
+
try {
|
60 |
+
$this->_addReviewsTab($observer);
|
61 |
+
} catch (Exception $e) {
|
62 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
protected function _addReviewsTab(Varien_Event_Observer $observer)
|
67 |
+
{
|
68 |
+
$layout = $observer->getEvent()->getLayout();
|
69 |
+
|
70 |
+
if (!$layout) {
|
71 |
+
return;
|
72 |
+
}
|
73 |
+
|
74 |
+
$tabs = $layout->getBlock('product.info.tabs');
|
75 |
+
if ($tabs) {
|
76 |
+
$tabs->addTab(
|
77 |
+
'lipscore.reviews', self::REVIEW_TITLE_PLACEHOLDER, 'lipscore_ratingsreviews/catalog_product_reviews',
|
78 |
+
'lipscore/reviews/view.phtml'
|
79 |
+
);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
public function addReviewsFeatures(Varien_Event_Observer $observer)
|
84 |
+
{
|
85 |
+
try {
|
86 |
+
$this->_addReviewsFeatures($observer);
|
87 |
+
} catch (Exception $e) {
|
88 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
protected function _addReviewsFeatures(Varien_Event_Observer $observer)
|
93 |
+
{
|
94 |
+
$block = $observer->getBlock();
|
95 |
+
$layout = $block->getLayout();
|
96 |
+
|
97 |
+
if (!$layout) {
|
98 |
+
return;
|
99 |
+
}
|
100 |
+
|
101 |
+
$layoutHandles = $layout->getUpdate()->getHandles();
|
102 |
+
$properLayout = in_array('catalog_product_view', $layoutHandles);
|
103 |
+
$properBlock = $block->getNameInLayout() == 'product.info';
|
104 |
+
|
105 |
+
if ($properLayout && $properBlock) {
|
106 |
+
$transport = $observer->getTransport();
|
107 |
+
$html = $transport->getHtml();
|
108 |
+
|
109 |
+
// set review title
|
110 |
+
$titleBlock = $block->getLayout()->createBlock('lipscore_ratingsreviews/review_tabtitle');
|
111 |
+
$html = str_replace(self::REVIEW_TITLE_PLACEHOLDER, $titleBlock->toHtml(), $html);
|
112 |
+
|
113 |
+
// ensure that reviews block exists on a page
|
114 |
+
$pos = strripos($html, 'lipscore-review-list');
|
115 |
+
if ($pos === false) {
|
116 |
+
$reviewsBlock = $block->getLayout()->createBlock('lipscore_ratingsreviews/review_single');
|
117 |
+
$html .= $reviewsBlock->toHtml();
|
118 |
+
}
|
119 |
+
|
120 |
+
$transport->setHtml($html);
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
protected function disableModuleOutput($moduleName)
|
125 |
+
{
|
126 |
+
$outputPath = 'advanced/modules_disable_output/' . $moduleName;
|
127 |
+
if (!Mage::getStoreConfig($outputPath)) {
|
128 |
+
Mage::app()->getStore()->setConfig($outputPath, true);
|
129 |
+
}
|
130 |
+
}
|
131 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Purchase/Reminder.php
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Model_Purchase_Reminder
|
4 |
-
{
|
5 |
-
protected $lipscoreConfig;
|
6 |
-
protected $sender;
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
$
|
13 |
-
|
14 |
-
|
15 |
-
$this->
|
16 |
-
|
17 |
-
'
|
18 |
-
'
|
19 |
-
));
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
$
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
}
|
39 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_Purchase_Reminder
|
4 |
+
{
|
5 |
+
protected $lipscoreConfig;
|
6 |
+
protected $sender;
|
7 |
+
protected $dataHelper;
|
8 |
+
|
9 |
+
public function __construct($params)
|
10 |
+
{
|
11 |
+
$websiteCode = isset($params['websiteCode']) ? $params['websiteCode'] : null;
|
12 |
+
$storeCode = isset($params['storeCode']) ? $params['storeCode'] : null;
|
13 |
+
|
14 |
+
$this->lipscoreConfig = Mage::helper('lipscore_ratingsreviews/config')->getScoped($websiteCode, $storeCode);
|
15 |
+
$this->sender = Mage::getModel('lipscore_ratingsreviews/api_request', array(
|
16 |
+
'lipscoreConfig' => $this->lipscoreConfig,
|
17 |
+
'path' => 'purchases',
|
18 |
+
'timeout' => isset($params['timeout']) ? $params['timeout'] : null
|
19 |
+
));
|
20 |
+
$this->dataHelper = Mage::helper('lipscore_ratingsreviews/reminder');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function sendSingle($order)
|
24 |
+
{
|
25 |
+
$data = $this->dataHelper->orderData($order);
|
26 |
+
return $this->sender->send($data);
|
27 |
+
}
|
28 |
+
|
29 |
+
public function sendMultiple($orders)
|
30 |
+
{
|
31 |
+
$data = array();
|
32 |
+
|
33 |
+
foreach ($orders as $order) {
|
34 |
+
$data[] = $this->dataHelper->orderData($order);
|
35 |
+
}
|
36 |
+
|
37 |
+
return $this->sender->send(array('purchases' => $data));
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Shop.php
CHANGED
@@ -1,52 +1,52 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Model_Shop
|
4 |
-
{
|
5 |
-
protected $name;
|
6 |
-
protected $url;
|
7 |
-
protected $contactName;
|
8 |
-
protected $contactEmail;
|
9 |
-
protected $country;
|
10 |
-
protected $langs;
|
11 |
-
|
12 |
-
public function __construct($params)
|
13 |
-
{
|
14 |
-
$this->checkParameter($params, 'website');
|
15 |
-
|
16 |
-
$website = $params['website'];
|
17 |
-
|
18 |
-
$this->name = $website->getName();
|
19 |
-
$this->url = $website->getConfig('web/unsecure/base_url');
|
20 |
-
$this->contactName = $website->getConfig('trans_email/ident_general/name');
|
21 |
-
$this->contactEmail = $website->getConfig('trans_email/ident_general/email');
|
22 |
-
$this->country = $website->getConfig('general/store_information/merchant_country');
|
23 |
-
$this->langs = $this->findLangs($website);
|
24 |
-
}
|
25 |
-
|
26 |
-
public function __get($name) {
|
27 |
-
if (property_exists($this, $name)) {
|
28 |
-
return $this->$name;
|
29 |
-
} else {
|
30 |
-
new Exception("Undefined property $name");
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
protected function checkParameter($params, $name)
|
35 |
-
{
|
36 |
-
if (empty($params[$name])) {
|
37 |
-
throw new Exception("$name parameter is empty");
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
-
protected function findLangs($website)
|
42 |
-
{
|
43 |
-
$langs = array();
|
44 |
-
$stores = $website->getStores();
|
45 |
-
|
46 |
-
foreach ($stores as $store) {
|
47 |
-
$langs[] = $store->getConfig('general/locale/code');
|
48 |
-
}
|
49 |
-
|
50 |
-
return array_unique($langs);
|
51 |
-
}
|
52 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_Shop
|
4 |
+
{
|
5 |
+
protected $name;
|
6 |
+
protected $url;
|
7 |
+
protected $contactName;
|
8 |
+
protected $contactEmail;
|
9 |
+
protected $country;
|
10 |
+
protected $langs;
|
11 |
+
|
12 |
+
public function __construct($params)
|
13 |
+
{
|
14 |
+
$this->checkParameter($params, 'website');
|
15 |
+
|
16 |
+
$website = $params['website'];
|
17 |
+
|
18 |
+
$this->name = $website->getName();
|
19 |
+
$this->url = $website->getConfig('web/unsecure/base_url');
|
20 |
+
$this->contactName = $website->getConfig('trans_email/ident_general/name');
|
21 |
+
$this->contactEmail = $website->getConfig('trans_email/ident_general/email');
|
22 |
+
$this->country = $website->getConfig('general/store_information/merchant_country');
|
23 |
+
$this->langs = $this->findLangs($website);
|
24 |
+
}
|
25 |
+
|
26 |
+
public function __get($name) {
|
27 |
+
if (property_exists($this, $name)) {
|
28 |
+
return $this->$name;
|
29 |
+
} else {
|
30 |
+
new Exception("Undefined property $name");
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
protected function checkParameter($params, $name)
|
35 |
+
{
|
36 |
+
if (empty($params[$name])) {
|
37 |
+
throw new Exception("$name parameter is empty");
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
protected function findLangs($website)
|
42 |
+
{
|
43 |
+
$langs = array();
|
44 |
+
$stores = $website->getStores();
|
45 |
+
|
46 |
+
foreach ($stores as $store) {
|
47 |
+
$langs[] = $store->getConfig('general/locale/code');
|
48 |
+
}
|
49 |
+
|
50 |
+
return array_unique($langs);
|
51 |
+
}
|
52 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/System/Config/Backend/Apikey.php
CHANGED
@@ -1,72 +1,72 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Model_System_Config_Backend_Apikey extends Mage_Core_Model_Config_Data
|
4 |
-
{
|
5 |
-
protected $trackedWebsites = array();
|
6 |
-
|
7 |
-
protected function _afterSave()
|
8 |
-
{
|
9 |
-
parent::_afterSave();
|
10 |
-
|
11 |
-
if (!$this->isValueChanged()) {
|
12 |
-
return $this;
|
13 |
-
}
|
14 |
-
|
15 |
-
try {
|
16 |
-
$this->findSitesForTracking();
|
17 |
-
} catch (Exception $e) {
|
18 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
19 |
-
}
|
20 |
-
|
21 |
-
return $this;
|
22 |
-
}
|
23 |
-
|
24 |
-
public function afterCommitCallback()
|
25 |
-
{
|
26 |
-
parent::afterCommitCallback();
|
27 |
-
|
28 |
-
try {
|
29 |
-
$this->trackChanges();
|
30 |
-
} catch (Exception $e) {
|
31 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
32 |
-
}
|
33 |
-
|
34 |
-
return $this;
|
35 |
-
}
|
36 |
-
|
37 |
-
protected function findSitesForTracking()
|
38 |
-
{
|
39 |
-
$storeCode = $this->getStoreCode();
|
40 |
-
if (!empty($storeCode)) {
|
41 |
-
return;
|
42 |
-
}
|
43 |
-
|
44 |
-
$websiteCode = $this->getWebsiteCode();
|
45 |
-
|
46 |
-
if ($websiteCode) {
|
47 |
-
$this->trackedWebsites[] = Mage::app()->getWebsite($websiteCode);
|
48 |
-
} else {
|
49 |
-
$path = $this->getPath();
|
50 |
-
foreach (Mage::app()->getWebsites() as $website) {
|
51 |
-
$inherit = false;
|
52 |
-
Mage::getModel('adminhtml/config_data')
|
53 |
-
->setSection('lipscore_general')
|
54 |
-
->setWebsite($website->getCode())
|
55 |
-
->getConfigDataValue($path, $inherit);
|
56 |
-
if ($inherit) {
|
57 |
-
$this->trackedWebsites[] = $website;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
-
}
|
62 |
-
|
63 |
-
protected function trackChanges()
|
64 |
-
{
|
65 |
-
Mage::app()->getConfig()->reinit();
|
66 |
-
|
67 |
-
$tracker = Mage::getModel('lipscore_ratingsreviews/tracker_action');
|
68 |
-
foreach ($this->trackedWebsites as $website) {
|
69 |
-
$tracker->track(Lipscore_RatingsReviews_Model_Tracker_Action::API_KEY_UPDATED, $website);
|
70 |
-
}
|
71 |
-
}
|
72 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_System_Config_Backend_Apikey extends Mage_Core_Model_Config_Data
|
4 |
+
{
|
5 |
+
protected $trackedWebsites = array();
|
6 |
+
|
7 |
+
protected function _afterSave()
|
8 |
+
{
|
9 |
+
parent::_afterSave();
|
10 |
+
|
11 |
+
if (!$this->isValueChanged()) {
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
|
15 |
+
try {
|
16 |
+
$this->findSitesForTracking();
|
17 |
+
} catch (Exception $e) {
|
18 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
19 |
+
}
|
20 |
+
|
21 |
+
return $this;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function afterCommitCallback()
|
25 |
+
{
|
26 |
+
parent::afterCommitCallback();
|
27 |
+
|
28 |
+
try {
|
29 |
+
$this->trackChanges();
|
30 |
+
} catch (Exception $e) {
|
31 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
32 |
+
}
|
33 |
+
|
34 |
+
return $this;
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function findSitesForTracking()
|
38 |
+
{
|
39 |
+
$storeCode = $this->getStoreCode();
|
40 |
+
if (!empty($storeCode)) {
|
41 |
+
return;
|
42 |
+
}
|
43 |
+
|
44 |
+
$websiteCode = $this->getWebsiteCode();
|
45 |
+
|
46 |
+
if ($websiteCode) {
|
47 |
+
$this->trackedWebsites[] = Mage::app()->getWebsite($websiteCode);
|
48 |
+
} else {
|
49 |
+
$path = $this->getPath();
|
50 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
51 |
+
$inherit = false;
|
52 |
+
Mage::getModel('adminhtml/config_data')
|
53 |
+
->setSection('lipscore_general')
|
54 |
+
->setWebsite($website->getCode())
|
55 |
+
->getConfigDataValue($path, $inherit);
|
56 |
+
if ($inherit) {
|
57 |
+
$this->trackedWebsites[] = $website;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
protected function trackChanges()
|
64 |
+
{
|
65 |
+
Mage::app()->getConfig()->reinit();
|
66 |
+
|
67 |
+
$tracker = Mage::getModel('lipscore_ratingsreviews/tracker_action');
|
68 |
+
foreach ($this->trackedWebsites as $website) {
|
69 |
+
$tracker->track(Lipscore_RatingsReviews_Model_Tracker_Action::API_KEY_UPDATED, $website);
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/System/Config/Source/Locale.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Model_System_Config_Source_Locale
|
4 |
-
{
|
5 |
-
public function toOptionArray()
|
6 |
-
{
|
7 |
-
return array(
|
8 |
-
array('value' => 'auto', 'label' => Mage::helper('adminhtml')->__('Auto')),
|
9 |
-
array('value' => 'cz', 'label' => Mage::helper('adminhtml')->__('Czech')),
|
10 |
-
array('value' => 'dk', 'label' => Mage::helper('adminhtml')->__('Danish')),
|
11 |
-
array('value' => 'nl', 'label' => Mage::helper('adminhtml')->__('Dutch')),
|
12 |
-
array('value' => 'en', 'label' => Mage::helper('adminhtml')->__('English')),
|
13 |
-
array('value' => 'de', 'label' => Mage::helper('adminhtml')->__('German')),
|
14 |
-
array('value' => 'it', 'label' => Mage::helper('adminhtml')->__('Italian')),
|
15 |
-
array('value' => 'ja', 'label' => Mage::helper('adminhtml')->__('Japanese')),
|
16 |
-
array('value' => 'no', 'label' => Mage::helper('adminhtml')->__('Norwegian')),
|
17 |
-
array('value' => 'br', 'label' => Mage::helper('adminhtml')->__('Portuguese (Brazil)')),
|
18 |
-
array('value' => 'ru', 'label' => Mage::helper('adminhtml')->__('Russian')),
|
19 |
-
array('value' => 'es', 'label' => Mage::helper('adminhtml')->__('Spanish')),
|
20 |
-
array('value' => 'se', 'label' => Mage::helper('adminhtml')->__('Swedish')),
|
21 |
-
);
|
22 |
-
}
|
23 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_System_Config_Source_Locale
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
return array(
|
8 |
+
array('value' => 'auto', 'label' => Mage::helper('adminhtml')->__('Auto')),
|
9 |
+
array('value' => 'cz', 'label' => Mage::helper('adminhtml')->__('Czech')),
|
10 |
+
array('value' => 'dk', 'label' => Mage::helper('adminhtml')->__('Danish')),
|
11 |
+
array('value' => 'nl', 'label' => Mage::helper('adminhtml')->__('Dutch')),
|
12 |
+
array('value' => 'en', 'label' => Mage::helper('adminhtml')->__('English')),
|
13 |
+
array('value' => 'de', 'label' => Mage::helper('adminhtml')->__('German')),
|
14 |
+
array('value' => 'it', 'label' => Mage::helper('adminhtml')->__('Italian')),
|
15 |
+
array('value' => 'ja', 'label' => Mage::helper('adminhtml')->__('Japanese')),
|
16 |
+
array('value' => 'no', 'label' => Mage::helper('adminhtml')->__('Norwegian')),
|
17 |
+
array('value' => 'br', 'label' => Mage::helper('adminhtml')->__('Portuguese (Brazil)')),
|
18 |
+
array('value' => 'ru', 'label' => Mage::helper('adminhtml')->__('Russian')),
|
19 |
+
array('value' => 'es', 'label' => Mage::helper('adminhtml')->__('Spanish')),
|
20 |
+
array('value' => 'se', 'label' => Mage::helper('adminhtml')->__('Swedish')),
|
21 |
+
);
|
22 |
+
}
|
23 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/System/Config/Source/Order/Status.php
CHANGED
@@ -1,17 +1,30 @@
|
|
1 |
-
<?php
|
2 |
-
class Lipscore_RatingsReviews_Model_System_Config_Source_Order_Status
|
3 |
-
{
|
4 |
-
public function toOptionArray()
|
5 |
-
{
|
6 |
-
$
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
);
|
14 |
-
}
|
15 |
-
|
16 |
-
|
17 |
-
}
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?php
|
2 |
+
class Lipscore_RatingsReviews_Model_System_Config_Source_Order_Status
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
$options = array(
|
7 |
+
array('value' =>'', 'label' => Mage::helper('adminhtml')->__('--Please Select--'))
|
8 |
+
);
|
9 |
+
|
10 |
+
try {
|
11 |
+
$options = $this->collectStatuses($options);
|
12 |
+
} catch (Exception $e) {
|
13 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
14 |
+
}
|
15 |
+
|
16 |
+
return $options;
|
17 |
+
}
|
18 |
+
|
19 |
+
protected function collectStatuses($options)
|
20 |
+
{
|
21 |
+
$statuses = Mage::getSingleton('sales/order_config')->getStatuses();
|
22 |
+
foreach ($statuses as $code => $label) {
|
23 |
+
$options[] = array(
|
24 |
+
'value' => $code,
|
25 |
+
'label' => $label
|
26 |
+
);
|
27 |
+
}
|
28 |
+
return $options;
|
29 |
+
}
|
30 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/System/Config/Source/Pricerule.php
CHANGED
@@ -1,45 +1,45 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Model_System_Config_Source_Pricerule
|
4 |
-
{
|
5 |
-
public function toOptionArray()
|
6 |
-
{
|
7 |
-
$attrs = array(
|
8 |
-
array('value' => '', 'label' => Mage::helper('adminhtml')->__('--Please Select--'))
|
9 |
-
);
|
10 |
-
|
11 |
-
try {
|
12 |
-
$attrs = array_merge($attrs, $this->_findAttrs());
|
13 |
-
} catch (Exception $e) {
|
14 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
15 |
-
}
|
16 |
-
|
17 |
-
return $attrs;
|
18 |
-
}
|
19 |
-
|
20 |
-
protected function _findAttrs()
|
21 |
-
{
|
22 |
-
$attrs = array();
|
23 |
-
|
24 |
-
if (!Mage::helper('lipscore_ratingsreviews/coupon')->isAutoGenerationSupported()) {
|
25 |
-
// magento doesn't support auto generation
|
26 |
-
return $attrs;
|
27 |
-
}
|
28 |
-
|
29 |
-
$collection = Mage::getModel('salesrule/rule')
|
30 |
-
->getResourceCollection()
|
31 |
-
->addFieldToFilter('coupon_type', Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC)
|
32 |
-
->addFieldToFilter('use_auto_generation', '1');
|
33 |
-
|
34 |
-
if ($collection->getSize() > 0) {
|
35 |
-
foreach ($collection->getItems() as $rule) {
|
36 |
-
$attrs[] = array(
|
37 |
-
'value' => $rule->getRuleId(),
|
38 |
-
'label' => $rule->getName()
|
39 |
-
);
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
return $attrs;
|
44 |
-
}
|
45 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_System_Config_Source_Pricerule
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
$attrs = array(
|
8 |
+
array('value' => '', 'label' => Mage::helper('adminhtml')->__('--Please Select--'))
|
9 |
+
);
|
10 |
+
|
11 |
+
try {
|
12 |
+
$attrs = array_merge($attrs, $this->_findAttrs());
|
13 |
+
} catch (Exception $e) {
|
14 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
15 |
+
}
|
16 |
+
|
17 |
+
return $attrs;
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _findAttrs()
|
21 |
+
{
|
22 |
+
$attrs = array();
|
23 |
+
|
24 |
+
if (!Mage::helper('lipscore_ratingsreviews/coupon')->isAutoGenerationSupported()) {
|
25 |
+
// magento doesn't support auto generation
|
26 |
+
return $attrs;
|
27 |
+
}
|
28 |
+
|
29 |
+
$collection = Mage::getModel('salesrule/rule')
|
30 |
+
->getResourceCollection()
|
31 |
+
->addFieldToFilter('coupon_type', Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC)
|
32 |
+
->addFieldToFilter('use_auto_generation', '1');
|
33 |
+
|
34 |
+
if ($collection->getSize() > 0) {
|
35 |
+
foreach ($collection->getItems() as $rule) {
|
36 |
+
$attrs[] = array(
|
37 |
+
'value' => $rule->getRuleId(),
|
38 |
+
'label' => $rule->getName()
|
39 |
+
);
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
return $attrs;
|
44 |
+
}
|
45 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/System/Config/Source/Productattr/Brand.php
CHANGED
@@ -1,40 +1,40 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Model_System_Config_Source_Productattr_Brand
|
4 |
-
{
|
5 |
-
public function toOptionArray()
|
6 |
-
{
|
7 |
-
$attrs = array(
|
8 |
-
array('value' =>'', 'label' => Mage::helper('adminhtml')->__('--Please Select--'))
|
9 |
-
);
|
10 |
-
|
11 |
-
try {
|
12 |
-
$attrs = array_merge($attrs, $this->_findAttrs());
|
13 |
-
} catch (Exception $e) {
|
14 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
15 |
-
}
|
16 |
-
|
17 |
-
return $attrs;
|
18 |
-
}
|
19 |
-
|
20 |
-
protected function _findAttrs()
|
21 |
-
{
|
22 |
-
$attrs = array();
|
23 |
-
|
24 |
-
$collection = Mage::getResourceModel('catalog/product_attribute_collection')
|
25 |
-
->addStoreLabel(Mage::app()->getStore()->getId())
|
26 |
-
->addFieldToFilter('frontend_input', array('in' => array('text', 'select')))
|
27 |
-
->addVisibleFilter();
|
28 |
-
|
29 |
-
if ($collection->getSize() > 0) {
|
30 |
-
foreach ($collection->getItems() as $attr) {
|
31 |
-
$attrs[] = array(
|
32 |
-
'value' => $attr->getAttributeCode(),
|
33 |
-
'label' => $attr->getStoreLabel()
|
34 |
-
);
|
35 |
-
}
|
36 |
-
}
|
37 |
-
|
38 |
-
return $attrs;
|
39 |
-
}
|
40 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Model_System_Config_Source_Productattr_Brand
|
4 |
+
{
|
5 |
+
public function toOptionArray()
|
6 |
+
{
|
7 |
+
$attrs = array(
|
8 |
+
array('value' =>'', 'label' => Mage::helper('adminhtml')->__('--Please Select--'))
|
9 |
+
);
|
10 |
+
|
11 |
+
try {
|
12 |
+
$attrs = array_merge($attrs, $this->_findAttrs());
|
13 |
+
} catch (Exception $e) {
|
14 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
15 |
+
}
|
16 |
+
|
17 |
+
return $attrs;
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function _findAttrs()
|
21 |
+
{
|
22 |
+
$attrs = array();
|
23 |
+
|
24 |
+
$collection = Mage::getResourceModel('catalog/product_attribute_collection')
|
25 |
+
->addStoreLabel(Mage::app()->getStore()->getId())
|
26 |
+
->addFieldToFilter('frontend_input', array('in' => array('text', 'select')))
|
27 |
+
->addVisibleFilter();
|
28 |
+
|
29 |
+
if ($collection->getSize() > 0) {
|
30 |
+
foreach ($collection->getItems() as $attr) {
|
31 |
+
$attrs[] = array(
|
32 |
+
'value' => $attr->getAttributeCode(),
|
33 |
+
'label' => $attr->getStoreLabel()
|
34 |
+
);
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
return $attrs;
|
39 |
+
}
|
40 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/System/Config/Source/Reminderperiod.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
<?php
|
2 |
-
class Lipscore_RatingsReviews_Model_System_Config_Source_Reminderperiod
|
3 |
-
{
|
4 |
-
public function toOptionArray()
|
5 |
-
{
|
6 |
-
return array(
|
7 |
-
array('value' =>'', 'label' => Mage::helper('adminhtml')->__('--Please Select--')),
|
8 |
-
array('value' => '1 week', 'label' => Mage::helper('adminhtml')->__('1 week')),
|
9 |
-
array('value' => '1 month', 'label' => Mage::helper('adminhtml')->__('1 month')),
|
10 |
-
array('value' => '3 months', 'label' => Mage::helper('adminhtml')->__('3 months')),
|
11 |
-
);
|
12 |
-
}
|
13 |
-
}
|
1 |
+
<?php
|
2 |
+
class Lipscore_RatingsReviews_Model_System_Config_Source_Reminderperiod
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value' =>'', 'label' => Mage::helper('adminhtml')->__('--Please Select--')),
|
8 |
+
array('value' => '1 week', 'label' => Mage::helper('adminhtml')->__('1 week')),
|
9 |
+
array('value' => '1 month', 'label' => Mage::helper('adminhtml')->__('1 month')),
|
10 |
+
array('value' => '3 months', 'label' => Mage::helper('adminhtml')->__('3 months')),
|
11 |
+
);
|
12 |
+
}
|
13 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Tracker/Action.php
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
-
<?php
|
2 |
-
class Lipscore_RatingsReviews_Model_Tracker_Action
|
3 |
-
{
|
4 |
-
const APP_INSTALLED = 'installed';
|
5 |
-
const API_KEY_UPDATED = 'api_key_updated';
|
6 |
-
|
7 |
-
public function track($actionType, $website)
|
8 |
-
{
|
9 |
-
$lipscoreConfig = Mage::helper('lipscore_ratingsreviews/config')->getScoped($website->getCode(), null);
|
10 |
-
|
11 |
-
$installationId = $lipscoreConfig->pluginInstallationId();
|
12 |
-
if (empty($installationId)) {
|
13 |
-
return false;
|
14 |
-
}
|
15 |
-
|
16 |
-
$sender = $this->getSender($lipscoreConfig, $installationId);
|
17 |
-
$data = array('action_type' => $actionType);
|
18 |
-
|
19 |
-
return $sender->send($data);
|
20 |
-
}
|
21 |
-
|
22 |
-
protected function getSender($lipscoreConfig, $installationId)
|
23 |
-
{
|
24 |
-
return Mage::getModel('lipscore_ratingsreviews/api_request', array(
|
25 |
-
'lipscoreConfig' => $lipscoreConfig,
|
26 |
-
'path' => "plugin_installations/$installationId/actions"
|
27 |
-
));
|
28 |
-
}
|
29 |
-
}
|
1 |
+
<?php
|
2 |
+
class Lipscore_RatingsReviews_Model_Tracker_Action
|
3 |
+
{
|
4 |
+
const APP_INSTALLED = 'installed';
|
5 |
+
const API_KEY_UPDATED = 'api_key_updated';
|
6 |
+
|
7 |
+
public function track($actionType, $website)
|
8 |
+
{
|
9 |
+
$lipscoreConfig = Mage::helper('lipscore_ratingsreviews/config')->getScoped($website->getCode(), null);
|
10 |
+
|
11 |
+
$installationId = $lipscoreConfig->pluginInstallationId();
|
12 |
+
if (empty($installationId)) {
|
13 |
+
return false;
|
14 |
+
}
|
15 |
+
|
16 |
+
$sender = $this->getSender($lipscoreConfig, $installationId);
|
17 |
+
$data = array('action_type' => $actionType);
|
18 |
+
|
19 |
+
return $sender->send($data);
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function getSender($lipscoreConfig, $installationId)
|
23 |
+
{
|
24 |
+
return Mage::getModel('lipscore_ratingsreviews/api_request', array(
|
25 |
+
'lipscoreConfig' => $lipscoreConfig,
|
26 |
+
'path' => "plugin_installations/$installationId/actions"
|
27 |
+
));
|
28 |
+
}
|
29 |
+
}
|
app/code/community/Lipscore/RatingsReviews/Model/Tracker/Installation.php
CHANGED
@@ -1,79 +1,79 @@
|
|
1 |
-
<?php
|
2 |
-
class Lipscore_RatingsReviews_Model_Tracker_Installation
|
3 |
-
{
|
4 |
-
public function track($website)
|
5 |
-
{
|
6 |
-
$lipscoreConfig = $this->getConfig($website);
|
7 |
-
$data = $this->getData($website);
|
8 |
-
$sender = $this->getSender($lipscoreConfig, 'POST');
|
9 |
-
|
10 |
-
$result = $sender->send($data);
|
11 |
-
$isSuccess = $result && !empty($result['id']);
|
12 |
-
if ($isSuccess) {
|
13 |
-
$lipscoreConfig->setLastTrackedVersion($this->getPluginVersion());
|
14 |
-
$lipscoreConfig->setPluginInstallationId($result['id']);
|
15 |
-
}
|
16 |
-
|
17 |
-
return $isSuccess;
|
18 |
-
}
|
19 |
-
|
20 |
-
public function trackUpgrade($website)
|
21 |
-
{
|
22 |
-
$lipscoreConfig = $this->getConfig($website);
|
23 |
-
|
24 |
-
$installationId = $lipscoreConfig->pluginInstallationId();
|
25 |
-
if (empty($installationId)) {
|
26 |
-
return false;
|
27 |
-
}
|
28 |
-
|
29 |
-
$sender = $this->getSender($lipscoreConfig, 'PUT', $installationId);
|
30 |
-
$result = $sender->send(array('plugin_version' => $this->getPluginVersion()));
|
31 |
-
if ($result) {
|
32 |
-
$lipscoreConfig->setLastTrackedVersion($this->getPluginVersion());
|
33 |
-
}
|
34 |
-
|
35 |
-
return !empty($result);
|
36 |
-
}
|
37 |
-
|
38 |
-
protected function getData($website)
|
39 |
-
{
|
40 |
-
$shop = Mage::getModel('lipscore_ratingsreviews/shop', array('website' => $website));
|
41 |
-
$moduleHelper = Mage::helper('lipscore_ratingsreviews/module');
|
42 |
-
|
43 |
-
return array(
|
44 |
-
'name' => $shop->name,
|
45 |
-
'url' => $shop->url,
|
46 |
-
'contact_name' => $shop->contactName,
|
47 |
-
'contact_email' => $shop->contactEmail,
|
48 |
-
'country' => $shop->country,
|
49 |
-
'platform' => 'magento',
|
50 |
-
'platform_version' => Mage::getVersion(),
|
51 |
-
'plugin_version' => $moduleHelper->getversion(),
|
52 |
-
'langs' => $shop->langs
|
53 |
-
);
|
54 |
-
}
|
55 |
-
|
56 |
-
protected function getSender($lipscoreConfig, $requestType, $installationId = null)
|
57 |
-
{
|
58 |
-
$path = 'plugin_installations';
|
59 |
-
if ($installationId) {
|
60 |
-
$path .= "/$installationId";
|
61 |
-
}
|
62 |
-
return Mage::getModel('lipscore_ratingsreviews/api_request', array(
|
63 |
-
'lipscoreConfig' => $lipscoreConfig,
|
64 |
-
'path' => $path,
|
65 |
-
'requestType' => $requestType
|
66 |
-
));
|
67 |
-
}
|
68 |
-
|
69 |
-
protected function getConfig($website)
|
70 |
-
{
|
71 |
-
return Mage::getModel('lipscore_ratingsreviews/config', array('website' => $website));
|
72 |
-
}
|
73 |
-
|
74 |
-
protected function getPluginVersion()
|
75 |
-
{
|
76 |
-
$moduleHelper = Mage::helper('lipscore_ratingsreviews/module');
|
77 |
-
return $moduleHelper->getVersion();
|
78 |
-
}
|
79 |
-
}
|
1 |
+
<?php
|
2 |
+
class Lipscore_RatingsReviews_Model_Tracker_Installation
|
3 |
+
{
|
4 |
+
public function track($website)
|
5 |
+
{
|
6 |
+
$lipscoreConfig = $this->getConfig($website);
|
7 |
+
$data = $this->getData($website);
|
8 |
+
$sender = $this->getSender($lipscoreConfig, 'POST');
|
9 |
+
|
10 |
+
$result = $sender->send($data);
|
11 |
+
$isSuccess = $result && !empty($result['id']);
|
12 |
+
if ($isSuccess) {
|
13 |
+
$lipscoreConfig->setLastTrackedVersion($this->getPluginVersion());
|
14 |
+
$lipscoreConfig->setPluginInstallationId($result['id']);
|
15 |
+
}
|
16 |
+
|
17 |
+
return $isSuccess;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function trackUpgrade($website)
|
21 |
+
{
|
22 |
+
$lipscoreConfig = $this->getConfig($website);
|
23 |
+
|
24 |
+
$installationId = $lipscoreConfig->pluginInstallationId();
|
25 |
+
if (empty($installationId)) {
|
26 |
+
return false;
|
27 |
+
}
|
28 |
+
|
29 |
+
$sender = $this->getSender($lipscoreConfig, 'PUT', $installationId);
|
30 |
+
$result = $sender->send(array('plugin_version' => $this->getPluginVersion()));
|
31 |
+
if ($result) {
|
32 |
+
$lipscoreConfig->setLastTrackedVersion($this->getPluginVersion());
|
33 |
+
}
|
34 |
+
|
35 |
+
return !empty($result);
|
36 |
+
}
|
37 |
+
|
38 |
+
protected function getData($website)
|
39 |
+
{
|
40 |
+
$shop = Mage::getModel('lipscore_ratingsreviews/shop', array('website' => $website));
|
41 |
+
$moduleHelper = Mage::helper('lipscore_ratingsreviews/module');
|
42 |
+
|
43 |
+
return array(
|
44 |
+
'name' => $shop->name,
|
45 |
+
'url' => $shop->url,
|
46 |
+
'contact_name' => $shop->contactName,
|
47 |
+
'contact_email' => $shop->contactEmail,
|
48 |
+
'country' => $shop->country,
|
49 |
+
'platform' => 'magento',
|
50 |
+
'platform_version' => Mage::getVersion(),
|
51 |
+
'plugin_version' => $moduleHelper->getversion(),
|
52 |
+
'langs' => $shop->langs
|
53 |
+
);
|
54 |
+
}
|
55 |
+
|
56 |
+
protected function getSender($lipscoreConfig, $requestType, $installationId = null)
|
57 |
+
{
|
58 |
+
$path = 'plugin_installations';
|
59 |
+
if ($installationId) {
|
60 |
+
$path .= "/$installationId";
|
61 |
+
}
|
62 |
+
return Mage::getModel('lipscore_ratingsreviews/api_request', array(
|
63 |
+
'lipscoreConfig' => $lipscoreConfig,
|
64 |
+
'path' => $path,
|
65 |
+
'requestType' => $requestType
|
66 |
+
));
|
67 |
+
}
|
68 |
+
|
69 |
+
protected function getConfig($website)
|
70 |
+
{
|
71 |
+
return Mage::getModel('lipscore_ratingsreviews/config', array('website' => $website));
|
72 |
+
}
|
73 |
+
|
74 |
+
protected function getPluginVersion()
|
75 |
+
{
|
76 |
+
$moduleHelper = Mage::helper('lipscore_ratingsreviews/module');
|
77 |
+
return $moduleHelper->getVersion();
|
78 |
+
}
|
79 |
+
}
|
app/code/community/Lipscore/RatingsReviews/controllers/Purchases/RemindersController.php
CHANGED
@@ -1,152 +1,152 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Lipscore_RatingsReviews_Purchases_RemindersController extends Mage_Adminhtml_Controller_Action
|
4 |
-
{
|
5 |
-
protected $lipscoreConfig = null;
|
6 |
-
|
7 |
-
public function preDispatch()
|
8 |
-
{
|
9 |
-
Mage::setIsDeveloperMode(true);
|
10 |
-
parent::preDispatch();
|
11 |
-
}
|
12 |
-
|
13 |
-
public function sendAction()
|
14 |
-
{
|
15 |
-
if (!$this->getRequest()->isAjax()) {
|
16 |
-
Lipscore_RatingsReviews_Logger::logException(new Exception('Non-ajax request to sending reminders action'));
|
17 |
-
$this->_forward('noRoute');
|
18 |
-
return;
|
19 |
-
}
|
20 |
-
|
21 |
-
try {
|
22 |
-
$this->send();
|
23 |
-
} catch (Exception $e) {
|
24 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
25 |
-
$this->response(false, $e->getMessage() . '\n' . $e->getTraceAsString());
|
26 |
-
}
|
27 |
-
}
|
28 |
-
|
29 |
-
protected function send()
|
30 |
-
{
|
31 |
-
$this->checkKey();
|
32 |
-
|
33 |
-
$period = $this->getPeriod();
|
34 |
-
$statuses = $this->getStatuses();
|
35 |
-
|
36 |
-
$orders = Mage::getModel('sales/order')->getCollection()
|
37 |
-
->addAttributeToFilter('created_at', $period)
|
38 |
-
->addAttributeToFilter('status', array('in' => $statuses));
|
39 |
-
|
40 |
-
$store = $this->getStore();
|
41 |
-
if ($store) {
|
42 |
-
$orders->addAttributeToFilter('store_id', array('eq' => $store->getId()));
|
43 |
-
}
|
44 |
-
|
45 |
-
if (!count($orders)) {
|
46 |
-
$this->response(false, 'No orders found for a selected period.');
|
47 |
-
}
|
48 |
-
|
49 |
-
$sender = Mage::getModel('lipscore_ratingsreviews/purchase_reminder', array(
|
50 |
-
'websiteCode' => $this->getWebsiteCode(),
|
51 |
-
'storeCode' => $this->getStoreCode()
|
52 |
-
));
|
53 |
-
|
54 |
-
$result = $sender->
|
55 |
-
if ($result) {
|
56 |
-
$this->response(true, "Emails were scheduled successfully.");
|
57 |
-
} else {
|
58 |
-
$this->response(false, $sender->getResponseMsg());
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
protected function checkKey()
|
63 |
-
{
|
64 |
-
$apiKey = $this->getLipscoreConfig()->apiKey();
|
65 |
-
if (!$apiKey) {
|
66 |
-
$this->response(false, 'You should provide your Api Key and save config.');
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
protected function getPeriod()
|
71 |
-
{
|
72 |
-
$data = $this->getRequest()->getParams();
|
73 |
-
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
|
74 |
-
|
75 |
-
try {
|
76 |
-
$startDate = empty($data['from']) ? false : new Zend_Date($data['from'], $format);
|
77 |
-
$endDate = empty($data['to']) ? false : new Zend_Date($data['to'], $format);
|
78 |
-
} catch (Exception $e) {
|
79 |
-
$startDate = false;
|
80 |
-
$endDate = false;
|
81 |
-
}
|
82 |
-
|
83 |
-
$correctPeriod = $startDate && $endDate ? $startDate->compare($endDate) <= 0 : $startDate || $endDate;
|
84 |
-
if (!$correctPeriod) {
|
85 |
-
$this->response(false, 'Please set a correct period.');
|
86 |
-
}
|
87 |
-
|
88 |
-
$result = array('datetime' => true);
|
89 |
-
if ($startDate) {
|
90 |
-
$result['from'] = $startDate;
|
91 |
-
}
|
92 |
-
if ($endDate) {
|
93 |
-
$result['to'] = $endDate;
|
94 |
-
}
|
95 |
-
|
96 |
-
return $result;
|
97 |
-
}
|
98 |
-
|
99 |
-
protected function getStatuses()
|
100 |
-
{
|
101 |
-
$statuses = $this->getRequest()->getParam('status', array());
|
102 |
-
if (empty($statuses)) {
|
103 |
-
$this->response(false, 'Please select order status.');
|
104 |
-
}
|
105 |
-
return $statuses;
|
106 |
-
}
|
107 |
-
|
108 |
-
protected function response($result, $response)
|
109 |
-
{
|
110 |
-
$body = Zend_Json::encode(array('message' => $response));
|
111 |
-
$this->getResponse()
|
112 |
-
->setHeader('Content-Type', 'application/json')
|
113 |
-
->setBody($body);
|
114 |
-
|
115 |
-
if (!$result) {
|
116 |
-
$this->getResponse()->setHttpResponseCode(422);
|
117 |
-
}
|
118 |
-
|
119 |
-
$this->getResponse()->sendResponse();
|
120 |
-
|
121 |
-
exit(0);
|
122 |
-
}
|
123 |
-
|
124 |
-
protected function getLipscoreConfig()
|
125 |
-
{
|
126 |
-
if (!$this->lipscoreConfig) {
|
127 |
-
$websiteCode = $this->getWebsiteCode();
|
128 |
-
$storeCode = $this->getStoreCode();
|
129 |
-
|
130 |
-
$this->lipscoreConfig = Mage::helper('lipscore_ratingsreviews/config')->getScoped($websiteCode, $storeCode);
|
131 |
-
}
|
132 |
-
return $this->lipscoreConfig;
|
133 |
-
}
|
134 |
-
|
135 |
-
protected function getStore()
|
136 |
-
{
|
137 |
-
$code = $this->getStoreCode();
|
138 |
-
if ($code) {
|
139 |
-
return Mage::getModel('core/store')->load($code);
|
140 |
-
}
|
141 |
-
}
|
142 |
-
|
143 |
-
protected function getWebsiteCode()
|
144 |
-
{
|
145 |
-
return $this->getRequest()->getParam('website');
|
146 |
-
}
|
147 |
-
|
148 |
-
protected function getStoreCode()
|
149 |
-
{
|
150 |
-
return $this->getRequest()->getParam('store');
|
151 |
-
}
|
152 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Lipscore_RatingsReviews_Purchases_RemindersController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
protected $lipscoreConfig = null;
|
6 |
+
|
7 |
+
public function preDispatch()
|
8 |
+
{
|
9 |
+
Mage::setIsDeveloperMode(true);
|
10 |
+
parent::preDispatch();
|
11 |
+
}
|
12 |
+
|
13 |
+
public function sendAction()
|
14 |
+
{
|
15 |
+
if (!$this->getRequest()->isAjax()) {
|
16 |
+
Lipscore_RatingsReviews_Logger::logException(new Exception('Non-ajax request to sending reminders action'));
|
17 |
+
$this->_forward('noRoute');
|
18 |
+
return;
|
19 |
+
}
|
20 |
+
|
21 |
+
try {
|
22 |
+
$this->send();
|
23 |
+
} catch (Exception $e) {
|
24 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
25 |
+
$this->response(false, $e->getMessage() . '\n' . $e->getTraceAsString());
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
protected function send()
|
30 |
+
{
|
31 |
+
$this->checkKey();
|
32 |
+
|
33 |
+
$period = $this->getPeriod();
|
34 |
+
$statuses = $this->getStatuses();
|
35 |
+
|
36 |
+
$orders = Mage::getModel('sales/order')->getCollection()
|
37 |
+
->addAttributeToFilter('created_at', $period)
|
38 |
+
->addAttributeToFilter('status', array('in' => $statuses));
|
39 |
+
|
40 |
+
$store = $this->getStore();
|
41 |
+
if ($store) {
|
42 |
+
$orders->addAttributeToFilter('store_id', array('eq' => $store->getId()));
|
43 |
+
}
|
44 |
+
|
45 |
+
if (!count($orders)) {
|
46 |
+
$this->response(false, 'No orders found for a selected period.');
|
47 |
+
}
|
48 |
+
|
49 |
+
$sender = Mage::getModel('lipscore_ratingsreviews/purchase_reminder', array(
|
50 |
+
'websiteCode' => $this->getWebsiteCode(),
|
51 |
+
'storeCode' => $this->getStoreCode()
|
52 |
+
));
|
53 |
+
|
54 |
+
$result = $sender->sendMultiple($orders);
|
55 |
+
if ($result) {
|
56 |
+
$this->response(true, "Emails were scheduled successfully.");
|
57 |
+
} else {
|
58 |
+
$this->response(false, $sender->getResponseMsg());
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
protected function checkKey()
|
63 |
+
{
|
64 |
+
$apiKey = $this->getLipscoreConfig()->apiKey();
|
65 |
+
if (!$apiKey) {
|
66 |
+
$this->response(false, 'You should provide your Api Key and save config.');
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
protected function getPeriod()
|
71 |
+
{
|
72 |
+
$data = $this->getRequest()->getParams();
|
73 |
+
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
|
74 |
+
|
75 |
+
try {
|
76 |
+
$startDate = empty($data['from']) ? false : new Zend_Date($data['from'], $format);
|
77 |
+
$endDate = empty($data['to']) ? false : new Zend_Date($data['to'], $format);
|
78 |
+
} catch (Exception $e) {
|
79 |
+
$startDate = false;
|
80 |
+
$endDate = false;
|
81 |
+
}
|
82 |
+
|
83 |
+
$correctPeriod = $startDate && $endDate ? $startDate->compare($endDate) <= 0 : $startDate || $endDate;
|
84 |
+
if (!$correctPeriod) {
|
85 |
+
$this->response(false, 'Please set a correct period.');
|
86 |
+
}
|
87 |
+
|
88 |
+
$result = array('datetime' => true);
|
89 |
+
if ($startDate) {
|
90 |
+
$result['from'] = $startDate;
|
91 |
+
}
|
92 |
+
if ($endDate) {
|
93 |
+
$result['to'] = $endDate;
|
94 |
+
}
|
95 |
+
|
96 |
+
return $result;
|
97 |
+
}
|
98 |
+
|
99 |
+
protected function getStatuses()
|
100 |
+
{
|
101 |
+
$statuses = $this->getRequest()->getParam('status', array());
|
102 |
+
if (empty($statuses)) {
|
103 |
+
$this->response(false, 'Please select order status.');
|
104 |
+
}
|
105 |
+
return $statuses;
|
106 |
+
}
|
107 |
+
|
108 |
+
protected function response($result, $response)
|
109 |
+
{
|
110 |
+
$body = Zend_Json::encode(array('message' => $response));
|
111 |
+
$this->getResponse()
|
112 |
+
->setHeader('Content-Type', 'application/json')
|
113 |
+
->setBody($body);
|
114 |
+
|
115 |
+
if (!$result) {
|
116 |
+
$this->getResponse()->setHttpResponseCode(422);
|
117 |
+
}
|
118 |
+
|
119 |
+
$this->getResponse()->sendResponse();
|
120 |
+
|
121 |
+
exit(0);
|
122 |
+
}
|
123 |
+
|
124 |
+
protected function getLipscoreConfig()
|
125 |
+
{
|
126 |
+
if (!$this->lipscoreConfig) {
|
127 |
+
$websiteCode = $this->getWebsiteCode();
|
128 |
+
$storeCode = $this->getStoreCode();
|
129 |
+
|
130 |
+
$this->lipscoreConfig = Mage::helper('lipscore_ratingsreviews/config')->getScoped($websiteCode, $storeCode);
|
131 |
+
}
|
132 |
+
return $this->lipscoreConfig;
|
133 |
+
}
|
134 |
+
|
135 |
+
protected function getStore()
|
136 |
+
{
|
137 |
+
$code = $this->getStoreCode();
|
138 |
+
if ($code) {
|
139 |
+
return Mage::getModel('core/store')->load($code);
|
140 |
+
}
|
141 |
+
}
|
142 |
+
|
143 |
+
protected function getWebsiteCode()
|
144 |
+
{
|
145 |
+
return $this->getRequest()->getParam('website');
|
146 |
+
}
|
147 |
+
|
148 |
+
protected function getStoreCode()
|
149 |
+
{
|
150 |
+
return $this->getRequest()->getParam('store');
|
151 |
+
}
|
152 |
+
}
|
app/code/community/Lipscore/RatingsReviews/data/lipscore_ratingsreviews_setup/data-install-1.2.21.0.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php
|
2 |
-
try {
|
3 |
-
$tracker = Mage::getModel('lipscore_ratingsreviews/tracker_installation');
|
4 |
-
foreach (Mage::app()->getWebsites() as $website) {
|
5 |
-
$result = $tracker->track($website);
|
6 |
-
}
|
7 |
-
} catch (Exception $e) {
|
8 |
-
Lipscore_RatingsReviews_Logger::logException($e);
|
9 |
-
}
|
10 |
Â
|
1 |
+
<?php
|
2 |
+
try {
|
3 |
+
$tracker = Mage::getModel('lipscore_ratingsreviews/tracker_installation');
|
4 |
+
foreach (Mage::app()->getWebsites() as $website) {
|
5 |
+
$result = $tracker->track($website);
|
6 |
+
}
|
7 |
+
} catch (Exception $e) {
|
8 |
+
Lipscore_RatingsReviews_Logger::logException($e);
|
9 |
+
}
|
10 |
Â
|
app/code/community/Lipscore/RatingsReviews/etc/adminhtml.xml
CHANGED
@@ -1,26 +1,26 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
|
3 |
-
<config>
|
4 |
-
<acl>
|
5 |
-
<resources>
|
6 |
-
<admin>
|
7 |
-
<children>
|
8 |
-
<system>
|
9 |
-
<children>
|
10 |
-
<config>
|
11 |
-
<children>
|
12 |
-
<lipscore_general translate="title">
|
13 |
-
<title>General</title>
|
14 |
-
</lipscore_general>
|
15 |
-
<lipscore_coupons translate="title">
|
16 |
-
<title>Coupons</title>
|
17 |
-
</lipscore_coupons>
|
18 |
-
</children>
|
19 |
-
</config>
|
20 |
-
</children>
|
21 |
-
</system>
|
22 |
-
</children>
|
23 |
-
</admin>
|
24 |
-
</resources>
|
25 |
-
</acl>
|
26 |
-
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<acl>
|
5 |
+
<resources>
|
6 |
+
<admin>
|
7 |
+
<children>
|
8 |
+
<system>
|
9 |
+
<children>
|
10 |
+
<config>
|
11 |
+
<children>
|
12 |
+
<lipscore_general translate="title">
|
13 |
+
<title>General</title>
|
14 |
+
</lipscore_general>
|
15 |
+
<lipscore_coupons translate="title">
|
16 |
+
<title>Coupons</title>
|
17 |
+
</lipscore_coupons>
|
18 |
+
</children>
|
19 |
+
</config>
|
20 |
+
</children>
|
21 |
+
</system>
|
22 |
+
</children>
|
23 |
+
</admin>
|
24 |
+
</resources>
|
25 |
+
</acl>
|
26 |
+
</config>
|
app/code/community/Lipscore/RatingsReviews/etc/config.xml
CHANGED
@@ -1,161 +1,180 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
|
3 |
-
<!--
|
4 |
-
/**
|
5 |
-
* Module configuration
|
6 |
-
*
|
7 |
-
* @author oivanova
|
8 |
-
*/
|
9 |
-
-->
|
10 |
-
|
11 |
-
<config>
|
12 |
-
<modules>
|
13 |
-
<Lipscore_RatingsReviews>
|
14 |
-
<version>1.
|
15 |
-
</Lipscore_RatingsReviews>
|
16 |
-
</modules>
|
17 |
-
|
18 |
-
<global>
|
19 |
-
<cache>
|
20 |
-
<types>
|
21 |
-
<config_api translate="label,description" module="lipscore_ratingsreviews">
|
22 |
-
<label>Lipscore Extension Configuration</label>
|
23 |
-
<description>Environment configuration files.</description>
|
24 |
-
<tags>CONFIG_LIPSCORE_ENV</tags>
|
25 |
-
</config_api>
|
26 |
-
</types>
|
27 |
-
</cache>
|
28 |
-
|
29 |
-
<blocks>
|
30 |
-
<lipscore_ratingsreviews>
|
31 |
-
<class>Lipscore_RatingsReviews_Block</class>
|
32 |
-
</lipscore_ratingsreviews>
|
33 |
-
<review>
|
34 |
-
<rewrite>
|
35 |
-
<helper>Lipscore_RatingsReviews_Block_Review_Helper</helper>
|
36 |
-
</rewrite>
|
37 |
-
</review>
|
38 |
-
<catalog>
|
39 |
-
<rewrite>
|
40 |
-
<product_view>Lipscore_RatingsReviews_Block_Catalog_Product_View</product_view>
|
41 |
-
</rewrite>
|
42 |
-
</catalog>
|
43 |
-
</blocks>
|
44 |
-
|
45 |
-
<models>
|
46 |
-
<lipscore_ratingsreviews>
|
47 |
-
<class>Lipscore_RatingsReviews_Model</class>
|
48 |
-
</lipscore_ratingsreviews>
|
49 |
-
</models>
|
50 |
-
|
51 |
-
<helpers>
|
52 |
-
<lipscore_ratingsreviews>
|
53 |
-
<class>Lipscore_RatingsReviews_Helper</class>
|
54 |
-
</lipscore_ratingsreviews>
|
55 |
-
</helpers>
|
56 |
-
|
57 |
-
<events>
|
58 |
-
<controller_action_layout_load_before>
|
59 |
-
<observers>
|
60 |
-
<lipscore_ratingsreviews>
|
61 |
-
<class>lipscore_ratingsreviews/
|
62 |
-
<method>manageMageReviewModule</method>
|
63 |
-
</lipscore_ratingsreviews>
|
64 |
-
</observers>
|
65 |
-
</controller_action_layout_load_before>
|
66 |
-
<catalog_product_collection_load_after>
|
67 |
-
<observers>
|
68 |
-
<lipscore_ratingsreviews>
|
69 |
-
<class>lipscore_ratingsreviews/
|
70 |
-
<method>addRatings</method>
|
71 |
-
</lipscore_ratingsreviews>
|
72 |
-
</observers>
|
73 |
-
</catalog_product_collection_load_after>
|
74 |
-
<controller_action_layout_generate_blocks_after>
|
75 |
-
<observers>
|
76 |
-
<lipscore_ratingsreviews>
|
77 |
-
<class>lipscore_ratingsreviews/
|
78 |
-
<method>addReviewsTab</method>
|
79 |
-
</lipscore_ratingsreviews>
|
80 |
-
</observers>
|
81 |
-
</controller_action_layout_generate_blocks_after>
|
82 |
-
<core_block_abstract_to_html_after>
|
83 |
-
<observers>
|
84 |
-
<lipscore_ratingsreviews>
|
85 |
-
<class>lipscore_ratingsreviews/
|
86 |
-
<method>addReviewsFeatures</method>
|
87 |
-
</lipscore_ratingsreviews>
|
88 |
-
</observers>
|
89 |
-
</core_block_abstract_to_html_after>
|
90 |
-
<http_response_send_before>
|
91 |
-
<observers>
|
92 |
-
<lipscore_ratingsreviews>
|
93 |
-
<class>lipscore_ratingsreviews/
|
94 |
-
<method>
|
95 |
-
</lipscore_ratingsreviews>
|
96 |
-
</observers>
|
97 |
-
</http_response_send_before>
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
</
|
105 |
-
</
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
</
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<!--
|
4 |
+
/**
|
5 |
+
* Module configuration
|
6 |
+
*
|
7 |
+
* @author oivanova
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
|
11 |
+
<config>
|
12 |
+
<modules>
|
13 |
+
<Lipscore_RatingsReviews>
|
14 |
+
<version>1.3.0</version>
|
15 |
+
</Lipscore_RatingsReviews>
|
16 |
+
</modules>
|
17 |
+
|
18 |
+
<global>
|
19 |
+
<cache>
|
20 |
+
<types>
|
21 |
+
<config_api translate="label,description" module="lipscore_ratingsreviews">
|
22 |
+
<label>Lipscore Extension Configuration</label>
|
23 |
+
<description>Environment configuration files.</description>
|
24 |
+
<tags>CONFIG_LIPSCORE_ENV</tags>
|
25 |
+
</config_api>
|
26 |
+
</types>
|
27 |
+
</cache>
|
28 |
+
|
29 |
+
<blocks>
|
30 |
+
<lipscore_ratingsreviews>
|
31 |
+
<class>Lipscore_RatingsReviews_Block</class>
|
32 |
+
</lipscore_ratingsreviews>
|
33 |
+
<review>
|
34 |
+
<rewrite>
|
35 |
+
<helper>Lipscore_RatingsReviews_Block_Review_Helper</helper>
|
36 |
+
</rewrite>
|
37 |
+
</review>
|
38 |
+
<catalog>
|
39 |
+
<rewrite>
|
40 |
+
<product_view>Lipscore_RatingsReviews_Block_Catalog_Product_View</product_view>
|
41 |
+
</rewrite>
|
42 |
+
</catalog>
|
43 |
+
</blocks>
|
44 |
+
|
45 |
+
<models>
|
46 |
+
<lipscore_ratingsreviews>
|
47 |
+
<class>Lipscore_RatingsReviews_Model</class>
|
48 |
+
</lipscore_ratingsreviews>
|
49 |
+
</models>
|
50 |
+
|
51 |
+
<helpers>
|
52 |
+
<lipscore_ratingsreviews>
|
53 |
+
<class>Lipscore_RatingsReviews_Helper</class>
|
54 |
+
</lipscore_ratingsreviews>
|
55 |
+
</helpers>
|
56 |
+
|
57 |
+
<events>
|
58 |
+
<controller_action_layout_load_before>
|
59 |
+
<observers>
|
60 |
+
<lipscore_ratingsreviews>
|
61 |
+
<class>lipscore_ratingsreviews/observer_output</class>
|
62 |
+
<method>manageMageReviewModule</method>
|
63 |
+
</lipscore_ratingsreviews>
|
64 |
+
</observers>
|
65 |
+
</controller_action_layout_load_before>
|
66 |
+
<catalog_product_collection_load_after>
|
67 |
+
<observers>
|
68 |
+
<lipscore_ratingsreviews>
|
69 |
+
<class>lipscore_ratingsreviews/observer_output</class>
|
70 |
+
<method>addRatings</method>
|
71 |
+
</lipscore_ratingsreviews>
|
72 |
+
</observers>
|
73 |
+
</catalog_product_collection_load_after>
|
74 |
+
<controller_action_layout_generate_blocks_after>
|
75 |
+
<observers>
|
76 |
+
<lipscore_ratingsreviews>
|
77 |
+
<class>lipscore_ratingsreviews/observer_output</class>
|
78 |
+
<method>addReviewsTab</method>
|
79 |
+
</lipscore_ratingsreviews>
|
80 |
+
</observers>
|
81 |
+
</controller_action_layout_generate_blocks_after>
|
82 |
+
<core_block_abstract_to_html_after>
|
83 |
+
<observers>
|
84 |
+
<lipscore_ratingsreviews>
|
85 |
+
<class>lipscore_ratingsreviews/observer_output</class>
|
86 |
+
<method>addReviewsFeatures</method>
|
87 |
+
</lipscore_ratingsreviews>
|
88 |
+
</observers>
|
89 |
+
</core_block_abstract_to_html_after>
|
90 |
+
<http_response_send_before>
|
91 |
+
<observers>
|
92 |
+
<lipscore_ratingsreviews>
|
93 |
+
<class>lipscore_ratingsreviews/observer_module</class>
|
94 |
+
<method>checkVersion</method>
|
95 |
+
</lipscore_ratingsreviews>
|
96 |
+
</observers>
|
97 |
+
</http_response_send_before>
|
98 |
+
<sales_order_load_after>
|
99 |
+
<observers>
|
100 |
+
<lipscore_ratingsreviews>
|
101 |
+
<class>lipscore_ratingsreviews/observer_order_status</class>
|
102 |
+
<method>fetch</method>
|
103 |
+
</lipscore_ratingsreviews>
|
104 |
+
</observers>
|
105 |
+
</sales_order_load_after>
|
106 |
+
<sales_order_save_after>
|
107 |
+
<observers>
|
108 |
+
<lipscore_ratingsreviews>
|
109 |
+
<class>lipscore_ratingsreviews/observer_order_status</class>
|
110 |
+
<method>check</method>
|
111 |
+
</lipscore_ratingsreviews>
|
112 |
+
</observers>
|
113 |
+
</sales_order_save_after>
|
114 |
+
</events>
|
115 |
+
|
116 |
+
<resources>
|
117 |
+
<lipscore_ratingsreviews_setup>
|
118 |
+
<setup>
|
119 |
+
<module>Lipscore_RatingsReviews</module>
|
120 |
+
</setup>
|
121 |
+
</lipscore_ratingsreviews_setup>
|
122 |
+
</resources>
|
123 |
+
</global>
|
124 |
+
|
125 |
+
<admin>
|
126 |
+
<routers>
|
127 |
+
<adminhtml>
|
128 |
+
<args>
|
129 |
+
<modules>
|
130 |
+
<lipscore_ratingsreviews after="Mage_Adminhtml">Lipscore_RatingsReviews</lipscore_ratingsreviews>
|
131 |
+
</modules>
|
132 |
+
<frontName>lipscore</frontName>
|
133 |
+
</args>
|
134 |
+
</adminhtml>
|
135 |
+
</routers>
|
136 |
+
</admin>
|
137 |
+
|
138 |
+
<frontend>
|
139 |
+
<layout>
|
140 |
+
<updates>
|
141 |
+
<lipscore_ratingsreviews>
|
142 |
+
<file>lipscore_ratingsreviews.xml</file>
|
143 |
+
</lipscore_ratingsreviews>
|
144 |
+
</updates>
|
145 |
+
</layout>
|
146 |
+
</frontend>
|
147 |
+
|
148 |
+
<adminhtml>
|
149 |
+
<layout>
|
150 |
+
<updates>
|
151 |
+
<lipscore_ratingsreviews>
|
152 |
+
<file>lipscore_ratingsreviews.xml</file>
|
153 |
+
</lipscore_ratingsreviews>
|
154 |
+
</updates>
|
155 |
+
</layout>
|
156 |
+
</adminhtml>
|
157 |
+
|
158 |
+
<default>
|
159 |
+
<lipscore_general>
|
160 |
+
<api_key>
|
161 |
+
<api_key>889c3f3e4b6ac67269261324</api_key>
|
162 |
+
<demo_api_key>889c3f3e4b6ac67269261324</demo_api_key>
|
163 |
+
</api_key>
|
164 |
+
<product_brand>
|
165 |
+
<attr>brand</attr>
|
166 |
+
</product_brand>
|
167 |
+
<locale>
|
168 |
+
<locale>auto</locale>
|
169 |
+
</locale>
|
170 |
+
<emails>
|
171 |
+
<order_status>pending</order_status>
|
172 |
+
</emails>
|
173 |
+
</lipscore_general>
|
174 |
+
<lipscore_coupons>
|
175 |
+
<coupons>
|
176 |
+
<length>12</length>
|
177 |
+
</coupons>
|
178 |
+
</lipscore_coupons>
|
179 |
+
</default>
|
180 |
+
</config>
|
app/code/community/Lipscore/RatingsReviews/etc/environments/production.xml
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
<config>
|
2 |
-
<lipscore_api_url>api.lipscore.com</lipscore_api_url>
|
3 |
-
<lipscore_assets_url>static.lipscore.com/assets</lipscore_assets_url>
|
4 |
-
<lipscore_errors_email>server_error@lipscore.com</lipscore_errors_email>
|
5 |
-
</config>
|
1 |
+
<config>
|
2 |
+
<lipscore_api_url>api.lipscore.com</lipscore_api_url>
|
3 |
+
<lipscore_assets_url>static.lipscore.com/assets</lipscore_assets_url>
|
4 |
+
<lipscore_errors_email>server_error@lipscore.com</lipscore_errors_email>
|
5 |
+
</config>
|
app/code/community/Lipscore/RatingsReviews/etc/system.xml
CHANGED
@@ -1,224 +1,248 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
|
3 |
-
<config>
|
4 |
-
<tabs>
|
5 |
-
<lipscore translate="label" module="lipscore_ratingsreviews">
|
6 |
-
<label>Lipscore</label>
|
7 |
-
<sort_order>500</sort_order>
|
8 |
-
</lipscore>
|
9 |
-
</tabs>
|
10 |
-
<sections>
|
11 |
-
<lipscore_general translate="label">
|
12 |
-
<label>General</label>
|
13 |
-
<tab>lipscore</tab>
|
14 |
-
<frontend_type>text</frontend_type>
|
15 |
-
<sort_order>100</sort_order>
|
16 |
-
<show_in_default>1</show_in_default>
|
17 |
-
<show_in_website>1</show_in_website>
|
18 |
-
<show_in_store>1</show_in_store>
|
19 |
-
|
20 |
-
<groups>
|
21 |
-
<api_key translate="label">
|
22 |
-
<label>Api Key</label>
|
23 |
-
<frontend_type>text</frontend_type>
|
24 |
-
<sort_order>100</sort_order>
|
25 |
-
<show_in_default>1</show_in_default>
|
26 |
-
<show_in_website>1</show_in_website>
|
27 |
-
<show_in_store>1</show_in_store>
|
28 |
-
<expanded>1</expanded>
|
29 |
-
|
30 |
-
<fields>
|
31 |
-
<api_key translate="label comment">
|
32 |
-
<label>Api Key</label>
|
33 |
-
<frontend_model>lipscore_ratingsreviews/system_config_form_field_apikey</frontend_model>
|
34 |
-
<backend_model>lipscore_ratingsreviews/system_config_backend_apikey</backend_model>
|
35 |
-
<frontend_type>text</frontend_type>
|
36 |
-
<validate>required-entry</validate>
|
37 |
-
<sort_order>10</sort_order>
|
38 |
-
<show_in_default>1</show_in_default>
|
39 |
-
<show_in_website>1</show_in_website>
|
40 |
-
<show_in_store>1</show_in_store>
|
41 |
-
</api_key>
|
42 |
-
</fields>
|
43 |
-
</api_key>
|
44 |
-
|
45 |
-
<product_brand translate="label">
|
46 |
-
<label>Product Brand</label>
|
47 |
-
<frontend_type>text</frontend_type>
|
48 |
-
<sort_order>300</sort_order>
|
49 |
-
<show_in_default>1</show_in_default>
|
50 |
-
<show_in_website>1</show_in_website>
|
51 |
-
<show_in_store>1</show_in_store>
|
52 |
-
<expanded>1</expanded>
|
53 |
-
<fields>
|
54 |
-
<attr translate="label comment">
|
55 |
-
<label>Brand Attribute</label>
|
56 |
-
<comment>Optional, but strongly recommended to increase accuracy of product identification.</comment>
|
57 |
-
<frontend_type>select</frontend_type>
|
58 |
-
<source_model>
|
59 |
-
lipscore_ratingsreviews/system_config_source_productattr_brand
|
60 |
-
</source_model>
|
61 |
-
<sort_order>
|
62 |
-
<show_in_default>1</show_in_default>
|
63 |
-
<show_in_website>1</show_in_website>
|
64 |
-
<show_in_store>1</show_in_store>
|
65 |
-
</attr>
|
66 |
-
</fields>
|
67 |
-
</product_brand>
|
68 |
-
|
69 |
-
<locale translate="label">
|
70 |
-
<label>Interface Locale</label>
|
71 |
-
<frontend_type>text</frontend_type>
|
72 |
-
<sort_order>
|
73 |
-
<show_in_default>1</show_in_default>
|
74 |
-
<show_in_website>1</show_in_website>
|
75 |
-
<show_in_store>1</show_in_store>
|
76 |
-
<expanded>1</expanded>
|
77 |
-
<fields>
|
78 |
-
<locale translate="label comment">
|
79 |
-
<label>Locale</label>
|
80 |
-
<comment>If 'Auto' is selected, the store locale will be used.</comment>
|
81 |
-
<frontend_type>select</frontend_type>
|
82 |
-
<source_model>
|
83 |
-
lipscore_ratingsreviews/system_config_source_locale
|
84 |
-
</source_model>
|
85 |
-
<sort_order>
|
86 |
-
<show_in_default>1</show_in_default>
|
87 |
-
<show_in_website>1</show_in_website>
|
88 |
-
<show_in_store>1</show_in_store>
|
89 |
-
</locale>
|
90 |
-
</fields>
|
91 |
-
</locale>
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
<
|
96 |
-
<
|
97 |
-
<
|
98 |
-
<
|
99 |
-
<
|
100 |
-
<
|
101 |
-
<
|
102 |
-
|
103 |
-
|
104 |
-
<
|
105 |
-
<
|
106 |
-
<
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
<
|
120 |
-
<
|
121 |
-
<
|
122 |
-
<
|
123 |
-
<
|
124 |
-
<
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
<
|
141 |
-
<label>
|
142 |
-
<
|
143 |
-
<
|
144 |
-
<
|
145 |
-
<
|
146 |
-
<
|
147 |
-
<
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
<
|
176 |
-
|
177 |
-
</
|
178 |
-
<
|
179 |
-
|
180 |
-
|
181 |
-
<
|
182 |
-
|
183 |
-
|
184 |
-
<
|
185 |
-
|
186 |
-
|
187 |
-
<
|
188 |
-
<
|
189 |
-
<
|
190 |
-
|
191 |
-
|
192 |
-
<
|
193 |
-
<
|
194 |
-
<
|
195 |
-
|
196 |
-
|
197 |
-
<
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
<
|
203 |
-
<
|
204 |
-
<
|
205 |
-
<
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
</
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<tabs>
|
5 |
+
<lipscore translate="label" module="lipscore_ratingsreviews">
|
6 |
+
<label>Lipscore</label>
|
7 |
+
<sort_order>500</sort_order>
|
8 |
+
</lipscore>
|
9 |
+
</tabs>
|
10 |
+
<sections>
|
11 |
+
<lipscore_general translate="label">
|
12 |
+
<label>General</label>
|
13 |
+
<tab>lipscore</tab>
|
14 |
+
<frontend_type>text</frontend_type>
|
15 |
+
<sort_order>100</sort_order>
|
16 |
+
<show_in_default>1</show_in_default>
|
17 |
+
<show_in_website>1</show_in_website>
|
18 |
+
<show_in_store>1</show_in_store>
|
19 |
+
|
20 |
+
<groups>
|
21 |
+
<api_key translate="label">
|
22 |
+
<label>Api Key</label>
|
23 |
+
<frontend_type>text</frontend_type>
|
24 |
+
<sort_order>100</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>1</show_in_store>
|
28 |
+
<expanded>1</expanded>
|
29 |
+
|
30 |
+
<fields>
|
31 |
+
<api_key translate="label comment">
|
32 |
+
<label>Api Key</label>
|
33 |
+
<frontend_model>lipscore_ratingsreviews/system_config_form_field_apikey</frontend_model>
|
34 |
+
<backend_model>lipscore_ratingsreviews/system_config_backend_apikey</backend_model>
|
35 |
+
<frontend_type>text</frontend_type>
|
36 |
+
<validate>required-entry</validate>
|
37 |
+
<sort_order>10</sort_order>
|
38 |
+
<show_in_default>1</show_in_default>
|
39 |
+
<show_in_website>1</show_in_website>
|
40 |
+
<show_in_store>1</show_in_store>
|
41 |
+
</api_key>
|
42 |
+
</fields>
|
43 |
+
</api_key>
|
44 |
+
|
45 |
+
<product_brand translate="label">
|
46 |
+
<label>Product Brand</label>
|
47 |
+
<frontend_type>text</frontend_type>
|
48 |
+
<sort_order>300</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
<expanded>1</expanded>
|
53 |
+
<fields>
|
54 |
+
<attr translate="label comment">
|
55 |
+
<label>Brand Attribute</label>
|
56 |
+
<comment>Optional, but strongly recommended to increase accuracy of product identification.</comment>
|
57 |
+
<frontend_type>select</frontend_type>
|
58 |
+
<source_model>
|
59 |
+
lipscore_ratingsreviews/system_config_source_productattr_brand
|
60 |
+
</source_model>
|
61 |
+
<sort_order>10</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>1</show_in_store>
|
65 |
+
</attr>
|
66 |
+
</fields>
|
67 |
+
</product_brand>
|
68 |
+
|
69 |
+
<locale translate="label">
|
70 |
+
<label>Interface Locale</label>
|
71 |
+
<frontend_type>text</frontend_type>
|
72 |
+
<sort_order>500</sort_order>
|
73 |
+
<show_in_default>1</show_in_default>
|
74 |
+
<show_in_website>1</show_in_website>
|
75 |
+
<show_in_store>1</show_in_store>
|
76 |
+
<expanded>1</expanded>
|
77 |
+
<fields>
|
78 |
+
<locale translate="label comment">
|
79 |
+
<label>Locale</label>
|
80 |
+
<comment>If 'Auto' is selected, the store locale will be used.</comment>
|
81 |
+
<frontend_type>select</frontend_type>
|
82 |
+
<source_model>
|
83 |
+
lipscore_ratingsreviews/system_config_source_locale
|
84 |
+
</source_model>
|
85 |
+
<sort_order>10</sort_order>
|
86 |
+
<show_in_default>1</show_in_default>
|
87 |
+
<show_in_website>1</show_in_website>
|
88 |
+
<show_in_store>1</show_in_store>
|
89 |
+
</locale>
|
90 |
+
</fields>
|
91 |
+
</locale>
|
92 |
+
|
93 |
+
<emails translate="label">
|
94 |
+
<label>Emails</label>
|
95 |
+
<frontend_type>text</frontend_type>
|
96 |
+
<sort_order>400</sort_order>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>1</show_in_store>
|
100 |
+
<expanded>1</expanded>
|
101 |
+
<fields>
|
102 |
+
<order_status translate="label comment">
|
103 |
+
<label>Order status</label>
|
104 |
+
<comment>Send emails for orders in this status</comment>
|
105 |
+
<frontend_type>select</frontend_type>
|
106 |
+
<source_model>
|
107 |
+
lipscore_ratingsreviews/system_config_source_order_status
|
108 |
+
</source_model>
|
109 |
+
<sort_order>10</sort_order>
|
110 |
+
<show_in_default>1</show_in_default>
|
111 |
+
<show_in_website>1</show_in_website>
|
112 |
+
<show_in_store>1</show_in_store>
|
113 |
+
</order_status>
|
114 |
+
</fields>
|
115 |
+
</emails>
|
116 |
+
|
117 |
+
<!--
|
118 |
+
<reminder translate="label">
|
119 |
+
<label>Kick-start your Lipscore integration!</label>
|
120 |
+
<frontend_type>text</frontend_type>
|
121 |
+
<sort_order>500</sort_order>
|
122 |
+
<show_in_default>1</show_in_default>
|
123 |
+
<show_in_website>1</show_in_website>
|
124 |
+
<show_in_store>1</show_in_store>
|
125 |
+
<expanded>1</expanded>
|
126 |
+
<fields>
|
127 |
+
<period translate="label comment">
|
128 |
+
<label>Period</label>
|
129 |
+
<frontend_model>lipscore_ratingsreviews/system_config_form_field_reminderperiod</frontend_model>
|
130 |
+
<frontend_type>text</frontend_type>
|
131 |
+
<sort_order>10</sort_order>
|
132 |
+
<show_in_default>1</show_in_default>
|
133 |
+
<show_in_website>1</show_in_website>
|
134 |
+
<show_in_store>1</show_in_store>
|
135 |
+
</period>
|
136 |
+
</fields>
|
137 |
+
</reminder>
|
138 |
+
-->
|
139 |
+
|
140 |
+
<dashboard_link translate="label">
|
141 |
+
<label>Advanced settings</label>
|
142 |
+
<frontend_model>lipscore_ratingsreviews/system_config_form_fieldset_dashboardlink</frontend_model>
|
143 |
+
<frontend_type>text</frontend_type>
|
144 |
+
<sort_order>600</sort_order>
|
145 |
+
<show_in_default>1</show_in_default>
|
146 |
+
<show_in_website>1</show_in_website>
|
147 |
+
<show_in_store>1</show_in_store>
|
148 |
+
<expanded>1</expanded>
|
149 |
+
</dashboard_link>
|
150 |
+
</groups>
|
151 |
+
</lipscore_general>
|
152 |
+
|
153 |
+
<lipscore_coupons>
|
154 |
+
<label>Coupons</label>
|
155 |
+
<tab>lipscore</tab>
|
156 |
+
<frontend_type>text</frontend_type>
|
157 |
+
<frontend_model>lipscore_ratingsreviews/system_config_form_coupons</frontend_model>
|
158 |
+
<sort_order>200</sort_order>
|
159 |
+
<show_in_default>1</show_in_default>
|
160 |
+
<show_in_website>1</show_in_website>
|
161 |
+
<show_in_store>1</show_in_store>
|
162 |
+
|
163 |
+
<groups>
|
164 |
+
<coupons translate="label">
|
165 |
+
<label>Coupons</label>
|
166 |
+
<frontend_type>text</frontend_type>
|
167 |
+
<sort_order>100</sort_order>
|
168 |
+
<show_in_default>1</show_in_default>
|
169 |
+
<show_in_website>1</show_in_website>
|
170 |
+
<show_in_store>1</show_in_store>
|
171 |
+
<expanded>1</expanded>
|
172 |
+
|
173 |
+
<fields>
|
174 |
+
<rule_id translate="label comment">
|
175 |
+
<label>Price Rule</label>
|
176 |
+
<comment>Price rule has to use auto generation to generate multiple coupon codes. Price rule's description will be used as a coupon description.</comment>
|
177 |
+
<frontend_type>select</frontend_type>
|
178 |
+
<source_model>
|
179 |
+
lipscore_ratingsreviews/system_config_source_pricerule
|
180 |
+
</source_model>
|
181 |
+
<sort_order>10</sort_order>
|
182 |
+
<show_in_default>1</show_in_default>
|
183 |
+
<show_in_website>1</show_in_website>
|
184 |
+
<show_in_store>1</show_in_store>
|
185 |
+
</rule_id>
|
186 |
+
<length translate="label comment">
|
187 |
+
<label>Code Length</label>
|
188 |
+
<comment>Excluding prefix, suffix and separators.</comment>
|
189 |
+
<frontend_type>text</frontend_type>
|
190 |
+
<validate>validate-digits validate-greater-than-zero</validate>
|
191 |
+
<sort_order>20</sort_order>
|
192 |
+
<show_in_default>1</show_in_default>
|
193 |
+
<show_in_website>1</show_in_website>
|
194 |
+
<show_in_store>1</show_in_store>
|
195 |
+
</length>
|
196 |
+
<format translate="label comment">
|
197 |
+
<label>Code Format</label>
|
198 |
+
<frontend_type>select</frontend_type>
|
199 |
+
<source_model>
|
200 |
+
salesrule/system_config_source_coupon_format
|
201 |
+
</source_model>
|
202 |
+
<sort_order>30</sort_order>
|
203 |
+
<show_in_default>1</show_in_default>
|
204 |
+
<show_in_website>1</show_in_website>
|
205 |
+
<show_in_store>1</show_in_store>
|
206 |
+
</format>
|
207 |
+
<prefix translate="label comment">
|
208 |
+
<label>Code Prefix</label>
|
209 |
+
<frontend_type>text</frontend_type>
|
210 |
+
<sort_order>40</sort_order>
|
211 |
+
<show_in_default>1</show_in_default>
|
212 |
+
<show_in_website>1</show_in_website>
|
213 |
+
<show_in_store>1</show_in_store>
|
214 |
+
</prefix>
|
215 |
+
<suffix translate="label comment">
|
216 |
+
<label>Code Suffix</label>
|
217 |
+
<frontend_type>text</frontend_type>
|
218 |
+
<sort_order>50</sort_order>
|
219 |
+
<show_in_default>1</show_in_default>
|
220 |
+
<show_in_website>1</show_in_website>
|
221 |
+
<show_in_store>1</show_in_store>
|
222 |
+
</suffix>
|
223 |
+
<dash translate="label comment">
|
224 |
+
<label>Dash Every X Characters</label>
|
225 |
+
<comment>If empty no separation.</comment>
|
226 |
+
<frontend_type>text</frontend_type>
|
227 |
+
<validate>validate-digits</validate>
|
228 |
+
<sort_order>60</sort_order>
|
229 |
+
<show_in_default>1</show_in_default>
|
230 |
+
<show_in_website>1</show_in_website>
|
231 |
+
<show_in_store>1</show_in_store>
|
232 |
+
</dash>
|
233 |
+
</fields>
|
234 |
+
</coupons>
|
235 |
+
<coupons_warning translate="label">
|
236 |
+
<label>Coupons</label>
|
237 |
+
<frontend_model>lipscore_ratingsreviews/system_config_form_fieldset_coupons</frontend_model>
|
238 |
+
<frontend_type>text</frontend_type>
|
239 |
+
<sort_order>100</sort_order>
|
240 |
+
<show_in_default>1</show_in_default>
|
241 |
+
<show_in_website>1</show_in_website>
|
242 |
+
<show_in_store>1</show_in_store>
|
243 |
+
<expanded>1</expanded>
|
244 |
+
</coupons_warning>
|
245 |
+
</groups>
|
246 |
+
</lipscore_coupons>
|
247 |
+
</sections>
|
248 |
+
</config>
|
app/design/adminhtml/default/default/layout/lipscore_ratingsreviews.xml
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
|
3 |
-
<layout>
|
4 |
-
<adminhtml_system_config_edit>
|
5 |
-
<reference name="head">
|
6 |
-
<action method="addItem"><type>skin_css</type><file>lipscore.css</file></action>
|
7 |
-
<action method="addItem"><type>skin_js</type><file>js/lipscore.js</file></action>
|
8 |
-
</reference>
|
9 |
-
</adminhtml_system_config_edit>
|
10 |
-
</layout>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<layout>
|
4 |
+
<adminhtml_system_config_edit>
|
5 |
+
<reference name="head">
|
6 |
+
<action method="addItem"><type>skin_css</type><file>lipscore.css</file></action>
|
7 |
+
<action method="addItem"><type>skin_js</type><file>js/lipscore.js</file></action>
|
8 |
+
</reference>
|
9 |
+
</adminhtml_system_config_edit>
|
10 |
+
</layout>
|
app/design/frontend/base/default/layout/lipscore_ratingsreviews.xml
CHANGED
@@ -1,46 +1,24 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
|
3 |
-
<layout>
|
4 |
-
<default>
|
5 |
-
<update handle="lipscore_common_head" />
|
6 |
-
</default>
|
7 |
-
|
8 |
-
<catalog_product_view>
|
9 |
-
<reference name="product.info">
|
10 |
-
<block type="lipscore_ratingsreviews/catalog_product_reviews" name="lipscore.reviews" as="lipscore-reviews" template="lipscore/reviews/view.phtml">
|
11 |
-
<action method="addToParentGroup"><group>detailed_info</group></action>
|
12 |
-
<action method="setTitle"><value>lipscore_reviews_placeholder</value></action>
|
13 |
-
</block>
|
14 |
-
</reference>
|
15 |
-
</catalog_product_view>
|
16 |
-
|
17 |
-
<
|
18 |
-
<
|
19 |
-
|
20 |
-
|
21 |
-
<
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
</reference>
|
26 |
-
</checkout_onepage_success>
|
27 |
-
|
28 |
-
<checkout_multishipping_success>
|
29 |
-
<update handle="lipscore_common_head" />
|
30 |
-
|
31 |
-
<reference name="before_body_end">
|
32 |
-
<block type="lipscore_ratingsreviews/purchase_multishipping"
|
33 |
-
name="lipscore.purchase.multishipping"
|
34 |
-
as="lipscore-purchase-multishipping"
|
35 |
-
template="lipscore/purchase/view.phtml" />
|
36 |
-
</reference>
|
37 |
-
</checkout_multishipping_success>
|
38 |
-
|
39 |
-
<lipscore_common_head>
|
40 |
-
<reference name="head">
|
41 |
-
<block type="lipscore_ratingsreviews/init" name="lipscore.init" template="lipscore/init.phtml" />
|
42 |
-
<action method="addItem"><type>skin_css</type><file>css/lipscore.css</file></action>
|
43 |
-
<action method="addItem"><type>skin_js</type><file>js/lipscore.js</file></action>
|
44 |
-
</reference>
|
45 |
-
</lipscore_common_head>
|
46 |
-
</layout>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<layout>
|
4 |
+
<default>
|
5 |
+
<update handle="lipscore_common_head" />
|
6 |
+
</default>
|
7 |
+
|
8 |
+
<catalog_product_view>
|
9 |
+
<reference name="product.info">
|
10 |
+
<block type="lipscore_ratingsreviews/catalog_product_reviews" name="lipscore.reviews" as="lipscore-reviews" template="lipscore/reviews/view.phtml">
|
11 |
+
<action method="addToParentGroup"><group>detailed_info</group></action>
|
12 |
+
<action method="setTitle"><value>lipscore_reviews_placeholder</value></action>
|
13 |
+
</block>
|
14 |
+
</reference>
|
15 |
+
</catalog_product_view>
|
16 |
+
|
17 |
+
<lipscore_common_head>
|
18 |
+
<reference name="head">
|
19 |
+
<block type="lipscore_ratingsreviews/init" name="lipscore.init" template="lipscore/init.phtml" />
|
20 |
+
<action method="addItem"><type>skin_css</type><file>css/lipscore.css</file></action>
|
21 |
+
<action method="addItem"><type>skin_js</type><file>js/lipscore.js</file></action>
|
22 |
+
</reference>
|
23 |
+
</lipscore_common_head>
|
24 |
+
</layout>
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
app/design/frontend/base/default/template/lipscore/init.phtml
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* JS block for lipscore initialization
|
4 |
-
*
|
5 |
-
* @see Mage_Core_Block_Template
|
6 |
-
*/
|
7 |
-
?>
|
8 |
-
|
9 |
-
<?php if ($this->lipscoreApiKey) { ?>
|
10 |
-
<script type="text/javascript">
|
11 |
-
//<![CDATA[
|
12 |
-
window.lipscoreInit = function() {
|
13 |
-
lipscore.init({
|
14 |
-
apiKey: "<?php echo $this->lipscoreApiKey ?>"
|
15 |
-
});
|
16 |
-
};
|
17 |
-
(function() {
|
18 |
-
var scr = document.createElement('script'); scr.async = 1;
|
19 |
-
scr.src = "//<?php echo $this->assetsUrl ?>/<?php echo $this->getLipscoreLocale() ?>lipscore-v1.js";
|
20 |
-
document.getElementsByTagName('head')[0].appendChild(scr);
|
21 |
-
})();
|
22 |
-
//]]>
|
23 |
-
</script>
|
24 |
-
<?php } ?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* JS block for lipscore initialization
|
4 |
+
*
|
5 |
+
* @see Mage_Core_Block_Template
|
6 |
+
*/
|
7 |
+
?>
|
8 |
+
|
9 |
+
<?php if ($this->lipscoreApiKey) { ?>
|
10 |
+
<script type="text/javascript">
|
11 |
+
//<![CDATA[
|
12 |
+
window.lipscoreInit = function() {
|
13 |
+
lipscore.init({
|
14 |
+
apiKey: "<?php echo $this->lipscoreApiKey ?>"
|
15 |
+
});
|
16 |
+
};
|
17 |
+
(function() {
|
18 |
+
var scr = document.createElement('script'); scr.async = 1;
|
19 |
+
scr.src = "//<?php echo $this->assetsUrl ?>/<?php echo $this->getLipscoreLocale() ?>lipscore-v1.js";
|
20 |
+
document.getElementsByTagName('head')[0].appendChild(scr);
|
21 |
+
})();
|
22 |
+
//]]>
|
23 |
+
</script>
|
24 |
+
<?php } ?>
|
app/design/frontend/base/default/template/lipscore/purchase/view.phtml
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
-
<?php $productsData = $this->getProductsData() ?>
|
2 |
-
<?php $widgetHelper = $this->helper('lipscore_ratingsreviews/widget'); ?>
|
3 |
-
|
4 |
-
<?php if ($productsData) { ?>
|
5 |
-
<?php foreach ($productsData as $data) { ?>
|
6 |
-
<div class="lipscore-purchase"
|
7 |
-
ls-email="<?php echo $this->getCustomerEmail() ?>"
|
8 |
-
ls-name="<?php echo $this->getCustomerName() ?>"
|
9 |
-
ls-product-url="<?php echo $data['url'] ?>"
|
10 |
-
ls-voucher-code="<?php echo $this->getCouponCode() ?>"
|
11 |
-
ls-voucher-descr="<?php echo $this->getCouponDescription() ?>"
|
12 |
-
<?php echo $widgetHelper->getProductAttrs($data)?>>
|
13 |
-
</div>
|
14 |
-
<?php } ?>
|
15 |
-
<?php } ?>
|
1 |
+
<?php $productsData = $this->getProductsData() ?>
|
2 |
+
<?php $widgetHelper = $this->helper('lipscore_ratingsreviews/widget'); ?>
|
3 |
+
|
4 |
+
<?php if ($productsData) { ?>
|
5 |
+
<?php foreach ($productsData as $data) { ?>
|
6 |
+
<div class="lipscore-purchase"
|
7 |
+
ls-email="<?php echo $this->getCustomerEmail() ?>"
|
8 |
+
ls-name="<?php echo $this->getCustomerName() ?>"
|
9 |
+
ls-product-url="<?php echo $data['url'] ?>"
|
10 |
+
ls-voucher-code="<?php echo $this->getCouponCode() ?>"
|
11 |
+
ls-voucher-descr="<?php echo $this->getCouponDescription() ?>"
|
12 |
+
<?php echo $widgetHelper->getProductAttrs($data)?>>
|
13 |
+
</div>
|
14 |
+
<?php } ?>
|
15 |
+
<?php } ?>
|
app/design/frontend/base/default/template/lipscore/rating/view.phtml
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
<?php if ($this->getLsProductAttrs()) { ?>
|
2 |
-
<div class="ratings mg-lipscore-rating-wrapper">
|
3 |
-
<div <?php echo $this->getRatingType() ?>
|
4 |
-
<?php echo $this->getLsProductAttrs() ?>
|
5 |
-
<?php echo $this->getRichsnippetAttrs() ?>>
|
6 |
-
</div>
|
7 |
-
</div>
|
8 |
-
<?php } else { ?>
|
9 |
-
<div style="display: none !important;">Lipscore: empty product data</div>
|
10 |
-
<?php } ?>
|
1 |
+
<?php if ($this->getLsProductAttrs()) { ?>
|
2 |
+
<div class="ratings mg-lipscore-rating-wrapper">
|
3 |
+
<div <?php echo $this->getRatingType() ?>
|
4 |
+
<?php echo $this->getLsProductAttrs() ?>
|
5 |
+
<?php echo $this->getRichsnippetAttrs() ?>>
|
6 |
+
</div>
|
7 |
+
</div>
|
8 |
+
<?php } else { ?>
|
9 |
+
<div style="display: none !important;">Lipscore: empty product data</div>
|
10 |
+
<?php } ?>
|
app/design/frontend/base/default/template/lipscore/reviews/tab_title.phtml
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<span class='lipscore-reviews-tab'>
|
2 |
-
<?php echo $this->__('Reviews') ?><span class='lipscore-reviews-tab-count' style='display: none;'> (<span class='lipscore-review-count'></span>)</span>
|
3 |
-
</span>
|
1 |
+
<span class='lipscore-reviews-tab'>
|
2 |
+
<?php echo $this->__('Reviews') ?><span class='lipscore-reviews-tab-count' style='display: none;'> (<span class='lipscore-review-count'></span>)</span>
|
3 |
+
</span>
|
app/design/frontend/base/default/template/lipscore/reviews/view.phtml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
<div style="display: none !important;">Reviews</div>
|
2 |
-
<?php if ($this->getLsProductAttrs()) { ?>
|
3 |
-
<div id="lipscore-review-post" <?php echo $this->getLsProductAttrs() ?>></div>
|
4 |
-
<div id="lipscore-review-list" <?php echo $this->getLsProductAttrs() ?>></div>
|
5 |
-
<?php } else { ?>
|
6 |
-
<div style="display: none !important;">Lipscore: empty product data</div>
|
7 |
-
<?php } ?>
|
1 |
+
<div style="display: none !important;">Reviews</div>
|
2 |
+
<?php if ($this->getLsProductAttrs()) { ?>
|
3 |
+
<div id="lipscore-review-post" <?php echo $this->getLsProductAttrs() ?>></div>
|
4 |
+
<div id="lipscore-review-list" <?php echo $this->getLsProductAttrs() ?>></div>
|
5 |
+
<?php } else { ?>
|
6 |
+
<div style="display: none !important;">Lipscore: empty product data</div>
|
7 |
+
<?php } ?>
|
app/design/frontend/base/default/template/lipscore/reviews/view_single.phtml
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<div class="lipscore-reviews-single">
|
2 |
-
<h2><?php echo $this->getLayout()->createBlock('lipscore_ratingsreviews/review_tabtitle')->toHtml() ?></h2>
|
3 |
-
<?php echo $this->getLayout()->createBlock('lipscore_ratingsreviews/catalog_product_reviews', '', array('template' => 'lipscore/reviews/view.phtml'))->toHtml() ?>
|
4 |
-
</div>
|
1 |
+
<div class="lipscore-reviews-single">
|
2 |
+
<h2><?php echo $this->getLayout()->createBlock('lipscore_ratingsreviews/review_tabtitle')->toHtml() ?></h2>
|
3 |
+
<?php echo $this->getLayout()->createBlock('lipscore_ratingsreviews/catalog_product_reviews', '', array('template' => 'lipscore/reviews/view.phtml'))->toHtml() ?>
|
4 |
+
</div>
|
app/etc/modules/Lipscore_RatingsReviews.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
|
3 |
-
<!--
|
4 |
-
/**
|
5 |
-
* Module initial config
|
6 |
-
*
|
7 |
-
* @author @oivanova
|
8 |
-
*/
|
9 |
-
-->
|
10 |
-
|
11 |
-
<config>
|
12 |
-
<modules>
|
13 |
-
<Lipscore_RatingsReviews>
|
14 |
-
<active>true</active>
|
15 |
-
<codePool>community</codePool>
|
16 |
-
</Lipscore_RatingsReviews>
|
17 |
-
</modules>
|
18 |
-
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
|
3 |
+
<!--
|
4 |
+
/**
|
5 |
+
* Module initial config
|
6 |
+
*
|
7 |
+
* @author @oivanova
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
|
11 |
+
<config>
|
12 |
+
<modules>
|
13 |
+
<Lipscore_RatingsReviews>
|
14 |
+
<active>true</active>
|
15 |
+
<codePool>community</codePool>
|
16 |
+
</Lipscore_RatingsReviews>
|
17 |
+
</modules>
|
18 |
+
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
Â
<?xml version="1.0"?>
|
2 |
Â
<package>
|
3 |
Â
<name>lipscore</name>
|
4 |
-
<version>1.
|
5 |
Â
<stability>stable</stability>
|
6 |
Â
<license uri="https://lipscore.com/signup">Terms of use</license>
|
7 |
Â
<channel>community</channel>
|
@@ -11,11 +11,11 @@
|
|
11 |
Â
Lipscore has a range of great features that will
|
12 |
Â
take all the hassle out of collecting product reviews, and help convert more
|
13 |
Â
visitors in to profitable customers.</description>
|
14 |
-
<notes>
|
15 |
Â
<authors><author><name>Henning Frettem</name><user>Lipscore</user><email>henning@lipscore.com</email></author><author><name>Olga Ivanova</name><user>oivanova</user><email>o.ivanova@datacrafts.io</email></author></authors>
|
16 |
-
<date>2016-02-
|
17 |
-
<time>
|
18 |
-
<contents><target name="magecommunity"><dir name="Lipscore"><dir name="RatingsReviews"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="Reviews.php" hash="
|
19 |
Â
<compatible/>
|
20 |
Â
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
21 |
Â
</package>
|
1 |
Â
<?xml version="1.0"?>
|
2 |
Â
<package>
|
3 |
Â
<name>lipscore</name>
|
4 |
+
<version>1.3.0</version>
|
5 |
Â
<stability>stable</stability>
|
6 |
Â
<license uri="https://lipscore.com/signup">Terms of use</license>
|
7 |
Â
<channel>community</channel>
|
11 |
Â
Lipscore has a range of great features that will
|
12 |
Â
take all the hassle out of collecting product reviews, and help convert more
|
13 |
Â
visitors in to profitable customers.</description>
|
14 |
+
<notes>Better support for reminder emails. It's possible to select which order status triggers a reminder email.</notes>
|
15 |
Â
<authors><author><name>Henning Frettem</name><user>Lipscore</user><email>henning@lipscore.com</email></author><author><name>Olga Ivanova</name><user>oivanova</user><email>o.ivanova@datacrafts.io</email></author></authors>
|
16 |
+
<date>2016-02-24</date>
|
17 |
+
<time>10:30:36</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="Lipscore"><dir name="RatingsReviews"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="Reviews.php" hash="e42b5b73a1b0f108818e4e8dad529d65"/><file name="View.php" hash="7f02a4d1fe64167be9885984fb31b7d3"/></dir></dir><file name="Init.php" hash="5c7469506b215d9dfa3ce8c074b50ab2"/><dir name="Purchase"><file name="Abstract.php" hash="4f9b41b1b84dc81b500656211b6ae38f"/><file name="Multishipping.php" hash="e9c866aed8a68dbc44ef2e050b12dc57"/><file name="Onepage.php" hash="b40ad6b638d20ee66229f4259050c497"/></dir><dir name="Review"><file name="Helper.php" hash="d9f5a39a6e432b5ea58f7b3ed08084e4"/><file name="Single.php" hash="1828a165516557d36820851da6a4fd6a"/><file name="Tabtitle.php" hash="20dfc5f3dc63c5b341c98ac1652b81d9"/></dir><dir name="System"><dir name="Config"><dir name="Form"><file name="Coupons.php" hash="75b2d3c48d10ef77c2a9e5b560767be0"/><dir name="Field"><file name="Abstract.php" hash="d3aacaca28c50d77b4766b35a98cb064"/><file name="Apikey.php" hash="69f23062e608e9a552cce33d0f67f9d2"/><file name="Reminderperiod.php" hash="835b2c844a319317b3edfb7b396a8850"/></dir><dir name="Fieldset"><file name="Coupons.php" hash="ea3b6a086bf35810492a89103c81c3c5"/><file name="Dashboardlink.php" hash="274be65d943d4645bb9b25c90cc6dab4"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Abstract.php" hash="4715d026440f1bb1cda70d56a69a2513"/><file name="Config.php" hash="5fc54781d2944ab4aeb941de3ddbb6b5"/><file name="Coupon.php" hash="154dde45de15233138e4bdfd447578a6"/><file name="Data.php" hash="d4a2ee7e1dbdd277e5a6eff4927fe4b2"/><file name="Locale.php" hash="d87879480dcef5623aacf3f60b76ad38"/><file name="Module.php" hash="b15e3f74b7ce9f77780bc6db2e92efcc"/><file name="Price.php" hash="a18d38d97b10f2bf7ab4e1cd0a9e83a4"/><file name="Product.php" hash="143aae06c14564a008c1bada053f0da6"/><file name="Purchase.php" hash="1ca338f76113c292275067423c9329c9"/><file name="Reminder.php" hash="2fa0a5c45f750afd57f16f9ec84e1ae2"/><file name="Widget.php" hash="e084d21682603fc6bded14031c3ad81e"/></dir><file name="Logger.php" hash="c1d2ebc6b0b6d34537b4d76b7612a932"/><dir name="Model"><dir name="Api"><file name="Request.php" hash="b61017066275ec132bf94e1997896bde"/></dir><dir name="Config"><file name="Env.php" hash="6d541047b5f1366271d4ac92d4cd65b5"/></dir><file name="Config.php" hash="b5d0045d3e73f87fe2a7fab07ea8ec3e"/><dir name="Coupon"><file name="Generator.php" hash="935c307b401046d110c49b2eb09b7958"/></dir><dir name="Observer"><file name="Abstract.php" hash="9c6fc2d6cea03c9cea558933690a0b87"/><file name="Module.php" hash="4887fc64a1eab00776f4b8fa63b0d564"/><dir name="Order"><file name="Status.php" hash="09e560caa4a97da87863b17edbde6496"/></dir><file name="Output.php" hash="6d8c9cb651ac54ab23729f570807d6e8"/></dir><dir name="Purchase"><file name="Reminder.php" hash="6947f0251ac697afa80d87b0a557cccd"/></dir><file name="Shop.php" hash="b23d54688fc733ea672d427072a675af"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Apikey.php" hash="53385393e0e6c6320878f06929424581"/></dir><dir name="Source"><file name="Locale.php" hash="2dfe5a7c2a950504844a0b13eb357efa"/><dir name="Order"><file name="Status.php" hash="702892f9131cfdb1ee1aaefc4c627547"/></dir><file name="Pricerule.php" hash="5204f6c341f8adc8a6b8c77888e40396"/><dir name="Productattr"><file name="Brand.php" hash="fc166f0faa7304b4bc861d50e7b9a8e7"/></dir><file name="Reminderperiod.php" hash="1c6a9df19b5507ab2d706af46c96f4d5"/></dir></dir></dir><dir name="Tracker"><file name="Action.php" hash="94a353059f272207491baa05dd7686f5"/><file name="Installation.php" hash="15a0823b0fd346fba58a313c711c4103"/></dir></dir><dir name="controllers"><dir name="Purchases"><file name="RemindersController.php" hash="01103c031a42daa6958e802e7d39bfb5"/></dir></dir><dir name="data"><dir name="lipscore_ratingsreviews_setup"><file name="data-install-1.2.21.0.php" hash="0ebbbd1f815ef325cee95311bc4023f8"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c3a5ed358f97a2119bcaf3a6c1d6c026"/><file name="config.xml" hash="d9ba85dcf50c2d31abdf6c911e0ca7c0"/><dir name="environments"><file name="production.xml" hash="a519f9130a42c2bc04a30c23eeb3adaf"/></dir><file name="system.xml" hash="cc65b42c3061cfd346f2af19cb3a6e84"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="lipscore"><file name="init.phtml" hash="3de6b4043bfb937406e136f3644fa3d9"/><dir name="purchase"><file name="view.phtml" hash="ce87d7dcb5b36f67d19843b84a5198e7"/></dir><dir name="rating"><file name="view.phtml" hash="d678569a9626016f54502e8d35d0eea9"/></dir><dir name="reviews"><file name="tab_title.phtml" hash="716d399499e80fa1cb61dd83295be1f7"/><file name="view.phtml" hash="37b2a4de52536e0632bad412a80a21fc"/><file name="view_single.phtml" hash="3675bcf396c750b63e01dd56b576a676"/></dir></dir></dir><dir name="layout"><file name="lipscore_ratingsreviews.xml" hash="c41ae9b0c0add978cbec4b9ea07b293a"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="lipscore_ratingsreviews.xml" hash="3e6353dfc81756e37494941ef6eb8bee"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Lipscore_RatingsReviews.xml" hash="9422ff014d7fcbd68274ffd97182de1d"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><file name="lipscore.css" hash="b119c59d0beef8984416f455ea1d3e6e"/></dir><dir name="js"><file name="lipscore.js" hash="0ac6084e3d815ef75855fe2c2ebcae06"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><file name="lipscore.css" hash="5893f0e5e380d7013db09248da0097b9"/><dir name="js"><file name="lipscore.js" hash="8bc4b8b7cd53695bb02fc90bb4055f57"/></dir></dir></dir></dir></target></contents>
|
19 |
Â
<compatible/>
|
20 |
Â
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
21 |
Â
</package>
|
skin/adminhtml/default/default/js/lipscore.js
CHANGED
@@ -1,60 +1,60 @@
|
|
1 |
-
function sendLipscoreReminder(url) {
|
2 |
-
$statusEl = $('order_status');
|
3 |
-
$fromEl = $('remind_from');
|
4 |
-
$toEl = $('remind_to');
|
5 |
-
|
6 |
-
new Ajax.Request(url, {
|
7 |
-
method: 'post',
|
8 |
-
parameters: {
|
9 |
-
'status[]': $statusEl.getValue(),
|
10 |
-
from: $fromEl.getValue(),
|
11 |
-
to: $toEl.getValue(),
|
12 |
-
},
|
13 |
-
onSuccess: function(response) {
|
14 |
-
showReminderMessage(response);
|
15 |
-
},
|
16 |
-
onFailure: function(response) {
|
17 |
-
showReminderMessage(response);
|
18 |
-
}
|
19 |
-
});
|
20 |
-
};
|
21 |
-
|
22 |
-
function showReminderMessage(response) {
|
23 |
-
var txt = '';
|
24 |
-
var type = 'error';
|
25 |
-
var commonErr = "We're sorry, but something went wrong with reminders, please try again or contact support.<br/><br/>";
|
26 |
-
|
27 |
-
var errMessage = function(response) {
|
28 |
-
return commonErr + response.status + ': ' + response.request.url + '.<br/> Params: ' +
|
29 |
-
response.request.body + '.<br/> Text: ' + response.responseText;
|
30 |
-
};
|
31 |
-
|
32 |
-
switch(response.status) {
|
33 |
-
case 200:
|
34 |
-
if (response.responseJSON && 'message' in response.responseJSON) {
|
35 |
-
txt = response.responseJSON.message;
|
36 |
-
type = 'success';
|
37 |
-
} else {
|
38 |
-
txt = errMessage(response);
|
39 |
-
}
|
40 |
-
break;
|
41 |
-
case 403:
|
42 |
-
txt = '403 Forbidden';
|
43 |
-
break;
|
44 |
-
case 404:
|
45 |
-
txt = commonErr + '404 Not Found: ' + response.request.url;
|
46 |
-
break;
|
47 |
-
case 422:
|
48 |
-
txt = response.responseJSON.message;
|
49 |
-
break;
|
50 |
-
case 408:
|
51 |
-
txt = 'The server timed out waiting for the request.';
|
52 |
-
break;
|
53 |
-
default:
|
54 |
-
txt = errMessage(response);
|
55 |
-
break;
|
56 |
-
}
|
57 |
-
|
58 |
-
var html = '<ul class="messages"><li class="' + type + '-msg"><ul><li>' + txt + '</li></ul></li></ul>';
|
59 |
-
$('messages').update(html);
|
60 |
-
}
|
1 |
+
function sendLipscoreReminder(url) {
|
2 |
+
$statusEl = $('order_status');
|
3 |
+
$fromEl = $('remind_from');
|
4 |
+
$toEl = $('remind_to');
|
5 |
+
|
6 |
+
new Ajax.Request(url, {
|
7 |
+
method: 'post',
|
8 |
+
parameters: {
|
9 |
+
'status[]': $statusEl.getValue(),
|
10 |
+
from: $fromEl.getValue(),
|
11 |
+
to: $toEl.getValue(),
|
12 |
+
},
|
13 |
+
onSuccess: function(response) {
|
14 |
+
showReminderMessage(response);
|
15 |
+
},
|
16 |
+
onFailure: function(response) {
|
17 |
+
showReminderMessage(response);
|
18 |
+
}
|
19 |
+
});
|
20 |
+
};
|
21 |
+
|
22 |
+
function showReminderMessage(response) {
|
23 |
+
var txt = '';
|
24 |
+
var type = 'error';
|
25 |
+
var commonErr = "We're sorry, but something went wrong with reminders, please try again or contact support.<br/><br/>";
|
26 |
+
|
27 |
+
var errMessage = function(response) {
|
28 |
+
return commonErr + response.status + ': ' + response.request.url + '.<br/> Params: ' +
|
29 |
+
response.request.body + '.<br/> Text: ' + response.responseText;
|
30 |
+
};
|
31 |
+
|
32 |
+
switch(response.status) {
|
33 |
+
case 200:
|
34 |
+
if (response.responseJSON && 'message' in response.responseJSON) {
|
35 |
+
txt = response.responseJSON.message;
|
36 |
+
type = 'success';
|
37 |
+
} else {
|
38 |
+
txt = errMessage(response);
|
39 |
+
}
|
40 |
+
break;
|
41 |
+
case 403:
|
42 |
+
txt = '403 Forbidden';
|
43 |
+
break;
|
44 |
+
case 404:
|
45 |
+
txt = commonErr + '404 Not Found: ' + response.request.url;
|
46 |
+
break;
|
47 |
+
case 422:
|
48 |
+
txt = response.responseJSON.message;
|
49 |
+
break;
|
50 |
+
case 408:
|
51 |
+
txt = 'The server timed out waiting for the request.';
|
52 |
+
break;
|
53 |
+
default:
|
54 |
+
txt = errMessage(response);
|
55 |
+
break;
|
56 |
+
}
|
57 |
+
|
58 |
+
var html = '<ul class="messages"><li class="' + type + '-msg"><ul><li>' + txt + '</li></ul></li></ul>';
|
59 |
+
$('messages').update(html);
|
60 |
+
}
|
skin/adminhtml/default/default/lipscore.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
.ls-reminder-label { margin-right: 10px; display: inline-block; vertical-align: middle; }
|
2 |
-
#ls-reminder img { margin-right: 7px; }
|
3 |
-
#ls-reminder-button { margin-left: 8px }
|
4 |
-
#order_status {margin-right: 15px; }
|
5 |
-
.lipscore-notice-msg { background: url(images/warning_msg_icon.gif) no-repeat; padding: 2px 0 0 20px; }
|
1 |
+
.ls-reminder-label { margin-right: 10px; display: inline-block; vertical-align: middle; }
|
2 |
+
#ls-reminder img { margin-right: 7px; }
|
3 |
+
#ls-reminder-button { margin-left: 8px }
|
4 |
+
#order_status {margin-right: 15px; }
|
5 |
+
.lipscore-notice-msg { background: url(images/warning_msg_icon.gif) no-repeat; padding: 2px 0 0 20px; }
|
skin/frontend/base/default/css/lipscore.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
img.lipscore-rating-small-image { display: inline; }
|
2 |
-
.lipscore-reviews-single {
|
3 |
-
clear: both;
|
4 |
-
display: block;
|
5 |
-
margin-top: 15px;
|
6 |
-
}
|
1 |
+
img.lipscore-rating-small-image { display: inline; }
|
2 |
+
.lipscore-reviews-single {
|
3 |
+
clear: both;
|
4 |
+
display: block;
|
5 |
+
margin-top: 15px;
|
6 |
+
}
|
skin/frontend/base/default/js/lipscore.js
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
function magentoLipscoreInit() {
|
2 |
-
tabSelector = '.lipscore-reviews-tab';
|
3 |
-
if ($$(tabSelector).length > 0) {
|
4 |
-
// show review count
|
5 |
-
lipscore.on('review-count-set', function(data) {
|
6 |
-
if (data.value > 0) {
|
7 |
-
$$('.lipscore-reviews-tab-count').invoke('show');
|
8 |
-
}
|
9 |
-
});
|
10 |
-
|
11 |
-
// open reviews tab if reviews link clicked
|
12 |
-
lipscore.on('review-count-link-clicked', function(data) {
|
13 |
-
$$(tabSelector)[0].up().click();
|
14 |
-
});
|
15 |
-
}
|
16 |
-
}
|
17 |
-
|
18 |
-
document.observe('dom:loaded', function() {
|
19 |
-
if (typeof lipscore !== 'undefined') {
|
20 |
-
magentoLipscoreInit();
|
21 |
-
} else {
|
22 |
-
document.observe('lipscore-created', magentoLipscoreInit);
|
23 |
-
}
|
24 |
-
});
|
1 |
+
function magentoLipscoreInit() {
|
2 |
+
tabSelector = '.lipscore-reviews-tab';
|
3 |
+
if ($$(tabSelector).length > 0) {
|
4 |
+
// show review count
|
5 |
+
lipscore.on('review-count-set', function(data) {
|
6 |
+
if (data.value > 0) {
|
7 |
+
$$('.lipscore-reviews-tab-count').invoke('show');
|
8 |
+
}
|
9 |
+
});
|
10 |
+
|
11 |
+
// open reviews tab if reviews link clicked
|
12 |
+
lipscore.on('review-count-link-clicked', function(data) {
|
13 |
+
$$(tabSelector)[0].up().click();
|
14 |
+
});
|
15 |
+
}
|
16 |
+
}
|
17 |
+
|
18 |
+
document.observe('dom:loaded', function() {
|
19 |
+
if (typeof lipscore !== 'undefined') {
|
20 |
+
magentoLipscoreInit();
|
21 |
+
} else {
|
22 |
+
document.observe('lipscore-created', magentoLipscoreInit);
|
23 |
+
}
|
24 |
+
});
|