epoqRS - Version 1.2.4

Version Notes

- Minor Bugfixes

Download this release

Release Info

Developer Flagbit GmbH
Extension epoqRS
Version 1.2.4
Comparing to
See all releases


Code changes from version 1.2.2 to 1.2.4

Files changed (23) hide show
  1. app/code/community/Flagbit/EpoqInterface/Block/Abstract.php +10 -2
  2. app/code/community/Flagbit/EpoqInterface/Block/Export/Productlist.php +3 -3
  3. app/code/community/Flagbit/EpoqInterface/Block/Recommendation/Abstract.php +3 -1
  4. app/code/community/Flagbit/EpoqInterface/Block/Recommendation/Cart.php +8 -1
  5. app/code/community/Flagbit/EpoqInterface/Block/Recommendation/Product.php +0 -2
  6. app/code/community/Flagbit/EpoqInterface/Block/Recommendation/User.php +8 -1
  7. app/code/community/Flagbit/EpoqInterface/Block/Track/Cart.php +7 -4
  8. app/code/community/Flagbit/EpoqInterface/Block/Track/Product.php +2 -0
  9. app/code/community/Flagbit/EpoqInterface/Block/Track/User.php +56 -0
  10. app/code/community/Flagbit/EpoqInterface/Model/Abstract.php +2 -1
  11. app/code/community/Flagbit/EpoqInterface/Model/Recommendation/Abstract.php +56 -12
  12. app/code/community/Flagbit/EpoqInterface/Model/Resource/Eav/Mysql4/Product/Collection.php +4 -0
  13. app/code/community/Flagbit/EpoqInterface/controllers/RecommendationController.php +6 -1
  14. app/code/community/Flagbit/EpoqInterface/documentation/{epoqRS_Magento Installation Guide 1.2.0.pdf → epoqRS_Magento Installation Guide 1.2.4.pdf} +0 -0
  15. app/code/community/Flagbit/EpoqInterface/etc/config.xml +5 -1
  16. app/code/community/Flagbit/EpoqInterface/etc/system.xml +39 -4
  17. app/design/frontend/base/default/layout/epoqinterface.xml +8 -3
  18. app/design/frontend/base/default/template/epoqinterface/recommendation/cart.phtml +24 -20
  19. app/design/frontend/default/default/layout/epoqinterface.xml +12 -4
  20. app/design/frontend/default/default/template/epoqinterface/recommendation/cart.phtml +34 -29
  21. app/design/frontend/default/default/template/epoqinterface/recommendation/user.phtml +10 -9
  22. js/epoqinterface/epoq_recommendations.js +40 -25
  23. package.xml +4 -8
app/code/community/Flagbit/EpoqInterface/Block/Abstract.php CHANGED
@@ -21,6 +21,11 @@ class Flagbit_EpoqInterface_Block_Abstract extends Mage_Core_Block_Abstract
21
  const XML_TENANT_ID_PATH = 'epoqinterface/config/tenant_id';
22
  const XML_AJAX_ENABLED = 'epoqinterface/config/ajax';
23
  const XML_DEMO_PATH = 'epoqinterface/config/demo';
 
 
 
 
 
24
 
25
  protected $_lastRecommendationId = null;
26
  protected $_product = null;
@@ -44,7 +49,8 @@ class Flagbit_EpoqInterface_Block_Abstract extends Mage_Core_Block_Abstract
44
  $variables = array(
45
  'epoq_tenantId' => Mage::getStoreConfig(self::XML_TENANT_ID_PATH),
46
  'epoq_sessionId' => (!Mage::getStoreConfig(self::XML_AJAX_ENABLED) ? Mage::getSingleton('core/session')->getSessionId() : ''),
47
- 'epoq_demoMode' => Mage::getStoreConfig(self::XML_DEMO_PATH) ? 6 : '',
 
48
  );
49
 
