Expertrec_Recommendation - Version 1.0.12

Version Notes

Expertrec Recommendation plugin for magento sites.

Download this release

Release Info

Developer melchi
Extension Expertrec_Recommendation
Version 1.0.12
Comparing to
See all releases


Code changes from version 1.1.5 to 1.0.12

Files changed (23) hide show
  1. app/code/community/Expertrec/Recommendation/Block/Api.php +11 -1
  2. app/code/community/Expertrec/Recommendation/Block/Product/List/Toolbar.php +0 -46
  3. app/code/community/Expertrec/Recommendation/Helper/Autocompletehelper.php +128 -0
  4. app/code/community/Expertrec/Recommendation/Helper/Data.php +16 -14
  5. app/code/community/Expertrec/Recommendation/Helper/Search/Layout.php +447 -8
  6. app/code/community/Expertrec/Recommendation/Helper/Searchhelper.php +0 -224
  7. app/code/community/Expertrec/Recommendation/Model/Catalogsearch/Layer.php +0 -115
  8. app/code/community/Expertrec/Recommendation/Model/Observer.php +48 -3
  9. app/code/community/Expertrec/Recommendation/Model/Resource/Mysql4/Setup.php +6 -0
  10. app/code/community/Expertrec/Recommendation/Model/Validate.php +8 -1
  11. app/code/community/Expertrec/Recommendation/controllers/ApiController.php +646 -1
  12. app/code/community/Expertrec/Recommendation/controllers/CatalogSearch/ResultController.php +10 -1
  13. app/code/community/Expertrec/Recommendation/etc/config.xml +18 -15
  14. app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-install-1.0.0.php +0 -21
  15. app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-install-1.0.12.php +69 -0
  16. app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-upgrade-1.0.11-1.0.12.php +68 -0
  17. app/design/frontend/base/default/layout/expertrec/recommendation.xml +33 -4
  18. app/design/frontend/base/default/template/expertrec/feed/info.phtml +95 -29
  19. app/design/frontend/base/default/template/expertrec/recommendation/tracker.phtml +1 -11
  20. app/design/frontend/base/default/template/expertrec/search/custom.phtml +2 -0
  21. app/design/frontend/base/default/template/expertrec/search/list.phtml +23 -0
  22. app/design/frontend/base/default/template/expertrec/search/view.phtml +16 -0
  23. package.xml +4 -4
app/code/community/Expertrec/Recommendation/Block/Api.php CHANGED
@@ -4,6 +4,7 @@ class Expertrec_Recommendation_Block_Api extends Mage_Core_Block_Template{
4
 
5
  const CONFIG_HEADERS = 'expertrec/general/headers';
6
  const CONFIG_FILTERS = 'expertrec/general/filters';
 
7
  const SEARCH_LIST_ENABLE = 'search/enable';
8
  const SEARCH_LIST_API = 'search/api';
9
  const SEARCH_FACET_LIST = 'search/facets_list';
@@ -41,6 +42,14 @@ class Expertrec_Recommendation_Block_Api extends Mage_Core_Block_Template{
41
  return $baseUrl;
42
  }
43
 
 
 
 
 
 
 
 
 
44
  //Fetching secret passed in url request parameters
45
  public function getSecret()
46
  {
@@ -73,7 +82,8 @@ class Expertrec_Recommendation_Block_Api extends Mage_Core_Block_Template{
73
  //Fetching image width and height
74
  public function getImageParams()
75
  {
76
- $imageParamsArray = array();
 
77
  $imageWidth = Mage::getStoreConfig(self::IMAGE_WIDTH);
78
  $imageHeight = Mage::getStoreConfig(self::IMAGE_HEIGHT);
79
  $thumbWidth = Mage::getStoreConfig(self::THUMBNAIL_WIDTH);
4
 
5
  const CONFIG_HEADERS = 'expertrec/general/headers';
6
  const CONFIG_FILTERS = 'expertrec/general/filters';
7
+ const MERCHANT_ID = 'expertrec/general/mid';
8
  const SEARCH_LIST_ENABLE = 'search/enable';
9
  const SEARCH_LIST_API = 'search/api';
10
  const SEARCH_FACET_LIST = 'search/facets_list';
42
  return $baseUrl;
43
  }
44
 
45
+ //Fetching merchant ID
46
+ public function getMerchantID()
47
+ {
48
+ $mid = "";
49
+ $mid=Mage::getStoreConfig(self::MERCHANT_ID);
50
+ return $mid;
51
+ }
52
+
53
  //Fetching secret passed in url request parameters
54
  public function getSecret()
55
  {
82
  //Fetching image width and height
83
  public function getImageParams()
84
  {
85
+ $keys = array('imgwidth', 'imgheight','thumbwidth', 'thumbwidth');
86
+ $imageParamsArray = array_fill_keys($keys, "");
87
  $imageWidth = Mage::getStoreConfig(self::IMAGE_WIDTH);
88
  $imageHeight = Mage::getStoreConfig(self::IMAGE_HEIGHT);
89
  $thumbWidth = Mage::getStoreConfig(self::THUMBNAIL_WIDTH);
app/code/community/Expertrec/Recommendation/Block/Product/List/Toolbar.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
-
3
- class Expertrec_Recommendation_Block_Product_List_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar {
4
-
5
- /**
6
- * Set collection to pager, overriding this function
7
- *To ignore relevance
8
- *
9
- * @param Varien_Data_Collection $collection
10
- * @return Mage_Catalog_Block_Product_List_Toolbar
11
- */
12
- public function setCollection($collection)
13
- {
14
- $searchEnable = Mage::helper('expertrec_recommendation/searchhelper')->getSearchEnable();
15
- $pageIdentifier = Mage::app()->getFrontController()->getAction()->getFullActionName();
16
- $isSearchPage = $pageIdentifier === 'catalogsearch_result_index' ||
17
- $pageIdentifier === 'expertrec_result_index';
18
-
19
- //Don't use the toolbar when it is not the search page or when the search is not enabled
20
- if(!$isSearchPage || !(isset($searchEnable) && $searchEnable == "true"))
21
- {
22
- Mage::getSingleton('expertrec_recommendation/log')->log(" Default Toolbar call made ");
23
- return parent::setCollection($collection);
24
- }
25
-
26
- $this->_collection = $collection;
27
- $this->_collection->setCurPage($this->getCurrentPage());
28
-
29
- // we need to set pagination only if passed value integer and more that 0
30
- $limit = (int)$this->getLimit();
31
- if ($limit) {
32
- $this->_collection->setPageSize($limit);
33
- }
34
- if ($this->getCurrentOrder() != "relevance") {
35
-
36
- Mage::getSingleton('expertrec_recommendation/log')->log(" I have received order from Magento ".print_r($this->getCurrentOrder(),1),null);
37
- $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
38
-
39
- }
40
-
41
- return $this;
42
- }
43
-
44
- }
45
-
46
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Expertrec/Recommendation/Helper/Autocompletehelper.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Expertrec_Recommendation_Helper_Autocompletehelper extends Mage_Core_Helper_Abstract{
4
+
5
+ const SEARCH_LIST_API = 'search/api';
6
+ const SEARCH_FACET_LIST = 'search/facets_list';
7
+ const SEARCH_ITEMS_PER_PAGE = 'search/items_per_page';
8
+
9
+ protected $_facetList = array();
10
+ protected $_itemsPerPage = 20;
11
+
12
+ protected function getFormatUrl($url){
13
+ $splitedUrl = explode("?", $url);
14
+ $newUrl = preg_replace('/\/ajax/',"",$splitedUrl[0]);
15
+ if(count($splitedUrl) == 2){
16
+ $newUrl .= '?'.$splitedUrl[1];
17
+ }
18
+ return $newUrl;
19
+ }
20
+
21
+ protected function getSearchApi($confArray){
22
+ $searchApi = "";
23
+ try{
24
+ $itemsPerPage = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_ITEMS_PER_PAGE);
25
+ $storeSearchApi = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_LIST_API);
26
+ }catch(Exception $e){
27
+ Mage::getSingleton('expertrec_recommendation/log')->log('Autocompletehelper::getting searchApi exception: '.$e->getMessage());
28
+ }
29
+ if(!empty($itemsPerPage)){
30
+ $this->_itemsPerPage = $itemsPerPage;
31
+ }
32
+
33
+ if(!empty($storeSearchApi)){
34
+ $searchApi = $storeSearchApi;
35
+ $previous = $confArray["curPage"]-1;
36
+ $searchApi .= "?q=".urlencode($confArray["query"])."&page=".$previous."&size=".$this->_itemsPerPage;
37
+ $searchApi .= "&fq=order:".urlencode($confArray["order"]);
38
+ if(isset($confArray['filters'])){
39
+ $filters = $confArray['filters'];
40
+ foreach ($filters as $fkey => $fvalue) {
41
+ $searchApi .= "&fq=".$fkey.":".urlencode($fvalue);
42
+ }
43
+ }
44
+ }
45
+
46
+ return $searchApi;
47
+ }
48
+
49
+ public function getItemsPerPage(){
50
+ return (int)$this->_itemsPerPage;
51
+ }
52
+
53
+ public function prepareLayer($requestParams){
54
+ $confArray = array();
55
+ $filters = array();
56
+ $resultData = array();
57
+ try{
58
+ $confArray["url"] = $this->getFormatUrl(Mage::helper('core/url')->getCurrentUrl());
59
+ $confArray["query"] = htmlentities($requestParams['q'], ENT_QUOTES);
60
+
61
+ $confArray["curPage"] = isset($requestParams['p']) ? (int)$requestParams['p'] : 1;
62
+
63
+ $mode = isset($requestParams['mode']) ? $requestParams['mode'] : 'grid';
64
+ $confArray["mode"] = $mode == 'list' ? $mode : 'grid';
65
+ $confArray["order"] = isset($requestParams["order"]) ? $requestParams["order"] : 'relevance';
66
+
67
+ try{
68
+ $facetList = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_FACET_LIST);
69
+ $this->_facetList = !empty($facetList) ? explode(",", $facetList) : $this->_facetList;
70
+ }catch(Exception $ex){
71
+ Mage::getSingleton('expertrec_recommendation/log')->log('Autocompletehelper::getting facetlist from db exception: '.$ex->getMessage());
72
+ }
73
+
74
+ if(count($this->_facetList) > 0){
75
+ foreach($this->_facetList as $facet){
76
+ $filter = isset($requestParams[$facet]) ? $requestParams[$facet] : '';
77
+ if(!empty($filter)){
78
+ $filters[$facet] = str_replace(" ","+",$filter);
79
+ }
80
+ }
81
+ $confArray['filters'] = $filters;
82
+ }
83
+
84
+ //setup search url
85
+ $searchApi = $this->getSearchApi($confArray);
86
+ //Mage::getSingleton('expertrec_recommendation/log')->log('search url: '.$searchApi);
87
+
88
+ if(!empty($searchApi)){
89
+
90
+ //sending request
91
+ $resp = Mage::helper('expertrec_recommendation')->sendCurl($searchApi);
92
+ $response_json = json_decode($resp,true);
93
+
94
+ if(isset($response_json["res"]) && isset($response_json["res"]["count"])){
95
+ $confArray["count"] = (int)$response_json["res"]["count"];
96
+ }
97
+
98
+ //Initiate search layout
99
+ $layoutHelper = Mage::helper('expertrec_recommendation/search_layout')->init($confArray);
100
+
101
+ $searchListData = $response_json["results"];
102
+ $searchListHtml = $layoutHelper->prepareLayout($searchListData);
103
+
104
+ if(isset($confArray['filters'])){
105
+ $facetData = $response_json["facets"];
106
+ $facetNavHtml = $layoutHelper->prepareFilterLayout($facetData);
107
+ }else{
108
+ $facetNavHtml = '';
109
+ }
110
+
111
+ $resultData["listHtml"] = $searchListHtml;
112
+ $resultData["facetHtml"] = $facetNavHtml;
113
+
114
+
115
+ }
116
+
117
+ }catch (Exception $e) {
118
+ Mage::getSingleton('expertrec_recommendation/log')->log('Autocompletehelper::prepareLayer exception: '.$e->getMessage());
119
+ $resultData["listHtml"] = '<div style="color:red;><span style="font-weight:bold;">Error: </span>Oops. Something went wrong. Please try again later.</div>';
120
+ $resultData["facetHtml"] = '';
121
+ }
122
+
123
+ return $resultData;
124
+ }
125
+
126
+ }
127
+
128
+ ?>
app/code/community/Expertrec/Recommendation/Helper/Data.php CHANGED
@@ -196,6 +196,22 @@ class Expertrec_Recommendation_Helper_Data extends Mage_Core_Helper_Abstract {
196
  }
197
  return '';
198
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
 
200
  public function pushFeed($filepath){
201
  try{
@@ -235,20 +251,6 @@ class Expertrec_Recommendation_Helper_Data extends Mage_Core_Helper_Abstract {
235
  return true;
236
  }
237
 
238
- /*
239
- Fetching number of products per store, per website
240
- */
241
- public function getProductCount($wid,$sid)
242
- {
243
- $productcount = 0;
244
-
245
- $collection = Mage::getResourceModel('catalog/product_collection');
246
- $collection->addStoreFilter($sid);
247
- $collection->addWebsiteFilter($wid);
248
- // Retrieve product count in collection
249
- $productcount = $collection->getSize();
250
 
251
- return $productcount;
252
- }
253
  }
254
  ?>
196
  }
197
  return '';
198
  }
199
+
200
+ /*
201
+ Fetching number of products per store, per website
202
+ */
203
+ public function getProductCount($wid,$sid)
204
+ {
205
+ $productcount = 0;
206
+
207
+ $collection = Mage::getResourceModel('catalog/product_collection');
208
+ $collection->addStoreFilter($sid);
209
+ $collection->addWebsiteFilter($wid);
210
+ // Retrieve product count in collection
211
+ $productcount = $collection->getSize();
212
+
213
+ return $productcount;
214
+ }
215
 
216
  public function pushFeed($filepath){
217
  try{
251
  return true;
252
  }
253
 
 
 
 
 
 
 
 
 
 
 
 
 
254
 
 
 
255
  }
256
  ?>
app/code/community/Expertrec/Recommendation/Helper/Search/Layout.php CHANGED
@@ -4,10 +4,16 @@ class Expertrec_Recommendation_Helper_Search_Layout extends Mage_Core_Helper_Abs
4
 
5
  const SEARCH_SINGLE_SELECT_FILTERS = 'search/single_select_filters';
6
  const SEARCH_IS_AJAX = 'search/is_ajax';
7
-
 
 
 
 
 
8
  protected $_isAjax = false;
9
  protected $_confArray;
10
-
 
11
  protected $_singleSelectFilters = array();
12
 
13
  public function init($confArray){
@@ -15,11 +21,17 @@ class Expertrec_Recommendation_Helper_Search_Layout extends Mage_Core_Helper_Abs
15
  try{
16
  $singleFilters = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_SINGLE_SELECT_FILTERS);
17
  $isAjax = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_IS_AJAX);
18
-
 
 
19
 
20
  $this->_singleSelectFilters = isset($singleFilters) ? explode(',', $singleFilters) : $this->_singleSelectFilters;
21
  $this->_isAjax = isset($isAjax) && $isAjax == 'true' ? true : false;
22
-
 
 
 
 
23
  }catch (Exception $e) {
24
  Mage::getSingleton('expertrec_recommendation/log')->log('Search Layout Helper::init exception: '.$e->getMessage());
25
  }
@@ -36,7 +48,268 @@ class Expertrec_Recommendation_Helper_Search_Layout extends Mage_Core_Helper_Abs
36
  return $finalUrl;
37
  }
38
 
39
- /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  * @param string facet-header
41
  * @param string facet-label
42
  * @return string url
@@ -56,8 +329,30 @@ class Expertrec_Recommendation_Helper_Search_Layout extends Mage_Core_Helper_Abs
56
  }else{
57
  $url .= "&".str_replace(" ","_",$fhead).'='.$label;
58
  }
