Me_Gravity - Version 1.0.2.1

Version Notes

Version number: 1.0.2.1
Stability: Stable
Compatibility: CE 1.6.x, 1.7.x, 1.8.x, 1.9.x

Download this release

Release Info

Developer Gravity Recommendations
Extension Me_Gravity
Version 1.0.2.1
Comparing to
See all releases


Code changes from version 1.0.1.7 to 1.0.2.1

Files changed (34) hide show
  1. app/code/community/Me/Gravity/Block/Catalog/Category/Boxes/Category.php +14 -8
  2. app/code/community/Me/Gravity/Block/Catalog/Category/Boxes/Personal.php +5 -2
  3. app/code/community/Me/Gravity/Block/Catalog/Category/Boxes/Top.php +5 -2
  4. app/code/community/Me/Gravity/Block/Catalog/Product/View/Boxes/Accessories.php +5 -2
  5. app/code/community/Me/Gravity/Block/Catalog/Product/View/Boxes/Personal.php +6 -2
  6. app/code/community/Me/Gravity/Block/Catalog/Product/View/Boxes/Product.php +14 -8
  7. app/code/community/Me/Gravity/Block/Catalog/Product/View/Boxes/Similar.php +5 -2
  8. app/code/community/Me/Gravity/Block/General/Boxes/Best.php +5 -2
  9. app/code/community/Me/Gravity/Block/General/Boxes/History.php +5 -2
  10. app/code/community/Me/Gravity/Block/General/Boxes/Others.php +5 -2
  11. app/code/community/Me/Gravity/Block/General/Boxes/Popular.php +5 -2
  12. app/code/community/Me/Gravity/Block/Recommendation.php +35 -7
  13. app/code/community/Me/Gravity/Helper/Boxes.php +21 -0
  14. app/code/community/Me/Gravity/Helper/Data.php +18 -0
  15. app/code/community/Me/Gravity/Model/Client/GravityClient.php +29 -2
  16. app/code/community/Me/Gravity/Model/Method/Request.php +95 -5
  17. app/code/community/Me/Gravity/Model/Observer.php +195 -17
  18. app/code/community/Me/Gravity/etc/config.xml +2 -1
  19. app/code/community/Me/Gravity/etc/system.xml +10 -0
  20. app/design/frontend/base/default/template/me/gravity/catalog/category/boxes/default.phtml +23 -16
  21. app/design/frontend/base/default/template/me/gravity/catalog/category/boxes/sidebar.phtml +23 -16
  22. app/design/frontend/base/default/template/me/gravity/catalog/product/view/boxes/default.phtml +20 -13
  23. app/design/frontend/base/default/template/me/gravity/catalog/product/view/boxes/sidebar.phtml +20 -13
  24. app/design/frontend/base/default/template/me/gravity/general/boxes/default.phtml +18 -11
  25. app/design/frontend/base/default/template/me/gravity/general/boxes/sidebar.phtml +8 -1
  26. app/design/frontend/base/default/template/me/gravity/page/js/body-end.phtml +10 -0
  27. app/design/frontend/base/default/template/me/gravity/page/js/gravity.phtml +8 -2
  28. app/design/frontend/rwd/default/template/me/gravity/catalog/category/boxes/default.phtml +23 -16
  29. app/design/frontend/rwd/default/template/me/gravity/catalog/category/boxes/sidebar.phtml +15 -7
  30. app/design/frontend/rwd/default/template/me/gravity/catalog/product/view/boxes/default.phtml +20 -13
  31. app/design/frontend/rwd/default/template/me/gravity/catalog/product/view/boxes/sidebar.phtml +9 -2
  32. app/design/frontend/rwd/default/template/me/gravity/general/boxes/default.phtml +18 -11
  33. app/design/frontend/rwd/default/template/me/gravity/general/boxes/sidebar.phtml +8 -1
  34. package.xml +5 -5