50
  if($customerId = Mage::getSingleton('customer/session')->getId()){
@@ -66,7 +72,9 @@ class Flagbit_EpoqInterface_Block_Abstract extends Mage_Core_Block_Abstract
66
 
67
  $output = "<script type=\"text/javascript\">\n";
68
  $output .= $content."\n";
69
- $output .= "epoq_".$function."();\n";
 
 
70
  $output .= "</script>\n";
71
 
72
  return $output;
21
  const XML_TENANT_ID_PATH = 'epoqinterface/config/tenant_id';
22
  const XML_AJAX_ENABLED = 'epoqinterface/config/ajax';
23
  const XML_DEMO_PATH = 'epoqinterface/config/demo';
24
+ const XML_DEMO_ITEMS_AMOUNT = 'epoqinterface/config/demo_items';
25
+
26
+ const XML_RULE_CUSTOMER = 'epoqinterface/display_recommendation/rule_customer';
27
+ const XML_RULE_CART = 'epoqinterface/display_recommendation/rule_cart';
28
+ const XML_RULE_PRODUCT = 'epoqinterface/display_recommendation/rule_product';
29
 
30
  protected $_lastRecommendationId = null;
31
  protected $_product = null;
49
  $variables = array(
50
  'epoq_tenantId' => Mage::getStoreConfig(self::XML_TENANT_ID_PATH),
51
  'epoq_sessionId' => (!Mage::getStoreConfig(self::XML_AJAX_ENABLED) ? Mage::getSingleton('core/session')->getSessionId() : ''),
52
+ 'epoq_demoMode' => Mage::getStoreConfig(self::XML_DEMO_PATH) ? Mage::getStoreConfig(self::XML_DEMO_ITEMS_AMOUNT) : '',
53
+ 'epoq_baseUrl' => Mage::getBaseUrl(),
54
  );
55
 
56
  if($customerId = Mage::getSingleton('customer/session')->getId()){
72
 
73
  $output = "<script type=\"text/javascript\">\n";
74
  $output .= $content."\n";
75
+ if ($function) {
76
+ $output .= "epoq_".$function."();\n";
77
+ }
78
  $output .= "</script>\n";
79
 
80
  return $output;
app/code/community/Flagbit/EpoqInterface/Block/Export/Productlist.php CHANGED
@@ -155,12 +155,12 @@ class Flagbit_EpoqInterface_Block_Export_Productlist extends Flagbit_EpoqInterfa
155
  // set Product variant
156
  if(isset($parentProduct[0])){
157
  $data['e:variant_of'] = $parentProduct[0];
158
- $data['c:mgt_parents'] = implode(',', $parentProduct);
159
  }
160
  if($product->isConfigurable()
161
  && $product->getTypeInstance(true) instanceof Mage_Catalog_Model_Product_Type_Configurable){
162
- $data['e:variants_id'] = implode(',', $this->_getVariantIds($product));
163
- $data['e:variants_sku'] = implode(',', $this->_getVariantIds($product, 'sku'));
164
  }
165
 
166
  // add Product Attributes
155
  // set Product variant
156
  if(isset($parentProduct[0])){
157
  $data['e:variant_of'] = $parentProduct[0];
158
+ $data['c:mgt_parents'] = implode(';', $parentProduct);
159
  }
160
  if($product->isConfigurable()
161
  && $product->getTypeInstance(true) instanceof Mage_Catalog_Model_Product_Type_Configurable){
162
+ $data['e:variants_id'] = implode(';', $this->_getVariantIds($product));
163
+ $data['e:variants_sku'] = implode(';', $this->_getVariantIds($product, 'sku'));
164
  }
165
 
166
  // add Product Attributes
app/code/community/Flagbit/EpoqInterface/Block/Recommendation/Abstract.php CHANGED
@@ -17,6 +17,8 @@
17
 
18
  class Flagbit_EpoqInterface_Block_Recommendation_Abstract extends Mage_Catalog_Block_Product_Abstract
19
  {
 
 
20
  protected $_columnCount = 4;
21
 
22
  protected $_items;
@@ -24,7 +26,7 @@ class Flagbit_EpoqInterface_Block_Recommendation_Abstract extends Mage_Catalog_B
24
  protected $_itemCollection;
25
 
26
  protected $_itemLimits = array();
27
-
28
  protected function _prepareData()
29
  {
30
 
17
 
18
  class Flagbit_EpoqInterface_Block_Recommendation_Abstract extends Mage_Catalog_Block_Product_Abstract
19
  {
20
+ const XML_USING_AJAX = 'epoqinterface/config/ajax';
21
+
22
  protected $_columnCount = 4;
23
 
24
  protected $_items;
26
  protected $_itemCollection;
27
 
28
  protected $_itemLimits = array();
29
+
30
  protected function _prepareData()
31
  {
32
 
app/code/community/Flagbit/EpoqInterface/Block/Recommendation/Cart.php CHANGED
@@ -20,7 +20,7 @@ class Flagbit_EpoqInterface_Block_Recommendation_Cart extends Flagbit_EpoqInterf
20
 
21
  protected $_collectionModel = 'epoqinterface/recommendation_cart';
22
  const XML_STATUS_PATH = 'epoqinterface/display_recommendation/cart';
23
-
24
  /**
25
  * Render block HTML
26
  *
@@ -32,6 +32,13 @@ class Flagbit_EpoqInterface_Block_Recommendation_Cart extends Flagbit_EpoqInterf
32
  return '';
33
  }
34
 
 
 
 
 
 
 
 
35
  return parent::_toHtml();
36
  }
37
  }
20
 
21
  protected $_collectionModel = 'epoqinterface/recommendation_cart';
22
  const XML_STATUS_PATH = 'epoqinterface/display_recommendation/cart';
23
+
24
  /**
25
  * Render block HTML
26
  *
32
  return '';
33
  }
34
 
35
+ if(Mage::getStoreConfig(self::XML_USING_AJAX)){
36
+ $html = '';
37
+ $html .= '<p id="epoqWidget1"></p>'."\n";
38
+ $html .= '<script type="text/javascript" src="'.$this->getJsUrl('epoqinterface/epoq_recommendations.js').'"></script>'."\n";
39
+ return $html;
40
+ }
41
+
42
  return parent::_toHtml();
43
  }
44
  }
app/code/community/Flagbit/EpoqInterface/Block/Recommendation/Product.php CHANGED
@@ -20,7 +20,6 @@ class Flagbit_EpoqInterface_Block_Recommendation_Product extends Flagbit_EpoqInt
20
 
21
  protected $_collectionModel = 'epoqinterface/recommendation_product';
22
  const XML_STATUS_PATH = 'epoqinterface/display_recommendation/product';
23
- const XML_USING_AJAX = 'epoqinterface/config/ajax';
24
 
25
  /**
26
  * Render block HTML
@@ -29,7 +28,6 @@ class Flagbit_EpoqInterface_Block_Recommendation_Product extends Flagbit_EpoqInt
29
  */
30
  protected function _toHtml()
31
  {
32
-
33
  if(!Mage::getStoreConfig(self::XML_STATUS_PATH)){
34
  return '';
35
  }
20
 
21
  protected $_collectionModel = 'epoqinterface/recommendation_product';
22
  const XML_STATUS_PATH = 'epoqinterface/display_recommendation/product';
 
23
 
24
  /**
25
  * Render block HTML
28
  */
29
  protected function _toHtml()
30
  {
 
31
  if(!Mage::getStoreConfig(self::XML_STATUS_PATH)){
32
  return '';
33
  }
app/code/community/Flagbit/EpoqInterface/Block/Recommendation/User.php CHANGED
@@ -20,7 +20,7 @@ class Flagbit_EpoqInterface_Block_Recommendation_User extends Flagbit_EpoqInterf
20
 
21
  protected $_collectionModel = 'epoqinterface/recommendation_user';
22
  const XML_STATUS_PATH = 'epoqinterface/display_recommendation/user';
23
-
24
  /**
25
  * Render block HTML
26
  *
@@ -31,6 +31,13 @@ class Flagbit_EpoqInterface_Block_Recommendation_User extends Flagbit_EpoqInterf
31
  if(!Mage::getStoreConfig(self::XML_STATUS_PATH)){
32
  return '';
33
  }
 
 
 
 
 
 
 
34
 
35
  return parent::_toHtml();
36
  }
20
 
21
  protected $_collectionModel = 'epoqinterface/recommendation_user';
22
  const XML_STATUS_PATH = 'epoqinterface/display_recommendation/user';
23
+
24
  /**
25
  * Render block HTML
26
  *
31
  if(!Mage::getStoreConfig(self::XML_STATUS_PATH)){
32
  return '';
33
  }
34
+
35
+ if(Mage::getStoreConfig(self::XML_USING_AJAX)){
36
+ $html = '';
37
+ $html .= '<p id="epoqWidget1"></p>'."\n";
38
+ $html .= '<script type="text/javascript" src="'.$this->getJsUrl('epoqinterface/epoq_recommendations.js').'"></script>'."\n";
39
+ return $html;
40
+ }
41
 
42
  return parent::_toHtml();
43
  }
app/code/community/Flagbit/EpoqInterface/Block/Track/Cart.php CHANGED
@@ -36,10 +36,10 @@ class Flagbit_EpoqInterface_Block_Track_Cart extends Flagbit_EpoqInterface_Block
36
  #return $output;
37
  }
38
 
39
- $variables = array(
40
- 'epoq_tenantId' => Mage::getStoreConfig('epoqinterface/config/tenant_id'),
41
- 'epoq_sessionId' => Mage::getSingleton('core/session')->getSessionId(),
42
- );
43
 
44
 
45
  $function = $this->getSession()->getCartUpdate() == 'process' ? 'processCart' : 'updateCart';
@@ -79,6 +79,9 @@ class Flagbit_EpoqInterface_Block_Track_Cart extends Flagbit_EpoqInterface_Block
79
  }
80
 
81
  $variables['epoq_tag'] = Mage::helper('epoqinterface')->getCookieStatus();
 
 
 
82
 
83
  return $variables;
84
  }
36
  #return $output;
37
  }
38
 
39
+ // $variables = array(
40
+ // 'epoq_tenantId' => Mage::getStoreConfig('epoqinterface/config/tenant_id'),
41
+ // 'epoq_sessionId' => Mage::getSingleton('core/session')->getSessionId(),
42
+ // );
43
 
44
 
45
  $function = $this->getSession()->getCartUpdate() == 'process' ? 'processCart' : 'updateCart';
79
  }
80
 
81
  $variables['epoq_tag'] = Mage::helper('epoqinterface')->getCookieStatus();
82
+ $variables['epoq_productId'] = '';
83
+ $variables['epoq_d_rules'] = Mage::getStoreConfig(Flagbit_EpoqInterface_Block_Abstract::XML_RULE_CART);
84
+ $variables['epoq_section'] = 'cart';
85
 
86
  return $variables;
87
  }
app/code/community/Flagbit/EpoqInterface/Block/Track/Product.php CHANGED
@@ -68,6 +68,8 @@ class Flagbit_EpoqInterface_Block_Track_Product extends Flagbit_EpoqInterface_Bl
68
  'epoq_attributes' => $this->getProductAttributes(),
69
  'epoq_locakey' => substr(Mage::getSingleton('core/locale')->getLocale(), 0, 2),
70
  'epoq_tag' => Mage::helper('epoqinterface')->getCookieStatus(),
 
 
71
  );
72
 
73
  return array_merge(parent::getParamsArray(), $variables);
68
  'epoq_attributes' => $this->getProductAttributes(),
69
  'epoq_locakey' => substr(Mage::getSingleton('core/locale')->getLocale(), 0, 2),
70
  'epoq_tag' => Mage::helper('epoqinterface')->getCookieStatus(),
71
+ 'epoq_d_rules' => Mage::getStoreConfig(Flagbit_EpoqInterface_Block_Abstract::XML_RULE_PRODUCT),
72
+ 'epoq_section' => 'product',
73
  );
74
 
75
  return array_merge(parent::getParamsArray(), $variables);
app/code/community/Flagbit/EpoqInterface/Block/Track/User.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* *
3
+ * This script is part of the epoq Recommendation Service project *
4
+ * *
5
+ * epoqinterface is free software; you can redistribute it and/or modify *
6
+ * it under the terms of the GNU General Public License version 2 as *
7
+ * published by the Free Software Foundation. *
8
+ * *
9
+ * This script is distributed in the hope that it will be useful, but *
10
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
11
+ * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
12
+ * Public License for more details. *
13
+ * *
14
+ * @version $Id: Product.php 583 2010-11-26 10:08:21Z weller $
15
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
16
+ */
17
+ class Flagbit_EpoqInterface_Block_Track_User extends Flagbit_EpoqInterface_Block_Abstract
18
+ {
19
+ /**
20
+ * (non-PHPdoc)
21
+ * @see Mage_Core_Block_Abstract::_toHtml()
22
+ */
23
+ protected function _toHtml()
24
+ {
25
+
26
+ if (!$this->_beforeToHtml()
27
+ or !$this->getProduct() instanceof Mage_Catalog_Model_Product) {
28
+ return '';
29
+ }
30
+
31
+ return $this->getJavascriptOutput(
32
+ $this->arrayToString(
33
+ $this->getParamsArray()
34
+ ),
35
+ '');
36
+ }
37
+
38
+ /**
39
+ * (non-PHPdoc)
40
+ * @see Flagbit_EpoqInterface_Block_Abstract::getParamsArray()
41
+ */
42
+ protected function getParamsArray(){
43
+
44
+ $variables = array(
45
+ 'epoq_productId' => '',
46
+ 'epoq_d_rules' => Mage::getStoreConfig(Flagbit_EpoqInterface_Block_Abstract::XML_RULE_CUSTOMER),
47
+ 'epoq_section' => 'user',
48
+ 'epoq_customerId' => Mage::getSingleton('customer/session')->getId(),
49
+ );
50
+
51
+ return array_merge(parent::getParamsArray(), $variables);
52
+ }
53
+
54
+
55
+
56
+ }
app/code/community/Flagbit/EpoqInterface/Model/Abstract.php CHANGED
@@ -25,7 +25,8 @@ class Flagbit_EpoqInterface_Model_Abstract extends Mage_Core_Model_Abstract {
25
  const XML_MAX_ATTEMPTS_PATH = 'epoqinterface/error_handling/max_attempts';
26
  const XML_IDLE_TIME_PATH = 'epoqinterface/error_handling/idle_time';
27
  const XML_DEMO_PATH = 'epoqinterface/config/demo';
28
- const CACHE_REQUEST_FAILURE_COUNTER = 'epoqinterface_rest_failure_counter';
 
29
  const CACHE_REQUEST_FAILURE_TIME = 'epoqinterface_rest_failure_time';
30
  const XML_AJAX_ENABLED = 'epoqinterface/config/ajax';
31
 
25
  const XML_MAX_ATTEMPTS_PATH = 'epoqinterface/error_handling/max_attempts';
26
  const XML_IDLE_TIME_PATH = 'epoqinterface/error_handling/idle_time';
27
  const XML_DEMO_PATH = 'epoqinterface/config/demo';
28
+ const XML_DEMO_ITEMS_AMOUNT = 'epoqinterface/config/demo_items';
29
+ const CACHE_REQUEST_FAILURE_COUNTER = 'epoqinterface_rest_failure_counter';
30
  const CACHE_REQUEST_FAILURE_TIME = 'epoqinterface_rest_failure_time';
31
  const XML_AJAX_ENABLED = 'epoqinterface/config/ajax';
32
 
app/code/community/Flagbit/EpoqInterface/Model/Recommendation/Abstract.php CHANGED
@@ -15,9 +15,8 @@
15
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
16
  */
17
 
18
- class Flagbit_EpoqInterface_Model_Recommendation_Abstract extends Flagbit_EpoqInterface_Model_Abstract {
19
-
20
-
21
  /**
22
  * Constructor
23
  *
@@ -43,19 +42,20 @@ class Flagbit_EpoqInterface_Model_Recommendation_Abstract extends Flagbit_EpoqIn
43
  // generate product ID array
44
  $productIds = array();
45
  if ($result->getIterator() instanceof SimpleXMLElement) {
46
- foreach ($result->getIterator()->recommendation as $product) {
47
- $productIds[] = $product->productId;
48
  }
49
  }
50
 
51
  // set Data
52
  $this->setProductIds($productIds);
53
- $this->setRecommendationId((string) $result->getIterator()->recommendationId);
54
 
55
  $this->getSession()->setLastRecommendationId($this->getRecommendationId());
56
  $this->getSession()->setLastRecommendationProducts($this->getProductIds());
57
  }
58
 
 
59
  /**
60
  * get Product Collection
61
  *
@@ -69,6 +69,7 @@ class Flagbit_EpoqInterface_Model_Recommendation_Abstract extends Flagbit_EpoqIn
69
  return $collection;
70
  }
71
 
 
72
  /**
73
  * return Zend Rest Client
74
  *
@@ -80,7 +81,8 @@ class Flagbit_EpoqInterface_Model_Recommendation_Abstract extends Flagbit_EpoqIn
80
  if (array_key_exists('action', $this->getData()) && $this->getData('action') == 'processCart') {
81
  $url = $this->getRestUrl().'processCart?'.$this->_httpBuildQuery($this->getParamsArray());
82
  } else {
83
- $url = $this->getRestUrl().'getRecommendationsFor'.$this->_getRecommendationFor.'?'.$this->_httpBuildQuery($this->getParamsArray());
 
84
  }
85
 
86
  $this->_restClient = new Zend_Rest_Client($url);
@@ -93,6 +95,15 @@ class Flagbit_EpoqInterface_Model_Recommendation_Abstract extends Flagbit_EpoqIn
93
  return $this->_restClient;
94
  }
95
 
 
 
 
 
 
 
 
 
 
96
  protected function _httpBuildQuery($array, $previousKey='')
97
  {
98
  $string = '';
@@ -106,14 +117,19 @@ class Flagbit_EpoqInterface_Model_Recommendation_Abstract extends Flagbit_EpoqIn
106
  return $string;
107
  }
108
 
 
 
 
 
 
109
  protected function getParamsArray()
110
  {
111
  $variables = array(
112
- 'tenantId' => Mage::getStoreConfig(self::XML_TENANT_ID_PATH),
113
- 'sessionId' => Mage::getSingleton('core/session')->getSessionId(),
114
- 'demo' => Mage::getStoreConfig(self::XML_DEMO_PATH) ? 6 : 0,
115
- 'widgetTheme' => 'xml',
116
- 'rules' => $this->getRules()
117
  );
118
 
119
  if ($customerId = Mage::getSingleton('customer/session')->getId()) {
@@ -122,4 +138,32 @@ class Flagbit_EpoqInterface_Model_Recommendation_Abstract extends Flagbit_EpoqIn
122
 
123
  return $variables;
124
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  }
15
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License, version 2
16
  */
17
 
18
+ class Flagbit_EpoqInterface_Model_Recommendation_Abstract extends Flagbit_EpoqInterface_Model_Abstract
19
+ {
 
20
  /**
21
  * Constructor
22
  *
42
  // generate product ID array
43
  $productIds = array();
44
  if ($result->getIterator() instanceof SimpleXMLElement) {
45
+ foreach ($result->getIterator()->domain->recommendation as $product) {
46
+ $productIds[] = (string) $product->productId;
47
  }
48
  }
49
 
50
  // set Data
51
  $this->setProductIds($productIds);
52
+ $this->setRecommendationId((string) $result->getIterator()->domain->recommendationId);
53
 
54
  $this->getSession()->setLastRecommendationId($this->getRecommendationId());
55
  $this->getSession()->setLastRecommendationProducts($this->getProductIds());
56
  }
57
 
58
+
59
  /**
60
  * get Product Collection
61
  *
69
  return $collection;
70
  }
71
 
72
+
73
  /**
74
  * return Zend Rest Client
75
  *
81
  if (array_key_exists('action', $this->getData()) && $this->getData('action') == 'processCart') {
82
  $url = $this->getRestUrl().'processCart?'.$this->_httpBuildQuery($this->getParamsArray());
83
  } else {
84
+ // $url = $this->getRestUrl().'getRecommendationsFor'.$this->_getRecommendationFor.'?'.$this->_httpBuildQuery($this->getParamsArray());
85
+ $url = $this->getRestUrl().'getRecommendations'.'?'.$this->_httpBuildQuery($this->getParamsArray());
86
  }
87
 
88
  $this->_restClient = new Zend_Rest_Client($url);
95
  return $this->_restClient;
96
  }
97
 
98
+
99
+ /**
100
+ * add parameters to url
101
+ *
102
+ * @param array $array
103
+ * @param string/int $previousKey
104
+ *
105
+ * @return string $string
106
+ */
107
  protected function _httpBuildQuery($array, $previousKey='')
108
  {
109
  $string = '';
117
  return $string;
118
  }
119
 
120
+
121
+ /**
122
+ * (non-PHPdoc)
123
+ * @see Flagbit_EpoqInterface_Model_Abstract::getParamsArray()
124
+ */
125
  protected function getParamsArray()
126
  {
127
  $variables = array(
128
+ 'tenantId' => Mage::getStoreConfig(self::XML_TENANT_ID_PATH),
129
+ 'sessionId' => Mage::getSingleton('core/session')->getSessionId(),
130
+ 'demo' => Mage::getStoreConfig(self::XML_DEMO_PATH) ? Mage::getStoreConfig(self::XML_DEMO_ITEMS_AMOUNT) : 0,
131
+ 'widgetTheme' => 'multixml',
132
+ 'rules' => $this->_getRulesForSection()
133
  );
134
 
135
  if ($customerId = Mage::getSingleton('customer/session')->getId()) {
138
 
139
  return $variables;
140
  }
141
+
142
+
143
+ /**
144
+ * get the rule of the current section
145
+ *
146
+ * @return string $rule
147
+ */
148
+ protected function _getRulesForSection()
149
+ {
150
+ $rule = '';
151
+ switch($this->_getRecommendationFor)
152
+ {
153
+ case 'Item':
154
+ $rule = Mage::getStoreConfig(Flagbit_EpoqInterface_Block_Abstract::XML_RULE_PRODUCT);
155
+ break;
156
+ case 'Cart':
157
+ $rule = Mage::getStoreConfig(Flagbit_EpoqInterface_Block_Abstract::XML_RULE_CART);
158
+ break;
159
+ case 'Customer':
160
+ $rule = Mage::getStoreConfig(Flagbit_EpoqInterface_Block_Abstract::XML_RULE_CUSTOMER);
161
+ break;
162
+ default:
163
+ $rule = '';
164
+ break;
165
+ }
166
+
167
+ return $rule;
168
+ }
169
  }
app/code/community/Flagbit/EpoqInterface/Model/Resource/Eav/Mysql4/Product/Collection.php CHANGED
@@ -45,6 +45,10 @@ class Flagbit_EpoqInterface_Model_Resource_Eav_Mysql4_Product_Collection
45
  */
46
  public function _loadEntities($printQuery = false, $logQuery = false)
47
  {
 
 
 
 
48
  $productIds = array_unique($this->_productIds);
49
  // $idFieldName = 'entity_id';
50
  $idFieldName = Mage::helper('epoqinterface')->getIdFieldName();
45
  */
46
  public function _loadEntities($printQuery = false, $logQuery = false)
47
  {
48
+ if (!is_array($this->_productIds)) {
49
+ return $this;
50
+ }
51
+
52
  $productIds = array_unique($this->_productIds);
53
  // $idFieldName = 'entity_id';
54
  $idFieldName = Mage::helper('epoqinterface')->getIdFieldName();
app/code/community/Flagbit/EpoqInterface/controllers/RecommendationController.php CHANGED
@@ -3,9 +3,14 @@ class Flagbit_EpoqInterface_RecommendationController extends Mage_Core_Controll
3
  {
4
  public function listAction()
5
  {
 
 
 
 
 
6
  echo $this->getLayout()->createBlock('epoqinterface/recommendation_ajaxproduct')
7
  ->setProductIds(Mage::app()->getRequest()->getParam('pid'))
8
- ->setTemplate('epoqinterface/recommendation/product.phtml')
9
  ->toHtml();
10
  }
11
 
3
  {
4
  public function listAction()
5
  {
6
+ // indicate the template to load
7
+ if (!$section = Mage::app()->getRequest()->getParam('section')) {
8
+ $section = 'product';
9
+ }
10
+
11
  echo $this->getLayout()->createBlock('epoqinterface/recommendation_ajaxproduct')
12
  ->setProductIds(Mage::app()->getRequest()->getParam('pid'))
13
+ ->setTemplate('epoqinterface/recommendation/'.$section.'.phtml')
14
  ->toHtml();
15
  }
16
 
app/code/community/Flagbit/EpoqInterface/documentation/{epoqRS_Magento Installation Guide 1.2.0.pdf → epoqRS_Magento Installation Guide 1.2.4.pdf} RENAMED
Binary file
app/code/community/Flagbit/EpoqInterface/etc/config.xml CHANGED
@@ -20,7 +20,7 @@
20
  <modules>
21
  <Flagbit_EpoqInterface>
22
  <active>true</active>
23
- <version>1.2.2</version>
24
  </Flagbit_EpoqInterface>
25
  </modules>
26
 
@@ -161,6 +161,7 @@
161
  <config>
162
  <timeout>2</timeout>
163
  <demo>0</demo>
 
164
  <customer_profiles>0</customer_profiles>
165
  <debug>0</debug>
166
  <ajax>0</ajax>
@@ -168,8 +169,11 @@
168
  </config>
169
  <display_recommendation>
170
  <user>1</user>
 
171
  <cart>1</cart>
 
172
  <product>1</product>
 
173
  </display_recommendation>
174
  <export>
175
  <username>epoq</username>
20
  <modules>
21
  <Flagbit_EpoqInterface>
22
  <active>true</active>
23
+ <version>1.2.4</version>
24
  </Flagbit_EpoqInterface>
25
  </modules>
26
 
161
  <config>
162
  <timeout>2</timeout>
163
  <demo>0</demo>
164
+ <demo_items>6</demo_items>
165
  <customer_profiles>0</customer_profiles>
166
  <debug>0</debug>
167
  <ajax>0</ajax>
169
  </config>
170
  <display_recommendation>
171
  <user>1</user>
172
+ <rule_customer>RecommendationForCustomerRule</rule_customer>
173
  <cart>1</cart>
174
+ <rule_cart>RecommendationForCartRule</rule_cart>
175
  <product>1</product>
176
+ <rule_product>default</rule_product>
177
  </display_recommendation>
178
  <export>
179
  <username>epoq</username>
app/code/community/Flagbit/EpoqInterface/etc/system.xml CHANGED
@@ -88,11 +88,19 @@
88
  <show_in_website>1</show_in_website>
89
  <show_in_store>1</show_in_store>
90
  </demo>
 
 
 
 
 
 
 
 
91
  <debug translate="label">
92
  <label>Debug Log (var/log/epoq.log)</label>
93
  <frontend_type>select</frontend_type>
94
  <source_model>adminhtml/system_config_source_yesno</source_model>
95
- <sort_order>60</sort_order>
96
  <show_in_default>1</show_in_default>
97
  <show_in_website>1</show_in_website>
98
  <show_in_store>1</show_in_store>
@@ -110,7 +118,7 @@
110
  <label>Enable cookies</label>
111
  <frontend_type>select</frontend_type>
112
  <source_model>adminhtml/system_config_source_yesno</source_model>
113
- <sort_order>70</sort_order>
114
  <show_in_default>1</show_in_default>
115
  <show_in_website>1</show_in_website>
116
  <show_in_store>1</show_in_store>
@@ -134,24 +142,51 @@
134
  <show_in_website>1</show_in_website>
135
  <show_in_store>1</show_in_store>
136
  </cart>
 
 
 
 
 
 
 
 
 
137
  <product translate="label">
138
  <label>Product View</label>
139
  <frontend_type>select</frontend_type>
140
  <source_model>adminhtml/system_config_source_yesno</source_model>
141
- <sort_order>20</sort_order>
142
  <show_in_default>1</show_in_default>
143
  <show_in_website>1</show_in_website>
144
  <show_in_store>1</show_in_store>
145
  </product>
 
 
 
 
 
 
 
 
 
146
  <user translate="label">
147
  <label>My Account</label>
148
  <frontend_type>select</frontend_type>
149
  <source_model>adminhtml/system_config_source_yesno</source_model>
150
- <sort_order>30</sort_order>
151
  <show_in_default>1</show_in_default>
152
  <show_in_website>1</show_in_website>
153
  <show_in_store>1</show_in_store>
154
  </user>
 
 
 
 
 
 
 
 
 
155
  </fields>
156
  </display_recommendation>
157
  <export translate="label">
88
  <show_in_website>1</show_in_website>
89
  <show_in_store>1</show_in_store>
90
  </demo>
91
+ <demo_items translate="label">
92
+ <label>Demo items amount</label>
93
+ <frontend_type>text</frontend_type>
94
+ <sort_order>60</sort_order>
95
+ <show_in_default>1</show_in_default>
96
+ <show_in_website>1</show_in_website>
97
+ <show_in_store>1</show_in_store>
98
+ </demo_items>
99
  <debug translate="label">
100
  <label>Debug Log (var/log/epoq.log)</label>
101
  <frontend_type>select</frontend_type>
102
  <source_model>adminhtml/system_config_source_yesno</source_model>
103
+ <sort_order>70</sort_order>
104
  <show_in_default>1</show_in_default>
105
  <show_in_website>1</show_in_website>
106
  <show_in_store>1</show_in_store>
118
  <label>Enable cookies</label>
119
  <frontend_type>select</frontend_type>
120
  <source_model>adminhtml/system_config_source_yesno</source_model>
121
+ <sort_order>80</sort_order>
122
  <show_in_default>1</show_in_default>
123
  <show_in_website>1</show_in_website>
124
  <show_in_store>1</show_in_store>
142
  <show_in_website>1</show_in_website>
143
  <show_in_store>1</show_in_store>
144
  </cart>
145
+ <rule_cart translate="label">
146
+ <label>Cart rule</label>
147
+ <comment>; seperated i. e. RecommendationForCartRule;RecommendationForCartRule</comment>
148
+ <frontend_type>text</frontend_type>
149
+ <sort_order>20</sort_order>
150
+ <show_in_default>1</show_in_default>
151
+ <show_in_website>1</show_in_website>
152
+ <show_in_store>1</show_in_store>
153
+ </rule_cart>
154
  <product translate="label">
155
  <label>Product View</label>
156
  <frontend_type>select</frontend_type>
157
  <source_model>adminhtml/system_config_source_yesno</source_model>
158
+ <sort_order>30</sort_order>
159
  <show_in_default>1</show_in_default>
160
  <show_in_website>1</show_in_website>
161
  <show_in_store>1</show_in_store>
162
  </product>
163
+ <rule_product translate="label">
164
+ <label>Product rule</label>
165
+ <comment>; seperated i. e. default;default1</comment>
166
+ <frontend_type>text</frontend_type>
167
+ <sort_order>40</sort_order>
168
+ <show_in_default>1</show_in_default>
169
+ <show_in_website>1</show_in_website>
170
+ <show_in_store>1</show_in_store>
171
+ </rule_product>
172
  <user translate="label">
173
  <label>My Account</label>
174
  <frontend_type>select</frontend_type>
175
  <source_model>adminhtml/system_config_source_yesno</source_model>
176
+ <sort_order>50</sort_order>
177
  <show_in_default>1</show_in_default>
178
  <show_in_website>1</show_in_website>
179
  <show_in_store>1</show_in_store>
180
  </user>
181
+ <rule_customer translate="label">
182
+ <label>Customer rule</label>
183
+ <comment>; seperated i. e. RecommendationForCustomerRule;RecommendationForCustomerRule</comment>
184
+ <frontend_type>text</frontend_type>
185
+ <sort_order>60</sort_order>
186
+ <show_in_default>1</show_in_default>
187
+ <show_in_website>1</show_in_website>
188
+ <show_in_store>1</show_in_store>
189
+ </rule_customer>
190
  </fields>
191
  </display_recommendation>
192
  <export translate="label">
app/design/frontend/base/default/layout/epoqinterface.xml CHANGED
@@ -25,8 +25,10 @@
25
  </default>
26
 
27
  <catalog_product_view>
 
 
 
28
  <reference name="content">
29
- <block type="epoqinterface/track_product" name="epoqinterface.track.product" before="epoqinterface.recommendation.product" />
30
  <reference name="product.info.additional">
31
  <block type="epoqinterface/recommendation_product" name="epoqinterface.recommendation.product" template="epoqinterface/recommendation/product.phtml">
32
  <!-- <action method="setRules"><rules>name(value)</rules></action> -->
@@ -36,10 +38,13 @@
36
  </catalog_product_view>
37
 
38
  <checkout_cart_index>
 
 
 
39
  <reference name="content">
40
- <block type="epoqinterface/track_cart" name="epoqinterface.track.cart"/>
41
  <reference name="checkout.cart">
42
- <block type="epoqinterface/recommendation_cart" name="epoqinterface.recommendation.cart" template="epoqinterface/recommendation/cart.phtml"/>
 
43
  </reference>
44
  </reference>
45
  </checkout_cart_index>
25
  </default>
26
 
27
  <catalog_product_view>
28
+ <reference name="head">
29
+ <block type="epoqinterface/track_product" name="epoqinterface.track.product" before="epoqinterface.recommendation.product" />
30
+ </reference>
31
  <reference name="content">
 
32
  <reference name="product.info.additional">
33
  <block type="epoqinterface/recommendation_product" name="epoqinterface.recommendation.product" template="epoqinterface/recommendation/product.phtml">
34
  <!-- <action method="setRules"><rules>name(value)</rules></action> -->
38
  </catalog_product_view>
39
 
40
  <checkout_cart_index>
41
+ <reference name="head">
42
+ <block type="epoqinterface/track_cart" name="epoqinterface.track.cart" before="epoqinterface.recommendation.cart" />
43
+ </reference>
44
  <reference name="content">
 
45
  <reference name="checkout.cart">
46
+ <remove name="checkout.cart.crosssell" />
47
+ <block type="epoqinterface/recommendation_cart" name="epoqinterface.recommendation.cart" as="crosssell" template="epoqinterface/recommendation/cart.phtml"/>
48
  </reference>
49
  </reference>
50
  </checkout_cart_index>
app/design/frontend/base/default/template/epoqinterface/recommendation/cart.phtml CHANGED
@@ -17,29 +17,33 @@
17
  ?>
18
 
19
  <?php if(count($this->getItemCollection()->getItems())): ?>
20
- <div class="collateral-box up-sell">
21
  <div class="head"><h4><?php echo $this->__('epoq: You may also be interested in the following product(s)') ?></h4></div>
22
- <table cellspacing="0" class="generic-product-grid catalog-listing" id="upsell-product-table">
23
- <?php // $this->setColumnCount(4); // uncomment this line if you want to have another number of columns. also can be changed in layout ?>
24
  <?php $this->resetItemsIterator() ?>
25
- <?php for($_i=0;$_i<$this->getRowCount();$_i++): ?>
26
- <tr>
27
- <?php for($_j=0;$_j<$this->getColumnCount();$_j++): ?>
28
- <?php if($_link=$this->getIterableItem()): ?>
29
- <td>
30
- <p class="product-image"><a href="<?php echo $_link->getProductUrl() ?>" class="epoq-recommendation-link"><img src="<?php echo $this->helper('catalog/image')->init($_link, 'small_image')->resize(125) ?>" width="125" height="125" alt="<?php echo $this->htmlEscape($_link->getName()) ?>" /></a></p>
31
- <h5><a href="<?php echo $_link->getProductUrl() ?>" class="epoq-recommendation-link"><?php echo $this->htmlEscape($_link->getName()) ?></a></h5>
32
- <?php echo $this->getPriceHtml($_link, true) ?>
33
- <?php echo $this->getReviewsSummaryHtml($_link) ?>
34
- </td>
35
- <?php else: ?>
36
- <td class="empty-product">&nbsp;</td>
37
- <?php endif; ?>
38
- <?php endfor; ?>
39
- </tr>
 
 
 
 
40
  <?php endfor; ?>
41
- </table>
42
- <script type="text/javascript">decorateTable('upsell-product-table')</script>
 
43
  </div>
44
  <script type="text/javascript">
45
  $$('a.epoq-recommendation-link').each(function(elem, index){
17
  ?>
18
 
19
  <?php if(count($this->getItemCollection()->getItems())): ?>
20
+ <div class="crosssell">
21
  <div class="head"><h4><?php echo $this->__('epoq: You may also be interested in the following product(s)') ?></h4></div>
22
+ <ul id="crosssell-products-list">
 
23
  <?php $this->resetItemsIterator() ?>
24
+ <?php for($_j=0;$_j<$this->getColumnCount();$_j++): ?>
25
+ <?php if($_link=$this->getIterableItem()): ?>
26
+ <li class="item">
27
+ <a class="product-image" href="<?php echo $_link->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_link->getName()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_link, 'thumbnail')->resize(75); ?>" width="75" height="75" alt="<?php echo $this->htmlEscape($_link->getName()) ?>" /></a>
28
+ <div class="product-details">
29
+ <h3 class="product-name"><a href="<?php echo $_link->getProductUrl() ?>"><?php echo $this->htmlEscape($_link->getName()) ?></a></h3>
30
+ <?php echo $this->getPriceHtml($_link, true) ?>
31
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_link) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
32
+ <ul class="add-to-links">
33
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
34
+ <li><a href="<?php echo $this->getAddToWishlistUrl($_link) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
35
+ <?php endif; ?>
36
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_link)): ?>
37
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
38
+ <?php endif; ?>
39
+ </ul>
40
+ </div>
41
+ </li>
42
+ <?php endif; ?>
43
  <?php endfor; ?>
44
+ </ul>
45
+ <script type="text/javascript">decorateList('crosssell-products-list', 'none-recursive')</script>
46
+
47
  </div>
48
  <script type="text/javascript">
49
  $$('a.epoq-recommendation-link').each(function(elem, index){
app/design/frontend/default/default/layout/epoqinterface.xml CHANGED
@@ -25,8 +25,10 @@
25
  </default>
26
 
27
  <catalog_product_view>
 
 
 
28
  <reference name="content">
29
- <block type="epoqinterface/track_product" name="epoqinterface.track.product" before="epoqinterface.recommendation.product" />
30
  <reference name="product.info.additional">
31
  <block type="epoqinterface/recommendation_product" name="epoqinterface.recommendation.product" template="epoqinterface/recommendation/product.phtml">
32
  <!-- <action method="setRules"><rules>name(value)</rules></action> -->
@@ -36,10 +38,13 @@
36
  </catalog_product_view>
37
 
38
  <checkout_cart_index>
39
- <reference name="content">
40
- <block type="epoqinterface/track_cart" name="epoqinterface.track.cart"/>
 
 
41
  <reference name="checkout.cart">
42
- <block type="epoqinterface/recommendation_cart" name="epoqinterface.recommendation.cart" template="epoqinterface/recommendation/cart.phtml"/>
 
43
  </reference>
44
  </reference>
45
  </checkout_cart_index>
@@ -57,6 +62,9 @@
57
  </checkout_onepage_success>
58
 
59
  <customer_account_index>
 
 
 
60
  <reference name="customer_account_dashboard">
61
  <block type="epoqinterface/recommendation_user" name="epoqinterface.recommendation.user" as="info1" template="epoqinterface/recommendation/user.phtml"/>
62
  </reference>
25
  </default>
26
 
27
  <catalog_product_view>
28
+ <reference name="head">
29
+ <block type="epoqinterface/track_product" name="epoqinterface.track.product" before="epoqinterface.recommendation.product" />
30
+ </reference>
31
  <reference name="content">
 
32
  <reference name="product.info.additional">
33
  <block type="epoqinterface/recommendation_product" name="epoqinterface.recommendation.product" template="epoqinterface/recommendation/product.phtml">
34
  <!-- <action method="setRules"><rules>name(value)</rules></action> -->
38
  </catalog_product_view>
39
 
40
  <checkout_cart_index>
41
+ <reference name="head">
42
+ <block type="epoqinterface/track_cart" name="epoqinterface.track.cart" before="epoqinterface.recommendation.cart" />
43
+ </reference>
44
+ <reference name="content">
45
  <reference name="checkout.cart">
46
+ <remove name="checkout.cart.crosssell" />
47
+ <block type="epoqinterface/recommendation_cart" name="epoqinterface.recommendation.cart" as="crosssell" template="epoqinterface/recommendation/cart.phtml"/>
48
  </reference>
49
  </reference>
50
  </checkout_cart_index>
62
  </checkout_onepage_success>
63
 
64
  <customer_account_index>
65
+ <reference name="head">
66
+ <block type="epoqinterface/track_user" name="epoqinterface.track.user" before="epoqinterface.recommendation.user" />
67
+ </reference>
68
  <reference name="customer_account_dashboard">
69
  <block type="epoqinterface/recommendation_user" name="epoqinterface.recommendation.user" as="info1" template="epoqinterface/recommendation/user.phtml"/>
70
  </reference>
app/design/frontend/default/default/template/epoqinterface/recommendation/cart.phtml CHANGED
@@ -17,43 +17,48 @@
17
  ?>
18
 
19
  <?php if(count($this->getItemCollection()->getItems())): ?>
20
- <div class="collateral-box up-sell">
21
  <div class="head"><h4><?php echo $this->__('epoq: You may also be interested in the following product(s)') ?></h4></div>
22
- <table cellspacing="0" class="generic-product-grid catalog-listing" id="upsell-product-table">
23
- <?php // $this->setColumnCount(4); // uncomment this line if you want to have another number of columns. also can be changed in layout ?>
24
  <?php $this->resetItemsIterator() ?>
25
- <?php for($_i=0;$_i<$this->getRowCount();$_i++): ?>
26
- <tr>
27
- <?php for($_j=0;$_j<$this->getColumnCount();$_j++): ?>
28
- <?php if($_link=$this->getIterableItem()): ?>
29
- <td>
30
- <p class="product-image"><a href="<?php echo $_link->getProductUrl() ?>" class="epoq-recommendation-link"><img src="<?php echo $this->helper('catalog/image')->init($_link, 'small_image')->resize(125) ?>" width="125" height="125" alt="<?php echo $this->htmlEscape($_link->getName()) ?>" /></a></p>
31
- <h5><a href="<?php echo $_link->getProductUrl() ?>" class="epoq-recommendation-link"><?php echo $this->htmlEscape($_link->getName()) ?></a></h5>
32
- <?php echo $this->getPriceHtml($_link, true) ?>
33
- <?php echo $this->getReviewsSummaryHtml($_link) ?>
34
- </td>
35
- <?php else: ?>
36
- <td class="empty-product">&nbsp;</td>
37
- <?php endif; ?>
38
- <?php endfor; ?>
39
- </tr>
 
 
 
 
40
  <?php endfor; ?>
41
- </table>
42
- <script type="text/javascript">decorateTable('upsell-product-table')</script>
 
43
  </div>
44
  <script type="text/javascript">
45
  $$('a.epoq-recommendation-link').each(function(elem, index){
46
- var newParam = 'recommendation_id=<?php echo $this->getSession()->getLastRecommendationId();?>',
47
- params = '?' + newParam;
48
- params = elem.href.replace(new RegExp('[\?&]' + 'recommendation_id' + '[^&]*'), '$1' + newParam);
49
- if (params === elem.href) {
50
- if(elem.href.indexOf('?') == '-1'){
51
- params += '?' + newParam;
52
- }else{
53
- params += '&' + newParam;
 
54
  }
 
55
  }
56
- elem.href = params;
57
  });
58
  </script>
59
  <?php endif ?>
17
  ?>
18
 
19
  <?php if(count($this->getItemCollection()->getItems())): ?>
20
+ <div class="crosssell">
21
  <div class="head"><h4><?php echo $this->__('epoq: You may also be interested in the following product(s)') ?></h4></div>
22
+ <ul id="crosssell-products-list">
 
23
  <?php $this->resetItemsIterator() ?>
24
+ <?php for($_j=0;$_j<$this->getColumnCount();$_j++): ?>
25
+ <?php if($_link=$this->getIterableItem()): ?>
26
+ <li class="item">
27
+ <a class="product-image" href="<?php echo $_link->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_link->getName()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_link, 'thumbnail')->resize(75); ?>" width="75" height="75" alt="<?php echo $this->htmlEscape($_link->getName()) ?>" /></a>
28
+ <div class="product-details">
29
+ <h3 class="product-name"><a href="<?php echo $_link->getProductUrl() ?>"><?php echo $this->htmlEscape($_link->getName()) ?></a></h3>
30
+ <?php echo $this->getPriceHtml($_link, true) ?>
31
+ <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_link) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
32
+ <ul class="add-to-links">
33
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
34
+ <li><a href="<?php echo $this->getAddToWishlistUrl($_link) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
35
+ <?php endif; ?>
36
+ <?php if($_compareUrl=$this->getAddToCompareUrl($_link)): ?>
37
+ <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
38
+ <?php endif; ?>
39
+ </ul>
40
+ </div>
41
+ </li>
42
+ <?php endif; ?>
43
  <?php endfor; ?>
44
+ </ul>
45
+ <script type="text/javascript">decorateList('crosssell-products-list', 'none-recursive')</script>
46
+
47
  </div>
48
  <script type="text/javascript">
49
  $$('a.epoq-recommendation-link').each(function(elem, index){
50
+ var newParam = 'recommendation_id=<?php echo $this->getSession()->getLastRecommendationId();?>';
51
+ if (elem.href.indexOf('recommendation_id') == '-1') {
52
+ params = elem.href.replace(new RegExp('[\?&]' + 'recommendation_id' + '[^&]*'), RegExp.$1 + newParam);
53
+ if (params === elem.href) {
54
+ if(elem.href.indexOf('?') == '-1'){
55
+ params += '?' + newParam;
56
+ }else{
57
+ params += '&' + newParam;
58
+ }
59
  }
60
+ elem.href = params;
61
  }
 
62
  });
63
  </script>
64
  <?php endif ?>
app/design/frontend/default/default/template/epoqinterface/recommendation/user.phtml CHANGED
@@ -44,17 +44,18 @@
44
  </div>
45
  <script type="text/javascript">
46
  $$('a.epoq-recommendation-link').each(function(elem, index){
47
- var newParam = 'recommendation_id=<?php echo $this->getSession()->getLastRecommendationId();?>',
48
- params = '?' + newParam;
49
- params = elem.href.replace(new RegExp('[\?&]' + 'recommendation_id' + '[^&]*'), '$1' + newParam);
50
- if (params === elem.href) {
51
- if(elem.href.indexOf('?') == '-1'){
52
- params += '?' + newParam;
53
- }else{
54
- params += '&' + newParam;
 
55
  }
 
56
  }
57
- elem.href = params;
58
  });
59
  </script>
60
  <?php endif ?>
44
  </div>
45
  <script type="text/javascript">
46
  $$('a.epoq-recommendation-link').each(function(elem, index){
47
+ var newParam = 'recommendation_id=<?php echo $this->getSession()->getLastRecommendationId();?>';
48
+ if (elem.href.indexOf('recommendation_id') == '-1') {
49
+ params = elem.href.replace(new RegExp('[\?&]' + 'recommendation_id' + '[^&]*'), RegExp.$1 + newParam);
50
+ if (params === elem.href) {
51
+ if(elem.href.indexOf('?') == '-1'){
52
+ params += '?' + newParam;
53
+ }else{
54
+ params += '&' + newParam;
55
+ }
56
  }
57
+ elem.href = params;
58
  }
 
59
  });
60
  </script>
61
  <?php endif ?>
js/epoqinterface/epoq_recommendations.js CHANGED
@@ -1,14 +1,14 @@
1
  jQuery.noConflict();
2
 
3
- function addRecommendationsToPage(recommendationPids, recommendationId, data)
4
  {
5
- //customize here => http://www.IHRE_URL.com/shop/get-recommendation-htmlsrc.php?pid=4711&pid=0815&pid=1234 should deliver html code for the recommendation widget
6
- // var recWidgetFromShopURL = "http://localhost:8080/ee-1.11.2.0/epoqinterface/recommendation/list?";
7
- var recWidgetFromShopURL = "http://localhost:8080/magento-1.6.2.0/epoqinterface/recommendation/list?";
8
 
9
  for(var i=0; i < recommendationPids.length; i++){
10
  recWidgetFromShopURL+='pid[]='+recommendationPids[i]+'&';
11
  }
 
 
12
 
13
  //(be careful "same origin policy").
14
  jQuery.ajax({
@@ -16,23 +16,19 @@ function addRecommendationsToPage(recommendationPids, recommendationId, data)
16
  cache: false,
17
  success: function(html){
18
  jQuery("#epoqWidget1").append(html); //alter here for auto tracking clicks on recommendations
19
- /*
20
  jQuery("#epoqWidget1 a").each( function()
21
  {
22
  this.href = this.href + "&eqrecqid=" + recommendationId;
23
- } );
24
- */
25
  },
26
  reccommands: {}
27
  });
28
-
29
  }
30
 
31
  epoq.go({
32
  tenantId: epoq_tenantId,
33
  sessionId: epoq_sessionId,
34
- // rules: "InCategoryFilter;NotInCategoryFilter",
35
- rules: "default;default1",
36
  productId: epoq_productId,
37
  demo: epoq_demoMode,
38
  success: function (data)
@@ -40,27 +36,46 @@ epoq.go({
40
  var recommendations = data['recommendations'];
41
  if(typeof(recommendations['domain']) != "undefined")
42
  {
43
- if(typeof(recommendations['domain'][0]) != "undefined") {
44
- //isagteaser
45
- var recommendationPids = new Array();
46
- for(var i=0; i < recommendations['domain'][0]['items'].item.length; i++){
47
- recommendationPids[i] = recommendations['domain'][0]['items'].item[i]['@id'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
- var recommendationId = recommendations.domain[0].recommendationId['$'];
50
- addRecommendationsToPage(recommendationPids, recommendationId, data);
51
- }
52
 
53
- if(typeof(recommendations['domain'][1]) != "undefined") {
54
- //isagentrypage
55
  var recommendationPids = new Array();
56
- for(var i=0; i < recommendations['domain'][1]['items'].item.length; i++){
57
- recommendationPids[i] = recommendations['domain'][1]['items'].item[i]['@id'];
 
 
58
  }
59
- var recommendationId = recommendations.domain[1].recommendationId['$'];
60
- addRecommendationsToPage(recommendationPids, recommendationId, data);
61
  }
62
 
63
-
64
  }
65
  }
66
  });
1
  jQuery.noConflict();
2
 
3
+ function addRecommendationsToPage(recommendationPids, recommendationId, data, section)
4
  {
5
+ var recWidgetFromShopURL = epoq_baseUrl + "epoqinterface/recommendation/list?";
 
 
6
 
7
  for(var i=0; i < recommendationPids.length; i++){
8
  recWidgetFromShopURL+='pid[]='+recommendationPids[i]+'&';
9
  }
10
+
11
+ recWidgetFromShopURL+='section='+section+'&';
12
 
13
  //(be careful "same origin policy").
14
  jQuery.ajax({
16
  cache: false,
17
  success: function(html){
18
  jQuery("#epoqWidget1").append(html); //alter here for auto tracking clicks on recommendations
 
19
  jQuery("#epoqWidget1 a").each( function()
20
  {
21
  this.href = this.href + "&eqrecqid=" + recommendationId;
22
+ });
 
23
  },
24
  reccommands: {}
25
  });
 
26
  }
27
 
28
  epoq.go({
29
  tenantId: epoq_tenantId,
30
  sessionId: epoq_sessionId,
31
+ rules: epoq_d_rules,
 
32
  productId: epoq_productId,
33
  demo: epoq_demoMode,
34
  success: function (data)
36
  var recommendations = data['recommendations'];
37
  if(typeof(recommendations['domain']) != "undefined")
38
  {
39
+ if( Object.prototype.toString.call(recommendations['domain']) === '[object Array]' ) {
40
+ // two rules set i. e. default;default1
41
+
42
+ if(typeof(recommendations['domain'][0]) != "undefined") {
43
+ //isagteaser
44
+ var recommendationPids = new Array();
45
+ if (typeof(recommendations['domain'][0]['items']) != "undefined") {
46
+ for(var i=0; i < recommendations['domain'][0]['items'].item.length; i++){
47
+ recommendationPids[i] = recommendations['domain'][0]['items'].item[i]['@id'];
48
+ }
49
+ }
50
+ var recommendationId = recommendations.domain[0].recommendationId['$'];
51
+ addRecommendationsToPage(recommendationPids, recommendationId, data, epoq_section);
52
+ }
53
+
54
+ if(typeof(recommendations['domain'][1]) != "undefined") {
55
+ //isagentrypage
56
+ var recommendationPids = new Array();
57
+
58
+ if (typeof(recommendations['domain'][1]['items']) != "undefined") {
59
+ for(var i=0; i < recommendations['domain'][1]['items'].item.length; i++){
60
+ recommendationPids[i] = recommendations['domain'][1]['items'].item[i]['@id'];
61
+ }
62
+ }
63
+ var recommendationId = recommendations.domain[1].recommendationId['$'];
64
+ addRecommendationsToPage(recommendationPids, recommendationId, data, epoq_section);
65
  }
 
 
 
66
 
67
+ } else {
68
+ // one rule set i. e. default
69
  var recommendationPids = new Array();
70
+ if (typeof(recommendations['domain']['items']) != "undefined") {
71
+ for(var i=0; i < recommendations['domain']['items'].item.length; i++){
72
+ recommendationPids[i] = recommendations['domain']['items'].item[i]['@id'];
73
+ }
74
  }
75
+ var recommendationId = recommendations.domain.recommendationId['$'];
76
+ addRecommendationsToPage(recommendationPids, recommendationId, data, epoq_section);
77
  }
78
 
 
79
  }
80
  }
81
  });
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>epoqRS</name>
4
- <version>1.2.2</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
@@ -13,15 +13,11 @@ The quick and easy integration of epoq RS makes your Magento sell more within a
13
  &#xD;
14
  Try epoq Recommendation Service - free and without obligation in our 30-day trial version.</description>
15
  <notes>- Minor Bugfixes&#xD;
16
- - Ajax support&#xD;
17
- - Cookies&#xD;
18
- - Transmission of SKU / ProduktId&#xD;
19
- - Newsletter Template&#xD;
20
  </notes>
21
  <authors><author><name>FlagbitFlagbit GmbH Co. KG</name><user>flagbit</user><email>magento@flagbit.de</email></author></authors>
22
- <date>2012-07-23</date>
23
- <time>13:43:26</time>
24
- <contents><target name="magecommunity"><dir name="Flagbit"><dir name="EpoqInterface"><dir name="Block"><file name="Abstract.php" hash="17e13dfe4a8dfd2bd78ed76d5b5a41b4"/><dir name="Export"><file name="Productlist.php" hash="ea9ff392847cbaf7ed5f17e97d2af398"/></dir><file name="Head.php" hash="a898e39f4f86c0fcb8555c8d37e7ea2f"/><dir name="Recommendation"><file name="Abstract.php" hash="9e89b41685a41515ffd347fd58af0807"/><file name="Ajaxproduct.php" hash="558658147d6227436ff64996798e1fca"/><file name="Cart.php" hash="7b437a86fbbccda2276aa4601bddfff7"/><file name="Product.php" hash="6da47eae68476a5b29c7fc6efb3d17f8"/><file name="User.php" hash="ae2dc9c26c73ab7a1850e0eaf21fa755"/></dir><dir name="Result"><file name="List.php" hash="247ba01688e5d9f89cf21fd0d73faf1f"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Version.php" hash="71e3964c13333a57929221aa8e2edf07"/></dir></dir></dir></dir><dir name="Track"><file name="Cart.php" hash="c7b3b8749e7838759a8858f6ae4910f8"/><file name="Order.php" hash="5280a5644c6fb62493d6853dafb887e5"/><file name="Product.php" hash="8bdef16f8d9741328cbf841401069a6c"/></dir></dir><dir name="Helper"><file name="Data.php" hash="5dc4a2feab4aa81f40efda3313daf7de"/><file name="Debug.php" hash="7ab1e3121471d87ee59f02d129f308be"/></dir><dir name="Model"><file name="Abstract.php" hash="68922066f28d44cf99a60ce164ed46d2"/><dir name="Container"><file name="Product.php" hash="bb25e96a4159584c9701854d51962e52"/><file name="TrackProduct.php" hash="f95bbb60d7344859f71bd13b22d587c7"/></dir><dir name="Customer"><file name="Profiles.php" hash="fbedb6a3259a29db05b2c8783d02957b"/></dir><file name="Observer.php" hash="fa554bcc512f2c7d3b383b16ce41ebee"/><file name="Order.php" hash="ea86b408bd6a809ccd6f2b0f85b3f4d0"/><dir name="Recommendation"><file name="Abstract.php" hash="7d296a3f20dcf9c1e22338aa5a6cc01b"/><file name="Cart.php" hash="09d517aaef0bb286fb391f30d5fd0515"/><file name="Product.php" hash="a86b84718495e92ffe0eb470c21f3d01"/><file name="User.php" hash="549e3ba3efe4035c47a7a6c8b13eb39f"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><dir name="Product"><file name="Collection.php" hash="21e261decb48d356d051e92d9e2c9649"/></dir></dir></dir></dir><file name="Session.php" hash="413f7d31ad2d5878f20a7db7adf5d207"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Attemps.php" hash="c01ebd5c76fd4d51305ed7111326d57d"/><file name="Identifier.php" hash="9e56f688a92a5691a5934e47f42144b6"/><file name="Idletime.php" hash="957ec9d0c4af2d52add60a9765c4e573"/><file name="Timeout.php" hash="95c38625ad50dc44ba2b2d371de1db65"/></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="6ea3c2de180540e082f0598133355e69"/><file name="RecommendationController.php" hash="ccf91e227c725fae068383a58bf7a471"/></dir><dir name="documentation"><file name="epoqRS_Magento Installation Guide 1.2.0.pdf" hash="fdfb9ea23c998e1ff0e749854c962090"/></dir><dir name="etc"><file name="cache.xml" hash="7ed329563d8914670ae1ddeb399de34d"/><file name="config.xml" hash="6d746ed673cfa44cfb26a0810385df35"/><file name="system.xml" hash="58e3970181649fae2039e444319c6e60"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Flagbit_EpoqInterface.xml" hash="8ada99bfdbcc7727ad36339bc11da6ec"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Flagbit_EpoqInterface.csv" hash="222d5eaedfde0639dd26f91c52dc395e"/></dir></target><target name="mageweb"><dir name="js"><dir name="epoqinterface"><file name="epoq_recommendations.js" hash="b7a0cd229fba65f358889a071ec57623"/><file name="jQuery_init.js" hash="3179f2255b046d5f2e9a71e365287bef"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="epoqinterface.xml" hash="05938a86a2901d5214494c48fb2294c2"/></dir><dir name="template"><dir name="epoqinterface"><dir name="recommendation"><file name="cart.phtml" hash="d508fe280f9ef8428fb2aa99a1b47baf"/><file name="list.phtml" hash="c6c9c45f81993542dd182abea8c88f43"/><file name="mailproduct.phtml" hash="a81b28b9bee47f9e63a58ef87b7bb898"/><file name="product.phtml" hash="a558cf1a1dec1de784e7f05405dd83be"/><file name="user.phtml" hash="a3e884ce1f8ca6ab5ed4383e43b044d8"/></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="epoqinterface.xml" hash="3505b6440076055ecdef51acaf0c0987"/></dir><dir name="template"><dir name="epoqinterface"><dir name="recommendation"><file name="cart.phtml" hash="d508fe280f9ef8428fb2aa99a1b47baf"/><file name="list.phtml" hash="92158be9c3dddca88cbd202aab666d39"/><file name="product.phtml" hash="a558cf1a1dec1de784e7f05405dd83be"/><file name="user.phtml" hash="a3e884ce1f8ca6ab5ed4383e43b044d8"/></dir></dir></dir></dir></dir></dir></target></contents>
25
  <compatible/>
26
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
27
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>epoqRS</name>
4
+ <version>1.2.4</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
13
  &#xD;
14
  Try epoq Recommendation Service - free and without obligation in our 30-day trial version.</description>
15
  <notes>- Minor Bugfixes&#xD;
 
 
 
 
16
  </notes>
17
  <authors><author><name>FlagbitFlagbit GmbH Co. KG</name><user>flagbit</user><email>magento@flagbit.de</email></author></authors>
18
+ <date>2012-08-29</date>
19
+ <time>15:13:54</time>
20
+ <contents><target name="magecommunity"><dir name="Flagbit"><dir name="EpoqInterface"><dir name="Block"><file name="Abstract.php" hash="8d96815ddd6899c68bb127d1314276c5"/><dir name="Export"><file name="Productlist.php" hash="1b5b36a34603753a4ff5c17a4d8acf55"/></dir><file name="Head.php" hash="a898e39f4f86c0fcb8555c8d37e7ea2f"/><dir name="Recommendation"><file name="Abstract.php" hash="4188c7d0b6b8e2148c576933f631aed3"/><file name="Ajaxproduct.php" hash="558658147d6227436ff64996798e1fca"/><file name="Cart.php" hash="4bbe3e8abedbf4313db25b941b4f3e51"/><file name="Product.php" hash="94752b4f0837337862bb7d5ad692f21c"/><file name="User.php" hash="27d90f93b2a157bbb999a38136234407"/></dir><dir name="Result"><file name="List.php" hash="247ba01688e5d9f89cf21fd0d73faf1f"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Version.php" hash="71e3964c13333a57929221aa8e2edf07"/></dir></dir></dir></dir><dir name="Track"><file name="Cart.php" hash="401061ad5b1d3bf279019c0803497178"/><file name="Order.php" hash="5280a5644c6fb62493d6853dafb887e5"/><file name="Product.php" hash="55d1c37666dee51273b590f749142a58"/><file name="User.php" hash="4f13de8744f15cbb2567b1ec0d1564e8"/></dir></dir><dir name="Helper"><file name="Data.php" hash="5dc4a2feab4aa81f40efda3313daf7de"/><file name="Debug.php" hash="7ab1e3121471d87ee59f02d129f308be"/></dir><dir name="Model"><file name="Abstract.php" hash="6d369b3b01ccaa3c796c37484e95a85f"/><dir name="Container"><file name="Product.php" hash="bb25e96a4159584c9701854d51962e52"/><file name="TrackProduct.php" hash="f95bbb60d7344859f71bd13b22d587c7"/></dir><dir name="Customer"><file name="Profiles.php" hash="fbedb6a3259a29db05b2c8783d02957b"/></dir><file name="Observer.php" hash="fa554bcc512f2c7d3b383b16ce41ebee"/><file name="Order.php" hash="ea86b408bd6a809ccd6f2b0f85b3f4d0"/><dir name="Recommendation"><file name="Abstract.php" hash="614242e6b9fd096f0be3f56203a577fc"/><file name="Cart.php" hash="09d517aaef0bb286fb391f30d5fd0515"/><file name="Product.php" hash="a86b84718495e92ffe0eb470c21f3d01"/><file name="User.php" hash="549e3ba3efe4035c47a7a6c8b13eb39f"/></dir><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><dir name="Product"><file name="Collection.php" hash="f9dfe605ee9a6fa22698a71af9697ad7"/></dir></dir></dir></dir><file name="Session.php" hash="413f7d31ad2d5878f20a7db7adf5d207"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Attemps.php" hash="c01ebd5c76fd4d51305ed7111326d57d"/><file name="Identifier.php" hash="9e56f688a92a5691a5934e47f42144b6"/><file name="Idletime.php" hash="957ec9d0c4af2d52add60a9765c4e573"/><file name="Timeout.php" hash="95c38625ad50dc44ba2b2d371de1db65"/></dir></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="6ea3c2de180540e082f0598133355e69"/><file name="RecommendationController.php" hash="004b36c79f662928170177b14985ec2a"/></dir><dir name="documentation"><file name="epoqRS_Magento Installation Guide 1.2.4.pdf" hash="364abe5d2e44ce8aa31d08384dc54e1a"/></dir><dir name="etc"><file name="cache.xml" hash="7ed329563d8914670ae1ddeb399de34d"/><file name="config.xml" hash="9f1312892b8c0ff20840e6f08cb6968b"/><file name="system.xml" hash="a5d70a49602cd9d14f542d515cde30bb"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Flagbit_EpoqInterface.xml" hash="8ada99bfdbcc7727ad36339bc11da6ec"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Flagbit_EpoqInterface.csv" hash="222d5eaedfde0639dd26f91c52dc395e"/></dir></target><target name="mageweb"><dir name="js"><dir name="epoqinterface"><file name="epoq_recommendations.js" hash="9797defb9c645a8d4d809c226f29fe26"/><file name="jQuery_init.js" hash="3179f2255b046d5f2e9a71e365287bef"/></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="epoqinterface.xml" hash="c9c440dc73ef060c0e4f56cf24c440d4"/></dir><dir name="template"><dir name="epoqinterface"><dir name="recommendation"><file name="cart.phtml" hash="91fe1e5178fd79249dade5391952f9fa"/><file name="list.phtml" hash="c6c9c45f81993542dd182abea8c88f43"/><file name="mailproduct.phtml" hash="a81b28b9bee47f9e63a58ef87b7bb898"/><file name="product.phtml" hash="a558cf1a1dec1de784e7f05405dd83be"/><file name="user.phtml" hash="a3e884ce1f8ca6ab5ed4383e43b044d8"/></dir></dir></dir></dir></dir><dir name="default"><dir name="default"><dir name="layout"><file name="epoqinterface.xml" hash="3adf6175b89f0f2f4e9b2a611b296788"/></dir><dir name="template"><dir name="epoqinterface"><dir name="recommendation"><file name="cart.phtml" hash="71bd2c1724743d995d31df4b96a24e87"/><file name="list.phtml" hash="92158be9c3dddca88cbd202aab666d39"/><file name="product.phtml" hash="a558cf1a1dec1de784e7f05405dd83be"/><file name="user.phtml" hash="90043a07221d19dcb079b86615eafa3b"/></dir></dir></dir></dir></dir></dir></target></contents>
21
  <compatible/>
22
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
23
  </package>