59
- return rtrim($url,'&');
60
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  /*
63
  * @param filterkey string
@@ -69,7 +364,151 @@ class Expertrec_Recommendation_Helper_Search_Layout extends Mage_Core_Helper_Abs
69
  $linkUrl = $baseUrl.'&'.str_replace(' ', '_', $fKey)."=".implode('%2C', $flist);
70
  return $linkUrl;
71
  }
72
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  }
74
 
75
  ?>
4
 
5
  const SEARCH_SINGLE_SELECT_FILTERS = 'search/single_select_filters';
6
  const SEARCH_IS_AJAX = 'search/is_ajax';
7
+ const SEARCH_DISPLAY_PAGES = 'search/display_pages';
8
+ const SEARCH_FETCH_PRICE = 'search/fetch_price';
9
+ const SEARCH_CONVERT_PRICE = 'search/convert_price';
10
+
11
+ protected $_itemsPerPage;
12
+ protected $_displayPages = 5;
13
  protected $_isAjax = false;
14
  protected $_confArray;
15
+ protected $_fetchPrice = false;
16
+ protected $_convertPrice = false;
17
  protected $_singleSelectFilters = array();
18
 
19
  public function init($confArray){
21
  try{
22
  $singleFilters = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_SINGLE_SELECT_FILTERS);
23
  $isAjax = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_IS_AJAX);
24
+ $displayPages = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_DISPLAY_PAGES);
25
+ $fetchPrice = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_FETCH_PRICE);
26
+ $convertPrice = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_CONVERT_PRICE);
27
 
28
  $this->_singleSelectFilters = isset($singleFilters) ? explode(',', $singleFilters) : $this->_singleSelectFilters;
29
  $this->_isAjax = isset($isAjax) && $isAjax == 'true' ? true : false;
30
+ $this->_fetchPrice = isset($fetchPrice) && $fetchPrice == 'true' ? true : false;
31
+ $this->_convertPrice = isset($convertPrice) && $convertPrice == 'true' ? true : false;
32
+ $this->_displayPages = !empty($displayPages) ? (int)$displayPages : $this->_displayPages;
33
+
34
+ $this->_itemsPerPage = Mage::helper('expertrec_recommendation/autocompletehelper')->getItemsPerPage();
35
  }catch (Exception $e) {
36
  Mage::getSingleton('expertrec_recommendation/log')->log('Search Layout Helper::init exception: '.$e->getMessage());
37
  }
48
  return $finalUrl;
49
  }
50
 
51
+ protected function getToolbarDiv(){
52
+
53
+ $result = '<div class="toolbar"><div class="sorter">';
54
+ $result .= '<p class="view-mode"><label>'.$this->__('View as').'</label>';
55
+
56
+ if($this->_confArray["mode"] == 'grid'){
57
+ $result .= '<strong title="Grid" class="grid">Grid</strong><a href="'.$this->removeRequestParam("mode").'&mode=list" title="List" class="list">List</a>';
58
+ }else{
59
+ $result .= '<a href= "'.$this->removeRequestParam("mode").'&mode=grid" title="Grid" class="grid">Grid</a><strong title="List" class="list">List</strong>';
60
+ }
61
+
62
+ $result .= '</p>';
63
+ $result .= '<div class="sort-by"><label>'.$this->__('Sort By').'</label>';
64
+ $result .= '<select onchange="setLocation(this.value)" title="'.$this->__('Sort By').'">';
65
+
66
+ //sort by
67
+ $orderArray = array("relevance"=>"Relevance", 'popularity'=>"Popularity", "price+asc"=>"Price - Low to High", "price+desc"=>"Price - High to Low");
68
+ foreach ($orderArray as $oKey => $oValue) {
69
+ if(urlencode($this->_confArray["order"]) == $oKey){
70
+ $result .= '<option value="'.$this->removeRequestParam("order").'&order='.$oKey.'" selected="selected">'.$this->__($oValue).'</option>';
71
+ }else{
72
+ $result .= '<option value="'.$this->removeRequestParam("order").'&order='.$oKey.'">'.$this->__($oValue).' </option>';
73
+ }
74
+ }
75
+
76
+ $result .= '</select>';
77
+ $result .= '</div></div>';//close sorter
78
+
79
+ $result .= '<div class="pager">';
80
+ $result .= '<div class="count-container">';
81
+
82
+ $totalNum = $this->_confArray["count"];
83
+ $totalPage = ceil($totalNum/$this->_itemsPerPage);
84
+ $previous = $this->_confArray["curPage"]-1;
85
+ $firstNum = $previous * $this->_itemsPerPage + 1;
86
+ $lastNum = min(($this->_confArray["curPage"] * $this->_itemsPerPage),$totalNum);
87
+
88
+ if($totalPage > 1){
89
+ $result .= '<p class="amount amount--has-pages">';
90
+ $result .= $this->__('Showing %s - %s of %s', $firstNum, $lastNum, $totalNum);
91
+ }else{
92
+ $result .= '<p class="amount amount--no-pages">';
93
+ $result .= '<strong>'.$this->__('Showing %s Item(s)', $totalNum) .'</strong>';
94
+ }
95
+ $result .= '</p>';
96
+ $result .= '</div>';//close count-container
97
+
98
+ $result .= '<div class="pages"><strong>Page:</strong>';
99
+ $result .= '<ol>';
100
+
101
+ //pager
102
+ if($previous >= 1){
103
+ $result .= '<li><a class="previous i-previous" href="'.$this->removeRequestParam("p").'&p='.(string)$previous.'" title="Previous">Prev</a></li>';
104
+ }
105
+
106
+ $pages = Mage::helper('expertrec_recommendation')
107
+ ->getPages($this->_confArray["curPage"],$totalNum,$this->_displayPages,$this->_itemsPerPage);
108
+ if(count($pages) > 1){
109
+ foreach ($pages as $page){
110
+ if($page == $this->_confArray["curPage"]){
111
+ $result .= '<li class="current">'.(string)($this->_confArray["curPage"]).'</li>';
112
+ }else{
113
+ $result .= '<li><a href="'.$this->removeRequestParam("p").'&p='.(string)$page.'">'.(string)$page.'</a></li>';
114
+ }
115
+ }
116
+ }
117
+
118
+ $next = $this->_confArray["curPage"]+1;
119
+ if($next <= $totalPage){
120
+ $result .= '<li><a class="next i-next" href="'.$this->removeRequestParam("p").'&p='.(string)$next.'" title="Next">Next</a></li>';
121
+ }
122
+
123
+ $result .= '</ol>';
124
+ $result .= '</div>';//close pages
125
+ $result .= '</div>';//close pager
126
+ $result .= '</div>';//close toolbar
127
+
128
+ return $result;
129
+ }
130
+
131
+ protected function getGridProductsDiv($data){
132
+ $confArray = $this->_confArray;
133
+
134
+ $result = '<ul class="products-grid products-grid--max-3-col">';
135
+
136
+ foreach ($data as $item) {
137
+ if(!isset($item["entity_id"]) && !isset($item["title"]) && !isset($item["url"]) && !isset($item["image_url"])){
138
+ continue;
139
+ }
140
+ $msrp = "";
141
+ $price = "";
142
+ $compareUrl = Mage::helper('expertrec_recommendation')->getProductCompareUrl($item['entity_id']);
143
+ $wishlistUrl = Mage::helper('expertrec_recommendation')->getWishlistUrl($item['entity_id']);
144
+ $cartUrl = Mage::helper('expertrec_recommendation')->getAddToCartUrl($item['entity_id']);
145
+
146
+ if(!empty($item["msrp"]) && $item["msrp"] != "None" && $item["msrp"] != "0"){
147
+ $msrp =$item['msrp'];
148
+ }
149
+ if(!empty($item["price"]) && $item["price"] != "None" && $item["price"] != "0"){
150
+ $price = $item['price'];
151
+ }
152
+
153
+ if($this->_convertPrice){
154
+ $price = Mage::helper('expertrec_recommendation')->getFormatCurrency($price,$item['entity_id'],$this->_fetchPrice);
155
+ $msrp = Mage::helper('expertrec_recommendation')->getFormatCurrency($msrp,$item['entity_id'],$this->_fetchPrice);
156
+ }else{
157
+ $price = Mage::helper('expertrec_recommendation')->getFormatPrice($price);
158
+ $msrp = Mage::helper('expertrec_recommendation')->getFormatPrice($msrp);
159
+ }
160
+
161
+ $result .= '<li class="item last">';
162
+ $result .= '<a href="'.$item["url"].'" title="'.$item['title'].'" class="product-image">';
163
+ $result .= '<img id="product-collection-image-'.$item['entity_id'].'" src="'.$item['image_url'].'" alt="'.$item['title'].'">';
164
+ $result .= '</a>';
165
+ $result .= '<div class="product-info" style="padding-bottom: 75px; min-height: 133px;"><h2 class="product-name">';
166
+ $result .= '<a href="'.$item["url"].'" title="'.$item['title'].'">'.$item['title'].'</a>';
167
+ $result .= '</h2>';
168
+ $result .= '<div class="price-box">';
169
+ if(!empty($msrp)){
170
+ $result .= '<p class="old-price">';
171
+ $result .= '<span class="price-label">Regular Price:</span>';
172
+ $result .= '<span class="price" id="old-price-'.$item['entity_id'].'">'.$msrp.'</span>';
173
+ $result .= '</p>';
174
+
175
+ $result .= '<p class="special-price">';
176
+ $result .= '<span class="price-label">Special Price</span>';
177
+ $result .= '<span class="price" id="product-price-'.$item['entity_id'].'">'.$price.'</span>';
178
+ $result .= '</p>';
179
+ }else{
180
+ $result .= '<span class="regular-price" id="product-price-'.$item['entity_id'].'"><span class="price">'.$price.'</span></span>';
181
+ }
182
+ $result .= '</div>';
183
+ $result .= '<div class="actions">';
184
+
185
+ if(!empty($cartUrl)){
186
+ $result .= '<button type="button" title="Add to Cart" class="button btn-cart" onclick="setLocation(\''.$cartUrl.'\')">';
187
+ $result .= '<span><span>Add to Cart</span></span>';
188
+ $result .= '</button>';
189
+ }
190
+ $result .= '<ul class="add-to-links">';
191
+
192
+ if(!empty($wishlistUrl)){
193
+ $result .= '<li><a href="'.$wishlistUrl.'" class="link-wishlist"> <i class="fa fa-heart" aria-hidden="true"></i> Wishlist</a></li>';
194
+ }
195
+ if(!empty($compareUrl)){
196
+ $result .= '<li><span class="separator">|</span>';
197
+ $result .= '<a href="'.$compareUrl.'" class="link-compare"> <i class="fa fa-balance-scale" aria-hidden="true"></i> Compare</a>';
198
+ $result .= '</li>';
199
+ }
200
+ $result .= '</ul>'; //add to links
201
+ $result .= '</div>'; // actions div
202
+ $result .= '</div>'; //product-info div
203
+ $result .= '</li>';
204
+
205
+ }
206
+ $result .= '</ul>';
207
+
208
+ return $result;
209
+ }
210
+
211
+ protected function getListProductsDiv($data){
212
+ $confArray = $this->_confArray;
213
+
214
+ $result = '<ol class="products-list" id="products-list">';
215
+ $index = 1;
216
+ $data_size = count($data);
217
+ foreach ($data as $item) {
218
+ if(!isset($item["entity_id"]) && !isset($item["title"]) && !isset($item["url"]) && !isset($item["image_url"])){
219
+ continue;
220
+ }
221
+ $msrp = "";
222
+ $price = "";
223
+ $compareUrl = Mage::helper('expertrec_recommendation')->getProductCompareUrl($item['entity_id']);
224
+ $wishlistUrl = Mage::helper('expertrec_recommendation')->getWishlistUrl($item['entity_id']);
225
+ $cartUrl = Mage::helper('expertrec_recommendation')->getAddToCartUrl($item['entity_id']);
226
+ $description = isset($item['desc']) ? $item['desc'] : (Mage::helper('expertrec_recommendation')->getProductDescription($item['entity_id']));
227
+
228
+ if(!empty($item["msrp"]) && $item["msrp"] != "None" && $item["msrp"] != "0"){
229
+ $msrp =$item['msrp'];
230
+ }
231
+ if(!empty($item["price"]) && $item["price"] != "None" && $item["price"] != "0"){
232
+ $price = $item['price'];
233
+ }
234
+
235
+ if($this->_convertPrice){
236
+ $price = Mage::helper('expertrec_recommendation')->getFormatCurrency($price,$item['entity_id'],$this->_fetchPrice);
237
+ $msrp = Mage::helper('expertrec_recommendation')->getFormatCurrency($msrp,$item['entity_id'],$this->_fetchPrice);
238
+ }else{
239
+ $price = Mage::helper('expertrec_recommendation')->getFormatPrice($price);
240
+ $msrp = Mage::helper('expertrec_recommendation')->getFormatPrice($msrp);
241
+ }
242
+
243
+ $odd_even = $data_size == $index ? 'last ' : '';
244
+
245
+ $odd_even .= ($index % 2) == 0 ? 'even' : 'odd';
246
+
247
+ $result .= '<li class="item '.$odd_even.'">';
248
+ $result .= '<a href="'.$item["url"].'" title="'.$item['title'].'" class="product-image">';
249
+ $result .= '<img id="product-collection-image-'.$item['entity_id'].'" src="'.$item['image_url'].'" alt="'.$item['title'].'">';
250
+ $result .= '</a>';
251
+ $result .= '<div class="product-shop">';
252
+ $result .= '<div class="f-fix">';
253
+ $result .= '<div class="product-primary">';
254
+ $result .= '<h2 class="product-name">';
255
+ $result .= '<a href="'.$item["url"].'" title="'.$item['title'].'">'.$item['title'].'</a>';
256
+ $result .= '</h2>';
257
+ $result .= '</div>'; //product-primary
258
+ $result .= '<div class="product-secondary">';
259
+ $result .= '<div class="price-box">';
260
+ if(!empty($msrp)){
261
+ $result .= '<p class="old-price">';
262
+ $result .= '<span class="price-label">Regular Price:</span>';
263
+ $result .= '<span class="price" id="old-price-'.$item['entity_id'].'">'.$msrp.'</span>';
264
+ $result .= '</p>';
265
+
266
+ $result .= '<p class="special-price">';
267
+ $result .= '<span class="price-label">Special Price</span>';
268
+ $result .= '<span class="price" id="product-price-'.$item['entity_id'].'">'.$price.'</span>';
269
+ $result .= '</p>';
270
+ }else{
271
+ $result .= '<span class="regular-price" id="product-price-'.$item['entity_id'].'"><span class="price">'.$price.'</span></span>';
272
+ }
273
+ $result .= '</div>'; //price-box
274
+ $result .= '</div>'; //product-secondary
275
+ $result .= '<div class="product-secondary">';
276
+ $result .= '<p class="action">';
277
+
278
+ if(!empty($cartUrl)){
279
+ $result .= '<button type="button" title="Add to Cart" class="button btn-cart" onclick="setLocation(\''.$cartUrl.'\')">';
280
+ $result .= '<span><span>Add to Cart</span></span>';
281
+ $result .= '</button>';
282
+ }
283
+
284
+ $result .= '</p>';
285
+ $result .= '<ul class="add-to-links">';
286
+
287
+ if(!empty($wishlistUrl)){
288
+ $result .= '<li><a href="'.$wishlistUrl.'" class="link-wishlist"> <i class="fa fa-heart" aria-hidden="true"></i> Wishlist</a></li>';
289
+ }
290
+ if(!empty($compareUrl)){
291
+ $result .= '<li><span class="separator">|</span>';
292
+ $result .= '<a href="'.$compareUrl.'" class="link-compare"> <i class="fa fa-balance-scale" aria-hidden="true"></i> Compare</a>';
293
+ $result .= '</li>';
294
+ }
295
+ $result .= '</ul>'; //add to links
296
+ $result .= '</div>'; //product-secondary
297
+ $result .= '<div class="desc std">'.$description;
298
+ $result .= '<a href="'.$item["url"].'" title="'.$item['title'].'" class="link-learn">Learn More</a>';
299
+ $result .= '</div>'; //desc
300
+ $result .= '</div>'; // f-fix
301
+ $result .= '</div>'; //product-shop
302
+ $result .= '</li>';
303
+
304
+ $index = $index + 1;
305
+ }
306
+
307
+ $result .= '</ol>';
308
+
309
+ return $result;
310
+ }
311
+
312
+ /*
313
  * @param string facet-header
314
  * @param string facet-label
315
  * @return string url
329
  }else{
330
  $url .= "&".str_replace(" ","_",$fhead).'='.$label;
331
  }
332
+ return $url;
333
+ }
334
+
335
+ /*
336
+ * @param string facet-header
337
+ * @param string facet-label
338
+ * @return string class
339
+ */
340
+ protected function getFacetClass($fhead,$facetLabel){
341
+ $confArray = $this->_confArray;
342
+
343
+ $class = $fhead == "category" ? "expertrec-filter-cat" : "expertrec-filter-attr";
344
+ $filter = isset($confArray["filters"][$fhead]) ? $confArray["filters"][$fhead] : '';
345
+ $label = str_replace(" ","+",$facetLabel);
346
+
347
+ if(!empty($filter)){
348
+ $att = preg_split('/(%2C|,)/', $filter);
349
+ if(in_array($label, $att)){
350
+ $class .= '-selected';
351
+ }
352
+ }
353
+
354
+ return $class;
355
+ }
356
 