app/code/community/Me/Gravity/Block/Catalog/Category/Boxes/Category.php CHANGED
@@ -29,14 +29,20 @@ class Me_Gravity_Block_Catalog_Category_Boxes_Category extends Me_Gravity_Block_
29
  {
30
  if ($this->getRecommendationType()) {
31
 
32
- $items = Mage::getModel('me_gravity/method_request')->sendRequest(
33
- Me_Gravity_Model_Method_Request::EVENT_TYPE_GET,
34
- array(
35
- 'type' => $this->_recommendationType,
36
- 'limit' => $this->_recommendationLimit,
37
- 'filters' => $this->_filters ? $this->_filters : null
38
- )
39
- );
 
 
 
 
 
 
40
 
41
  if (!empty($items)) {
42
 
29
  {
30
  if ($this->getRecommendationType()) {
31
 
32
+ $items = array();
33
+
34
+ if (!$this->getGravityHelper()->useBulkRecommendation()) {
35
+ $items = Mage::getModel('me_gravity/method_request')->sendRequest(
36
+ Me_Gravity_Model_Method_Request::EVENT_TYPE_GET,
37
+ array(
38
+ 'type' => $this->_recommendationType,
39
+ 'limit' => $this->_recommendationLimit,
40
+ 'filters' => $this->_filters ? $this->_filters : null
41
+ )
42
+ );
43
+ } else {
44
+ $items = $this->getBulkItems();
45
+ }
46
 
47
  if (!empty($items)) {
48
 
app/code/community/Me/Gravity/Block/Catalog/Category/Boxes/Personal.php CHANGED
@@ -33,15 +33,18 @@ class Me_Gravity_Block_Catalog_Category_Boxes_Personal extends Me_Gravity_Block_
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
 
36
 
37
- $this->setRecommendationType(Me_Gravity_Model_Method_Request::CATEGORY_PAGE_PERSONAL);
 
 
 
38
 
39
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
40
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
41
  : $this->getGravityHelper()->__('Personal Product(s)');
42
  $this->setRecommendationTitle($boxTitle);
43
 
44
- $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
45
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
46
 
47
  $this->_setFilters();
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
36
+ $gravityHelper = $this->getGravityHelper();
37
 
38
+ if (!$gravityHelper->useBulkRecommendation() || $gravityHelper->useGravityTemplate()) {
39
+ $this->setRecommendationType(Me_Gravity_Model_Method_Request::CATEGORY_PAGE_PERSONAL);
40
+ $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
41
+ }
42
 
43
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
44
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
45
  : $this->getGravityHelper()->__('Personal Product(s)');
46
  $this->setRecommendationTitle($boxTitle);
47
 
 
48
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
49
 
50
  $this->_setFilters();
app/code/community/Me/Gravity/Block/Catalog/Category/Boxes/Top.php CHANGED
@@ -33,15 +33,18 @@ class Me_Gravity_Block_Catalog_Category_Boxes_Top extends Me_Gravity_Block_Catal
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
 
36
 
37
- $this->setRecommendationType(Me_Gravity_Model_Method_Request::CATEGORY_PAGE_TOP);
 
 
 
38
 
39
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
40
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
41
  : $this->getGravityHelper()->__('Top Product(s)');
42
  $this->setRecommendationTitle($boxTitle);
43
 
44
- $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
45
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
46
 
47
  $this->_setFilters();
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
36
+ $gravityHelper = $this->getGravityHelper();
37
 
38
+ if (!$gravityHelper->useBulkRecommendation() || $gravityHelper->useGravityTemplate()) {
39
+ $this->setRecommendationType(Me_Gravity_Model_Method_Request::CATEGORY_PAGE_TOP);
40
+ $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
41
+ }
42
 
43
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
44
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
45
  : $this->getGravityHelper()->__('Top Product(s)');
46
  $this->setRecommendationTitle($boxTitle);
47
 
 
48
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
49
 
50
  $this->_setFilters();
app/code/community/Me/Gravity/Block/Catalog/Product/View/Boxes/Accessories.php CHANGED
@@ -33,15 +33,18 @@ class Me_Gravity_Block_Catalog_Product_View_Boxes_Accessories extends Me_Gravity
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
 
36
 
37
- $this->setRecommendationType(Me_Gravity_Model_Method_Request::PRODUCT_PAGE_ACCESSORIES);
 
 
 
38
 
39
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
40
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
41
  : $this->getGravityHelper()->__('Accessories');
42
  $this->setRecommendationTitle($boxTitle);
43
 
44
- $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
45
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
46
 
47
  parent::_construct();
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
36
+ $gravityHelper = $this->getGravityHelper();
37
 
38
+ if (!$gravityHelper->useBulkRecommendation() || $gravityHelper->useGravityTemplate()) {
39
+ $this->setRecommendationType(Me_Gravity_Model_Method_Request::PRODUCT_PAGE_ACCESSORIES);
40
+ $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
41
+ }
42
 
43
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
44
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
45
  : $this->getGravityHelper()->__('Accessories');
46
  $this->setRecommendationTitle($boxTitle);
47
 
 
48
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
49
 
50
  parent::_construct();
app/code/community/Me/Gravity/Block/Catalog/Product/View/Boxes/Personal.php CHANGED
@@ -33,15 +33,19 @@ class Me_Gravity_Block_Catalog_Product_View_Boxes_Personal extends Me_Gravity_Bl
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
 
36
 
37
- $this->setRecommendationType(Me_Gravity_Model_Method_Request::PRODUCT_PAGE_PERSONAL);
 
 
 
38
 
39
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
40
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
41
  : $this->getGravityHelper()->__('Personal Product(s)');
42
  $this->setRecommendationTitle($boxTitle);
43
 
44
- $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
45
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
46
 
47
  parent::_construct();
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
36
+ $gravityHelper = $this->getGravityHelper();
37
 
38
+ if (!$gravityHelper->useBulkRecommendation() || $gravityHelper->useGravityTemplate()) {
39
+ $this->setRecommendationType(Me_Gravity_Model_Method_Request::PRODUCT_PAGE_PERSONAL);
40
+ $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
41
+ }
42
 
43
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
44
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
45
  : $this->getGravityHelper()->__('Personal Product(s)');
46
  $this->setRecommendationTitle($boxTitle);
47
 
48
+
49
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
50
 
51
  parent::_construct();
app/code/community/Me/Gravity/Block/Catalog/Product/View/Boxes/Product.php CHANGED
@@ -24,14 +24,20 @@ class Me_Gravity_Block_Catalog_Product_View_Boxes_Product extends Me_Gravity_Blo
24
  {
25
  if ($this->getRecommendationType()) {
26
 
27
- $items = Mage::getModel('me_gravity/method_request')->sendRequest(
28
- Me_Gravity_Model_Method_Request::EVENT_TYPE_GET,
29
- array(
30
- 'type' => $this->_recommendationType,
31
- 'limit' => $this->_recommendationLimit,
32
- 'itemId' => $this->getProduct() ? $this->getProduct()->getId() : null
33
- )
34
- );
 
 
 
 
 
 
35
 
36
  if (!empty($items)) {
37
  $this->_recommendationId = key($items);
24
  {
25
  if ($this->getRecommendationType()) {
26
 
27
+ $items = array();
28
+
29
+ if (!$this->getGravityHelper()->useBulkRecommendation()) {
30
+ $items = Mage::getModel('me_gravity/method_request')->sendRequest(
31
+ Me_Gravity_Model_Method_Request::EVENT_TYPE_GET,
32
+ array(
33
+ 'type' => $this->_recommendationType,
34
+ 'limit' => $this->_recommendationLimit,
35
+ 'itemId' => $this->getProduct() ? $this->getProduct()->getId() : null
36
+ )
37
+ );
38
+ } else {
39
+ $items = $this->getBulkItems();
40
+ }
41
 
42
  if (!empty($items)) {
43
  $this->_recommendationId = key($items);
app/code/community/Me/Gravity/Block/Catalog/Product/View/Boxes/Similar.php CHANGED
@@ -33,15 +33,18 @@ class Me_Gravity_Block_Catalog_Product_View_Boxes_Similar extends Me_Gravity_Blo
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
 
36
 
37
- $this->setRecommendationType(Me_Gravity_Model_Method_Request::PRODUCT_PAGE_SIMILAR);
 
 
 
38
 
39
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
40
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
41
  : $this->getGravityHelper()->__('Similar Product(s)');
42
  $this->setRecommendationTitle($boxTitle);
43
 
44
- $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
45
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
46
 
47
  parent::_construct();
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
36
+ $gravityHelper = $this->getGravityHelper();
37
 
38
+ if (!$gravityHelper->useBulkRecommendation() || $gravityHelper->useGravityTemplate()) {
39
+ $this->setRecommendationType(Me_Gravity_Model_Method_Request::PRODUCT_PAGE_SIMILAR);
40
+ $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
41
+ }
42
 
43
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
44
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
45
  : $this->getGravityHelper()->__('Similar Product(s)');
46
  $this->setRecommendationTitle($boxTitle);
47
 
 
48
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
49
 
50
  parent::_construct();
app/code/community/Me/Gravity/Block/General/Boxes/Best.php CHANGED
@@ -33,15 +33,18 @@ class Me_Gravity_Block_General_Boxes_Best extends Me_Gravity_Block_Recommendatio
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
 
36
 
37
- $this->setRecommendationType(Me_Gravity_Model_Method_Request::GENERAL_PERSONAL_BEST);
 
 
 
38
 
39
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
40
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
41
  : $this->getGravityHelper()->__('Recommended for you');
42
  $this->setRecommendationTitle($boxTitle);
43
 
44
- $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
45
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
46
 
47
  parent::_construct();
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
36
+ $gravityHelper = $this->getGravityHelper();
37
 
38
+ if (!$gravityHelper->useBulkRecommendation() || $gravityHelper->useGravityTemplate()) {
39
+ $this->setRecommendationType(Me_Gravity_Model_Method_Request::GENERAL_PERSONAL_BEST);
40
+ $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
41
+ }
42
 
43
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
44
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
45
  : $this->getGravityHelper()->__('Recommended for you');
46
  $this->setRecommendationTitle($boxTitle);
47
 
 
48
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
49
 
50
  parent::_construct();
app/code/community/Me/Gravity/Block/General/Boxes/History.php CHANGED
@@ -33,15 +33,18 @@ class Me_Gravity_Block_General_Boxes_History extends Me_Gravity_Block_Recommenda
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
 
36
 
37
- $this->setRecommendationType(Me_Gravity_Model_Method_Request::GENERAL_PERSONAL_HISTORY);
 
 
 
38
 
39
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
40
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
41
  : $this->getGravityHelper()->__('You viewed');
42
  $this->setRecommendationTitle($boxTitle);
43
 
44
- $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
45
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
46
 
47
  parent::_construct();
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
36
+ $gravityHelper = $this->getGravityHelper();
37
 
38
+ if (!$gravityHelper->useBulkRecommendation() || $gravityHelper->useGravityTemplate()) {
39
+ $this->setRecommendationType(Me_Gravity_Model_Method_Request::GENERAL_PERSONAL_HISTORY);
40
+ $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
41
+ }
42
 
43
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
44
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
45
  : $this->getGravityHelper()->__('You viewed');
46
  $this->setRecommendationTitle($boxTitle);
47
 
 
48
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
49
 
50
  parent::_construct();
app/code/community/Me/Gravity/Block/General/Boxes/Others.php CHANGED
@@ -33,15 +33,18 @@ class Me_Gravity_Block_General_Boxes_Others extends Me_Gravity_Block_Recommendat
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
 
36
 
37
- $this->setRecommendationType(Me_Gravity_Model_Method_Request::GENERAL_CURRENTLY_VIEWED);
 
 
 
38
 
39
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
40
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
41
  : $this->getGravityHelper()->__('Others are looking at right now');
42
  $this->setRecommendationTitle($boxTitle);
43
 
44
- $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
45
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
46
 
47
  parent::_construct();
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
36
+ $gravityHelper = $this->getGravityHelper();
37
 
38
+ if (!$gravityHelper->useBulkRecommendation() || $gravityHelper->useGravityTemplate()) {
39
+ $this->setRecommendationType(Me_Gravity_Model_Method_Request::GENERAL_CURRENTLY_VIEWED);
40
+ $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
41
+ }
42
 
43
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
44
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
45
  : $this->getGravityHelper()->__('Others are looking at right now');
46
  $this->setRecommendationTitle($boxTitle);
47
 
 
48
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
49
 
50
  parent::_construct();
app/code/community/Me/Gravity/Block/General/Boxes/Popular.php CHANGED
@@ -33,15 +33,18 @@ class Me_Gravity_Block_General_Boxes_Popular extends Me_Gravity_Block_Recommenda
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
 
36
 
37
- $this->setRecommendationType(Me_Gravity_Model_Method_Request::GENERAL_POPULAR);
 
 
 
38
 
39
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
40
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
41
  : $this->getGravityHelper()->__('Top products');
42
  $this->setRecommendationTitle($boxTitle);
43
 
44
- $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
45
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
46
 
47
  parent::_construct();
33
  protected function _construct()
34
  {
35
  $boxHelper = $this->_getGravityBoxHelper();
36
+ $gravityHelper = $this->getGravityHelper();
37
 
38
+ if (!$gravityHelper->useBulkRecommendation() || $gravityHelper->useGravityTemplate()) {
39
+ $this->setRecommendationType(Me_Gravity_Model_Method_Request::GENERAL_POPULAR);
40
+ $this->setRecommendationLimit($boxHelper->getBoxLimit($this->_boxClass, $this->_pageType));
41
+ }
42
 
43
  $boxTitle = $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
44
  ? $boxHelper->getBoxTitle($this->_boxClass, $this->_pageType)
45
  : $this->getGravityHelper()->__('Top products');
46
  $this->setRecommendationTitle($boxTitle);
47
 
 
48
  $this->setBoxColumnCount($boxHelper->getBoxColumns($this->_boxClass, $this->_pageType));
49
 
50
  parent::_construct();
app/code/community/Me/Gravity/Block/Recommendation.php CHANGED
@@ -50,6 +50,8 @@ class Me_Gravity_Block_Recommendation extends Mage_Catalog_Block_Product_Abstrac
50
  */
51
  protected $_boxClass = '';
52
 
 
 
53
  /**
54
  * Get recommended items
55
  *
@@ -59,13 +61,19 @@ class Me_Gravity_Block_Recommendation extends Mage_Catalog_Block_Product_Abstrac
59
  {
60
  if ($this->getRecommendationType()) {
61
 
62
- $items = Mage::getModel('me_gravity/method_request')->sendRequest(
63
- Me_Gravity_Model_Method_Request::EVENT_TYPE_GET,
64
- array(
65
- 'type' => $this->_recommendationType,
66
- 'limit' => $this->_recommendationLimit
67
- )
68
- );
 
 
 
 
 
 
69
 
70
  if (!empty($items)) {
71
 
@@ -238,6 +246,26 @@ class Me_Gravity_Block_Recommendation extends Mage_Catalog_Block_Product_Abstrac
238
  return Mage::app()->getStore()->getId();
239
  }
240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  /**
242
  * Get product ids in cart
243
  *
50
  */
51
  protected $_boxClass = '';
52
 
53
+ protected $_groupSec = 1;
54
+
55
  /**
56
  * Get recommended items
57
  *
61
  {
62
  if ($this->getRecommendationType()) {
63
 
64
+ $items = array();
65
+
66
+ if (!$this->getGravityHelper()->useBulkRecommendation()) {
67
+ $items = Mage::getModel('me_gravity/method_request')->sendRequest(
68
+ Me_Gravity_Model_Method_Request::EVENT_TYPE_GET,
69
+ array(
70
+ 'type' => $this->_recommendationType,
71
+ 'limit' => $this->_recommendationLimit
72
+ )
73
+ );
74
+ } else {
75
+ $items = $this->getBulkItems();
76
+ }
77
 
78
  if (!empty($items)) {
79
 
246
  return Mage::app()->getStore()->getId();
247
  }
248
 
249
+ /**
250
+ * Get bulk items
251
+ *
252
+ * @return mixed
253
+ */
254
+ public function getBulkItems()
255
+ {
256
+ return $this->getData('bulk_items');
257
+ }
258
+
259
+ /**
260
+ * Get customer session
261
+ *
262
+ * @return Mage_Customer_Model_Session
263
+ */
264
+ protected function _getSession()
265
+ {
266
+ return Mage::getSingleton('customer/session');
267
+ }
268
+
269
  /**
270
  * Get product ids in cart
271
  *
app/code/community/Me/Gravity/Helper/Boxes.php CHANGED
@@ -100,4 +100,25 @@ class Me_Gravity_Helper_Boxes extends Mage_Core_Helper_Data
100
  return false;
101
  }
102
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  }
100
  return false;
101
  }
102
  }
103
+
104
+ /**
105
+ * Identify recommendation items key by partial string
106
+ *
107
+ * @param array $bulkItems bulk items array
108
+ * @param string $recommendationType type
109
+ * @return mixed
110
+ */
111
+ public function identifyBulkKeys($bulkItems = array(), $recommendationType = '')
112
+ {
113
+ $result = array();
114
+
115
+ foreach ($bulkItems as $k => $v) {
116
+ if (strpos($k, $recommendationType) !== false) {
117
+ $result[$k] = $bulkItems[$k];
118
+ break;
119
+ }
120
+ }
121
+
122
+ return $result;
123
+ }
124
  }
app/code/community/Me/Gravity/Helper/Data.php CHANGED
@@ -85,6 +85,13 @@ class Me_Gravity_Helper_Data extends Mage_Core_Helper_Data
85
  */
86
  const XML_PATH_USE_TEMPLATE = 'gravity/config/template';
87
 
 
 
 
 
 
 
 
88
  /**
89
  * Path to store config catalog export all
90
  *
@@ -441,6 +448,17 @@ class Me_Gravity_Helper_Data extends Mage_Core_Helper_Data
441
  return Mage::getStoreConfigFlag(self::XML_PATH_USE_TEMPLATE, $store);
442
  }
443
 
 
 
 
 
 
 
 
 
 
 
 
444
  /**
445
  * Get customer update synchronisation enabled
446
  *
85
  */
86
  const XML_PATH_USE_TEMPLATE = 'gravity/config/template';
87
 
88
+ /**
89
+ * Path to store config use bulk recommendation
90
+ *
91
+ * @var string
92
+ */
93
+ const XML_PATH_USE_BULK = 'gravity/config/bulk';
94
+
95
  /**
96
  * Path to store config catalog export all
97
  *
448
  return Mage::getStoreConfigFlag(self::XML_PATH_USE_TEMPLATE, $store);
449
  }
450
 
451
+ /**
452
+ * Check whether use bulk recommendation
453
+ *
454
+ * @param integer|string|Mage_Core_Model_Store $store store
455
+ * @return bool
456
+ */
457
+ public function useBulkRecommendation($store = null)
458
+ {
459
+ return Mage::getStoreConfigFlag(self::XML_PATH_USE_BULK, $store);
460
+ }
461
+
462
  /**
463
  * Get customer update synchronisation enabled
464
  *
app/code/community/Me/Gravity/Model/Client/GravityClient.php CHANGED
@@ -40,7 +40,7 @@ class GravityClient {
40
  /**
41
  * The version info of the client.
42
  */
43
- private $version = '1.0.9';
44
 
45
  /**
46
  * Creates a new client instance with the specified configuration
@@ -190,6 +190,34 @@ class GravityClient {
190
  );
191
  }
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  /**
194
  * Simple test function to test without side effects whether the service is alive.
195
  * @return string "Hello " + <code>$name</code>
@@ -247,7 +275,6 @@ class GravityClient {
247
  curl_setopt($ch, CURLOPT_POST, true);
248
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestBody));
249
  }
250
-
251
  $result = curl_exec($ch);
252
 
253
  $retryEnabled = in_array($methodName, array("addUsers", "addItems"));
40
  /**
41
  * The version info of the client.
42
  */
43
+ private $version = '1.0.10';
44
 
45
  /**
46
  * Creates a new client instance with the specified configuration
190
  );
191
  }
192
 
193
+ /**
194
+ * Given the userId and the cookieId, we can request recommendations for multiple scenarios (described by the context).
195
+ * This function returns lists of recommended items for each of the given scenarios in an array.
196
+ *
197
+ * @param string <var>$userId</var> The identifier of the logged in user. If no user is logged in, null should be specified.
198
+ * @param string <var>$cookieId</var> It should be a permanent identifier for the end users computer, preserving its value across browser sessions.
199
+ * It should be always specified.
200
+ * @param GravityRecommendationContext[] <var>$context</var>
201
+ * Additional Array of information which describes the actual scenarios.
202
+ * @return GravityItemRecommendation[]
203
+ * An Array containing the recommended items for each scenario with other information about the recommendation.
204
+ */
205
+ public function getItemRecommendationBulk($userId, $cookieId, array $context) {
206
+ foreach ($context as $element) {
207
+ $element->cookieId = $cookieId;
208
+ $element->userId = $userId;
209
+ }
210
+ return $this->sendRequest(
211
+ 'getItemRecommendationBulk',
212
+ array(
213
+ 'userId' => $userId,
214
+ 'cookieId' => $cookieId,
215
+ ),
216
+ $context,
217
+ true
218
+ );
219
+ }
220
+
221
  /**
222
  * Simple test function to test without side effects whether the service is alive.
223
  * @return string "Hello " + <code>$name</code>
275
  curl_setopt($ch, CURLOPT_POST, true);
276
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestBody));
277
  }
 
278
  $result = curl_exec($ch);
279
 
280
  $retryEnabled = in_array($methodName, array("addUsers", "addItems"));
app/code/community/Me/Gravity/Model/Method/Request.php CHANGED
@@ -22,6 +22,11 @@ class Me_Gravity_Model_Method_Request extends Me_Gravity_Model_Method_Abstract
22
  */
23
  const EVENT_TYPE_GET = 'GET';
24
 
 
 
 
 
 
25
  /**
26
  * Send event type
27
  */
@@ -199,6 +204,9 @@ class Me_Gravity_Model_Method_Request extends Me_Gravity_Model_Method_Abstract
199
  case self::EVENT_TYPE_GET:
200
  $result = $this->_getRecommendationItems($client, $params);
201
  break;
 
 
 
202
  case self::EVENT_TYPE_TEST:
203
  $result = $client->test($this->_helper->getApiUser());
204
  break;
@@ -216,7 +224,7 @@ class Me_Gravity_Model_Method_Request extends Me_Gravity_Model_Method_Abstract
216
  $this->_helper->getLogger($result);
217
  }
218
 
219
- return $this->_validateResult($result);
220
 
221
  } catch (Mage_Core_Exception $e) {
222
 
@@ -419,6 +427,75 @@ class Me_Gravity_Model_Method_Request extends Me_Gravity_Model_Method_Abstract
419
  }
420
  }
421
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
422
  /**
423
  * Send update
424
  *
@@ -443,7 +520,7 @@ class Me_Gravity_Model_Method_Request extends Me_Gravity_Model_Method_Abstract
443
  $user->hidden = false;
444
 
445
  if ($this->_canDebugLog) {
446
- $this->_helper->getLogger('userId: ' .$params['userid']);
447
  }
448
 
449
  unset($params['type']);
@@ -466,7 +543,7 @@ class Me_Gravity_Model_Method_Request extends Me_Gravity_Model_Method_Abstract
466
  $item->title = $params['title'];
467
  $item->hidden = $params['hidden'];
468
  if ($this->_canDebugLog) {
469
- $this->_helper->getLogger('itemId: ' .$params['itemid']);
470
  }
471
 
472
  unset($params['type']);
@@ -503,13 +580,26 @@ class Me_Gravity_Model_Method_Request extends Me_Gravity_Model_Method_Abstract
503
  * Validate result
504
  *
505
  * @param stdClass $result result
 
506
  * @return null|string|array
507
  */
508
- protected function _validateResult($result)
509
  {
510
  $answer = array();
511
 
512
- if ($result && $result instanceof stdClass) {
 
 
 
 
 
 
 
 
 
 
 
 
513
 
514
  if (!empty($result->itemIds)) {
515
  $answer[$result->recommendationId] = $result->itemIds;
22
  */
23
  const EVENT_TYPE_GET = 'GET';
24
 
25
+ /**
26
+ * Request event type bulk
27
+ */
28
+ const EVENT_TYPE_BULK = 'BULK';
29
+
30
  /**
31
  * Send event type
32
  */
204
  case self::EVENT_TYPE_GET:
205
  $result = $this->_getRecommendationItems($client, $params);
206
  break;
207
+ case self::EVENT_TYPE_BULK:
208
+ $result = $this->_getBulkRecommendationItems($client, $params);
209
+ break;
210
  case self::EVENT_TYPE_TEST:
211
  $result = $client->test($this->_helper->getApiUser());
212
  break;
224
  $this->_helper->getLogger($result);
225
  }
226
 
227
+ return $this->_validateResult($result, $this->_helper->useBulkRecommendation());
228
 
229
  } catch (Mage_Core_Exception $e) {
230
 
427
  }
428
  }
429
 
430
+ /**
431
+ * Get recommendation
432
+ *
433
+ * @param GravityClient $client client
434
+ * @param array $params parameters
435
+ * @throws Mage_Core_Exception
436
+ * @return object
437
+ */
438
+ protected function _getBulkRecommendationItems($client, $params)
439
+ {
440
+ if ($this->_helper->getDebugMode()) {
441
+ $this->_helper->getLogger($params);
442
+ }
443
+
444
+ $recommendationContextArray = array();
445
+ $userId = $this->_getCustomerId();
446
+ $cookieId = $this->_gravityCookie;
447
+
448
+ $i = 0;
449
+ foreach ($params as $param) {
450
+
451
+ if (!isset($param['type'])) {
452
+ Mage::throwException($this->_helper->__('Invalid recommendation type.'));
453
+ }
454
+
455
+ $recommendationContext = new GravityRecommendationContext();
456
+ $recommendationContext->scenarioId = $param['type'];
457
+
458
+ if (isset($param['limit']) && $param['limit']) {
459
+ $recommendationContext->numberLimit = $param['limit'];
460
+ } else {
461
+ $recommendationContext->numberLimit = 5;
462
+ }
463
+
464
+ $storeValue = new GravityNameValue('storeId', $this->_storeId);
465
+ $recommendationContext->nameValues = array($storeValue);
466
+
467
+ if (isset($param['itemId']) && $param['itemId']) {
468
+ $pageItemId = new GravityNameValue('currentItemId', $param['itemId']);
469
+ $recommendationContext->nameValues = array_merge(array($pageItemId), $recommendationContext->nameValues);
470
+ }
471
+
472
+ $recommendationContext->recommendationTime = time();
473
+
474
+ $recommendationContextArray[$i] = $recommendationContext;
475
+ $recommendationContext = null;
476
+ $i++;
477
+ }
478
+
479
+ if ($this->_canDebugLog) {
480
+ $this->_helper->getLogger($recommendationContextArray);
481
+ }
482
+
483
+ $itemRecommendations = null;
484
+ try {
485
+
486
+ $itemRecommendations = $client->getItemRecommendationBulk($userId, $cookieId, $recommendationContextArray);
487
+
488
+ return $itemRecommendations;
489
+
490
+ } catch (GravityException $e) {
491
+
492
+ $this->_helper->getLogger($this->_helper->__('Error happened by getting the item recommendation!'));
493
+ $this->_helper->getLogger($e->getMessage());
494
+ $this->_helper->getLogger($e->faultInfo);
495
+
496
+ }
497
+ }
498
+
499
  /**
500
  * Send update
501
  *
520
  $user->hidden = false;
521
 
522
  if ($this->_canDebugLog) {
523
+ $this->_helper->getLogger('userId: ' . $params['userid']);
524
  }
525
 
526
  unset($params['type']);
543
  $item->title = $params['title'];
544
  $item->hidden = $params['hidden'];
545
  if ($this->_canDebugLog) {
546
+ $this->_helper->getLogger('itemId: ' . $params['itemid']);
547
  }
548
 
549
  unset($params['type']);
580
  * Validate result
581
  *
582
  * @param stdClass $result result
583
+ * @param bool $isBulk bulk recommendation
584
  * @return null|string|array
585
  */
586
+ protected function _validateResult($result, $isBulk = false)
587
  {
588
  $answer = array();
589
 
590
+ if ($isBulk && is_array($result)) {
591
+
592
+ foreach ($result as $_result) {
593
+
594
+ if (!empty($_result->itemIds) && $_result instanceof stdClass) {
595
+ $answer[$_result->recommendationId] = $_result->itemIds;
596
+ }
597
+
598
+ }
599
+
600
+ return $answer;
601
+
602
+ } elseif ($result && $result instanceof stdClass) {
603
 
604
  if (!empty($result->itemIds)) {
605
  $answer[$result->recommendationId] = $result->itemIds;
app/code/community/Me/Gravity/Model/Observer.php CHANGED
@@ -16,7 +16,47 @@
16
  class Me_Gravity_Model_Observer
17
  {
18
  /**
19
- * App Gravity block to catalog product view
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  *
21
  * @param Varien_Event_Observer $observer observer
22
  * @return void|boolean
@@ -416,14 +456,20 @@ class Me_Gravity_Model_Observer
416
  */
417
  protected function _setGeneralBoxes($layout)
418
  {
 
 
419
  $boxHelper = $this->_getGravityBoxHelper();
420
 
421
- $boxNames = array(
422
- 'best',
423
- 'history',
424
- 'others',
425
- 'popular'
426
- );
 
 
 
 
427
 
428
  foreach ($boxNames as $name) {
429
 
@@ -432,6 +478,14 @@ class Me_Gravity_Model_Observer
432
  $block = $layout->createBlock('me_gravity/general_boxes_' . $name)
433
  ->setName('me.gravity.general.' . $name);
434
 
 
 
 
 
 
 
 
 
435
  if (Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT == $boxHelper->getBoxLayout($name, 'general')) {
436
  $block->setTemplate('me/gravity/general/boxes/default.phtml');
437
  if ($reference = $layout->getBlock(Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT)) {
@@ -443,6 +497,7 @@ class Me_Gravity_Model_Observer
443
  $reference->append($block);
444
  }
445
  }
 
446
  }
447
 
448
  }
@@ -456,13 +511,13 @@ class Me_Gravity_Model_Observer
456
  */
457
  protected function _setCategoryPageBoxes($layout)
458
  {
 
 
459
  $boxHelper = $this->_getGravityBoxHelper();
460
 
461
- $boxNames = array(
462
- 'personal',
463
- 'top'
464
- );
465
 
 
466
  foreach ($boxNames as $name) {
467
 
468
  if ($boxHelper->getBoxEnabled($name, 'category')) {
@@ -470,6 +525,24 @@ class Me_Gravity_Model_Observer
470
  $block = $layout->createBlock('me_gravity/catalog_category_boxes_' . $name)
471
  ->setName('me.gravity.category.' . $name);
472
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
473
  if (Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT == $boxHelper->getBoxLayout($name, 'category')) {
474
  $block->setTemplate('me/gravity/catalog/category/boxes/default.phtml');
475
  if ($reference = $layout->getBlock(Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT)) {
@@ -482,7 +555,6 @@ class Me_Gravity_Model_Observer
482
  }
483
  }
484
  }
485
-
486
  }
487
  }
488
 
@@ -494,19 +566,35 @@ class Me_Gravity_Model_Observer
494
  */
495
  protected function _setProductPageBoxes($layout)
496
  {
 
 
497
  $boxHelper = $this->_getGravityBoxHelper();
498
 
499
- $boxNames = array(
500
- 'similar',
501
- 'personal',
502
- 'accessories'
503
- );
 
 
 
 
 
504
 
505
  foreach ($boxNames as $name) {
506
 
507
  if ($boxHelper->getBoxEnabled($name, 'product')) {
508
  $block = $layout->createBlock('me_gravity/catalog_product_view_boxes_' . $name)
509
  ->setName('me.gravity.product.view.' . $name);
 
 
 
 
 
 
 
 
 
510
  if (Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT == $boxHelper->getBoxLayout($name, 'product')) {
511
  $block->setTemplate('me/gravity/catalog/product/view/boxes/default.phtml');
512
  if ($reference = $layout->getBlock(Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT)) {
@@ -523,6 +611,96 @@ class Me_Gravity_Model_Observer
523
  }
524
  }
525
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526
  /**
527
  * Set search result page box
528
  *
16
  class Me_Gravity_Model_Observer
17
  {
18
  /**
19
+ * Product recommendation types
20
+ *
21
+ * @var array
22
+ */
23
+ protected $_productRecommendationTypes = array(
24
+ 'similar' => Me_Gravity_Model_Method_Request::PRODUCT_PAGE_SIMILAR,
25
+ 'personal' => Me_Gravity_Model_Method_Request::PRODUCT_PAGE_PERSONAL,
26
+ 'accessories' => Me_Gravity_Model_Method_Request::PRODUCT_PAGE_ACCESSORIES
27
+ );
28
+
29
+ /**
30
+ * Category recommendation types
31
+ *
32
+ * @var array
33
+ */
34
+ protected $_categoryRecommendationTypes = array(
35
+ 'personal' => Me_Gravity_Model_Method_Request::CATEGORY_PAGE_PERSONAL,
36
+ 'top' => Me_Gravity_Model_Method_Request::CATEGORY_PAGE_TOP
37
+ );
38
+
39
+ /**
40
+ * Main page recommendation types
41
+ *
42
+ * @var array
43
+ */
44
+ protected $_pageRecommendationTypes = array(
45
+ 'best' => Me_Gravity_Model_Method_Request::GENERAL_PERSONAL_BEST,
46
+ 'history' => Me_Gravity_Model_Method_Request::GENERAL_PERSONAL_HISTORY,
47
+ 'others' => Me_Gravity_Model_Method_Request::GENERAL_CURRENTLY_VIEWED,
48
+ 'popular' => Me_Gravity_Model_Method_Request::GENERAL_POPULAR
49
+ );
50
+
51
+ /**
52
+ * Category filters
53
+ *
54
+ * @var array|null
55
+ */
56
+ protected $_filters = null;
57
+
58
+ /**
59
+ * Add Gravity block to catalog product view
60
  *
61
  * @param Varien_Event_Observer $observer observer
62
  * @return void|boolean
456
  */
457
  protected function _setGeneralBoxes($layout)
458
  {
459
+ $bulkItems = array();
460
+ $gravityHelper = $this->_getGravityHelper();
461
  $boxHelper = $this->_getGravityBoxHelper();
462
 
463
+ $boxNames = array_keys($this->_pageRecommendationTypes);
464
+
465
+ if ($gravityHelper->useBulkRecommendation() && !$gravityHelper->useGravityTemplate()) {
466
+
467
+ $bulkItems = Mage::getModel('me_gravity/method_request')->sendRequest(
468
+ Me_Gravity_Model_Method_Request::EVENT_TYPE_BULK,
469
+ $this->_getPageBulkParameters($boxHelper, $boxNames)
470
+ );
471
+
472
+ }
473
 
474
  foreach ($boxNames as $name) {
475
 
478
  $block = $layout->createBlock('me_gravity/general_boxes_' . $name)
479
  ->setName('me.gravity.general.' . $name);
480
 
481
+ if ($gravityHelper->useBulkRecommendation() && !$gravityHelper->useGravityTemplate()) {
482
+ $blockBulkItems = $boxHelper->identifyBulkKeys($bulkItems, $this->_pageRecommendationTypes[$name]);
483
+ if ($blockBulkItems) {
484
+ $block->setRecommendationType($this->_pageRecommendationTypes[$name]);
485
+ $block->setBulkItems($blockBulkItems);
486
+ }
487
+ }
488
+
489
  if (Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT == $boxHelper->getBoxLayout($name, 'general')) {
490
  $block->setTemplate('me/gravity/general/boxes/default.phtml');
491
  if ($reference = $layout->getBlock(Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT)) {
497
  $reference->append($block);
498
  }
499
  }
500
+
501
  }
502
 
503
  }
511
  */
512
  protected function _setCategoryPageBoxes($layout)
513
  {
514
+ $bulkItems = array();
515
+ $gravityHelper = $this->_getGravityHelper();
516
  $boxHelper = $this->_getGravityBoxHelper();
517
 
518
+ $boxNames = array_keys($this->_categoryRecommendationTypes);
 
 
 
519
 
520
+ $filterSet = false;
521
  foreach ($boxNames as $name) {
522
 
523
  if ($boxHelper->getBoxEnabled($name, 'category')) {
525
  $block = $layout->createBlock('me_gravity/catalog_category_boxes_' . $name)
526
  ->setName('me.gravity.category.' . $name);
527
 
528
+ if ($gravityHelper->useBulkRecommendation() && !$gravityHelper->useGravityTemplate() && !$filterSet) {
529
+
530
+ $this->_filters = $block->getFilters();
531
+ $bulkItems = Mage::getModel('me_gravity/method_request')->sendRequest(
532
+ Me_Gravity_Model_Method_Request::EVENT_TYPE_BULK,
533
+ $this->_getCategoryBulkParameters($boxHelper, $boxNames)
534
+ );
535
+ $filterSet = true;
536
+ }
537
+
538
+ if ($this->_getGravityHelper()->useBulkRecommendation()) {
539
+ $blockBulkItems = $boxHelper->identifyBulkKeys($bulkItems, $this->_categoryRecommendationTypes[$name]);
540
+ if ($blockBulkItems) {
541
+ $block->setRecommendationType($this->_categoryRecommendationTypes[$name]);
542
+ $block->setBulkItems($blockBulkItems);
543
+ }
544
+ }
545
+
546
  if (Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT == $boxHelper->getBoxLayout($name, 'category')) {
547
  $block->setTemplate('me/gravity/catalog/category/boxes/default.phtml');
548
  if ($reference = $layout->getBlock(Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT)) {
555
  }
556
  }
557
  }
 
558
  }
559
  }
560
 
566
  */
567
  protected function _setProductPageBoxes($layout)
568
  {
569
+ $bulkItems = array();
570
+ $gravityHelper = $this->_getGravityHelper();
571
  $boxHelper = $this->_getGravityBoxHelper();
572
 
573
+ $boxNames = array_keys($this->_productRecommendationTypes);
574
+
575
+ if ($gravityHelper->useBulkRecommendation() && !$gravityHelper->useGravityTemplate()) {
576
+
577
+ $bulkItems = Mage::getModel('me_gravity/method_request')->sendRequest(
578
+ Me_Gravity_Model_Method_Request::EVENT_TYPE_BULK,
579
+ $this->_getProductBulkParameters($boxHelper, $this->_getProductId(), $boxNames)
580
+ );
581
+
582
+ }
583
 
584
  foreach ($boxNames as $name) {
585
 
586
  if ($boxHelper->getBoxEnabled($name, 'product')) {
587
  $block = $layout->createBlock('me_gravity/catalog_product_view_boxes_' . $name)
588
  ->setName('me.gravity.product.view.' . $name);
589
+
590
+ if ($this->_getGravityHelper()->useBulkRecommendation()) {
591
+ $blockBulkItems = $boxHelper->identifyBulkKeys($bulkItems, $this->_productRecommendationTypes[$name]);
592
+ if ($blockBulkItems) {
593
+ $block->setRecommendationType($this->_productRecommendationTypes[$name]);
594
+ $block->setBulkItems($blockBulkItems);
595
+ }
596
+ }
597
+
598
  if (Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT == $boxHelper->getBoxLayout($name, 'product')) {
599
  $block->setTemplate('me/gravity/catalog/product/view/boxes/default.phtml');
600
  if ($reference = $layout->getBlock(Me_Gravity_Model_System_Config_Source_Layout_Layout::LAYOUT_CONTENT)) {
611
  }
612
  }
613
 
614
+ /**
615
+ * Get current product
616
+ *
617
+ * @throws Mage_Core_Exception
618
+ * @return int|bool
619
+ */
620
+ protected function _getProductId()
621
+ {
622
+ $product = Mage::registry('current_product');
623
+ if (!is_null($product) && $product->getId()) {
624
+ return $product->getId();
625
+ } else {
626
+ Mage::throwException($this->_getGravityHelper()->__('Invalid product during bulk recommendation'));
627
+ }
628
+
629
+ return false;
630
+ }
631
+
632
+ /**
633
+ * Get product page bulk recommendation parameters
634
+ *
635
+ * @param Me_Gravity_Helper_Boxes $boxHelper helper
636
+ * @param int $itemId item Id
637
+ * @param array $boxNames box names
638
+ * @return array
639
+ */
640
+ protected function _getProductBulkParameters(Me_Gravity_Helper_Boxes $boxHelper, $itemId = 0, $boxNames = array())
641
+ {
642
+ $parameters = array();
643
+
644
+ foreach ($boxNames as $name) {
645
+ if ($boxHelper->getBoxEnabled($name, 'product')) {
646
+ $parameters[$name] = array(
647
+ 'type' => $this->_productRecommendationTypes[$name],
648
+ 'limit' => $boxHelper->getBoxLimit($name, 'product'),
649
+ 'itemId' => $itemId
650
+ );
651
+ }
652
+ }
653
+
654
+ return $parameters;
655
+ }
656
+
657
+ /**
658
+ * Get category page bulk recommendation parameters
659
+ *
660
+ * @param Me_Gravity_Helper_Boxes $boxHelper helper
661
+ * @param array $boxNames box names
662
+ * @return array
663
+ */
664
+ protected function _getCategoryBulkParameters(Me_Gravity_Helper_Boxes $boxHelper, $boxNames = array())
665
+ {
666
+ $parameters = array();
667
+
668
+ foreach ($boxNames as $name) {
669
+ if ($boxHelper->getBoxEnabled($name, 'category')) {
670
+ $parameters[$name] = array(
671
+ 'type' => $this->_categoryRecommendationTypes[$name],
672
+ 'limit' => $boxHelper->getBoxLimit($name, 'category'),
673
+ 'filters' => $this->_filters ? $this->_filters : null
674
+ );
675
+ }
676
+ }
677
+
678
+ return $parameters;
679
+ }
680
+
681
+ /**
682
+ * Get main page bulk recommendation parameters
683
+ *
684
+ * @param Me_Gravity_Helper_Boxes $boxHelper helper
685
+ * @param array $boxNames box names
686
+ * @return array
687
+ */
688
+ protected function _getPageBulkParameters(Me_Gravity_Helper_Boxes $boxHelper, $boxNames = array())
689
+ {
690
+ $parameters = array();
691
+
692
+ foreach ($boxNames as $name) {
693
+ if ($boxHelper->getBoxEnabled($name, 'general')) {
694
+ $parameters[$name] = array(
695
+ 'type' => $this->_pageRecommendationTypes[$name],
696
+ 'limit' => $boxHelper->getBoxLimit($name, 'general')
697
+ );
698
+ }
699
+ }
700
+
701
+ return $parameters;
702
+ }
703
+
704
  /**
705
  * Set search result page box
706
  *
app/code/community/Me/Gravity/etc/config.xml CHANGED
@@ -12,7 +12,7 @@
12
  <config>
13
  <modules>
14
  <Me_Gravity>
15
- <version>1.0.1.7</version>
16
  </Me_Gravity>
17
  </modules>
18
  <global>
@@ -163,6 +163,7 @@ y.src='//'+i+'/grrec-'+t+'-war/JSServlet4?cc=test';g.parentNode.insertBefore(y,g
163
  </script>
164
  ]]></custom_js>
165
  <template>0</template>
 
166
  </config>
167
  <export>
168
  <catalog_path>gravity_reco/</catalog_path>
12
  <config>
13
  <modules>
14
  <Me_Gravity>
15
+ <version>1.0.2.1</version>
16
  </Me_Gravity>
17
  </modules>
18
  <global>
163
  </script>
164
  ]]></custom_js>
165
  <template>0</template>
166
+ <bulk>1</bulk>
167
  </config>
168
  <export>
169
  <catalog_path>gravity_reco/</catalog_path>
app/code/community/Me/Gravity/etc/system.xml CHANGED
@@ -124,6 +124,16 @@
124
  <show_in_store>1</show_in_store>
125
  <comment>General display setting. If YES all boxes will use Gravity template.</comment>
126
  </template>
 
 
 
 
 
 
 
 
 
 
127
  </fields>
128
  </config>
129
  <export translate="label">
124
  <show_in_store>1</show_in_store>
125
  <comment>General display setting. If YES all boxes will use Gravity template.</comment>
126
  </template>
127
+ <bulk translate="label">
128
+ <label>Enable Bulk Recommendation</label>
129
+ <frontend_type>select</frontend_type>
130
+ <source_model>adminhtml/system_config_source_yesno</source_model>
131
+ <sort_order>80</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
+ <comment>General recommendation setting. If YES bulk recommendation will be enabled.</comment>
136
+ </bulk>
137
  </fields>
138
  </config>
139
  <export translate="label">
app/design/frontend/base/default/template/me/gravity/catalog/category/boxes/default.phtml CHANGED
@@ -18,7 +18,7 @@
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
- <div class="block block-<?php echo $this->getBoxClass() ?>">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
@@ -46,21 +46,28 @@
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
- _gravity.push({
50
- type: "recommendation",
51
- scenarioId: "<?php echo $this->getRecommendationType() ?>",
52
- numberLimit: <?php echo $this->getRecommendationLimit() ?>,
53
- storeId: <?php echo $storeId ?>,
54
- <?php if($filters = $this->getFilters()) : ?>
55
- <?php foreach($filters as $attributeCode => $value) : ?>
56
- <?php echo $attributeCode ?>: "<?php echo $value ?>",
57
- <?php endforeach; ?>
58
- <?php endif; ?>
59
- resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
60
- templating: {
61
- targetElementId: "target-<?php echo $this->getBoxClass() ?>",
62
- templateElementId: "template-<?php echo $this->getBoxClass() ?>"
63
- }
 
 
 
 
 
 
 
64
  });
65
  //]]>
66
  </script>
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
+ <div class="block block-<?php echo $this->getBoxClass() ?> me-gravity">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
+ document.observe("dom:loaded", function() {
50
+ _gravity.push({
51
+ type: "recommendation",
52
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
53
+ groupId: "CATEGORY_PAGE_GROUP",
54
+ groupSeq: window.gravityGroupSeq++,
55
+ groupSize: window.gravityGroupSize,
56
+ <?php endif; ?>
57
+ scenarioId: "<?php echo $this->getRecommendationType() ?>",
58
+ numberLimit: <?php echo $this->getRecommendationLimit() ?>,
59
+ storeId: <?php echo $storeId ?>,
60
+ <?php if($filters = $this->getFilters()) : ?>
61
+ <?php foreach($filters as $attributeCode => $value) : ?>
62
+ <?php echo $attributeCode ?>: "<?php echo $value ?>",
63
+ <?php endforeach; ?>
64
+ <?php endif; ?>
65
+ resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
66
+ templating: {
67
+ targetElementId: "target-<?php echo $this->getBoxClass() ?>",
68
+ templateElementId: "template-<?php echo $this->getBoxClass() ?>"
69
+ }
70
+ });
71
  });
72
  //]]>
73
  </script>
app/design/frontend/base/default/template/me/gravity/catalog/category/boxes/sidebar.phtml CHANGED
@@ -18,7 +18,7 @@
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
- <div class="block block-<?php echo $this->getBoxClass() ?>">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
@@ -46,21 +46,28 @@
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
- _gravity.push({
50
- type: "recommendation",
51
- scenarioId: "<?php echo $this->getRecommendationType() ?>",
52
- numberLimit: <?php echo $this->getRecommendationLimit() ?>,
53
- storeId: <?php echo $storeId ?>,
54
- <?php if($filters = $this->getFilters()) : ?>
55
- <?php foreach($filters as $attributeCode => $value) : ?>
56
- <?php echo $attributeCode ?>: "<?php echo $value ?>",
57
- <?php endforeach; ?>
58
- <?php endif; ?>
59
- resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
60
- templating: {
61
- targetElementId: "target-<?php echo $this->getBoxClass() ?>",
62
- templateElementId: "template-<?php echo $this->getBoxClass() ?>"
63
- }
 
 
 
 
 
 
 
64
  });
65
  //]]>
66
  </script>
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
+ <div class="block block-<?php echo $this->getBoxClass() ?> me-gravity">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
+ document.observe("dom:loaded", function() {
50
+ _gravity.push({
51
+ type: "recommendation",
52
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
53
+ groupId: "CATEGORY_PAGE_GROUP",
54
+ groupSeq: window.gravityGroupSeq++,
55
+ groupSize: window.gravityGroupSize,
56
+ <?php endif; ?>
57
+ scenarioId: "<?php echo $this->getRecommendationType() ?>",
58
+ numberLimit: <?php echo $this->getRecommendationLimit() ?>,
59
+ storeId: <?php echo $storeId ?>,
60
+ <?php if($filters = $this->getFilters()) : ?>
61
+ <?php foreach($filters as $attributeCode => $value) : ?>
62
+ <?php echo $attributeCode ?>: "<?php echo $value ?>",
63
+ <?php endforeach; ?>
64
+ <?php endif; ?>
65
+ resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
66
+ templating: {
67
+ targetElementId: "target-<?php echo $this->getBoxClass() ?>",
68
+ templateElementId: "template-<?php echo $this->getBoxClass() ?>"
69
+ }
70
+ });
71
  });
72
  //]]>
73
  </script>
app/design/frontend/base/default/template/me/gravity/catalog/product/view/boxes/default.phtml CHANGED
@@ -18,7 +18,7 @@
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
- <div class="block block-<?php echo $this->getBoxClass() ?>">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
@@ -46,19 +46,26 @@
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
- _gravity.push({
50
- type: "recommendation",
51
- scenarioId: "<?php echo $this->getRecommendationType() ?>",
52
- numberLimit: <?php echo $this->getRecommendationLimit() ?>,
53
- storeId: <?php echo $storeId ?>,
54
- <?php if($productId = $this->getProduct()->getId()) : ?>
 
 
 
 
 
 
55
  currentItemId: "<?php echo $productId ?>",
56
- <?php endif; ?>
57
- resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
58
- templating: {
59
- targetElementId: "target-<?php echo $this->getBoxClass() ?>",
60
- templateElementId: "template-<?php echo $this->getBoxClass() ?>"
61
- }
 
62
  });
63
  //]]>
64
  </script>
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
+ <div class="block block-<?php echo $this->getBoxClass() ?> me-gravity">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
+ document.observe("dom:loaded", function() {
50
+ _gravity.push({
51
+ type: "recommendation",
52
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
53
+ groupId: "ITEM_PAGE_GROUP",
54
+ groupSeq: window.gravityGroupSeq++,
55
+ groupSize: window.gravityGroupSize,
56
+ <?php endif; ?>
57
+ scenarioId: "<?php echo $this->getRecommendationType() ?>",
58
+ numberLimit: <?php echo $this->getRecommendationLimit() ?>,
59
+ storeId: <?php echo $storeId ?>,
60
+ <?php if($productId = $this->getProduct()->getId()) : ?>
61
  currentItemId: "<?php echo $productId ?>",
62
+ <?php endif; ?>
63
+ resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
64
+ templating: {
65
+ targetElementId: "target-<?php echo $this->getBoxClass() ?>",
66
+ templateElementId: "template-<?php echo $this->getBoxClass() ?>"
67
+ }
68
+ });
69
  });
70
  //]]>
71
  </script>
app/design/frontend/base/default/template/me/gravity/catalog/product/view/boxes/sidebar.phtml CHANGED
@@ -18,7 +18,7 @@
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
- <div class="block block-<?php echo $this->getBoxClass() ?>">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
@@ -46,19 +46,26 @@
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
- _gravity.push({
50
- type: "recommendation",
51
- scenarioId: "<?php echo $this->getRecommendationType() ?>",
52
- numberLimit: <?php echo $this->getRecommendationLimit() ?>,
53
- storeId: <?php echo $storeId ?>,
54
- <?php if($productId = $this->getProduct()->getId()) : ?>
 
 
 
 
 
 
55
  currentItemId: "<?php echo $productId ?>",
56
- <?php endif; ?>
57
- resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
58
- templating: {
59
- targetElementId: "target-<?php echo $this->getBoxClass() ?>",
60
- templateElementId: "template-<?php echo $this->getBoxClass() ?>"
61
- }
 
62
  });
63
  //]]>
64
  </script>
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
+ <div class="block block-<?php echo $this->getBoxClass() ?> me-gravity">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
+ document.observe("dom:loaded", function() {
50
+ _gravity.push({
51
+ type: "recommendation",
52
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
53
+ groupId: "ITEM_PAGE_GROUP",
54
+ groupSeq: window.gravityGroupSeq++,
55
+ groupSize: window.gravityGroupSize,
56
+ <?php endif; ?>
57
+ scenarioId: "<?php echo $this->getRecommendationType() ?>",
58
+ numberLimit: <?php echo $this->getRecommendationLimit() ?>,
59
+ storeId: <?php echo $storeId ?>,
60
+ <?php if($productId = $this->getProduct()->getId()) : ?>
61
  currentItemId: "<?php echo $productId ?>",
62
+ <?php endif; ?>
63
+ resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
64
+ templating: {
65
+ targetElementId: "target-<?php echo $this->getBoxClass() ?>",
66
+ templateElementId: "template-<?php echo $this->getBoxClass() ?>"
67
+ }
68
+ });
69
  });
70
  //]]>
71
  </script>
app/design/frontend/base/default/template/me/gravity/general/boxes/default.phtml CHANGED
@@ -18,7 +18,7 @@
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
- <div class="block block-<?php echo $this->getBoxClass() ?>">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
@@ -46,16 +46,23 @@
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
- _gravity.push({
50
- type: "recommendation",
51
- scenarioId: "<?php echo $this->getRecommendationType() ?>",
52
- numberLimit: <?php echo $this->getRecommendationLimit() ?>,
53
- storeId: <?php echo $storeId ?>,
54
- resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
55
- templating: {
56
- targetElementId: "target-<?php echo $this->getBoxClass() ?>",
57
- templateElementId: "template-<?php echo $this->getBoxClass() ?>"
58
- }
 
 
 
 
 
 
 
59
  });
60
  //]]>
61
  </script>
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
+ <div class="block block-<?php echo $this->getBoxClass() ?> me-gravity">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
+ document.observe("dom:loaded", function() {
50
+ _gravity.push({
51
+ type: "recommendation",
52
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
53
+ groupId: "MAIN_PAGE_GROUP",
54
+ groupSeq: window.gravityGroupSeq++,
55
+ groupSize: window.gravityGroupSize,
56
+ <?php endif; ?>
57
+ scenarioId: "<?php echo $this->getRecommendationType() ?>",
58
+ numberLimit: <?php echo $this->getRecommendationLimit() ?>,
59
+ storeId: <?php echo $storeId ?>,
60
+ resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
61
+ templating: {
62
+ targetElementId: "target-<?php echo $this->getBoxClass() ?>",
63
+ templateElementId: "template-<?php echo $this->getBoxClass() ?>"
64
+ }
65
+ });
66
  });
67
  //]]>
68
  </script>
app/design/frontend/base/default/template/me/gravity/general/boxes/sidebar.phtml CHANGED
@@ -18,7 +18,7 @@
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
- <div class="block block-<?php echo $this->getBoxClass() ?>">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
@@ -46,8 +46,14 @@
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
 
49
  _gravity.push({
50
  type: "recommendation",
 
 
 
 
 
51
  scenarioId: "<?php echo $this->getRecommendationType() ?>",
52
  numberLimit: <?php echo $this->getRecommendationLimit() ?>,
53
  storeId: <?php echo $storeId ?>,
@@ -57,6 +63,7 @@
57
  templateElementId: "template-<?php echo $this->getBoxClass() ?>"
58
  }
59
  });
 
60
  //]]>
61
  </script>
62
  <?php else : ?>
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
+ <div class="block block-<?php echo $this->getBoxClass() ?> me-gravity">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
+ document.observe("dom:loaded", function() {
50
  _gravity.push({
51
  type: "recommendation",
52
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
53
+ groupId: "MAIN_PAGE_GROUP",
54
+ groupSeq: window.gravityGroupSeq++,
55
+ groupSize: window.gravityGroupSize,
56
+ <?php endif; ?>
57
  scenarioId: "<?php echo $this->getRecommendationType() ?>",
58
  numberLimit: <?php echo $this->getRecommendationLimit() ?>,
59
  storeId: <?php echo $storeId ?>,
63
  templateElementId: "template-<?php echo $this->getBoxClass() ?>"
64
  }
65
  });
66
+ });
67
  //]]>
68
  </script>
69
  <?php else : ?>
app/design/frontend/base/default/template/me/gravity/page/js/body-end.phtml CHANGED
@@ -14,6 +14,7 @@
14
  /**
15
  * Gravity initialization script
16
  *
 
17
  * @see Me_Gravity_Block_Page_Js_Gravity
18
  */
19
  ?>
@@ -29,3 +30,12 @@
29
  //]]>
30
  </script>
31
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
14
  /**
15
  * Gravity initialization script
16
  *
17
+ * var $this Me_Gravity_Block_Page_Js_Gravity
18
  * @see Me_Gravity_Block_Page_Js_Gravity
19
  */
20
  ?>
30
  //]]>
31
  </script>
32
  <?php endif; ?>
33
+ <?php if ($this->isEnabled() && $this->getGravityHelper()->useBulkRecommendation() && $this->getGravityHelper()->useGravityTemplate()) : ?>
34
+ <script type="text/javascript">
35
+ //<![CDATA[
36
+ $$('.me-gravity').each(function () {
37
+ window.gravityGroupSize++;
38
+ });
39
+ //]]>
40
+ </script>
41
+ <?php endif; ?>
app/design/frontend/base/default/template/me/gravity/page/js/gravity.phtml CHANGED
@@ -14,15 +14,21 @@
14
  /**
15
  * Gravity initialization script
16
  *
 
17
  * @see Me_Gravity_Block_Page_Js_Gravity
18
  */
19
  ?>
20
  <?php if ($this->isEnabled() && $this->getGravityCustomerId()) : ?>
 
21
  <?php if ($this->isCustomJsEnabled()) : ?>
22
  <?php echo $this->getCustomJsContent(); ?>
23
  <?php else : ?>
24
  <script type="text/javascript">
25
- //<![CDATA[
 
 
 
 
26
  var _gravity = _gravity || [];
27
  (function () {
28
  var gr = document.createElement("script");
@@ -33,7 +39,7 @@
33
  var s = document.getElementsByTagName("script")[0];
34
  s.parentNode.insertBefore(gr, s);
35
  })();
36
- //]]>
37
  </script>
38
  <?php endif; ?>
39
  <?php endif; ?>
14
  /**
15
  * Gravity initialization script
16
  *
17
+ * var $this Me_Gravity_Block_Page_Js_Gravity
18
  * @see Me_Gravity_Block_Page_Js_Gravity
19
  */
20
  ?>
21
  <?php if ($this->isEnabled() && $this->getGravityCustomerId()) : ?>
22
+ <?php $gravityHelper = $this->getGravityHelper(); ?>
23
  <?php if ($this->isCustomJsEnabled()) : ?>
24
  <?php echo $this->getCustomJsContent(); ?>
25
  <?php else : ?>
26
  <script type="text/javascript">
27
+ //<![CDATA[
28
+ <?php if ($gravityHelper->useBulkRecommendation() && $gravityHelper->useGravityTemplate()) : ?>
29
+ window.gravityGroupSeq = 1;
30
+ window.gravityGroupSize = 0;
31
+ <?php endif; ?>
32
  var _gravity = _gravity || [];
33
  (function () {
34
  var gr = document.createElement("script");
39
  var s = document.getElementsByTagName("script")[0];
40
  s.parentNode.insertBefore(gr, s);
41
  })();
42
+ //]]>
43
  </script>
44
  <?php endif; ?>
45
  <?php endif; ?>
app/design/frontend/rwd/default/template/me/gravity/catalog/category/boxes/default.phtml CHANGED
@@ -19,7 +19,7 @@
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
  <?php $_columnCount = 5; ?>
22
- <div class="box box-<?php echo $this->getBoxClass() ?>">
23
  <div class="box-head">
24
  <?php if($title = $this->getRecommendationTitle()) : ?>
25
  <h3><?php echo $title ?></h3>
@@ -45,21 +45,28 @@
45
  </div>
46
  <script type="text/javascript">
47
  //<![CDATA[
48
- _gravity.push({
49
- type: "recommendation",
50
- scenarioId: "<?php echo $this->getRecommendationType() ?>",
51
- numberLimit: <?php echo $this->getRecommendationLimit() ?>,
52
- storeId: <?php echo $storeId ?>,
53
- <?php if($filters = $this->getFilters()) : ?>
54
- <?php foreach($filters as $attributeCode => $value) : ?>
55
- <?php echo $attributeCode ?>: "<?php echo $value ?>",
56
- <?php endforeach; ?>
57
- <?php endif; ?>
58
- resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
59
- templating: {
60
- targetElementId: "target-<?php echo $this->getBoxClass() ?>",
61
- templateElementId: "template-<?php echo $this->getBoxClass() ?>"
62
- }
 
 
 
 
 
 
 
63
  });
64
  //]]>
65
  </script>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
  <?php $_columnCount = 5; ?>
22
+ <div class="box box-<?php echo $this->getBoxClass() ?> me-gravity">
23
  <div class="box-head">
24
  <?php if($title = $this->getRecommendationTitle()) : ?>
25
  <h3><?php echo $title ?></h3>
45
  </div>
46
  <script type="text/javascript">
47
  //<![CDATA[
48
+ document.observe("dom:loaded", function() {
49
+ _gravity.push({
50
+ type: "recommendation",
51
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
52
+ groupId: "CATEGORY_PAGE_GROUP",
53
+ groupSeq: window.gravityGroupSeq++,
54
+ groupSize: window.gravityGroupSize,
55
+ <?php endif; ?>
56
+ scenarioId: "<?php echo $this->getRecommendationType() ?>",
57
+ numberLimit: <?php echo $this->getRecommendationLimit() ?>,
58
+ storeId: <?php echo $storeId ?>,
59
+ <?php if($filters = $this->getFilters()) : ?>
60
+ <?php foreach($filters as $attributeCode => $value) : ?>
61
+ <?php echo $attributeCode ?>: "<?php echo $value ?>",
62
+ <?php endforeach; ?>
63
+ <?php endif; ?>
64
+ resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
65
+ templating: {
66
+ targetElementId: "target-<?php echo $this->getBoxClass() ?>",
67
+ templateElementId: "template-<?php echo $this->getBoxClass() ?>"
68
+ }
69
+ });
70
  });
71
  //]]>
72
  </script>
app/design/frontend/rwd/default/template/me/gravity/catalog/category/boxes/sidebar.phtml CHANGED
@@ -18,7 +18,7 @@
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
- <div class="block block-<?php echo $this->getBoxClass() ?>">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
@@ -46,22 +46,30 @@
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
 
49
  _gravity.push({
50
  type: "recommendation",
 
 
 
 
 
51
  scenarioId: "<?php echo $this->getRecommendationType() ?>",
52
  numberLimit: <?php echo $this->getRecommendationLimit() ?>,
53
  storeId: <?php echo $storeId ?>,
54
  <?php if($filters = $this->getFilters()) : ?>
55
- <?php foreach($filters as $attributeCode => $value) : ?>
56
- <?php echo $attributeCode ?>: "<?php echo $value ?>",
57
- <?php endforeach; ?>
 
58
  <?php endif; ?>
59
- resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
60
- templating: {
61
  targetElementId: "target-<?php echo $this->getBoxClass() ?>",
62
- templateElementId: "template-<?php echo $this->getBoxClass() ?>"
63
  }
64
  });
 
65
  //]]>
66
  </script>
67
  <?php else : ?>
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
+ <div class="block block-<?php echo $this->getBoxClass() ?> me-gravity">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
+ document.observe("dom:loaded", function() {
50
  _gravity.push({
51
  type: "recommendation",
52
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
53
+ groupId: "CATEGORY_PAGE_GROUP",
54
+ groupSeq: window.gravityGroupSeq++,
55
+ groupSize: window.gravityGroupSize,
56
+ <?php endif; ?>
57
  scenarioId: "<?php echo $this->getRecommendationType() ?>",
58
  numberLimit: <?php echo $this->getRecommendationLimit() ?>,
59
  storeId: <?php echo $storeId ?>,
60
  <?php if($filters = $this->getFilters()) : ?>
61
+ <?php foreach($filters as $attributeCode => $value) : ?>
62
+ <?php echo $attributeCode ?>:
63
+ "<?php echo $value ?>",
64
+ <?php endforeach; ?>
65
  <?php endif; ?>
66
+ resultNames : ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
67
+ templating : {
68
  targetElementId: "target-<?php echo $this->getBoxClass() ?>",
69
+ templateElementId : "template-<?php echo $this->getBoxClass() ?>"
70
  }
71
  });
72
+ });
73
  //]]>
74
  </script>
75
  <?php else : ?>
app/design/frontend/rwd/default/template/me/gravity/catalog/product/view/boxes/default.phtml CHANGED
@@ -19,7 +19,7 @@
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
  <?php $_columnCount = 5; ?>
22
- <div class="box box-<?php echo $this->getBoxClass() ?>">
23
  <div class="box-head">
24
  <?php if($title = $this->getRecommendationTitle()) : ?>
25
  <h3><?php echo $title ?></h3>
@@ -45,19 +45,26 @@
45
  </div>
46
  <script type="text/javascript">
47
  //<![CDATA[
48
- _gravity.push({
49
- type: "recommendation",
50
- scenarioId: "<?php echo $this->getRecommendationType() ?>",
51
- numberLimit: <?php echo $this->getRecommendationLimit() ?>,
52
- storeId: <?php echo $storeId ?>,
53
- <?php if($productId = $this->getProduct()->getId()) : ?>
 
 
 
 
 
 
54
  currentItemId: "<?php echo $productId ?>",
55
- <?php endif; ?>
56
- resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
57
- templating: {
58
- targetElementId: "target-<?php echo $this->getBoxClass() ?>",
59
- templateElementId: "template-<?php echo $this->getBoxClass() ?>"
60
- }
 
61
  });
62
  //]]>
63
  </script>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
  <?php $_columnCount = 5; ?>
22
+ <div class="box box-<?php echo $this->getBoxClass() ?> me-gravity">
23
  <div class="box-head">
24
  <?php if($title = $this->getRecommendationTitle()) : ?>
25
  <h3><?php echo $title ?></h3>
45
  </div>
46
  <script type="text/javascript">
47
  //<![CDATA[
48
+ document.observe("dom:loaded", function() {
49
+ _gravity.push({
50
+ type: "recommendation",
51
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
52
+ groupId: "ITEM_PAGE_GROUP",
53
+ groupSeq: window.gravityGroupSeq++,
54
+ groupSize: window.gravityGroupSize,
55
+ <?php endif; ?>
56
+ scenarioId: "<?php echo $this->getRecommendationType() ?>",
57
+ numberLimit: <?php echo $this->getRecommendationLimit() ?>,
58
+ storeId: <?php echo $storeId ?>,
59
+ <?php if($productId = $this->getProduct()->getId()) : ?>
60
  currentItemId: "<?php echo $productId ?>",
61
+ <?php endif; ?>
62
+ resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
63
+ templating: {
64
+ targetElementId: "target-<?php echo $this->getBoxClass() ?>",
65
+ templateElementId: "template-<?php echo $this->getBoxClass() ?>"
66
+ }
67
+ });
68
  });
69
  //]]>
70
  </script>
app/design/frontend/rwd/default/template/me/gravity/catalog/product/view/boxes/sidebar.phtml CHANGED
@@ -18,7 +18,7 @@
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
- <div class="block block-<?php echo $this->getBoxClass() ?>">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
@@ -46,13 +46,19 @@
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
 
49
  _gravity.push({
50
  type: "recommendation",
 
 
 
 
 
51
  scenarioId: "<?php echo $this->getRecommendationType() ?>",
52
  numberLimit: <?php echo $this->getRecommendationLimit() ?>,
53
  storeId: <?php echo $storeId ?>,
54
  <?php if($productId = $this->getProduct()->getId()) : ?>
55
- currentItemId: "<?php echo $productId ?>",
56
  <?php endif; ?>
57
  resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
58
  templating: {
@@ -60,6 +66,7 @@
60
  templateElementId: "template-<?php echo $this->getBoxClass() ?>"
61
  }
62
  });
 
63
  //]]>
64
  </script>
65
  <?php else : ?>
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
+ <div class="block block-<?php echo $this->getBoxClass() ?> me-gravity">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
+ document.observe("dom:loaded", function() {
50
  _gravity.push({
51
  type: "recommendation",
52
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
53
+ groupId: "ITEM_PAGE_GROUP",
54
+ groupSeq: window.gravityGroupSeq++,
55
+ groupSize: window.gravityGroupSize,
56
+ <?php endif; ?>
57
  scenarioId: "<?php echo $this->getRecommendationType() ?>",
58
  numberLimit: <?php echo $this->getRecommendationLimit() ?>,
59
  storeId: <?php echo $storeId ?>,
60
  <?php if($productId = $this->getProduct()->getId()) : ?>
61
+ currentItemId: "<?php echo $productId ?>",
62
  <?php endif; ?>
63
  resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
64
  templating: {
66
  templateElementId: "template-<?php echo $this->getBoxClass() ?>"
67
  }
68
  });
69
+ });
70
  //]]>
71
  </script>
72
  <?php else : ?>
app/design/frontend/rwd/default/template/me/gravity/general/boxes/default.phtml CHANGED
@@ -19,7 +19,7 @@
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
  <?php $_columnCount = 5; ?>
22
- <div class="box box-<?php echo $this->getBoxClass() ?>">
23
  <div class="box-head">
24
  <?php if($title = $this->getRecommendationTitle()) : ?>
25
  <h3><?php echo $title ?></h3>
@@ -45,16 +45,23 @@
45
  </div>
46
  <script type="text/javascript">
47
  //<![CDATA[
48
- _gravity.push({
49
- type: "recommendation",
50
- scenarioId: "<?php echo $this->getRecommendationType() ?>",
51
- numberLimit: <?php echo $this->getRecommendationLimit() ?>,
52
- storeId: <?php echo $storeId ?>,
53
- resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
54
- templating: {
55
- targetElementId: "target-<?php echo $this->getBoxClass() ?>",
56
- templateElementId: "template-<?php echo $this->getBoxClass() ?>"
57
- }
 
 
 
 
 
 
 
58
  });
59
  //]]>
60
  </script>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
  <?php $_columnCount = 5; ?>
22
+ <div class="box box-<?php echo $this->getBoxClass() ?> me-gravity">
23
  <div class="box-head">
24
  <?php if($title = $this->getRecommendationTitle()) : ?>
25
  <h3><?php echo $title ?></h3>
45
  </div>
46
  <script type="text/javascript">
47
  //<![CDATA[
48
+ document.observe("dom:loaded", function() {
49
+ _gravity.push({
50
+ type: "recommendation",
51
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
52
+ groupId: "MAIN_PAGE_GROUP",
53
+ groupSeq: window.gravityGroupSeq++,
54
+ groupSize: window.gravityGroupSize,
55
+ <?php endif; ?>
56
+ scenarioId: "<?php echo $this->getRecommendationType() ?>",
57
+ numberLimit: <?php echo $this->getRecommendationLimit() ?>,
58
+ storeId: <?php echo $storeId ?>,
59
+ resultNames: ["itemId", "title_<?php echo $storeId ?>", "link_<?php echo $storeId ?>", "image_link_<?php echo $storeId ?>"],
60
+ templating: {
61
+ targetElementId: "target-<?php echo $this->getBoxClass() ?>",
62
+ templateElementId: "template-<?php echo $this->getBoxClass() ?>"
63
+ }
64
+ });
65
  });
66
  //]]>
67
  </script>
app/design/frontend/rwd/default/template/me/gravity/general/boxes/sidebar.phtml CHANGED
@@ -18,7 +18,7 @@
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
- <div class="block block-<?php echo $this->getBoxClass() ?>">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
@@ -46,8 +46,14 @@
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
 
49
  _gravity.push({
50
  type: "recommendation",
 
 
 
 
 
51
  scenarioId: "<?php echo $this->getRecommendationType() ?>",
52
  numberLimit: <?php echo $this->getRecommendationLimit() ?>,
53
  storeId: <?php echo $storeId ?>,
@@ -57,6 +63,7 @@
57
  templateElementId: "template-<?php echo $this->getBoxClass() ?>"
58
  }
59
  });
 
60
  //]]>
61
  </script>
62
  <?php else : ?>
18
  <?php $gravityHelper = $this->getGravityHelper(); ?>
19
  <?php if ($gravityHelper->useGravityTemplate()) : ?>
20
  <?php $storeId = $this->getStoreId(); ?>
21
+ <div class="block block-<?php echo $this->getBoxClass() ?> me-gravity">
22
  <div class="block-title">
23
  <?php if($title = $this->getRecommendationTitle()) : ?>
24
  <strong><span><?php echo $title ?></span></strong>
46
  </div>
47
  <script type="text/javascript">
48
  //<![CDATA[
49
+ document.observe("dom:loaded", function() {
50
  _gravity.push({
51
  type: "recommendation",
52
+ <?php if ($gravityHelper->useBulkRecommendation()) : ?>
53
+ groupId: "MAIN_PAGE_GROUP",
54
+ groupSeq: window.gravityGroupSeq++,
55
+ groupSize: window.gravityGroupSize,
56
+ <?php endif; ?>
57
  scenarioId: "<?php echo $this->getRecommendationType() ?>",
58
  numberLimit: <?php echo $this->getRecommendationLimit() ?>,
59
  storeId: <?php echo $storeId ?>,
63
  templateElementId: "template-<?php echo $this->getBoxClass() ?>"
64
  }
65
  });
66
+ });
67
  //]]>
68
  </script>
69
  <?php else : ?>
package.xml CHANGED
@@ -1,20 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Me_Gravity</name>
4
- <version>1.0.1.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gravityrd.com/">Gravity R&amp;D, Ltd.</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>The Gravity Recommendation extension provides an interface between Magento web shop and Gravity Recommendation service. The communication based on PHP or Javascript API providing by Gravity service. </summary>
10
  <description>The Gravity Recommendation extension provides an interface between Magento web shop and Gravity Recommendation service. The communication based on PHP or Javascript API providing by Gravity service. The extension responsible for displaying recommendation boxes with products using Magento templates or Gravity based templates. The boxes contains the web shop products offered by the other side, and also sends information for Gravity service to provided proper analysis of users behaviors. It also able to export products catalog and customers for Gravity service using the extension configuration panel, or run daily scheduled export by cron job.</description>
11
- <notes>Version number: 1.0.1.7&#xD;
12
  Stability: Stable&#xD;
13
  Compatibility: CE 1.6.x, 1.7.x, 1.8.x, 1.9.x </notes>
14
  <authors><author><name>Gravity Recommendations</name><user>gravity_rd</user><email>web-integration@gravityrd.com</email></author></authors>
15
- <date>2015-07-06</date>
16
- <time>08:38:53</time>
17
- <contents><target name="mageetc"><dir name="modules"><file name="Me_Gravity.xml" hash="a385bf72a5c2f0f040d2bb0850ca0b7c"/></dir></target><target name="magecommunity"><dir name="Me"><dir name="Gravity"><dir name="Block"><file name="Abstract.php" hash="586409500493a209ba021f8d471c793c"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Catalog.php" hash="6adcc355986762d7cc19f854c5fdd067"/><file name="Customer.php" hash="50336da73ad37e3895f82980387f6970"/><file name="Test.php" hash="07d7fce9dd15eb623918d6f01505cc32"/><file name="Version.php" hash="cdaa1bf4da1dffefb71aa3a27a63d2f1"/></dir></dir></dir></dir><dir name="Catalog"><dir name="Category"><dir name="Boxes"><file name="Category.php" hash="0e9338d55a16ddde3ae30d14695e799d"/><file name="Personal.php" hash="7ac0315f48df1a3262fc06f33d46228a"/><file name="Top.php" hash="1e44870ec677da107bed26542233ab6b"/></dir></dir><dir name="Product"><dir name="View"><dir name="Boxes"><file name="Accessories.php" hash="f118fa14b7c457985c1e9b6b96f08f2e"/><file name="Personal.php" hash="1f2af5e09efad11f36c5a08de3861aee"/><file name="Product.php" hash="f7e66be937ec442e47c7dd4d3024d7df"/><file name="Similar.php" hash="47011f4c56d0bd7d9de7e159f9aeb9bb"/></dir><dir name="Js"><file name="Gravity.php" hash="cba4e59a726e2ff10d746748731ac35e"/></dir></dir></dir></dir><dir name="Catalogsearch"><dir name="Advanced"><dir name="Js"><file name="Gravity.php" hash="a37130181b430d057fa2dcb76de0ff60"/></dir></dir><dir name="Boxes"><file name="Result.php" hash="1c59e5b53cbef273f6cb7cd3448aa45b"/></dir><dir name="Js"><file name="Gravity.php" hash="d065f4ef6555312988c2e165621ea2a8"/></dir></dir><dir name="Checkout"><dir name="Cart"><dir name="Boxes"><file name="Cart.php" hash="b720e576c5123f9d52ee98807cb7ac36"/></dir></dir></dir><dir name="General"><dir name="Boxes"><file name="Best.php" hash="079eabb3dbfb2167eb9b0f9497fc37b0"/><file name="History.php" hash="85e0c22619328f8d0f03dfbcb5111709"/><file name="Others.php" hash="02c2cb071acbf74ce31a545c32c69f06"/><file name="Popular.php" hash="15ceca807386ffc3c384e393e4af7244"/></dir></dir><dir name="Page"><dir name="Js"><file name="Gravity.php" hash="6f78a812fa42227b25780a483fd202d8"/></dir></dir><file name="Recommendation.php" hash="7de37448b8fbd617a4c714d8fbbdfed3"/><dir name="Widget"><dir name="Boxes"><file name="Widget.php" hash="17560f25437bf04f2f8069b1aeee010e"/></dir></dir></dir><dir name="Helper"><file name="Boxes.php" hash="e321d569b2d6e6ff64e2ae33180b7509"/><file name="Data.php" hash="f649a34453f13f31514636afaec5e670"/></dir><dir name="Model"><dir name="Client"><file name="GravityClient.php" hash="0294939e272568ffd118db005d15563d"/></dir><file name="Customers.php" hash="7399f7fb93965a3c67f5e2c941209ffe"/><dir name="Export"><file name="Abstract.php" hash="9f42701355b6bb288b4ead0eadcf19f0"/><dir name="Catalog"><file name="Product.php" hash="53e49c91d3ed270933d12251fc137a99"/></dir><dir name="Customer"><file name="Customer.php" hash="d3577acc08cd3004ccfb865232eebb9c"/></dir></dir><dir name="Method"><file name="Abstract.php" hash="c907e89db6238c5001cf653b31afa56e"/><file name="Request.php" hash="5bd55deab246f6a1ea6803c39c93242f"/></dir><file name="Observer.php" hash="2527b0d10cf5448a6727bbee696e4d0c"/><file name="Products.php" hash="3b76c51170818f04fe94606f85e09dd2"/><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Catalog"><file name="Cron.php" hash="395fbd5f3d41223a336057b5bba6f4cc"/></dir></dir><dir name="Source"><dir name="Catalog"><file name="Attributes.php" hash="72df90bea6566c5e843c2301ba4dd6e1"/></dir><dir name="Customer"><file name="Attributes.php" hash="1e940ae61c568d83bc541b0fb8e87de1"/></dir><dir name="Layout"><file name="Layout.php" hash="18ab5c014f802bea1f6a841d062439ac"/><file name="Pages.php" hash="5e443f0c91329db385bc3d3b4e945c22"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="GravityController.php" hash="c6237b4322d5a7a33d191789325b8036"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="91c9644e779d2dcbfced9869d5b7dd95"/><file name="config.xml" hash="5fb405d8f77bb517bf69c8dca5cbd03c"/><file name="system.xml" hash="525d84e5587e5632024c81187fcf0957"/><file name="widget.xml" hash="9662aa456d8dcf6b38503944427c247e"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="me"><dir name="gravity"><dir name="catalog"><dir name="category"><dir name="boxes"><file name="default.phtml" hash="767fe3f58ab7398d38e5e9a0610b7e9b"/><file name="sidebar.phtml" hash="07624b8f1c51740734961788c8d1d4c1"/></dir></dir><dir name="product"><dir name="view"><dir name="boxes"><file name="default.phtml" hash="2f9ab7a2c0673786f58a1ec7c1161395"/><file name="sidebar.phtml" hash="30447c1eeb0aecd5021113ba4d0d666f"/></dir><dir name="js"><file name="gravity.phtml" hash="21b1752933f49d4fdf77c1dff3e8accb"/></dir></dir></dir></dir><dir name="catalogsearch"><dir name="advanced"><dir name="js"><file name="gravity.phtml" hash="ed37b5368abb0e5e1fddaf7d94f1634f"/></dir></dir><dir name="boxes"><file name="default.phtml" hash="600f331b3ef8772b652cc7fcde0270d6"/><file name="sidebar.phtml" hash="f9b64de7698f8d5a30da7dda56ef8f1d"/></dir><dir name="js"><file name="gravity.phtml" hash="a77756580b0a6577f9431194e88ce0f3"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="boxes"><file name="default.phtml" hash="20aedc8eed8ab7e4c139f06cd6c0266f"/><file name="sidebar.phtml" hash="1b1f4c63788bfc9f9e338f664c50af64"/></dir></dir></dir><dir name="general"><dir name="boxes"><file name="default.phtml" hash="aa41e16c11bfd37f4bf56a2a21967980"/><file name="sidebar.phtml" hash="0566509571da516c033e081009d007e9"/></dir></dir><dir name="page"><dir name="js"><file name="body-end.phtml" hash="5b642b64e8bb15d8bfe23b13400a7e63"/><file name="gravity.phtml" hash="9cddc0d488431b7a69903e0f38d62be3"/></dir></dir><dir name="widget"><dir name="boxes"><file name="widget.phtml" hash="80fd5994cde6c34f862e2850caa2beb1"/></dir></dir></dir></dir></dir><dir name="layout"><dir name="me"><file name="gravity.xml" hash="47f5ea1f53290cfd3f6a48bd2c64a7fc"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="template"><dir name="me"><dir name="gravity"><dir name="catalog"><dir name="category"><dir name="boxes"><file name="default.phtml" hash="ea2934a0f784adff2bf09d5e86653968"/><file name="sidebar.phtml" hash="f5ba9de470ce1f18720ccabe8cff5316"/></dir></dir><dir name="product"><dir name="view"><dir name="boxes"><file name="default.phtml" hash="ed17c57bb5003bce061d2eee473ddda2"/><file name="sidebar.phtml" hash="8cf5d02bd154b3c0f56d74dd5535c786"/></dir></dir></dir></dir><dir name="catalogsearch"><dir name="boxes"><file name="default.phtml" hash="8dc241f668fad3b36e1a26d8c3b01802"/><file name="sidebar.phtml" hash="6aa688d961dfc9818001ae39866a4992"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="boxes"><file name="default.phtml" hash="c81b3af4fe4fc03444da83f7416d0fc7"/><file name="sidebar.phtml" hash="d78a9160cbeded38e6a989eefe3c3753"/></dir></dir></dir><dir name="general"><dir name="boxes"><file name="default.phtml" hash="aaa00a090cef33df9d882edfd6dadc9f"/><file name="sidebar.phtml" hash="0566509571da516c033e081009d007e9"/></dir></dir><dir name="widget"><dir name="boxes"><file name="widget.phtml" hash="41552aa04ba7810eada0706a8ee7f5ec"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="me"><dir name="gravity"><dir name="system"><dir name="config"><dir name="form"><file name="test.phtml" hash="d9d972a23b04a34ab5f4d70a732d65b3"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="me"><dir name="gravity"><file name="gravity.css" hash="c2c4c7d30bced9a311c98032e38e0e11"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Me_Gravity.csv" hash="cf7233d08a92c8891d62c60b000953c4"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.3.0</min><max>5.6.4</max></php></required></dependencies>
20
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Me_Gravity</name>
4
+ <version>1.0.2.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gravityrd.com/">Gravity R&amp;D, Ltd.</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>The Gravity Recommendation extension provides an interface between Magento web shop and Gravity Recommendation service. The communication based on PHP or Javascript API providing by Gravity service. </summary>
10
  <description>The Gravity Recommendation extension provides an interface between Magento web shop and Gravity Recommendation service. The communication based on PHP or Javascript API providing by Gravity service. The extension responsible for displaying recommendation boxes with products using Magento templates or Gravity based templates. The boxes contains the web shop products offered by the other side, and also sends information for Gravity service to provided proper analysis of users behaviors. It also able to export products catalog and customers for Gravity service using the extension configuration panel, or run daily scheduled export by cron job.</description>
11
+ <notes>Version number: 1.0.2.1&#xD;
12
  Stability: Stable&#xD;
13
  Compatibility: CE 1.6.x, 1.7.x, 1.8.x, 1.9.x </notes>
14
  <authors><author><name>Gravity Recommendations</name><user>gravity_rd</user><email>web-integration@gravityrd.com</email></author></authors>
15
+ <date>2015-11-01</date>
16
+ <time>18:46:30</time>
17
+ <contents><target name="mageetc"><dir name="modules"><file name="Me_Gravity.xml" hash="a385bf72a5c2f0f040d2bb0850ca0b7c"/></dir></target><target name="magecommunity"><dir name="Me"><dir name="Gravity"><dir name="Block"><file name="Abstract.php" hash="586409500493a209ba021f8d471c793c"/><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><file name="Catalog.php" hash="6adcc355986762d7cc19f854c5fdd067"/><file name="Customer.php" hash="50336da73ad37e3895f82980387f6970"/><file name="Test.php" hash="07d7fce9dd15eb623918d6f01505cc32"/><file name="Version.php" hash="cdaa1bf4da1dffefb71aa3a27a63d2f1"/></dir></dir></dir></dir><dir name="Catalog"><dir name="Category"><dir name="Boxes"><file name="Category.php" hash="436b2d56c25114b152d786a939071cc4"/><file name="Personal.php" hash="7773ddf6e4a109e2cb16665ab1f469e6"/><file name="Top.php" hash="662641627445dd1a650467dfb2318151"/></dir></dir><dir name="Product"><dir name="View"><dir name="Boxes"><file name="Accessories.php" hash="765e6c65419b4c09702655d2e315835a"/><file name="Personal.php" hash="c3a1d8903982887485b1b0ca2c1548ec"/><file name="Product.php" hash="bc40a2d7e854fa9e6d8bb7b2bdd37a25"/><file name="Similar.php" hash="47099324fca5883edb881c8e4a3eb6bd"/></dir><dir name="Js"><file name="Gravity.php" hash="cba4e59a726e2ff10d746748731ac35e"/></dir></dir></dir></dir><dir name="Catalogsearch"><dir name="Advanced"><dir name="Js"><file name="Gravity.php" hash="a37130181b430d057fa2dcb76de0ff60"/></dir></dir><dir name="Boxes"><file name="Result.php" hash="1c59e5b53cbef273f6cb7cd3448aa45b"/></dir><dir name="Js"><file name="Gravity.php" hash="d065f4ef6555312988c2e165621ea2a8"/></dir></dir><dir name="Checkout"><dir name="Cart"><dir name="Boxes"><file name="Cart.php" hash="b720e576c5123f9d52ee98807cb7ac36"/></dir></dir></dir><dir name="General"><dir name="Boxes"><file name="Best.php" hash="07299f81cbf42d2fda4bfb31964f7c24"/><file name="History.php" hash="b50a5a27a6920efbf0ff51e349543e13"/><file name="Others.php" hash="263af4423f1dc40640c2bd0f3366cec5"/><file name="Popular.php" hash="d50fdf81725bd55be46141c5d5515480"/></dir></dir><dir name="Page"><dir name="Js"><file name="Gravity.php" hash="6f78a812fa42227b25780a483fd202d8"/></dir></dir><file name="Recommendation.php" hash="c0d131d38d35f18b596119c6c5253c13"/><dir name="Widget"><dir name="Boxes"><file name="Widget.php" hash="17560f25437bf04f2f8069b1aeee010e"/></dir></dir></dir><dir name="Helper"><file name="Boxes.php" hash="9d498b80819c6f8b5f94e77801e312ec"/><file name="Data.php" hash="4c17e76eee0b1216a707a7fed937ec2b"/></dir><dir name="Model"><dir name="Client"><file name="GravityClient.php" hash="361edf56f609ce392a748a7a91d718e6"/></dir><file name="Customers.php" hash="7399f7fb93965a3c67f5e2c941209ffe"/><dir name="Export"><file name="Abstract.php" hash="9f42701355b6bb288b4ead0eadcf19f0"/><dir name="Catalog"><file name="Product.php" hash="53e49c91d3ed270933d12251fc137a99"/></dir><dir name="Customer"><file name="Customer.php" hash="d3577acc08cd3004ccfb865232eebb9c"/></dir></dir><dir name="Method"><file name="Abstract.php" hash="c907e89db6238c5001cf653b31afa56e"/><file name="Request.php" hash="06a09971071c0d95df4e8e1b3a680018"/></dir><file name="Observer.php" hash="d268e4868b2223a0be9d7d7ad8a5c6bb"/><file name="Products.php" hash="3b76c51170818f04fe94606f85e09dd2"/><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Catalog"><file name="Cron.php" hash="395fbd5f3d41223a336057b5bba6f4cc"/></dir></dir><dir name="Source"><dir name="Catalog"><file name="Attributes.php" hash="72df90bea6566c5e843c2301ba4dd6e1"/></dir><dir name="Customer"><file name="Attributes.php" hash="1e940ae61c568d83bc541b0fb8e87de1"/></dir><dir name="Layout"><file name="Layout.php" hash="18ab5c014f802bea1f6a841d062439ac"/><file name="Pages.php" hash="5e443f0c91329db385bc3d3b4e945c22"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="GravityController.php" hash="c6237b4322d5a7a33d191789325b8036"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="91c9644e779d2dcbfced9869d5b7dd95"/><file name="config.xml" hash="fd23cb6b55ac99b554d00f283457f918"/><file name="system.xml" hash="637a082cd516b66623ba693eda86be10"/><file name="widget.xml" hash="9662aa456d8dcf6b38503944427c247e"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="me"><dir name="gravity"><dir name="catalog"><dir name="category"><dir name="boxes"><file name="default.phtml" hash="f1569ed325e167d4e24b48101c109bed"/><file name="sidebar.phtml" hash="bfd9e6b741652779fea92b059f991822"/></dir></dir><dir name="product"><dir name="view"><dir name="boxes"><file name="default.phtml" hash="c916e1eeae7a719a2f284c19627eb50e"/><file name="sidebar.phtml" hash="c603cab98a672f113f0850ac850ee492"/></dir><dir name="js"><file name="gravity.phtml" hash="21b1752933f49d4fdf77c1dff3e8accb"/></dir></dir></dir></dir><dir name="catalogsearch"><dir name="advanced"><dir name="js"><file name="gravity.phtml" hash="ed37b5368abb0e5e1fddaf7d94f1634f"/></dir></dir><dir name="boxes"><file name="default.phtml" hash="600f331b3ef8772b652cc7fcde0270d6"/><file name="sidebar.phtml" hash="f9b64de7698f8d5a30da7dda56ef8f1d"/></dir><dir name="js"><file name="gravity.phtml" hash="a77756580b0a6577f9431194e88ce0f3"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="boxes"><file name="default.phtml" hash="20aedc8eed8ab7e4c139f06cd6c0266f"/><file name="sidebar.phtml" hash="1b1f4c63788bfc9f9e338f664c50af64"/></dir></dir></dir><dir name="general"><dir name="boxes"><file name="default.phtml" hash="4b1308c89763c49b197883a9ae70e65b"/><file name="sidebar.phtml" hash="db426a25d29aaddf2c037aa471b0b855"/></dir></dir><dir name="page"><dir name="js"><file name="body-end.phtml" hash="c68cf0e1b26964c5867bd9fa1bf548c3"/><file name="gravity.phtml" hash="6a683618a3dc21584aabdb5b91137fb4"/></dir></dir><dir name="widget"><dir name="boxes"><file name="widget.phtml" hash="80fd5994cde6c34f862e2850caa2beb1"/></dir></dir></dir></dir></dir><dir name="layout"><dir name="me"><file name="gravity.xml" hash="47f5ea1f53290cfd3f6a48bd2c64a7fc"/></dir></dir></dir></dir><dir name="rwd"><dir name="default"><dir name="template"><dir name="me"><dir name="gravity"><dir name="catalog"><dir name="category"><dir name="boxes"><file name="default.phtml" hash="4c4c9c68a8695e4ee0e8df9372e3e545"/><file name="sidebar.phtml" hash="7e7226aed80cd351b66e2b0c599608d5"/></dir></dir><dir name="product"><dir name="view"><dir name="boxes"><file name="default.phtml" hash="b68aa48c1e3ff9884884084660cb04cd"/><file name="sidebar.phtml" hash="3dfdc2dbdb9c69dbad73e93759fe6dee"/></dir></dir></dir></dir><dir name="catalogsearch"><dir name="boxes"><file name="default.phtml" hash="8dc241f668fad3b36e1a26d8c3b01802"/><file name="sidebar.phtml" hash="6aa688d961dfc9818001ae39866a4992"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="boxes"><file name="default.phtml" hash="c81b3af4fe4fc03444da83f7416d0fc7"/><file name="sidebar.phtml" hash="d78a9160cbeded38e6a989eefe3c3753"/></dir></dir></dir><dir name="general"><dir name="boxes"><file name="default.phtml" hash="ec7412c0f1a6c8c15b859f5277c53885"/><file name="sidebar.phtml" hash="db426a25d29aaddf2c037aa471b0b855"/></dir></dir><dir name="widget"><dir name="boxes"><file name="widget.phtml" hash="41552aa04ba7810eada0706a8ee7f5ec"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="me"><dir name="gravity"><dir name="system"><dir name="config"><dir name="form"><file name="test.phtml" hash="d9d972a23b04a34ab5f4d70a732d65b3"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="me"><dir name="gravity"><file name="gravity.css" hash="c2c4c7d30bced9a311c98032e38e0e11"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Me_Gravity.csv" hash="cf7233d08a92c8891d62c60b000953c4"/></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.3.0</min><max>5.6.4</max></php></required></dependencies>
20
  </package>