357
  /*
358
  * @param filterkey string
364
  $linkUrl = $baseUrl.'&'.str_replace(' ', '_', $fKey)."=".implode('%2C', $flist);
365
  return $linkUrl;
366
  }
367
+
368
+ protected function getNavigationState(){
369
+ $result = '';
370
+ $confArray = $this->_confArray;
371
+
372
+ try{
373
+ if(!empty($confArray["filters"])){
374
+ $filters = $confArray["filters"];
375
+ $result .= '<div class="currently">';
376
+ $result .= '<p class="block-subtitle">'.$this->__('Currently Shopping by:').'</p>';
377
+ $result .= '<ol>';
378
+ foreach ($filters as $fKey => $fValue){
379
+ $result .= '<li>';
380
+ $result .= '<span class="label">'.$this->__(str_replace('_', ' ', $fKey)).':</span>';
381
+ $listSubFilter = preg_split('/(%2C|,)/', $fValue);
382
+
383
+ if(in_array($fKey, $this->_singleSelectFilters) || count($listSubFilter) == 1){
384
+ $result .= '<span class="value">'.str_replace('+', ' ', $listSubFilter[0]).'</span>';
385
+ $result .= '<a class="btn-remove" href="'.$this->removeRequestParam($fKey).'" title="'.$this->__('Remove This Item').'"><i class="fa fa-times" aria-hidden="true"></i></a>';
386
+ }else{
387
+ foreach ($listSubFilter as $sfKey) {
388
+ $remainSubFilterList = array_diff($listSubFilter, array($sfKey));
389
+
390
+ $result .= '<span class="multivalue">'.str_replace('+', ' ', $sfKey).'</span>';
391
+ $result .= '<a class="btn-remove-inline" href="'.$this->getClearLinkUrl($fKey,$remainSubFilterList).'" title="'.$this->__('Remove This Item').'">';
392
+ $result .= '<i class="fa fa-times-circle" aria-hidden="true"></i>';
393
+ $result .= '</a>';
394
+ $result .= '</span>';
395
+ }
396
+ }
397
+
398
+ $result .= '</li>';
399
+ }
400
+ $result .= '</ol>';
401
+ $result .= '</div>';
402
+ $result .= '<div class="actions">';
403
+ $result .= '<a href="'.strtok($confArray["url"], '?').'?q='.$confArray["query"].'">'.$this->__('Clear All').'</a>';
404
+ $result .= '</div>';
405
+ }
406
+ }catch(Exception $e){
407
+ Mage::getSingleton('expertrec_recommendation/log')->log( "Error in getting navigation state: ".$e->getMessage());
408
+ }
409
+
410
+ return $result;
411
+ }
412
+
413
+ /*
414
+ * @param Array facetlist
415
+ * @return html string
416
+ */
417
+ public function prepareFilterLayout($facets){
418
+ $result = '<div class="listing-filter">';
419
+ $result .= '<a href="javascript:;" onclick="erOpenFilter()">';
420
+ $result .= '<i class="fa fa-filter" aria-hidden="true"></i>&nbsp; Filter By </a>';
421
+ $result .= '</div>';
422
+ $result .= '<div id="er_Filteroption" class="overlay-filter">';
423
+ $result .= '<div class="block block-layered-nav expertrec-overflow-scroll-enabled">';
424
+ $result .= '<div class="block-title">';
425
+ $result .= '<strong><span>'.$this->__('Shop By').'</span></strong>';
426
+ $result .= '</div>';
427
+ $result .= '<div class="block-content toggle-content">';
428
+ $result .= '<div style="clear:both;"></div>';
429
+ $result .= '<p class="block-subtitle mobile-only"><i class="fa fa-filter" aria-hidden="true"></i> &nbsp; Filter By</p>';
430
+ $result .= '<dl id="narrow-by-list">';
431
+
432
+ foreach ($facets as $fKey => $fValue) {
433
+ if(count($fValue)){
434
+
435
+ $result .= '<dt>'.$fKey.'</dt>';
436
+ $result .= '<dd class="filter-search">';
437
+
438
+ $result .= '<ol>';
439
+ foreach ($fValue as $facetLabel => $facetCount) {
440
+ $result .= '<li class="'.$this->getFacetClass($fKey,$facetLabel).'">';
441
+ if($this->_isAjax){
442
+ $result .= '<a href="javascript:;">';
443
+ $result .= '<input class="ajaxUrl" type="hidden" value="'.$this->getFacetUrl($fKey,$facetLabel).'">';
444
+ }else{
445
+ $result .= '<a href="'.$this->getFacetUrl($fKey,$facetLabel).'">';
446
+ }
447
+ if(!in_array($fKey, $this->_singleSelectFilters)){
448
+ $result .= '<i class="fa fa-square-o" aria-hidden="true"></i>';
449
+ $result .= '<i class="fa fa-check-square-o" aria-hidden="true"></i>';
450
+ }
451
+ $result .= '&nbsp;'.ucwords(strip_tags($facetLabel));
452
+
453
+ $result .= ' <span class="count">('.$facetCount.')</span>';
454
+ $result .= '</a>';
455
+ $result .= '</li>';
456
+ }
457
+
458
+ $result .= '</ol>';
459
+ $result .= '</dd>';
460
+ }
461
+
462
+ }
463
+
464
+ $result .= '</dl>';
465
+ $result .= '<script type="text/javascript">decorateDataList(\'narrow-by-list\')</script>';
466
+ $result .= '<div class="mobile-only mobile-filter-closer" onclick="erCloseFilter()"> <i class="fa fa-times" aria-hidden="true"></i> &nbsp; Close Filter </div>';
467
+
468
+ $result .= '</div>'; // block-content close
469
+ $result .= '</div>'; // block-layered-nav close
470
+ $result .= '</div>'; // er_Filteroption close
471
+
472
+ return $result;
473
+ }
474
+
475
+
476
+ /*
477
+ * @param list of products
478
+ * @return html string
479
+ */
480
+
481
+ public function prepareLayout($data){
482
+ $confArray = $this->_confArray;
483
+
484
+ $finalResult = $this->getNavigationState();
485
+
486
+ if(!empty($confArray["count"])){
487
+ $toolbar = $this->getToolbarDiv();
488
+ $finalResult .= '<div class="category-products">';
489
+
490
+ $finalResult .= $toolbar;
491
+
492
+ if($confArray["mode"] == 'grid'){
493
+ $finalResult .= $this->getGridProductsDiv($data);
494
+ $finalResult .= '<script type="text/javascript">decorateGeneric($$("ul.products-grid"), ["odd","even","first","last"])</script>';
495
+ }else{
496
+ $finalResult .= $this->getListProductsDiv($data);
497
+ $finalResult .= '<script type="text/javascript">decorateList("products-list", "none-recursive")</script>';
498
+ }
499
+
500
+ $finalResult .= '<div class="toolbar-bottom">';
501
+ $finalResult .= $toolbar;
502
+ $finalResult .= '</div>';
503
+ $finalResult .= '</div>';
504
+ }else{
505
+ $noResult = $this->__('Your search returns no results.');
506
+ $finalResult .= '<p class="note-msg">'.$noResult.'</p>';
507
+ }
508
+
509
+ return $finalResult;
510
+
511
+ }
512
  }
513
 
514
  ?>
app/code/community/Expertrec/Recommendation/Helper/Searchhelper.php DELETED
@@ -1,224 +0,0 @@
1
- <?php
2
-
3
- class Expertrec_Recommendation_Helper_Searchhelper extends Mage_Core_Helper_Abstract{
4
-
5
- const SEARCH_LIST_API = 'search/api';
6
- const SEARCH_FACET_LIST = 'search/facets_list';
7
- const SEARCH_LIST_ENABLE = 'search/enable';
8
-
9
- protected $_facetList = array();
10
- protected $_resultIds = array();
11
-
12
- public function getResultIds(){
13
- return $this->_resultIds;
14
- }
15
-
16
- protected function getFormatUrl($url){
17
- $splitedUrl = explode("?", $url);
18
- $newUrl = preg_replace('/\/ajax/',"",$splitedUrl[0]);
19
- if(count($splitedUrl) == 2){
20
- $newUrl .= '?'.$splitedUrl[1];
21
- }
22
-
23
- return $newUrl;
24
- }
25
-
26
- public function getSearchEnable(){
27
- $searchEnable = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_LIST_ENABLE);
28
- return $searchEnable;
29
- }
30
-
31
- protected function getSearchApi($confArray){
32
-
33
- $searchApi = "";
34
-
35
- try{
36
- $storeSearchApi = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_LIST_API);
37
- }catch(Exception $e){
38
- Mage::getSingleton('expertrec_recommendation/log')->log('Searchhelper::getting searchApi exception: '.$e->getMessage());
39
- }
40
-
41
- if(!empty($storeSearchApi)){
42
- $searchApi = $storeSearchApi;
43
-
44
- // searching for cat and other facets
45
- // if(isset($confArray["facetPortion"]))
46
- // {
47
- // // $confArray["cat"] is to add cat and facets in searchapi
48
- // $searchApi .= "?q=".urlencode($confArray["query"]).$confArray["facetPortion"]."&page=0&src=magento";
49
- // }
50
-
51
- $searchApi .= "?q=".urlencode($confArray["query"])."&page=0&src=magento";
52
-
53
- $splitedUrl = explode("?",html_entity_decode($confArray["url"]));
54
-
55
- if(count($splitedUrl)==2)
56
- {
57
- $searchApi .= "&oq=".urlencode($splitedUrl[1]);
58
-
59
- }
60
- }
61
-
62
- Mage::getSingleton('expertrec_recommendation/log')->log("The search URL sent to Expertrec BE is : ".print_r($searchApi,1),null);
63
-
64
- //print_r($searchApi);
65
-
66
- return $searchApi;
67
- }
68
-
69
- public function getNonQueryUrlParameters($searchUrl)
70
- {
71
- //checking for cat and facets
72
- $facetPortion = "";
73
- $limitQuery = "";
74
-
75
- if(!strpos($searchUrl,"?q")){
76
-
77
- $parsedUrl = parse_url($searchUrl);
78
- $newQuery = array();
79
- $categoryArr = array();
80
- $query1 = "";
81
-
82
- $getCategory = explode("&",html_entity_decode($parsedUrl["query"]));
83
-
84
- // spliting queries
85
- foreach ($getCategory as $key => $value) {
86
- list($key1, $val) = explode('=', $value);
87
-
88
- //Excluding query term and cifr from categories
89
- if(!in_array($key1,array("q","cifr","limit","dir","order")))
90
- {
91
- $categoryArr[$key1] = $val;
92
- }
93
-
94
- }
95
-
96
- // getting all attributes
97
- $attributes = Mage::getModel('eav/entity_attribute_option')->getCollection()->setStoreFilter(0)->join('attribute','attribute.attribute_id=main_table.attribute_id', 'attribute_code');
98
-
99
- // changing id to name for cat and facets
100
- if(isset($categoryArr))
101
- {
102
- foreach ($categoryArr as $key => $value) {
103
-
104
- if($key == 'cat')
105
- {
106
- $id = $value;
107
- $cat = Mage::getModel('catalog/category')->load($id);
108
- $newQuery['category'] = $cat->getName();
109
- }
110
- else
111
- {
112
- //For all attributes not under the sortables, use attribute table
113
- if(!in_array($key,array("limit","order","dir")))
114
- {
115
- $attrMatched = false;
116
-
117
- foreach ($attributes as $attribute) {
118
- if ($attribute->getOptionId()==$value) {
119
- $newQuery[$key] = $attribute->getValue();
120
- $attrMatched = true;
121
- }
122
- }
123
-
124
- //If the attribute is not a category and it is not matched, just pass it to BE.
125
- if(!$attrMatched)
126
- {
127
- $newQuery[$key] = $value;
128
- }
129
- }
130
- else if($key == 'limit')
131
- {
132
- $limitQuery = "size=".urlencode($value);
133
- }
134
- else if($key == 'order')
135
- {
136
- $newQuery[$key] = $value." ".$categoryArr["dir"];
137
- }
138
- }
139
- }
140
-
141
- // changing to normal array
142
- foreach($newQuery as $k=>$v)
143
- {
144
- $finalQuery[] = $k.":".urlencode($v);
145
- }
146
-
147
- // implode with &fq as in url
148
- if(isset($finalQuery))
149
- {
150
- $query1 = "&fq=".implode("&fq=",$finalQuery);
151
- }
152
-
153
-
154
- if(strlen($limitQuery) > 0)
155
- {
156
- $query1 .= "&".$limitQuery;
157
- }
158
-
159
- $facetPortion = $query1;
160
-
161
- }
162
-
163
- }
164
-
165
- return $facetPortion;
166
- }
167
-
168
- public function prepareLayer($requestParams){
169
- $confArray = array();
170
- $filters = array();
171
-
172
- try{
173
- $confArray["url"] = $this->getFormatUrl(Mage::helper('core/url')->getCurrentUrl(),$confArray);
174
- $confArray["query"] = $requestParams['q'];
175
- //$confArray["facetPortion"] = $this->getNonQueryUrlParameters($confArray["url"]);
176
-
177
- //setup search url, if search URL is not empty
178
- $searchApi = $this->getSearchApi($confArray);
179
-
180
- if(!empty($searchApi)){
181
-
182
- //sending request
183
- $resp = Mage::helper('expertrec_recommendation')->sendCurl($searchApi);
184
- $response_json = json_decode($resp,true);
185
-
186
- // checking for url-resp
187
- if(isset($response_json["redirect"]) && isset($response_json["redirect_url"])){
188
- Mage::app()->getResponse()->setRedirect($response_json["redirect_url"]);
189
-
190
- }
191
- else
192
- {
193
- if(isset($response_json["res"]) && isset($response_json["res"]["count"])){
194
- $confArray["count"] = (int)$response_json["res"]["count"];
195
- Mage::getSingleton('expertrec_recommendation/log')->log("The json data is valid");
196
- }
197
-
198
- //Initiate search layout
199
- $layoutHelper = Mage::helper('expertrec_recommendation/search_layout')->init($confArray);
200
-
201
- $searchListData = $response_json["results"];
202
- $itemIds = array();
203
-
204
- if(isset($searchListData))
205
- {
206
- Mage::getSingleton('expertrec_recommendation/log')->log("Number of items returned by Expertrec BE ".count($searchListData));
207
-
208
- foreach ($searchListData as $item) {
209
- $itemIds[] = $item['entity_id'];
210
- }
211
- }
212
-
213
- $this->_resultIds = $itemIds;
214
- }
215
- }
216
-
217
- }catch (Exception $e) {
218
- Mage::getSingleton('expertrec_recommendation/log')->log('Searchhelper::prepareLayer exception: '.$e->getMessage());
219
-
220
- }
221
- }
222
-
223
- }
224
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Expertrec/Recommendation/Model/Catalogsearch/Layer.php DELETED
@@ -1,115 +0,0 @@
1
- <?php
2
-
3
- class Expertrec_Recommendation_Model_Catalogsearch_Layer extends Mage_CatalogSearch_Model_Layer{
4
-
5
- var $searchEnable;
6
- const SEARCH_LIST_ENABLE = 'search/enable';
7
- const SEARCH_CUSTOM_TEMPLATE = 'search/custom_template';
8
-
9
- private function setSearchEnable()
10
- {
11
-
12
- $this->searchEnable = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_LIST_ENABLE);
13
- }
14
-
15
- private function setExpertrecSearchData(){
16
- try
17
- {
18
- $app = Mage::app();
19
- $pageIdentifier = $app->getFrontController()->getAction()->getFullActionName();
20
-
21
- if ($pageIdentifier === 'catalogsearch_result_index' ||
22
- $pageIdentifier === 'expertrec_result_index')
23
- {
24
-
25
- $customTemplate = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_CUSTOM_TEMPLATE);
26
-
27
- $requestParams = $app->getRequest()->getParams();
28
-
29
- if( (isset($this->searchEnable) && $this->searchEnable == "true") ||
30
- (isset($requestParams["expertrec"]) && $requestParams["expertrec"] == "search"))
31
- {
32
- if(isset($customTemplate) && $customTemplate == "true")
33
- {
34
- $observer->getLayout()
35
- ->getUpdate()
36
- ->addHandle('expertrec_custom_autocomplete');
37
- }
38
- else
39
- {
40
- //This sets the result IDs
41
- Mage::getSingleton('expertrec_recommendation/log')->log(" Fetching search results from expertec ");
42
-
43
- Mage::helper('expertrec_recommendation/searchhelper')->prepareLayer($requestParams);
44
-
45
- }
46
- }
47
- }
48
- }
49
- catch (Exception $e)
50
- {
51
- Mage::getSingleton('expertrec_recommendation/log')->log('setExpertrecSearchData exception: '.$e->getMessage());
52
- }
53
-
54
- }
55
-
56
-
57
- /**
58
- * Prepare product collection
59
- *
60
- * @param Mage_Catalog_Model_Resource_Eav_Resource_Product_Collection $collection
61
- * @return Mage_Catalog_Model_Layer
62
- */
63
- public function prepareProductCollection($collection)
64
- {
65
- $this->setSearchEnable();
66
-
67
- if(isset($this->searchEnable) && $this->searchEnable == "true")
68
- {
69
- //Setting product IDs
70
- $this->setExpertrecSearchData();
71
- $product_ids = Mage::helper('expertrec_recommendation/searchhelper')->getResultIds();
72
- Mage::getSingleton('expertrec_recommendation/log')->log(" The expertrec result IDs are ".count($product_ids));
73
- //Mage::log($product_ids);
74
- $collection
75
- ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
76
- ->addFieldToFilter('entity_id',array('in'=>$product_ids))
77
- ->setStore(Mage::app()->getStore())
78
- ->addMinimalPrice()
79
- ->addFinalPrice()
80
- ->addTaxPercents()
81
- ->addStoreFilter()
82
- ->addUrlRewrite();
83
- //->getSelect()->order("find_in_set(e.entity_id, '" . implode(',', $product_ids)."') DESC");
84
- $requestParams = Mage::app()->getRequest()->getParams();
85
-
86
- $orderby = isset($requestParams["order"]) ? $requestParams["order"] : 'relevance';
87
- $dir = isset($requestParams["dir"]) ? $requestParams["dir"] : 'desc';
88
-
89
- if($orderby == "relevance") {
90
- if($dir == 'desc'){
91
- $collection->getSelect()->order("find_in_set(e.entity_id, '" . implode(',', $product_ids)."') ASC");
92
- }
93
- else {
94
- $collection->getSelect()->order("find_in_set(e.entity_id, '" . implode(',', $product_ids)."') DESC");
95
- }
96
- }
97
-
98
- Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
99
- Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
100
- }
101
- else
102
- {
103
- //Call parent function if search is not enabled
104
- Mage::getSingleton('expertrec_recommendation/log')->log(" Default search returned products ");
105
- return parent::prepareProductCollection($collection);
106
- }
107
-
108
-
109
- return $collection;
110
- }
111
-
112
-
113
- }
114
-
115
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Expertrec/Recommendation/Model/Observer.php CHANGED
@@ -304,7 +304,7 @@ class Expertrec_Recommendation_Model_Observer {
304
 
305
  if(empty($endpoint) || empty($mid)){
306
  Mage::getSingleton('expertrec_recommendation/log')
307
- ->log("feed endpoint or merchand id is not configured Properly");
308
  return '';
309
  }
310
 
@@ -313,6 +313,51 @@ class Expertrec_Recommendation_Model_Observer {
313
  Mage::getSingleton('expertrec_recommendation/log')->log("Error in getting feed endpoint: ".$e->getMessage());
314
  return '';
315
  }
316
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  }
318
- ?>
304
 
305
  if(empty($endpoint) || empty($mid)){
306
  Mage::getSingleton('expertrec_recommendation/log')
307
+ ->log("feed endpoint: ".$endpoint." or merchand id: ".$mid." is not configured Properly");
308
  return '';
309
  }
310
 
313
  Mage::getSingleton('expertrec_recommendation/log')->log("Error in getting feed endpoint: ".$e->getMessage());
314
  return '';
315
  }
316
+ }
317
+
318
+ /**
319
+ * Load Expertrec Search.
320
+ */
321
+ public function useExpertrecSearch(Varien_Event_Observer $observer){
322
+ try {
323
+ $app = Mage::app();
324
+ $pageIdentifier = $app->getFrontController()->getAction()->getFullActionName();
325
+
326
+ if ($pageIdentifier === 'catalogsearch_result_index' ||
327
+ $pageIdentifier === 'expertrec_result_index')
328
+ {
329
+ $searchEnable = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_LIST_ENABLE);
330
+ $customTemplate = Mage::helper('expertrec_recommendation')->getConfig(self::SEARCH_CUSTOM_TEMPLATE);
331
+
332
+ $requestParams = $app->getRequest()->getParams();
333
+ if( (isset($searchEnable) && $searchEnable == "true") ||
334
+ (isset($requestParams["expertrec"]) && $requestParams["expertrec"] == "search")
335
+ ){
336
+ if(isset($customTemplate) && $customTemplate == "true"){
337
+ $observer->getLayout()
338
+ ->getUpdate()
339
+ ->addHandle('expertrec_custom_autocomplete');
340
+ }else{
341
+ $resultData = Mage::helper('expertrec_recommendation/autocompletehelper')->prepareLayer($requestParams);
342
+
343
+ if(count($resultData) == 0 ){
344
+ throw new Exception("Either Search_api or facets_list has not configured.");
345
+ }
346
+
347
+ Mage::register('expertrec_search_navigation', $resultData["facetHtml"]);
348
+ Mage::register('expertrec_search_list', $resultData["listHtml"]);
349
+
350
+ $observer->getLayout()
351
+ ->getUpdate()
352
+ ->addHandle('expertrec_autocomplete');
353
+ }
354
+ }
355
+ }
356
+ }catch (Exception $e) {
357
+ Mage::getSingleton('expertrec_recommendation/log')->log('useExpertrecSearch exception: '.$e->getMessage());
358
+ }
359
+ return $this;
360
+ }
361
+
362
  }
363
+ ?>
app/code/community/Expertrec/Recommendation/Model/Resource/Mysql4/Setup.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Expertrec_Recommendation_Model_Resource_Mysql4_Setup extends Mage_Core_Model_Resource_Setup
3
+ {
4
+
5
+ }
6
+ ?>
app/code/community/Expertrec/Recommendation/Model/Validate.php CHANGED
@@ -25,7 +25,14 @@ class Expertrec_Recommendation_Model_Validate {
25
  }
26
 
27
  public function getPassword(){
28
- $storedPwd = base64_decode(Mage::getStoreConfig(self::CONFIG_SECRET));
 
 
 
 
 
 
 
29
  return $storedPwd;
30
  }
31
 
25
  }
26
 
27
  public function getPassword(){
28
+ $storedPwd = Mage::getSingleton('expertrec_recommendation/feed_feedconfig')->getSecret();
29
+
30
+ if(empty($storedPwd)){
31
+ $storedPwd = base64_decode(Mage::getStoreConfig(self::CONFIG_SECRET));
32
+ Mage::getSingleton('expertrec_recommendation/feed_feedconfig')
33
+ ->setSecret($storedPwd);
34
+ }
35
+
36
  return $storedPwd;
37
  }
38
 
app/code/community/Expertrec/Recommendation/controllers/ApiController.php CHANGED
@@ -1,7 +1,31 @@
1
  <?php
2
 
3
  class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_Action {
4
- const BUILD_NO = "1487051832";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  private $_password;
6
 
7
  //main function which loads the feed API
@@ -23,5 +47,626 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
23
  $this->renderLayout();
24
  }
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  }
27
  ?>
1
  <?php
2
 
3
  class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_Action {
4
+
5
+ const CONFIG_HEADERS = 'expertrec/general/headers';
6
+ // getting filters
7
+ const CONFIG_FILTERS = 'expertrec/general/filters';
8
+ const SEARCH_LIST_ENABLE = 'search/enable';
9
+ const SEARCH_LIST_API = 'search/api';
10
+ const SEARCH_FACET_LIST = 'search/facets_list';
11
+ const SEARCH_SINGLE_SELECT_FILTERS = 'search/single_select_filters';
12
+ const SEARCH_IS_AJAX = 'search/is_ajax';
13
+ const SEARCH_ITEMS_PER_PAGE = 'search/items_per_page';
14
+ const SEARCH_DISPLAY_PAGES = 'search/display_pages';
15
+ const SEARCH_FETCH_PRICE = 'search/fetch_price';
16
+ const SEARCH_CONVERT_PRICE = 'search/convert_price';
17
+ const SEARCH_CUSTOM_TEMPLATE = 'search/custom_template';
18
+ const FEED_LOG_ENDPOINT = 'log_endpoint';
19
+ const FEED_UPLOAD_ENDPOINT = 'upload_endpoint';
20
+ const IS_UPLOAD_FEED = 'is_upload';
21
+ const IMAGE_WIDTH = 'expertrec/general/expertrec_image_width';
22
+ const IMAGE_HEIGHT = 'expertrec/general/expertrec_image_height';
23
+ const THUMBNAIL_WIDTH = 'expertrec/general/expertrec_thumbnail_width';
24
+ const THUMBNAIL_HEIGHT = 'expertrec/general/expertrec_thumbnail_height';
25
+ const MERCHANT_ID = 'expertrec/general/mid';
26
+
27
+
28
+ const BUILD_NO = "1487335332";
29
  private $_password;
30
 
31
  //main function which loads the feed API
47
  $this->renderLayout();
48
  }
49
 
50
+ // return websites and stores information
51
+ public function infodupAction(){
52
+
53
+ //return array of all parameters sent
54
+ $requestParams = Mage::app()->getRequest()->getParams();
55
+
56
+ $Password = isset($requestParams['secret']) ? $requestParams['secret'] : '';
57
+
58
+ // Check password. if invalid password, it will not proceed.
59
+ if(!Mage::getModel('expertrec_recommendation/validate')->checkPassword($Password)){
60
+ die('ERROR: The specified password is invalid.');
61
+ }
62
+
63
+ $this->_password = Mage::getModel('expertrec_recommendation/validate')->getPassword();
64
+
65
+ // Set character set to UTF-8
66
+ header("Content-Type: text/html; charset=UTF-8");
67
+ ?>
68
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
69
+ <html xmlns="http://www.w3.org/1999/xhtml">
70
+ <head>
71
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
72
+ <title>Expertrec Feed Collection Api</title>
73
+ <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
74
+ <style type="text/css">
75
+ table {border-spacing: 0;border-collapse: collapse;width: 100%;}
76
+ .table-hover > tbody > tr:hover {background-color: #f5f5f5;}
77
+ tbody td, thead th{padding: 8px;line-height: 1.42857143;vertical-align: top;border-top: 1px solid #ddd;text-align:left;}
78
+ thead:first-child > tr:first-child > th {border-top: 0;}
79
+ thead th {vertical-align: bottom;border-bottom:2px solid #ddd;background-color:#f5f5f5;text-align:center;}
80
+ fieldset { display: block;margin:10px 2px;padding: .35em .625em .75em; border: 1px solid silver; }
81
+ legend{padding: 0px 5px; width: auto; border: 0px none;margin:0;}
82
+ fieldset p { text-align: left; display: block; }
83
+ #searchConfSection input[type="checkbox"]{bottom: 2px;}
84
+ </style>
85
+ </head>
86
+ <body>
87
+ <div class="container-fluid">
88
+ <?php
89
+ $version = (string)Mage::getConfig()->getNode('modules/Expertrec_Recommendation/version');
90
+ echo "<h4 style='margin:20px auto 10px;'>Extension Version: <span style='color:red;'>".$version."</span></h4>";
91
+ echo "<h4 style='margin:10px auto;'>Extension Build No.: <span style='color:red;'>".self::BUILD_NO."</span></h4>";
92
+ try{
93
+ echo "<h4 style='margin:10px auto;'>Magento Version: <span style='color:red;'>".Mage::getVersion()."</span></h4>";
94
+ }catch(Exception $em){};
95
+ echo "<h4 style='margin:10px auto;'>Merchant ID: <span style='color:red;'>".Mage::getStoreConfig(self::MERCHANT_ID)."</span></h4>";
96
+ ?>
97
+ <ul class="nav nav-tabs" style="margin-top:20px;">
98
+ <li class="active"><a data-toggle="tab" href="#apiSection">Api</a></li>
99
+ <li><a data-toggle="tab" href="#feedHeader">Feed Header</a></li>
100
+ <li><a data-toggle="tab" href="#feedEndpointSection">Feed Config</a></li>
101
+ <li><a data-toggle="tab" href="#searchConfSection">Search</a></li>
102
+ <li><a data-toggle="tab" href="#siteDetailsSection">Details</a></li>
103
+ <!-- added xml-file link -->
104
+ <!-- <li><a href="<?php //echo Mage::getBaseUrl().'xml.php';?>">xml file</a></li> -->
105
+ </ul>
106
+ <div style="clear:both;"></div>
107
+ <div class="tab-content">
108
+ <div id="apiSection" class="tab-pane fade in active">
109
+ <div style="margin-top:20px;">
110
+ <fieldset>
111
+ <legend>Getting Feeds Api</legend>
112
+ <table class="table-hover" style="margin: 1em auto;">
113
+ <thead>
114
+ <tr>
115
+ <th>Website ID</th>
116
+ <th>Website Name</th>
117
+ <th>Store ID</th>
118
+ <th>Store Name</th>
119
+ <th>Store Language</th>
120
+ <th>Total# Products</th>
121
+ <th>Url</th>
122
+ </tr>
123
+ </thead>
124
+ <tbody>
125
+ <?php
126
+
127
+ //site url
128
+ $baseUrl=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
129
+ $feedFilter = Mage::getSingleton('expertrec_recommendation/feed_feedfilter');
130
+
131
+ // List all website-stores
132
+ $websiteCollection = Mage::getModel('core/website')->getCollection()->load();
133
+ foreach ($websiteCollection as $website){
134
+ $wid=$website->getWebsiteId();
135
+ foreach ($website->getGroups() as $group) {
136
+ $stores = $group->getStores();
137
+ foreach ($stores as $oStore) {
138
+ $sid=$oStore->getId();
139
+ $storeUrl=Mage::app()->getStore($sid)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).'index.php/expertrec-feed?secret='.$this->_password.'&cmd=export&wid='.$wid.'&sid='.$sid;
140
+ // Display the store-website details with feed api
141
+ echo '<tr>';
142
+ echo '<td style="text-align:center;">'.$wid.'</td>';
143
+ echo '<td style="text-align:center;">'.$website->getName().'</td>';
144
+ echo '<td style="text-align:center;">'.$sid.'</td>';
145
+ echo '<td style="text-align:center;">'.$oStore->getName().'</td>';
146
+ echo '<td style="text-align:center;">'.Mage::getStoreConfig('general/locale/code', $sid).'</td>';
147
+ try{
148
+ $pcount = Mage::helper('expertrec_recommendation')->getProductCount($wid,$sid);
149
+
150
+ echo '<td style="text-align:center;">'.$pcount.'</td>';
151
+
152
+ }catch(Exception $e){
153
+ echo '<td style="text-align:center;"><b style="color:red;">Error: </b>'.$e->getMessage().'</td>';
154
+ }
155
+
156
+ echo '<td>
157
+ <form method="post" action="'.$storeUrl.'">
158
+ <p>'.$storeUrl.'</p>
159
+ <button type="submit">submit</button></form></td>';
160
+ echo '</tr>';
161
+ }
162
+ }
163
+ }
164
+
165
+ ?>
166
+ </tbody>
167
+ </table>
168
+ </fieldset>
169
+
170
+ </div>
171
+ <p>
172
+ <strong>Note:</strong><br />
173
+ <span>
174
+ 1. Each page contains 500 products.<br />
175
+ 2. For Getting custom image size, kindly add <b>width</b> and <b>height</b> parameter in the api url.
176
+ </span>
177
+ </p>
178
+ <fieldset>
179
+ <legend>Example</legend>
180
+ <?php
181
+ $customImagePortion ="&width=170&height=170";
182
+ $imageWidth = Mage::getStoreConfig(self::IMAGE_WIDTH);
183
+ $imageHeight = Mage::getStoreConfig(self::IMAGE_HEIGHT);
184
+ if((isset($imageWidth) && $imageWidth != "") && (isset($imageHeight) && $imageHeight != ""))
185
+ {
186
+ $customImagePortion = "&width=".$imageWidth."&height=".$imageHeight;
187
+ }
188
+ elseif(isset($imageWidth) && $imageWidth != "")
189
+ {
190
+ $customImagePortion ="&width=".$imageWidth."&height=170";
191
+ }
192
+ elseif(isset($imageHeight) && $imageHeight != "")
193
+ {
194
+ $customImagePortion ="&width=170&height=".$imageHeight;
195
+ }
196
+
197
+ $apiUrlWithCustomConf=$baseUrl.'index.php/expertrec-feed?secret='.$this->_password.'&cmd=export&wid=1&sid=1';
198
+
199
+ echo '<form id="custImageForm" name = "custImageForm" method="POST" action ="'.$apiUrlWithCustomConf.$customImagePortion.'">
200
+ <b>With Custom image size</b><br />';
201
+ echo '<p>'.$apiUrlWithCustomConf.$customImagePortion.'</p>
202
+ <button id="custImgSubmit" name="custImgSubmit" type="submit">Submit</button>
203
+ </form>';
204
+
205
+ echo '<form id ="custImgForm1" name="custImgForm1" method="POST" action="'.$apiUrlWithCustomConf.'&ps=1&pe=2">
206
+ <p><b>With pagination without page size(default page size is 500)</b><br />';
207
+ echo '<p>'.$apiUrlWithCustomConf.'&ps=1&pe=2</p>
208
+ <button id="custImgSubmit1" name="custImgSubmit1" type="submit">Submit</button>
209
+ </form>';
210
+
211
+ echo '<form id="custImgForm2" name="custImageForm2" method="POST" action="'.$apiUrlWithCustomConf.'&ps=1&pe=2&psize=50">
212
+ <p><b>With pagination & page size</b><br />';
213
+ echo '<p>'.$apiUrlWithCustomConf.'&ps=1&pe=2&psize=50</p>
214
+ <button type="submit" id="custImgSubmit2" name="custImgSubmit2">Submit</submit></form>';
215
+ echo '</fieldset>';
216
+
217
+ echo $this->displaySuggestionApi($baseUrl);
218
+ echo $this->displayLogApi($baseUrl);
219
+ ?>
220
+
221
+ </div> <!-- api section end -->
222
+
223
+ <!-- header section start -->
224
+ <div id="feedHeader" class="tab-pane fade">
225
+ <div style="margin-top:20px">
226
+ <?php
227
+ $allAttribute = $this->getAllAttributes();
228
+ //display header form
229
+ echo $this->displayHeaderForm($baseUrl,$allAttribute);
230
+ ?>
231
+ </div>
232
+ </div> <!-- header section end -->
233
+
234
+ <!-- Feed api configuration section start -->
235
+ <div id="feedEndpointSection" class="tab-pane fade">
236
+ <div style="margin-top:20px">
237
+ <?php echo $this->displayFeedConf($baseUrl); ?>
238
+ </div>
239
+ </div>
240
+ <!-- Feed api configuration section end -->
241
+
242
+ <!-- search section start -->
243
+ <div id="searchConfSection" class="tab-pane fade">
244
+ <div style="margin-top:20px">
245
+ <?php echo $this->displaySearchConf($baseUrl); ?>
246
+ </div>
247
+ </div>
248
+
249
+ <!-- site details -->
250
+ <div id="siteDetailsSection" class="tab-pane fade">
251
+ <div style="margin-top:20px">
252
+ <?php echo $this->displaySiteDetails(); ?>
253
+ </div>
254
+ </div>
255
+ </div> <!-- tab-content end-->
256
+ </div> <!-- container-fluid end-->
257
+ <!-- script section-->
258
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
259
+ <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
260
+
261
+ </body>
262
+ </html>
263
+ <?php
264
+
265
+ }
266
+
267
+ private function displayLogApi($baseUrl){
268
+ $result = '<div style="margin-top:20px">';
269
+ $result .= '<fieldset>';
270
+ $result .= '<legend>Getting log & Cleaning Expertrec Directory Api\'s</legend>';
271
+
272
+ $logUrl = $baseUrl.'index.php/expertrec-feed/index/getlog?secret='.$this->_password;
273
+ $cleanDirUrl = $baseUrl.'index.php/expertrec-feed/index/clean?secret='.$this->_password;
274
+
275
+ $result .= '<form method ="POST" id="logForm" name="logForm" method="POST" action="'.$logUrl.'">
276
+ <p><b>Log url</b><br />';
277
+ $result .= '<p>'.$logUrl.'</p>
278
+ <button type="submit" id="logSubmit" name="logSubmit">Submit</button></form>';
279
+
280
+
281
+ $result .= '<form method ="POST" id="cleanForm" name="cleanForm" method="POST" action="'.$cleanDirUrl.'">
282
+ <p><b>Clean directory url</b><br />';
283
+ $result .= '<p>'.$cleanDirUrl.'</p>
284
+ <button type="submit" id="cleanSubmit" name="cleanSubmit">Submit</button></form>';
285
+
286
+
287
+ $result .= '</fieldset>';
288
+ $result .= '</div>';
289
+
290
+ return $result;
291
+
292
+ }
293
+
294
+ private function displaySuggestionApi($baseUrl){
295
+ $result = '<div style="margin-top:20px">';
296
+ $result .= '<fieldset>';
297
+ $result .= '<legend>Getting Popular products Api</legend>';
298
+
299
+ $apiUrlWithCustomConf=$baseUrl.'index.php/expertrec-feed?secret='.$this->_password.'&cmd=getpp&wid=1&sid=1';
300
+
301
+ $result .= '<form method="POST" action="'.$apiUrlWithCustomConf.'" name ="sug1form" id="sug1form">
302
+ <p><b>Without pagination</b><br />';
303
+ $result .= '<p>'.$apiUrlWithCustomConf.'</p>
304
+ <button type="submit" name="sug1submit" id="sug1submit">Submit</button></form>';
305
+
306
+ $result .= '<form method="POST" action="'.$apiUrlWithCustomConf.'&ps=1&pe=2" name ="sug1form" id="sug1form">
307
+ <p><b>With pagination without page size(default page size is 500)</b><br />';
308
+ $result .= '<p>'.$apiUrlWithCustomConf.'&ps=1&pe=2</p>
309
+ <button type="submit" name="sug1submit" id="sug1submit">Submit</button></form>';
310
+
311
+ $result .= '<form method="POST" action="'.$apiUrlWithCustomConf.'&ps=1&pe=2&psize=50" name ="sug2form" id="sug2form">
312
+ <p><b>With pagination & page size</b><br />';
313
+ $result .= '<p>'.$apiUrlWithCustomConf.'&ps=1&pe=2&psize=50</p>
314
+ <button type="submit" name="sug2submit" id="sug2submit">Submit</button></form>';
315
+
316
+ $result .= '</fieldset>';
317
+ $result .= '</div>';
318
+
319
+ return $result;
320
+ }
321
+
322
+ private function getAllAttributes(){
323
+ $attrArray = array('qty','is_in_stock','expert_image','expert_smallImage','expert_thumbnail','expert_category','expert_url','final_price','entity_id','attribute_set_id','type_id','entity_type_id','rating_summary');
324
+ $attributes = Mage::getResourceModel('catalog/product_attribute_collection')->getItems();
325
+
326
+ foreach ($attributes as $attribute) {
327
+ $attrCode = $attribute->getAttributeCode();
328
+ if (!in_array($attrCode, $attrArray)) {
329
+ $attrArray[] = $attrCode;
330
+ }
331
+
332
+ }
333
+ return $attrArray;
334
+ }
335
+
336
+ private function displayHeaderForm($baseUrl,$attributes){
337
+ $saveHeaderUrl = $baseUrl."index.php/expertrec-feed/config/saveheaders?secret=".$this->_password;
338
+
339
+ $result = '<style type="text/css"> .setHeadersForm label{padding:0px 10px 10px 0px;} .setHeadersForm input{vertical-align: middle;} </style>';
340
+
341
+ $result .= '<script type="text/javascript">';
342
+ $result .= 'function toggle_select(){var checkboxes = document.getElementsByName("check_list[]"); var button = document.getElementById("toggleSelect"); if(button.value == "Select All"){for (var i in checkboxes){checkboxes[i].checked = "checked"; } button.value = "Deselect All"}else{for (var i in checkboxes){checkboxes[i].checked = ""; } button.value = "Select All";}}';
343
+ $result .= '</script>';
344
+
345
+ $storedHeaders = Mage::getStoreConfig(self::CONFIG_HEADERS);
346
+ if (isset($storedHeaders)){
347
+ $storedHeadersArray = explode(',', $storedHeaders);
348
+ }
349
+ $storedFilters = Mage::getStoreConfig(self::CONFIG_FILTERS);
350
+
351
+ if(isset($storedFilters)){
352
+ $storedFiltersArray = explode(',', $storedFilters);
353
+ }
354
+ $result .= '<fieldset>';
355
+ $result .= '<legend>Configure Feed Headers</legend>';
356
+
357
+ $result .= '<form class="setHeadersForm" action="'.$saveHeaderUrl.'" method="post" role="form" target="_blank">';
358
+
359
+ foreach ($attributes as $attr) {
360
+ if (isset($storedHeadersArray) && in_array($attr, $storedHeadersArray)){
361
+ $result .= '<input type="checkbox" id="'.$attr.'" name="check_list[]" value="'.$attr.'" checked>';
362
+ }else{
363
+ $result .= '<input type="checkbox" id="'.$attr.'" name="check_list[]" value="'.$attr.'">';
364
+ }
365
+ $result .= '<label for="'.$attr.'">'.$attr.'</label>';
366
+ }
367
+
368
+ // adding image width and height
369
+ $result .= '<div style="display:block"><h4>Expertrec Image</h4><label for="imagewidth">Image Width</label><input type="text" id="imagewidth" name="imagewidth" placeholder="Give image width" value="'.Mage::getStoreConfig(self::IMAGE_WIDTH).'"></div>';
370
+ $result .= '<div style="display:block"><label for="imageheight">Image Height</label><input type="text" id="imageheight" name="imageheight" placeholder="Give image height" value="'.Mage::getStoreConfig(self::IMAGE_HEIGHT).'"></div>';
371
+
372
+ // adding thumbnail width and height
373
+ $result .= '<div style="display:block"><h4>Expertrec Thumbnail</h4><label for="thumbnailwidth">Thumbnail Width</label><input type="text" id="thumbnailwidth" name="thumbnailwidth" placeholder="Give thumbnail width" value="'.Mage::getStoreConfig(self::THUMBNAIL_WIDTH).'"></div>';
374
+ $result .= '<div style="display:block"><label for="thumbnailheight">Thumbnail Height</label><input type="text" id="thumbnailheight" name="thumbnailheight" placeholder="Give thumbnail height" value="'.Mage::getStoreConfig(self::THUMBNAIL_HEIGHT).'"></div>';
375
+
376
+ $filterArray = array('filter_by_stock','filter_by_status','filter_by_visiblity');
377
+
378
+ // filter_by_not_visible_individually','filter_by_visible_catalog','filter_by_visible_search','filter_by_visible_catalog_search'
379
+
380
+ $result .='<fieldset>';
381
+ $result .='<legend>Configure Filters</legend>';
382
+
383
+ foreach ($filterArray as $filter) {
384
+ if (isset($storedFiltersArray) && in_array($filter, $storedFiltersArray)){
385
+ $result .= '<input type="checkbox" id="'.$filter.'" name="filter_check_list[]" value="'.$filter.'" checked>';
386
+ }else{
387
+ $result .= '<input type="checkbox" id="'.$filter.'" name="filter_check_list[]" value="'.$filter.'">';
388
+ }
389
+ $result .= '<label for="'.$filter.'">'.$filter.'</label>';
390
+ }
391
+
392
+ $result .='</fieldset>';
393
+
394
+
395
+ $result .= '<div style="text-align:center;margin:10px auto;"> ';
396
+ $result .= '<input type="button" class="btn btn-md btn-primary" id="toggleSelect" value="Select All" onClick="toggle_select()" style="padding:5px; margin: 5px;"/>';
397
+ $result .= '<input type="submit" class="btn btn-md btn-primary" name="selected_headers" value="Submit" style= "padding:5px; margin: 5px;"/>';
398
+ $result .= '</div>';
399
+ $result .= '</form>';
400
+ $result .= '</fieldset>';
401
+
402
+ $result .= '<fieldset style="margin-top:20px;">';
403
+ $result .= '<legend>Selected Headers</legend>';
404
+ $result .= '<div class="setHeadersForm">';
405
+
406
+ if (isset($storedHeadersArray) && count($storedHeadersArray) > 0){
407
+ foreach ($storedHeadersArray as $header) {
408
+ $result .= '<input type="checkbox" name="'.$header.'" value="'.$header.'" disabled checked>';
409
+ $result .= '<label>'.$header.'</label>';
410
+ }
411
+ }
412
+
413
+ $result .= '</div>';
414
+ $result .= '</fieldset>';
415
+
416
+ if(!empty($storedFilters)){
417
+
418
+ $result .= '<fieldset style="margin-top:20px;">';
419
+ $result .= '<legend>Selected Filters</legend>';
420
+ $result .= '<div class="setHeadersForm">';
421
+
422
+
423
+ if (isset($storedFiltersArray) && count($storedFiltersArray) > 0){
424
+ foreach ($storedFiltersArray as $filter) {
425
+ $result .= '<input type="checkbox" name="'.$filter.'" value="'.$filter.'" disabled checked>';
426
+ $result .= '<label>'.$filter.'</label>';
427
+ }
428
+ }
429
+
430
+ $result .= '</div>';
431
+ $result .= '</fieldset>';
432
+ }
433
+
434
+ return $result;
435
+ }
436
+
437
+ private function displaySearchConf($baseUrl){
438
+ $saveSearchUrl = $baseUrl."index.php/expertrec-feed/config/savesearch?secret=".$this->_password;
439
+ $result = '<fieldset>';
440
+ $result .= '<legend>Configure Search</legend>';
441
+ $result .= '<form class="form-horizontal" action="'.$saveSearchUrl.'" method="post" role="form" target="_blank">';
442
+
443
+ $textArray = array("api"=>"Search endpoint", "facet_list"=>"Facet list comma separated", "single_select_filter"=>"Single select filters comma separated", "items_per_page"=>"No of items per page","display_pages"=>"No. of pages to display");
444
+
445
+ $textToStoreKeyMapArray = array("api"=>self::SEARCH_LIST_API,"facet_list"=>self::SEARCH_FACET_LIST,"single_select_filter"=>self::SEARCH_SINGLE_SELECT_FILTERS,"items_per_page"=>self::SEARCH_ITEMS_PER_PAGE,"display_pages"=>self::SEARCH_DISPLAY_PAGES);
446
+
447
+ $chekboxArray = array("search_enable"=>self::SEARCH_LIST_ENABLE,"fetch_price"=>self::SEARCH_FETCH_PRICE,"convert_price"=>self::SEARCH_CONVERT_PRICE,"is_ajax"=>self::SEARCH_IS_AJAX,"custom_template"=>self::SEARCH_CUSTOM_TEMPLATE);
448
+
449
+ // input
450
+ foreach ($textArray as $tKey => $tValue) {
451
+ $label = ucwords(str_replace("_", " ", $tKey));
452
+ $storeValue = Mage::helper('expertrec_recommendation')->getConfig($textToStoreKeyMapArray[$tKey]);
453
+
454
+ $result .= '<div class="form-group">';
455
+ $result .= '<label class="control-label col-sm-2" for="search_'.$tKey.'">'.$label.':</label>';
456
+ $result .= '<div class="col-sm-8">';
457
+ if(isset($storeValue)){
458
+ $result .= '<input type="text" class="form-control" name="'.$tKey.'" value="'.$storeValue.'" id="search_'.$tKey.'" placeholder="'.$tValue.'">';
459
+ }else{
460
+ $result .= '<input type="text" class="form-control" name="'.$tKey.'" id="search_'.$tKey.'" placeholder="'.$tValue.'">';
461
+ }
462
+ $result .= '</div>';
463
+ $result .= '</div>';
464
+ }
465
+
466
+ //checkbox
467
+ $result .= '<div class="form-group">';
468
+ $result .= '<div class="col-sm-2"></div>';
469
+ $result .= '<div class="col-sm-8">';
470
+ foreach ($chekboxArray as $cKey => $cValue) {
471
+ $label = ucwords(str_replace("_", " ", $cKey));
472
+ $storeValue = Mage::helper('expertrec_recommendation')->getConfig($cValue);
473
+ $checked = isset($storeValue) && $storeValue == "true" ? "checked" :'';
474
+
475
+ $result .= '<div class="col-sm-2">';
476
+ $result .= '<div class="checkbox">';
477
+ $result .= '<label><input type="checkbox" name="search_check_list[]" value="'.$cKey.'" '.$checked.'>'.$label.'</label>';
478
+ $result .= '</div>';
479
+ $result .= '</div>';
480
+
481
+ }
482
+ $result .= '</div>';
483
+ $result .= '</div>';
484
+ $result .= '<div style="text-align:center;margin:10px auto;">';
485
+ $result .= '<input type="submit" class="btn btn-md btn-primary" name="selected_search" value="Submit" style="padding:5px; "/>';
486
+ $result .= '</div>';
487
+ $result .= '</form>';
488
+ $result .= '</fieldset>';
489
+
490
+ return $result;
491
+
492
+ }
493
+
494
+ private function displayFeedConf($baseUrl){
495
+ $saveFeedApiUrl = $baseUrl."index.php/expertrec-feed/config/savefeedconf?secret=".$this->_password;
496
+ $result = '<fieldset>';
497
+ $result .= '<legend>Configure Feed</legend>';
498
+ $result .= '<form class="form-horizontal" action="'.$saveFeedApiUrl.'" method="post" role="form" target="_blank">';
499
+
500
+ $textArray = array("log_api"=>"Feed log endpoint", "upload_api"=>"Feed upload endpoint");
501
+ $textToStoreKeyMapArray = array("log_api"=>self::FEED_LOG_ENDPOINT,"upload_api"=>self::FEED_UPLOAD_ENDPOINT);
502
+
503
+ foreach ($textArray as $tKey => $tValue) {
504
+ $label = ucwords(str_replace("_", " ", $tKey));
505
+ $storeValue = Mage::helper('expertrec_recommendation')->getConfig($textToStoreKeyMapArray[$tKey]);
506
+
507
+ $result .= '<div class="form-group">';
508
+ $result .= '<label class="control-label col-sm-2" for="search_'.$tKey.'">'.$label.':</label>';
509
+ $result .= '<div class="col-sm-8">';
510
+
511
+ if(isset($storeValue)){
512
+ $result .= '<input type="text" class="form-control" name="'.$tKey.'" value="'.$storeValue.'" placeholder="'.$tValue.'">';
513
+ }else{
514
+ $result .= '<input type="text" class="form-control" name="'.$tKey.'" placeholder="'.$tValue.'">';
515
+ }
516
+ $result .= '</div>';
517
+ $result .= '</div>';
518
+ }
519
+
520
+ //enable/disable feed upload
521
+ $isUpload = Mage::helper('expertrec_recommendation')->getConfig(self::IS_UPLOAD_FEED);
522
+ $result .= '<div class="row">';
523
+ $result .='<div class="col-sm-offset-2 col-sm-8" style="clear:both;">';
524
+ $result .= '<label class="checkbox-inline" style="padding-left: 20px;">';
525
+ if(isset($isUpload) && $isUpload == 'true'){
526
+ $result .= '<input type="checkbox" name="upload_feed" value="is_upload" checked>';
527
+ }else{
528
+ $result .= '<input type="checkbox" name="upload_feed" value="is_upload">';
529
+ }
530
+ $result .= 'Upload Feed';
531
+ $result .= '</label>';
532
+ $result .= '</div>';
533
+ $result .= '</div>';
534
+
535
+ $result .= '<div style="text-align:center;margin:10px auto;">';
536
+ $result .= '<input type="submit" class="btn btn-md btn-primary" name="feed_conf" value="Submit" style="padding:5px; "/>';
537
+ $result .= '</div>';
538
+
539
+ $result .= '</form>';
540
+ $result .= '</fieldset>';
541
+
542
+ return $result;
543
+ }
544
+
545
+ private function displaySiteDetails(){
546
+ $result = '<fieldset>';
547
+ $result .= '<legend>Site Info</legend>';
548
+ $result .= '<table class="table table-hover">';
549
+ $result .= '<tbody>';
550
+ try{
551
+ $adminEmail = Mage::getStoreConfig('trans_email/ident_general/email');
552
+ $adminName = Mage::getStoreConfig('trans_email/ident_general/name');
553
+ $salesEmail = Mage::getStoreConfig('trans_email/ident_sales/email');
554
+ $salesName = Mage::getStoreConfig('trans_email/ident_sales/name');
555
+ $secureUrl = Mage::getStoreConfig('web/secure/base_url');
556
+ $unsecureUrl = Mage::getStoreConfig('web/unsecure/base_url');
557
+ $baseCurrency = Mage::getStoreConfig('currency/options/base');
558
+ $defaultCurrency = Mage::getStoreConfig('currency/options/default');
559
+ $allowCurrency = Mage::getStoreConfig('currency/options/allow');
560
+ $timezone = Mage::getStoreConfig('general/locale/timezone');
561
+ $defaultCountry = Mage::getStoreConfig('general/country/default');
562
+ $installedCurrency = Mage::getStoreConfig('system/currency/installed');
563
+ }catch(Exception $e){}
564
+
565
+ if(isset($adminName)){
566
+ $result .= '<tr>';
567
+ $result .= '<td style="width: 20%;"><strong>Admin name: </strong></td>';
568
+ $result .= '<td>'.$adminName.'</td>';
569
+ $result .= '</tr>';
570
+ }
571
+ if(isset($adminEmail)){
572
+ $result .= '<tr>';
573
+ $result .= '<td style="width: 20%;"><strong>Admin email: </strong></td>';
574
+ $result .= '<td>'.$adminEmail.'</td>';
575
+ $result .= '</tr>';
576
+ }
577
+ if(isset($salesName)){
578
+ $result .= '<tr>';
579
+ $result .= '<td style="width: 20%;"><strong>Sales name: </strong></td>';
580
+ $result .= '<td>'.$salesName.'</td>';
581
+ $result .= '</tr>';
582
+ }
583
+ if(isset($salesEmail)){
584
+ $result .= '<tr>';
585
+ $result .= '<td style="width: 20%;"><strong>Sales email: </strong></td>';
586
+ $result .= '<td>'.$salesEmail.'</td>';
587
+ $result .= '</tr>';
588
+ }
589
+ if(isset($secureUrl)){
590
+ $result .= '<tr>';
591
+ $result .= '<td style="width: 20%;"><strong>Web secure base url: </strong></td>';
592
+ $result .= '<td>'.$secureUrl.'</td>';
593
+ $result .= '</tr>';
594
+ }
595
+ if(isset($unsecureUrl)){
596
+ $result .= '<tr>';
597
+ $result .= '<td style="width: 20%;"><strong>Web unsecure base url: </strong></td>';
598
+ $result .= '<td>'.$unsecureUrl.'</td>';
599
+ $result .= '</tr>';
600
+ }
601
+ if(isset($baseCurrency)){
602
+ $result .= '<tr>';
603
+ $result .= '<td style="width: 20%;"><strong>Base currency: </strong></td>';
604
+ $result .= '<td>'.$baseCurrency.'</td>';
605
+ $result .= '</tr>';
606
+ }
607
+ if(isset($defaultCurrency)){
608
+ $result .= '<tr>';
609
+ $result .= '<td style="width: 20%;"><strong>Default currency: </strong></td>';
610
+ $result .= '<td>'.$defaultCurrency.'</td>';
611
+ $result .= '</tr>';
612
+ }
613
+ if(isset($allowCurrency)){
614
+ $result .= '<tr>';
615
+ $result .= '<td style="width: 20%;"><strong>Allow currencies: </strong></td>';
616
+ $result .= '<td>'.str_replace(",", ", ",$allowCurrency).'</td>';
617
+ $result .= '</tr>';
618
+ }
619
+ if(isset($defaultCountry)){
620
+ $result .= '<tr>';
621
+ $result .= '<td style="width: 20%;"><strong>Default Country: </strong></td>';
622
+ $result .= '<td>'.$defaultCountry.'</td>';
623
+ $result .= '</tr>';
624
+ }
625
+ if(isset($timezone)){
626
+ $result .= '<tr>';
627
+ $result .= '<td style="width: 20%;"><strong>Timezone: </strong></td>';
628
+ $result .= '<td>'.$timezone.'</td>';
629
+ $result .= '</tr>';
630
+ }
631
+ if(isset($installedCurrency)){
632
+ $result .= '<tr>';
633
+ $result .= '<td style="width: 20%;"><strong>Installed currencies: </strong></td>';
634
+ $result .= '<td>'.str_replace(",", ", ",$installedCurrency).'</td>';
635
+ $result .= '</tr>';
636
+ }
637
+
638
+ try{
639
+ $modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
640
+ $modulesNameArray = array_keys($modulesArray);
641
+
642
+ //displaying list of installed modules
643
+ $result .= '<tr>';
644
+ $result .= '<td style="width: 20%;"><strong>Installed Extensions: </strong></td>';
645
+ $result .= '<td>'.implode(", ", $modulesNameArray).'</td>';
646
+ $result .= '</tr>';
647
+
648
+ //displaying list of active modules
649
+ $activeModules = array();
650
+ $coreHelper = Mage::helper('core');
651
+ foreach ($modulesNameArray as $module) {
652
+ if($coreHelper->isModuleEnabled($module)){
653
+ $activeModules[] = $module;
654
+ }
655
+ }
656
+ $result .= '<tr>';
657
+ $result .= '<td style="width: 20%;"><strong>Active Extensions: </strong></td>';
658
+ $result .= '<td>'.implode(", ", $activeModules).'</td>';
659
+ $result .= '</tr>';
660
+ }catch(Exception $e){$result .= '<tr>';
661
+ $result .= '<tr><td>Error</td><td style="color:red;">'.$e->getMessage().'</td></tr>';
662
+ }
663
+
664
+
665
+ $result .= '</tbody>';
666
+ $result .= '</table>';
667
+ $result .= '</fieldset>';
668
+ return $result;
669
+ }
670
+
671
  }
672
  ?>
app/code/community/Expertrec/Recommendation/controllers/CatalogSearch/ResultController.php CHANGED
@@ -4,10 +4,19 @@ require_once 'Mage/CatalogSearch/controllers/ResultController.php';
4
 
5
  class Expertrec_Recommendation_CatalogSearch_ResultController extends Mage_CatalogSearch_ResultController
6
  {
 
7
  public function indexAction(){
8
  $this->loadLayout();
9
  $this->renderLayout();
10
- }
 
 
 
 
 
 
 
 
11
  }
12
 
13
  ?>
4
 
5
  class Expertrec_Recommendation_CatalogSearch_ResultController extends Mage_CatalogSearch_ResultController
6
  {
7
+
8
  public function indexAction(){
9
  $this->loadLayout();
10
  $this->renderLayout();
11
+ }
12
+
13
+ public function ajaxAction(){
14
+ $requestParams = Mage::app()->getRequest()->getParams();
15
+ $resultData = Mage::helper('expertrec_recommendation/autocompletehelper')
16
+ ->prepareLayer($requestParams);
17
+ header('Content-Type: application/json');
18
+ echo json_encode($resultData);
19
+ }
20
  }
21
 
22
  ?>
app/code/community/Expertrec/Recommendation/etc/config.xml CHANGED
@@ -2,20 +2,15 @@
2
  <config>
3
  <modules>
4
  <Expertrec_Recommendation>
5
- <version>1.1.5</version>
6
  </Expertrec_Recommendation>
7
  </modules>
8
  <global>
9
  <models>
10
  <expertrec_recommendation>
11
  <class>Expertrec_Recommendation_Model</class>
12
- </expertrec_recommendation>
13
- <catalogsearch>
14
- <rewrite>
15
- <layer>Expertrec_Recommendation_Model_Catalogsearch_Layer</layer>
16
- </rewrite>
17
- </catalogsearch>
18
- </models>
19
  <helpers>
20
  <expertrec_recommendation>
21
  <class>Expertrec_Recommendation_Helper</class>
@@ -24,17 +19,14 @@
24
  <blocks>
25
  <expertrec_recommendation>
26
  <class>Expertrec_Recommendation_Block</class>
27
- </expertrec_recommendation>
28
- <catalog>
29
- <rewrite>
30
- <product_list_toolbar>Expertrec_Recommendation_Block_Product_List_Toolbar</product_list_toolbar>
31
- </rewrite>
32
- </catalog>
33
  </blocks>
34
  <resources>
35
  <expertrec_setup>
36
  <setup>
37
  <module>Expertrec_Recommendation</module>
 
 
38
  </setup>
39
  </expertrec_setup>
40
  </resources>
@@ -128,6 +120,17 @@
128
  <frontName>expertrec</frontName>
129
  </args>
130
  </expertrec>
131
- </routers>
 
 
 
 
 
 
 
 
 
 
 
132
  </frontend>
133
  </config>
2
  <config>
3
  <modules>
4
  <Expertrec_Recommendation>
5
+ <version>1.0.12</version>
6
  </Expertrec_Recommendation>
7
  </modules>
8
  <global>
9
  <models>
10
  <expertrec_recommendation>
11
  <class>Expertrec_Recommendation_Model</class>
12
+ </expertrec_recommendation>
13
+ </models>
 
 
 
 
 
14
  <helpers>
15
  <expertrec_recommendation>
16
  <class>Expertrec_Recommendation_Helper</class>
19
  <blocks>
20
  <expertrec_recommendation>
21
  <class>Expertrec_Recommendation_Block</class>
22
+ </expertrec_recommendation>
 
 
 
 
 
23
  </blocks>
24
  <resources>
25
  <expertrec_setup>
26
  <setup>
27
  <module>Expertrec_Recommendation</module>
28
+ <class>Expertrec_Recommendation_Model_Resource_Mysql4_Setup</class>
29
+
30
  </setup>
31
  </expertrec_setup>
32
  </resources>
120
  <frontName>expertrec</frontName>
121
  </args>
122
  </expertrec>
123
+ </routers>
124
+ <events>
125
+ <controller_action_layout_load_before>
126
+ <observers>
127
+ <expertrec_search>
128
+ <type>singleton</type>
129
+ <class>expertrec_recommendation/observer</class>
130
+ <method>useExpertrecSearch</method>
131
+ </expertrec_search>
132
+ </observers>
133
+ </controller_action_layout_load_before>
134
+ </events>
135
  </frontend>
136
  </config>
app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-install-1.0.0.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- $installer = $this;
4
- $installer->startSetup();
5
-
6
- $installer->run("
7
- INSERT INTO {$this->getTable('core_config_data')} (`scope`, `scope_id`, `path`, `value`)
8
- VALUES
9
- ('default',0,'expertrec/general/mid','new_user'),
10
- ('default',0,'expertrec/general/secret','NTE5NTQ1Zjk4OGExYzYxOWFkOTkyN2Y3MDQ5MTQ3NTM='),
11
- ('default',0,'expertrec/general/headers','is_in_stock,expert_image,expert_thumbnail,expert_category,final_price,entity_id,rating_summary,expert_url,created_at,image,msrp,name,price,short_description,sku,small_image,special_price,category_ids'),
12
- ('default',0,'expertrec/general/expertrec_image_width',250),
13
- ('default',0,'expertrec/general/expertrec_image_height',250),
14
- ('default',0,'expertrec/general/expertrec_thumbnail_width',80),
15
- ('default',0,'expertrec/general/expertrec_thumbnail_height',80)
16
- ON DUPLICATE KEY UPDATE `value`=`value`;
17
- ");
18
-
19
- $installer->endSetup();
20
-
21
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-install-1.0.12.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //echo 'Installing extension: '.get_class($this)."\n <br /> \n";
4
+ Mage::log("Installing magento : 1.0.12 ");
5
+
6
+
7
+ $installer = $this;
8
+
9
+ $host = $_SERVER['HTTP_HOST'];
10
+ $uri = $_SERVER['REQUEST_URI'];
11
+
12
+ $installer->startSetup();
13
+
14
+ $result =array();
15
+
16
+ //Status
17
+ $result['status'] = "Installed";
18
+ //Subdomain
19
+ $result['site_subdomain'] = $uri;
20
+ //hostname
21
+ $result['site_host'] = $host;
22
+ //selecting for site_details
23
+ $site_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('core_config_data')} where `path` like '%trans_email%'");
24
+ //site name and email
25
+ $result['site_name'] = $site_data[0]['value'];
26
+ $result['site_email'] = $site_data[1]['value'];
27
+ //selecting for admin_details
28
+ $admin_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('admin_user')}");
29
+ //admin name and email
30
+ $result['admin_firstname'] = $admin_data[0]['firstname'];
31
+ $result['admin_lastname'] = $admin_data[0]['lastname'];
32
+ $result['admin_email'] = $admin_data[0]['email'];
33
+
34
+ $postData = '';
35
+ //create name value pairs seperated by &
36
+ foreach($result as $key => $value)
37
+ {
38
+ $postData .= $key . '='.$value.'&';
39
+ }
40
+ $postData = rtrim($postData, '&');
41
+
42
+ //call install api
43
+ $url = "https://feed.expertrec.com/magento-install/77c3b75abd2842e93b8c52c4aiu8y";
44
+ $curl = curl_init();
45
+ curl_setopt($curl, CURLOPT_URL, $url);
46
+ curl_setopt($curl, CURLOPT_POST, 1);
47
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
48
+ curl_setopt($curl, CURLOPT_TIMEOUT, 130);
49
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
50
+ $response = curl_exec($curl);
51
+ curl_close($curl);
52
+
53
+ $installer->run("
54
+ INSERT INTO {$this->getTable('core_config_data')} (`scope`, `scope_id`, `path`, `value`)
55
+ VALUES
56
+ ('default',0,'expertrec/general/mid','new_user'),
57
+ ('default',0,'expertrec/general/secret','NTE5NTQ1Zjk4OGExYzYxOWFkOTkyN2Y3MDQ5MTQ3NTM='),
58
+ ('default',0,'expertrec/general/log_endpoint','https://feed.expertrec.com/magento/9418bba77c3b75abd2842e93b8c52c4a'),
59
+ ('default',0,'expertrec/general/headers','is_in_stock,expert_image,expert_thumbnail,expert_category,final_price,entity_id,rating_summary,expert_url,created_at,image,msrp,name,price,short_description,sku,small_image,special_price,category_ids'),
60
+ ('default',0,'expertrec/general/expertrec_image_width',250),
61
+ ('default',0,'expertrec/general/expertrec_image_height',250),
62
+ ('default',0,'expertrec/general/expertrec_thumbnail_width',80),
63
+ ('default',0,'expertrec/general/expertrec_thumbnail_height',80)
64
+ ON DUPLICATE KEY UPDATE `value`=`value`;
65
+ ");
66
+
67
+ $installer->endSetup();
68
+
69
+ ?>
app/code/community/Expertrec/Recommendation/sql/expertrec_setup/mysql4-upgrade-1.0.11-1.0.12.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ //echo 'Running The Upgrade from 1.1.5 to 1.1.6 : '.get_class($this)."\n <br /> \n";
4
+ Mage::log("Running The Upgrade from 1.0.11 to 1.0.12 : ".get_class($this));
5
+
6
+ $installer = $this;
7
+
8
+ $host = $_SERVER['HTTP_HOST'];
9
+ $uri = $_SERVER['REQUEST_URI'];
10
+
11
+
12
+ $installer->startSetup();
13
+
14
+ $result =array();
15
+ //status
16
+ $result['status'] = "Upgraded";
17
+ //hostname
18
+ $result['site_host'] = $host;
19
+ //Subdomain
20
+ $result['site_subdomain'] = $uri;
21
+ //selecting for site_details
22
+ $site_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('core_config_data')} where `path` like '%trans_email%'");
23
+ //site name and email
24
+ $result['site_name'] = $site_data[0]['value'];
25
+ $result['site_email'] = $site_data[1]['value'];
26
+ //selecting for admin_details
27
+ $admin_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('admin_user')}");
28
+ //admin name and email
29
+ $result['admin_firstname'] = $admin_data[0]['firstname'];
30
+ $result['admin_lastname'] = $admin_data[0]['lastname'];
31
+ $result['admin_email'] = $admin_data[0]['email'];
32
+
33
+ $postData = '';
34
+ //create name value pairs seperated by &
35
+ foreach($result as $key => $value)
36
+ {
37
+ $postData .= $key . '='.$value.'&';
38
+ }
39
+ $postData = rtrim($postData, '&');
40
+
41
+ //call install api
42
+ $url = "https://feed.expertrec.com/magento-install/77c3b75abd2842e93b8c52c4aiu8y";
43
+ $curl = curl_init();
44
+ curl_setopt($curl, CURLOPT_URL, $url);
45
+ curl_setopt($curl, CURLOPT_POST, 1);
46
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
47
+ curl_setopt($curl, CURLOPT_TIMEOUT, 130);
48
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
49
+ $response = curl_exec($curl);
50
+ curl_close($curl);
51
+
52
+ $installer->run("
53
+ INSERT INTO {$this->getTable('core_config_data')} (`scope`, `scope_id`, `path`, `value`)
54
+ VALUES
55
+ ('default',0,'expertrec/general/mid','new_user'),
56
+ ('default',0,'expertrec/general/secret','NTE5NTQ1Zjk4OGExYzYxOWFkOTkyN2Y3MDQ5MTQ3NTM='),
57
+ ('default',0,'expertrec/general/log_endpoint','https://feed.expertrec.com/magento/9418bba77c3b75abd2842e93b8c52c4a'),
58
+ ('default',0,'expertrec/general/headers','is_in_stock,expert_image,expert_thumbnail,expert_category,final_price,entity_id,rating_summary,expert_url,created_at,image,msrp,name,price,short_description,sku,small_image,special_price,category_ids'),
59
+ ('default',0,'expertrec/general/expertrec_image_width',250),
60
+ ('default',0,'expertrec/general/expertrec_image_height',250),
61
+ ('default',0,'expertrec/general/expertrec_thumbnail_width',80),
62
+ ('default',0,'expertrec/general/expertrec_thumbnail_height',80)
63
+ ON DUPLICATE KEY UPDATE `value`=`value`;
64
+ ");
65
+
66
+ $installer->endSetup();
67
+
68
+ ?>
app/design/frontend/base/default/layout/expertrec/recommendation.xml CHANGED
@@ -5,16 +5,45 @@
5
  <reference name="head">
6
  <block name="expertrec.rec.tracking" template="expertrec/recommendation/tracker.phtml" after="-" type="core/template"/>
7
  </reference>
8
- </default>
9
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  <expertrec_custom_autocomplete>
11
  <remove name="right"/>
12
  <remove name="left"/>
13
  <reference name="root">
14
  <action method="setTemplate"><template>page/1column.phtml</template></action>
15
- </reference>
 
 
 
 
16
  </expertrec_custom_autocomplete>
17
- <!--route the infoAction function in ApiController to info.phtml, which can access Api.php block functions-->
 
 
 
 
18
  <expertrec_recommendation_api_info>
19
  <reference name="root">
20
  <action method="setTemplate"><template>page/1column.phtml</template></action>
5
  <reference name="head">
6
  <block name="expertrec.rec.tracking" template="expertrec/recommendation/tracker.phtml" after="-" type="core/template"/>
7
  </reference>
8
+ </default>
9
+ <!-- PRODUCT PAGE -->
10
+ <catalog_product_view>
11
+ <reference name="before_body_end">
12
+ <block name="expertrec.rec.analytics.producttracking" template="expertrec/recommendation/tracking/product.phtml" after="-" type="core/template"/>
13
+ </reference>
14
+ </catalog_product_view>
15
+
16
+ <!-- Search -->
17
+ <expertrec_autocomplete>
18
+ <reference name="root">
19
+ <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
20
+ </reference>
21
+ <reference name="catalogsearch.leftnav">
22
+ <action method="setTemplate">
23
+ <value>expertrec/search/view.phtml</value>
24
+ </action>
25
+ </reference>
26
+ <remove name="search.result"/>
27
+ <reference name="content">
28
+ <block type="core/template" name="search_result_list" template="expertrec/search/list.phtml"/>
29
+ </reference>
30
+ </expertrec_autocomplete>
31
  <expertrec_custom_autocomplete>
32
  <remove name="right"/>
33
  <remove name="left"/>
34
  <reference name="root">
35
  <action method="setTemplate"><template>page/1column.phtml</template></action>
36
+ </reference>
37
+ <remove name="search.result"/>
38
+ <reference name="content">
39
+ <block type="core/template" name="expertrec_search_result" template="expertrec/search/custom.phtml"/>
40
+ </reference>
41
  </expertrec_custom_autocomplete>
42
+ <expertrec_result_index>
43
+ <reference name="left">
44
+ <block type="core/template" name="expertrec.leftnav" after="currency" template="expertrec/search/view.phtml"/>
45
+ </reference>
46
+ </expertrec_result_index>
47
  <expertrec_recommendation_api_info>
48
  <reference name="root">
49
  <action method="setTemplate"><template>page/1column.phtml</template></action>
app/design/frontend/base/default/template/expertrec/feed/info.phtml CHANGED
@@ -41,6 +41,7 @@
41
  <h4 style='margin:20px auto 10px;'>Extension Version: <span style='color:red;'><?php echo (string)Mage::getConfig()->getNode('modules/Expertrec_Recommendation/version')?></span></h4>
42
  <h4 style='margin:10px auto;'>Extension Build No.: <span style='color:red;'><?php echo Mage::registry('buildno'); ?></span></h4>
43
  <h4 style='margin:10px auto;'>Magento Version: <span style='color:red;'><?php echo Mage::getVersion(); ?></span></h4>
 
44
  <ul class="nav nav-tabs" style="margin-top:20px;">
45
  <li class="active"><a data-toggle="tab" href="#apiSection">Api</a></li>
46
  <li><a data-toggle="tab" href="#feedHeader">Feed Header</a></li>
@@ -87,6 +88,7 @@
87
  <th>Website Name</th>
88
  <th>Store ID</th>
89
  <th>Store Name</th>
 
90
  <th>Total# Products</th>
91
  <th>Url</th>
92
  </tr>
@@ -98,6 +100,7 @@
98
  <td style="text-align:center;"><?php echo $_item['wname'] ?></td>
99
  <td style="text-align:center;"><?php echo $_item['sid'] ?></td>
100
  <td style="text-align:center;"><?php echo $_item['sname'] ?></td>
 
101
  <?php if(isset($_item['pcount'])): ?>
102
  <td style="text-align:center;"><?php echo $_item['pcount'] ?></td>
103
  <?php endif;?>
@@ -107,7 +110,13 @@
107
  </td>
108
  <?php endif;?>
109
 
110
- <td><a href = "<?php echo $_item['surl'] ?>"><?php echo $_item['surl'] ?></a></td>
 
 
 
 
 
 
111
  </tr>
112
  <?php endforeach; ?>
113
  </tbody>
@@ -125,13 +134,14 @@
125
  <?php
126
  $customImageUrl = $this->getCustomApiUrl()."&width=170&height=170";
127
 
128
- if(isset($imageParams["imgwidth"]) && isset($imageParams["imgheight"])){
 
129
  $customImageUrl = $this->getCustomApiUrl()."&width=".$imageParams["imgwidth"]."&height=".$imageParams["imgheight"];
130
  }
131
- elseif(isset($imageParams["imgwidth"])){
132
  $customImageUrl =$this->getCustomApiUrl()."&width=".$imageParams["imgwidth"]."&height=170";
133
  }
134
- elseif(isset($imageParams["imgheight"])){
135
  $customImageUrl =$this->getCustomApiUrl()."&width=170&height=".$imageParams["imgheight"];
136
  }
137
 
@@ -139,43 +149,99 @@
139
 
140
  <fieldset>
141
  <legend>Example</legend>
142
- <p><b>With Custom Image</b></p>
143
- <p><a href="<?php echo $this->getCustomApiUrl().'&width=170&height=170' ?>">
144
- <?php echo $customImageUrl ?>
145
- </a></p>
146
- <p><b>With pagination without page size(default page size is 500)</b></p>
147
- <p><a href="<?php echo $this->getCustomApiUrl().'&ps=1&pe=2' ?>">
148
- <?php echo $this->getCustomApiUrl().'&ps=1&pe=2' ?></a></p>
149
- <p><b>With pagination without page size(default page size is 500)</b></p>
150
- <p><a href="<?php echo $this->getCustomApiUrl().'&ps=1&pe=2&psize=50' ?>">
151
- <?php echo $this->getCustomApiUrl().'&ps=1&pe=2&psize=50' ?></a></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  </fieldset>
153
  </div>
154
  <div style="margin-top:20px">
155
  <fieldset>
156
  <legend>Getting Popular Products Api</legend>
157
- <p><b>Without pagination</b></p>
158
- <p><a href="<?php echo $this->getSuggestionApiUrl() ?>">
159
- <?php echo $this->getSuggestionApiUrl() ?></a></p>
160
- <p><b>With pagination without page size(default page size is 500)</b></p>
161
- <p><a href="<?php echo $this->getSuggestionApiUrl().'&ps=1&pe=2' ?>">
162
- <?php echo $this->getSuggestionApiUrl().'&ps=1&pe=2' ?></a></p>
163
- <p><b>With pagination without page size(default page size is 500)</b></p>
164
- <p><a href="<?php echo $this->getSuggestionApiUrl().'&ps=1&pe=2&psize=50' ?>">
165
- <?php echo $this->getSuggestionApiUrl().'&ps=1&pe=2&psize=50' ?></a></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  </fieldset>
167
  </div>
168
  <div style="margin-top:20px">
169
  <fieldset>
170
  <legend>Getting log & Cleaning Expertrec Directory Api's</legend>
171
- <p><b>Get Log Url</b></p>
172
- <p><a href="<?php echo $this->getLogUrl() ?>">
173
- <?php echo $this->getLogUrl() ?></a></p>
174
- <p><b>Get Cleandir Url</b></p>
175
- <p><a href="<?php echo $this->getCleanDirUrl() ?>" target="_blank">
176
- <?php echo $this->getCleanDirUrl() ?></a></p>
 
 
 
 
 
 
177
  </fieldset>
178
  </div>
 
 
 
 
 
 
 
 
 
 
 
179
  </div>
180
  <!--End of API Info section-->
181
 
41
  <h4 style='margin:20px auto 10px;'>Extension Version: <span style='color:red;'><?php echo (string)Mage::getConfig()->getNode('modules/Expertrec_Recommendation/version')?></span></h4>
42
  <h4 style='margin:10px auto;'>Extension Build No.: <span style='color:red;'><?php echo Mage::registry('buildno'); ?></span></h4>
43
  <h4 style='margin:10px auto;'>Magento Version: <span style='color:red;'><?php echo Mage::getVersion(); ?></span></h4>
44
+ <h4 style='margin:10px auto;'>Merchant ID: <span style='color:red;'><?php echo $this->getMerchantID(); ?></span></h4>
45
  <ul class="nav nav-tabs" style="margin-top:20px;">
46
  <li class="active"><a data-toggle="tab" href="#apiSection">Api</a></li>
47
  <li><a data-toggle="tab" href="#feedHeader">Feed Header</a></li>
88
  <th>Website Name</th>
89
  <th>Store ID</th>
90
  <th>Store Name</th>
91
+ <th>Store Language</th>
92
  <th>Total# Products</th>
93
  <th>Url</th>
94
  </tr>
100
  <td style="text-align:center;"><?php echo $_item['wname'] ?></td>
101
  <td style="text-align:center;"><?php echo $_item['sid'] ?></td>
102
  <td style="text-align:center;"><?php echo $_item['sname'] ?></td>
103
+ <td style="text-align:center;"><?php echo Mage::getStoreConfig('general/locale/code', $_item['sid']); ?></td>
104
  <?php if(isset($_item['pcount'])): ?>
105
  <td style="text-align:center;"><?php echo $_item['pcount'] ?></td>
106
  <?php endif;?>
110
  </td>
111
  <?php endif;?>
112
 
113
+ <!-- <td><a href = "<?php //echo $_item['surl'] ?>"><?php //echo $_item['surl'] ?></a></td> -->
114
+ <!-- form post request -->
115
+ <td><form method="post" action="<?php echo $_item['surl'] ?>" id="webform<?php echo $_item['sid']; ?>" name="webform<?php echo $_item['sid']; ?>">
116
+ <p><?php echo $_item['surl'] ?></p>
117
+ <button type="submit" id ="websubmit<?php echo $_item['sid']; ?>" name ="websubmit<?php echo $_item['sid']; ?>">submit</button>
118
+ </form></td>
119
+
120
  </tr>
121
  <?php endforeach; ?>
122
  </tbody>
134
  <?php
135
  $customImageUrl = $this->getCustomApiUrl()."&width=170&height=170";
136
 
137
+ if((isset($imageParams["imgwidth"]) && $imageParams["imgwidth"] != "")
138
+ && (isset($imageParams["imgheight"]) && $imageParams["imgheight"] != "")){
139
  $customImageUrl = $this->getCustomApiUrl()."&width=".$imageParams["imgwidth"]."&height=".$imageParams["imgheight"];
140
  }
141
+ elseif(isset($imageParams["imgwidth"]) && $imageParams["imgwidth"] != ""){
142
  $customImageUrl =$this->getCustomApiUrl()."&width=".$imageParams["imgwidth"]."&height=170";
143
  }
144
+ elseif(isset($imageParams["imgheight"]) && $imageParams["imgheight"] != ""){
145
  $customImageUrl =$this->getCustomApiUrl()."&width=170&height=".$imageParams["imgheight"];
146
  }
147
 
149
 
150
  <fieldset>
151
  <legend>Example</legend>
152
+ <!-- form post request -->
153
+ <form method="post" action="<?php echo $this->getCustomApiUrl()?>" id="custImgForm" name="custImgForm">
154
+ <p><b>With Custom Image</b></p>
155
+ <!-- <p><a href="<?php //echo $this->getCustomApiUrl().'&width=170&height=170' ?>"><?php //echo $customImageUrl ?></a></p> -->
156
+ <p><?php echo $this->getCustomApiUrl().'&width=170&height=170' ?></p>
157
+ <input type="hidden" name="width" value="170">
158
+ <input type="hidden" name="height" value="170">
159
+ <button id="custsub" name="custsub" type="submit" name="onsubmit" value="custom">submit</button>
160
+ </form>
161
+
162
+ <form method="post" action="<?php echo $this->getCustomApiUrl()?>">
163
+ <p><b>With pagination without page size(default page size is 500)</b></p>
164
+ <!-- <p><a href="<?php //echo $this->getCustomApiUrl().'&ps=1&pe=2' ?>">
165
+ <?php //echo $this->getCustomApiUrl().'&ps=1&pe=2' ?></a></p> -->
166
+ <p><?php echo $this->getCustomApiUrl().'&ps=1&pe=2' ?></p>
167
+ <input type="hidden" name="ps" value="1">
168
+ <input type="hidden" name="pe" value="2">
169
+ <button type="submit" name="onsubmit" value="custom_nosize">submit</button>
170
+ </form>
171
+
172
+ <form method="post" action="<?php echo $this->getCustomApiUrl()?>" id="custform1" name="custform1">
173
+ <p><b>With pagination without page size(default page size is 500)</b></p>
174
+ <!-- <p><a href="<?php //echo $this->getCustomApiUrl().'&ps=1&pe=2&psize=50' ?>">
175
+ <?php //echo $this->getCustomApiUrl().'&ps=1&pe=2&psize=50' ?></a></p> -->
176
+ <p><?php echo $this->getCustomApiUrl().'&ps=1&pe=2&psize=50' ?></p>
177
+ <input type="hidden" name="ps" value="1">
178
+ <input type="hidden" name="pe" value="2">
179
+ <input type="hidden" name="psize" value="50">
180
+ <button id="custimgsub" name="custimgsub" type="submit" name="onsubmit" value="custom_size">submit</button>
181
+ </form>
182
+
183
  </fieldset>
184
  </div>
185
  <div style="margin-top:20px">
186
  <fieldset>
187
  <legend>Getting Popular Products Api</legend>
188
+ <!-- form post request -->
189
+ <form method="post" action="<?php echo $this->getSuggestionApiUrl() ?>" id="sugform" name="sugform">
190
+ <p><b>Without pagination</b></p>
191
+ <!-- <p><a href="<?php //echo $this->getSuggestionApiUrl() ?>"><?php //echo $this->getSuggestionApiUrl() ?></a></p> -->
192
+ <p><?php echo $this->getSuggestionApiUrl() ?></p>
193
+ <button id="sugsub" name="sugsub" type="submit" name="onsubmit" value="sugg">submit</button>
194
+ </form>
195
+
196
+ <form id="sug1form" name="sug1form" method="post" action="<?php echo $this->getSuggestionApiUrl() ?>">
197
+ <p><b>With pagination without page size(default page size is 500)</b></p>
198
+ <!-- <p><a href="<?php //echo $this->getSuggestionApiUrl().'&ps=1&pe=2' ?>"><?php //echo $this->getSuggestionApiUrl().'&ps=1&pe=2' ?></a></p> -->
199
+ <p><?php echo $this->getSuggestionApiUrl().'&ps=1&pe=2' ?></p>
200
+ <input type="hidden" name="ps" value="1">
201
+ <input type="hidden" name="pe" value="2">
202
+ <button id="sug1sub" name="sug1sub" type="submit" name="onsubmit" value="sugg_nosize">submit</button>
203
+ </form>
204
+
205
+ <form method="post" id="sug2form" name="sug2form" action="<?php echo $this->getSuggestionApiUrl() ?>">
206
+ <p><b>With pagination without page size(default page size is 500)</b></p>
207
+ <!-- <p><a href="<?php //echo $this->getSuggestionApiUrl().'&ps=1&pe=2&psize=50' ?>"><?php //echo $this->getSuggestionApiUrl().'&ps=1&pe=2&psize=50' ?></a></p> -->
208
+ <p><?php echo $this->getSuggestionApiUrl().'&ps=1&pe=2&psize=50' ?></p>
209
+ <input type="hidden" name="ps" value="1">
210
+ <input type="hidden" name="pe" value="2">
211
+ <input type="hidden" name="psize" value="50">
212
+ <button id="sug2sub" name="sug2sub" type="submit" name="onsubmit" value="sugg_size">submit</button>
213
+ </form>
214
+
215
  </fieldset>
216
  </div>
217
  <div style="margin-top:20px">
218
  <fieldset>
219
  <legend>Getting log & Cleaning Expertrec Directory Api's</legend>
220
+ <form id="logform" name="logform" method="post" action="<?php echo $this->getLogUrl() ?>">
221
+ <p><b>Get Log Url</b></p>
222
+ <!-- <p><a href="<?php echo $this->getLogUrl() ?>"><?php echo $this->getLogUrl() ?></a></p> -->
223
+ <p><?php echo $this->getLogUrl() ?></p>
224
+ <button id="logsub" name="logsub" type="submit">submit</button>
225
+ </form>
226
+ <form id="cleanform" name="cleanform" method="post" action="<?php echo $this->getCleanDirUrl() ?>" target="_blank">
227
+ <p><b>Get Cleandir Url</b></p>
228
+ <!-- <p><a href="<?php //echo $this->getCleanDirUrl() ?>" target="_blank"><?php //echo $this->getCleanDirUrl() ?></a></p> -->
229
+ <p><?php echo $this->getCleanDirUrl() ?></p>
230
+ <button id="cleansub" name="cleansub" type="submit">submit</button>
231
+ </form>
232
  </fieldset>
233
  </div>
234
+ <!-- xml-file
235
+ <div style="margin-top:20px">
236
+ <fieldset>
237
+ <legend>Xml File</legend>
238
+ <form method="post" action="<?php //echo $this->getBaseUrl().'xml.php';?>" target="_blank">
239
+ <input type="hidden" name="secret" value="<?php //echo $this->getSecret();?>">
240
+ <p><?php //echo $this->getBaseUrl().'xml.php'; ?></p>
241
+ <button type="submit">submit</button>
242
+ </form>
243
+ </fieldset>
244
+ </div>-->
245
  </div>
246
  <!--End of API Info section-->
247
 
app/design/frontend/base/default/template/expertrec/recommendation/tracker.phtml CHANGED
@@ -4,7 +4,7 @@
4
  <?php $category = Mage::registry("current_category");?>
5
  <?php
6
  $formKey = '';
7
- $currencyRates = array();
8
  try{
9
  $formkey_html = $this->getBlockHtml('formkey');
10
  $pattern = '/.*form_key.*value=\"([^\"]+)\"/s';
@@ -13,13 +13,6 @@ try{
13
  $formKey = $match[1];
14
  }
15
  }
16
-
17
- //currency rate
18
- $baseCurrencyCode = Mage::app()->getBaseCurrencyCode();
19
- $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
20
- $currencyRates = Mage::getModel('directory/currency')
21
- ->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));
22
-
23
  } catch (Exception $e){
24
  Mage::logException($e);
25
  }
@@ -33,9 +26,6 @@ if(typeof expertSiteConf == 'undefined' || expertSiteConf == null) {
33
  <?php if (isset($category)) { ?>
34
  ,category:"<?php echo $category->getName(); ?>"
35
  <?php } ?>
36
- <?php if (!empty($currencyRates)) { ?>
37
- ,rates: <?php echo json_encode($currencyRates); ?>
38
- <?php } ?>
39
  };
40
  }
41
 
4
  <?php $category = Mage::registry("current_category");?>
5
  <?php
6
  $formKey = '';
7
+
8
  try{
9
  $formkey_html = $this->getBlockHtml('formkey');
10
  $pattern = '/.*form_key.*value=\"([^\"]+)\"/s';
13
  $formKey = $match[1];
14
  }
15
  }
 
 
 
 
 
 
 
16
  } catch (Exception $e){
17
  Mage::logException($e);
18
  }
26
  <?php if (isset($category)) { ?>
27
  ,category:"<?php echo $category->getName(); ?>"
28
  <?php } ?>
 
 
 
29
  };
30
  }
31
 
app/design/frontend/base/default/template/expertrec/search/custom.phtml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
2
+ <div id="expertrec_search_result_list"></div>
app/design/frontend/base/default/template/expertrec/search/list.phtml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="page-title">
2
+ <h1>
3
+ <?php echo ($this->getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?>
4
+ </h1>
5
+ </div>
6
+
7
+ <div id="expertrec_search_result_list">
8
+ <?php
9
+ echo Mage::registry('expertrec_search_list');
10
+ ?>
11
+ </div>
12
+
13
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
14
+ <script type="text/javascript">
15
+ var erjq=jQuery.noConflict(true);function erOpenFilter(){erjq("#er_Filteroption").css("width","100%");erjq("body").css("overflow","hidden")}function erCloseFilter(){erjq("#er_Filteroption").css("width","0px");erjq("body").css("overflow","visible")}function erShowProduct(a){var c=a,d=c.listHtml||"",b=c.facetHtml||"";d&&erjq("#expertrec_search_result_list").html(d);b&&erjq("#expertrec_search_result_navigation").html(b);if(typeof erDisplayPriceFilter=="function"){erDisplayPriceFilter()}erjq("#expertrec-overlay").css("display","none");erAttachFilterEvent();erToggleNavigation()}function erMakeDealsCall(a){erjq.ajax({url:a,type:"GET",dataType:"json",success:erShowProduct,error:function(){erjq("#expertrec-overlay").css("display","none")}})}function erToggleNavigation(){erjq(".toggle-content").each(function(){var a=erjq(this);var c=a.hasClass("tabs");var g=a.hasClass("accordion");var e=a.hasClass("open");var j=a.children("dl:first");var d=j.children("dt");var l=j.children("dd");var b=new Array(d,l);if(c){var k=erjq('<ul class="toggle-tabs"></ul>');d.each(function(){var n=erjq(this);var i=erjq("<li></li>");i.html(n.html());k.append(i)});k.insertBefore(j);var m=k.children();b.push(m)}var f;for(f=0;f<b.length;f++){b[f].filter(":last").addClass("last")}function h(o,q){var n=q.index(o);var p;for(p=0;p<b.length;p++){b[p].removeClass("current");b[p].eq(n).addClass("current")}}d.on("click",function(i){if(erjq(this).hasClass("current")&&a.hasClass("accordion-open")){a.removeClass("accordion-open")}else{a.addClass("accordion-open")}h(erjq(this),d)});if(c){m.on("click",function(i){h(erjq(this),m)});m.eq(0).trigger("click")}if(e){d.eq(0).trigger("click")}})}erjq(document).ready(function(){var a=function(){if(erjq(window).width()<=771){erjq("#er_Filteroption").css("width","0px");erjq("#expertrec_search_result_navigation").prependTo(erjq("#expertrec_search_result_list"))}else{erjq("#er_Filteroption").css("width","100%");erjq(".col-left").first().prepend(erjq("#expertrec_search_result_navigation"))}};a();erjq(window).resize(function(){a()})});
16
+
17
+ <?php if(Mage::helper('expertrec_recommendation/search_layout')->getIsAjax()){ ?>
18
+
19
+ function erAttachFilterEvent(){erjq("#er_Filteroption .filter-search a").each(function(){var b=this,c="",e="",d=[],a=erjq(window).width();erjq(this).click(function(){if(a<771){erCloseFilter()}erjq("#expertrec-overlay").css("display","block");c=erjq(b).find("input").val();if(c){d=c.split("?");if(d.length==2){e=/\/$/.test(d[0])?d[0]+"ajax":d[0]+"/ajax";e+="?"+d[1];e=typeof erGetFilterPrice=="function"?erGetFilterPrice(e):e;erMakeDealsCall(e)}else{window.location.href=c}}})})}erjq(document).ready(function(){erAttachFilterEvent()});
20
+
21
+ <?php }?>
22
+
23
+ </script>
app/design/frontend/base/default/template/expertrec/search/view.phtml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
2
+ <style type="text/css">
3
+ #expertrec_search_result_list .note-msg {color:red;font-size:1.2em;}#er_Filteroption .no-display {display: block !important;}#expertrec_search_result_list .products-grid>li{position:relative;margin-bottom:20px;text-align:center}#expertrec_search_result_list .products-grid>li{float:left;width:47.72727%;}#expertrec_search_result_list .products-grid>li:nth-child(2n+1){clear:left}#expertrec_search_result_list .products-grid .product-image{margin-bottom:5px;text-align:center;margin-left:auto;margin-right:auto;display:block;width:100%}#expertrec_search_result_list .products-grid .product-info{min-height:inherit!important;padding-bottom:10px!important;position:relative}#expertrec_search_result_list .products-grid .product-name,#expertrec_search_result_list .products-list .product-name{text-transform:uppercase;margin-bottom:5px;font-size:14px;font-weight:normal;line-height:1.4;font-style:normal}#expertrec_search_result_list .products-grid .actions{position:relative;bottom:0;padding-top:10px;min-height:85px;width:100%;font-size:14px}#expertrec_search_result_list .add-to-links{margin:7px 0}#expertrec_search_result_list .add-to-links a{display:inline-block;padding:0 3px 3px}#expertrec_search_result_list .products-grid li.item button.btn-cart{width:100%}#expertrec_search_result_list .currently ol li .value,#expertrec_search_result_list .currently ol li .multivalue{padding:0 10px}#expertrec_search_result_list .currently ol li .label{text-transform:capitalize;font-weight:bold}#expertrec_search_result_list .currently ol li{margin-bottom:5px}#expertrec_search_result_list .currently ol li::after{content:'';display:table;clear:both}#expertrec_search_result_navigation .mobile-only,#expertrec_search_result_navigation p.mobile-only{display:none}#expertrec_search_result_navigation .listing-filter{display:none}#er_Filteroption .toggle-content .block-subtitle{float:none;text-align:center}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled .block-content>dl>dd{background:#fff}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled dl dd ol>li>a .count{color:#949494;font-size:12px}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled dl dd ol>li>a.expertrec-attr-selected{color:#5a647c}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled dl dd ol>li>a.expertrec-attr-selected:hover{text-decoration:none}#expertrec_search_result_navigation .block-layered-nav.expertrec-overflow-scroll-enabled .currently ol{padding-left:0;margin-bottom:10px}#expertrec_search_result_navigation #narrow-by-list{border-radius:3px;box-shadow:0 0 4px rgba(0,0,0,.2)}#expertrec_search_result_navigation .expertrec-overflow-scroll-enabled .block-content dl dd>ol{max-height:250px;overflow-y:auto}.expertrec-filter-attr .fa-square-o,.expertrec-filter-cat .fa-square-o{display:inline-block}.expertrec-filter-attr .fa-check-square-o,.expertrec-filter-cat .fa-check-square-o{display:none}.expertrec-filter-attr-selected .fa-square-o,.expertrec-filter-cat-selected .fa-square-o{display:none}.expertrec-filter-attr-selected .fa-check-square-o,.expertrec-filter-cat-selected .fa-check-square-o{display:inline-block}#expertrec-overlay{display:none;background-color:#000;height:100%;left:0;opacity:.7;filter:alpha(opacity= 50);position:fixed;top:0;width:100%;z-index:999}#expertrec-overlay img{top:45%;left:48%;display:block;position:fixed;z-index:900}#expertrec_search_result_list .products-grid .actions{position:relative;bottom:0}#expertrec_search_result_list .products-grid .product-info{min-height:inherit!important;padding-bottom:10px!important}#expertrec_search_result_list .products-grid .product-image img{width:100%;height:auto}@media only screen and (max-width:770px){#er_Filteroption .block-title{display:none}#expertrec_search_result_navigation .expertrec-overflow-scroll-enabled .block-content dl dd>ol{max-height:150px}#expertrec_search_result_navigation .mobile-only,#expertrec_search_result_navigation p.mobile-only{display:block}#expertrec_search_result_navigation .mobile-filter-closer{text-align:center;padding:10px 5px;background:#f04f25;color:#fff;width:99%;margin:10px auto;max-width:300px;clear:both;cursor:pointer}#expertrec_search_result_navigation .listing-filter{display:block;font-size:12px}#expertrec_search_result_navigation .listing-filter{display:block;border:1px solid #e7e7e7;text-align:center;margin-bottom:15px;width:80%;margin:0 auto 15px;padding:10px 5px;border-radius:5px}#expertrec_search_result_navigation .overlay-filter{height:100%;width:0;position:fixed;z-index:2000;top:0;left:0;background-color:#f3f3f3;overflow-x:hidden;transition:.5s}}@media only screen and (max-width:600px){#expertrec_search_result_list .products-list .desc{display:none}}@media only screen and (min-width:480px){#expertrec_search_result_list .products-grid>li:nth-child(odd){clear:none}#expertrec_search_result_list .products-grid>li:nth-child(even){margin-right:3.7037%}#expertrec_search_result_list .products-grid>li{width:30.8642%;margin-right:3.7037%}#expertrec_search_result_list .products-grid>li:nth-child(3n+1){clear:left}#expertrec_search_result_list .products-grid>li:nth-child(3n){margin-right:0}}
4
+ </style>
5
+
6
+
7
+ <div id="expertrec_search_result_navigation">
8
+ <?php
9
+ $expertrec_search_navigation = Mage::registry('expertrec_search_navigation');
10
+ echo $expertrec_search_navigation;
11
+ ?>
12
+ </div>
13
+
14
+ <div id="expertrec-overlay">
15
+ <img src="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif">
16
+ </div>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Expertrec_Recommendation</name>
4
- <version>1.1.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Expertrec search extension helps you have complete control over your site search results. You will be able to add instant autocomplete, spell corrections that learn from the user behaviour on your site, and show product recommendations within the search user interface. It also adds search results pages with facets, sorting by different attributes.</description>
11
  <notes>Expertrec Recommendation plugin for magento sites.</notes>
12
  <authors><author><name>melchi</name><user>melchi</user><email>magento@cloudinfra.in</email></author><author><name>magento</name><user>magento</user><email>magento-team@cloudinfra.in</email></author></authors>
13
- <date>2017-02-14</date>
14
- <time>05:58:12</time>
15
- <contents><target name="magecommunity"><dir name="Expertrec"><dir name="Recommendation"><dir name="Block"><file name="Api.php" hash="f606f34d734d892701b88b97b1b49c83"/><dir name="Product"><dir name="List"><file name="Toolbar.php" hash="bd05a0d7473829c47662e6b763907ea6"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="364ab05880bed5e6a02f20bcca1b993c"/><file name="Filehelper.php" hash="5ac956e12548398dc159a16eb1a03e8b"/><dir name="Search"><file name="Layout.php" hash="d7b7ec5f4bbd846dd063934f8a267d48"/></dir><file name="Searchhelper.php" hash="dfc4fc81fea519c15517f53645488c7a"/><file name="Suggestionhelper.php" hash="93f3aa295761a510f782856c0180a799"/></dir><dir name="Model"><dir name="Api"><file name="Request.php" hash="7df8b22d74b6a05de86da287687a6e96"/></dir><dir name="Catalogsearch"><file name="Layer.php" hash="2b6252ed8bb4c44d0a1c44b2e7dcc1d8"/></dir><dir name="Feed"><file name="Feedconfig.php" hash="013bd447dccc7cc4f073be5bd53a18c9"/><file name="Feedcreator.php" hash="fa6cf4590cf81073325b6717c8951486"/><file name="Feedfilter.php" hash="d7599a63a8d1f2033cb1e56204809c2d"/><file name="Formatter.php" hash="cb0d747319ef70e122c3558edaf89626"/></dir><file name="Feed.php" hash="ddac87d6a060bc77fb7718e7b19e1273"/><file name="Log.php" hash="27fcee49e67fe2be761b4af94aecff2b"/><file name="Observer.php" hash="5aedaf6c18314b6abee906577e77767f"/><dir name="Translator"><file name="Category.php" hash="dd209cdda3a1a62042a8a3360ee2dbac"/></dir><file name="Validate.php" hash="7a5fd226b0055e39b725975113e42ee5"/><dir name="Writer"><file name="Abstract.php" hash="6b5153c0a09f8d4ee6fe4cedc5ec8a64"/><file name="Csv.php" hash="427fea44d988302f409e1860c18875b1"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="c4f80c214d11fd531496e71b4951b27f"/></dir><file name="ApiController.php" hash="936f1ab4a41a2cdc893ce3e2940e9e43"/><dir name="CatalogSearch"><file name="ResultController.php" hash="9cb1406e901701ea58e663433358a4c6"/></dir><file name="ConfigController.php" hash="0fd9a9686806c26635c7db0a57a0f4ab"/><file name="IndexController.php" hash="7bfaa867dfa9bed0c7b0ebd634d2e2bb"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e86ff2b7aac4d09a4c359f0047b06ca3"/><file name="config.xml" hash="e081e8db7d726968795d765511f397f3"/></dir><dir name="sql"><dir name="expertrec_setup"><file name="mysql4-install-1.0.0.php" hash="4e7e163698fdca36df8c3dd2bd4ceef7"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Expertrec_Recommendation.xml" hash="c314465f907c89dfe912035be8d48e71"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="expertrec"><file name="recommendation.xml" hash="061b28ab9009ff2346977cebe2333cb8"/></dir></dir><dir name="template"><dir name="expertrec"><dir name="feed"><file name="info.phtml" hash="28ea4ca6cae0760c0ab1867908769695"/></dir><dir name="recommendation"><file name="tracker.phtml" hash="c4da6289ad644d96d7dac9b5521ae3a1"/><dir name="tracking"><file name="product.phtml" hash="e02d3f870397cf351bc0ff7ca864c7e2"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Expertrec_Recommendation</name>
4
+ <version>1.0.12</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
10
  <description>Expertrec search extension helps you have complete control over your site search results. You will be able to add instant autocomplete, spell corrections that learn from the user behaviour on your site, and show product recommendations within the search user interface. It also adds search results pages with facets, sorting by different attributes.</description>
11
  <notes>Expertrec Recommendation plugin for magento sites.</notes>
12
  <authors><author><name>melchi</name><user>melchi</user><email>magento@cloudinfra.in</email></author><author><name>magento</name><user>magento</user><email>magento-team@cloudinfra.in</email></author></authors>
13
+ <date>2017-02-17</date>
14
+ <time>12:42:47</time>
15
+ <contents><target name="magecommunity"><dir name="Expertrec"><dir name="Recommendation"><dir name="Block"><file name="Api.php" hash="b46b5a13bf53bf0cac27dcd3ff935e3b"/></dir><dir name="Helper"><file name="Autocompletehelper.php" hash="7bd733d91f69091c1f6f5bb162467a43"/><file name="Data.php" hash="8a2760edc960d6a1bc72d80e73944cb3"/><file name="Filehelper.php" hash="5ac956e12548398dc159a16eb1a03e8b"/><dir name="Search"><file name="Layout.php" hash="c68c9d6c4def7daca0a0ae332dceaff3"/></dir><file name="Suggestionhelper.php" hash="93f3aa295761a510f782856c0180a799"/></dir><dir name="Model"><dir name="Api"><file name="Request.php" hash="7df8b22d74b6a05de86da287687a6e96"/></dir><dir name="Feed"><file name="Feedconfig.php" hash="013bd447dccc7cc4f073be5bd53a18c9"/><file name="Feedcreator.php" hash="fa6cf4590cf81073325b6717c8951486"/><file name="Feedfilter.php" hash="d7599a63a8d1f2033cb1e56204809c2d"/><file name="Formatter.php" hash="cb0d747319ef70e122c3558edaf89626"/></dir><file name="Feed.php" hash="ddac87d6a060bc77fb7718e7b19e1273"/><file name="Log.php" hash="27fcee49e67fe2be761b4af94aecff2b"/><file name="Observer.php" hash="2c332472ed4cd1ccea25bec705dbda06"/><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="6b660487988035cd715fa3c51b2b58b6"/></dir></dir><dir name="Translator"><file name="Category.php" hash="dd209cdda3a1a62042a8a3360ee2dbac"/></dir><file name="Validate.php" hash="2d4619284f24309b77668f07cb1ef9f4"/><dir name="Writer"><file name="Abstract.php" hash="6b5153c0a09f8d4ee6fe4cedc5ec8a64"/><file name="Csv.php" hash="427fea44d988302f409e1860c18875b1"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="IndexController.php" hash="c4f80c214d11fd531496e71b4951b27f"/></dir><file name="ApiController.php" hash="ecac6b8b12bf66054253a8daa75260f5"/><dir name="CatalogSearch"><file name="ResultController.php" hash="e740f44c0cef4aa83545f2278626e7de"/></dir><file name="ConfigController.php" hash="0fd9a9686806c26635c7db0a57a0f4ab"/><file name="IndexController.php" hash="7bfaa867dfa9bed0c7b0ebd634d2e2bb"/></dir><dir name="etc"><file name="adminhtml.xml" hash="e86ff2b7aac4d09a4c359f0047b06ca3"/><file name="config.xml" hash="cdf3396edf6d407254a5ebecdf6b7f8a"/></dir><dir name="sql"><dir name="expertrec_setup"><file name="mysql4-install-1.0.12.php" hash="b551735fc7591093270c2f77aad819f3"/><file name="mysql4-upgrade-1.0.11-1.0.12.php" hash="a0a91e227fc6af9befc4189c0a042ee5"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Expertrec_Recommendation.xml" hash="c314465f907c89dfe912035be8d48e71"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="expertrec"><file name="recommendation.xml" hash="a1d166c3c3e665b476aaef69e0e6b792"/></dir></dir><dir name="template"><dir name="expertrec"><dir name="feed"><file name="info.phtml" hash="e386121a2d08b754ace87ab8a146e941"/></dir><dir name="recommendation"><file name="tracker.phtml" hash="6e8219c5d1e46642d7915cedaa974313"/><dir name="tracking"><file name="product.phtml" hash="e02d3f870397cf351bc0ff7ca864c7e2"/></dir></dir><dir name="search"><file name="custom.phtml" hash="0f162aa949c00329e3697f0a71abc43d"/><file name="list.phtml" hash="cda3f434a1e70f1272f62bb9f0848726"/><file name="view.phtml" hash="ecb9a55f6128bef2f10d66528dc5424b"/></dir></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>