Expertrec_Recommendation - Version 1.2.7

Version Notes

Expertrec Recommendation plugin for magento sites.

Download this release

Release Info

Developer melchi
Extension Expertrec_Recommendation
Version 1.2.7
Comparing to
See all releases


Code changes from version 1.2.6 to 1.2.7

app/code/community/Expertrec/Recommendation/Block/Api.php CHANGED
@@ -170,6 +170,13 @@ class Expertrec_Recommendation_Block_Api extends Mage_Core_Block_Template{
170
  }catch(Exception $e){
171
  $websiteStoreRow["pcounterr"] = $e.getMessage();
172
  }
 
 
 
 
 
 
 
173
 
174
  array_push($websiteStoreData,$websiteStoreRow);
175
  }
@@ -220,8 +227,8 @@ class Expertrec_Recommendation_Block_Api extends Mage_Core_Block_Template{
220
  "search_enable"=>self::SEARCH_LIST_ENABLE,
221
  "fetch_price"=>self::SEARCH_FETCH_PRICE,
222
  "convert_price"=>self::SEARCH_CONVERT_PRICE,
223
- "is_ajax"=>self::SEARCH_IS_AJAX,
224
- "custom_template"=>self::SEARCH_CUSTOM_TEMPLATE);
225
 
226
  foreach ($chekboxArray as $cKey => $cValue)
227
  {
170
  }catch(Exception $e){
171
  $websiteStoreRow["pcounterr"] = $e.getMessage();
172
  }
173
+ try{
174
+ $filteredCollection = $feedFilter->addBasicFilter($website,$oStore);
175
+ $websiteStoreRow["fcount"] = $filteredCollection->getSize();
176
+
177
+ }catch(Exception $e){
178
+ $websiteStoreRow["fcounterr"] = $e.getMessage();
179
+ }
180
 
181
  array_push($websiteStoreData,$websiteStoreRow);
182
  }
227
  "search_enable"=>self::SEARCH_LIST_ENABLE,
228
  "fetch_price"=>self::SEARCH_FETCH_PRICE,
229
  "convert_price"=>self::SEARCH_CONVERT_PRICE,
230
+ "is_ajax"=>self::SEARCH_IS_AJAX);
231
+ // "custom_template"=>self::SEARCH_CUSTOM_TEMPLATE);
232
 
233
  foreach ($chekboxArray as $cKey => $cValue)
234
  {
app/code/community/Expertrec/Recommendation/Helper/Data.php CHANGED
@@ -50,7 +50,7 @@ class Expertrec_Recommendation_Helper_Data extends Mage_Core_Helper_Abstract {
50
  $path = self::CONFIG_PREFIX . '/' . $key;
51
  Mage::getConfig()->saveConfig(rtrim($path, '/'), (string)$value, $scope, $scopeId);
52
 
53
- Mage::getSingleton('expertrec_recommendation/log')->log( "Successfully updated : <".$key."> in core_config_data table.");
54
  return $this;
55
  }
56
 
@@ -90,7 +90,7 @@ class Expertrec_Recommendation_Helper_Data extends Mage_Core_Helper_Abstract {
90
  }
91
  else
92
  {
93
- Mage::getSingleton("expertrec_recommendation/log")->log("Data received:");
94
  }
95
  }
96
  else
50
  $path = self::CONFIG_PREFIX . '/' . $key;
51
  Mage::getConfig()->saveConfig(rtrim($path, '/'), (string)$value, $scope, $scopeId);
52
 
53
+ // Mage::getSingleton('expertrec_recommendation/log')->log( "Successfully updated : <".$key."> in core_config_data table.");
54
  return $this;
55
  }
56
 
90
  }
91
  else
92
  {
93
+ // Mage::getSingleton("expertrec_recommendation/log")->log("Data received:");
94
  }
95
  }
96
  else
app/code/community/Expertrec/Recommendation/Helper/Filehelper.php CHANGED
@@ -3,7 +3,7 @@
3
  class Expertrec_Recommendation_Helper_Filehelper extends Mage_Core_Helper_Abstract{
4
 
5
  public function createFeedZipFile($rootPath,$zipFileName) {
6
- Mage::getSingleton('expertrec_recommendation/log')->log("Feed compression initiated");
7
 
8
  if(!is_dir($rootPath)){return $this;}
9
 
3
  class Expertrec_Recommendation_Helper_Filehelper extends Mage_Core_Helper_Abstract{
4
 
5
  public function createFeedZipFile($rootPath,$zipFileName) {
6
+ // Mage::getSingleton('expertrec_recommendation/log')->log("Feed compression initiated");
7
 
8
  if(!is_dir($rootPath)){return $this;}
9
 
app/code/community/Expertrec/Recommendation/Helper/Suggestionhelper.php CHANGED
@@ -19,13 +19,13 @@ class Expertrec_Recommendation_Helper_Suggestionhelper extends Mage_Core_Helper_
19
  return false;
20
  }
21
 
22
- $logger->log("Beginning ".$this->_fileName." export for store #".$storeId);
23
  $logger->logMemoryUsage();
24
- $logger->log("Initialising file writers...");
25
  $this->initWriters($oStore, $this->_fileName);
26
 
27
  // Prepare the csv file header
28
- $logger->log("Begin preparing header rows...");
29
 
30
  //if any error occur during header writing, it will return false
31
  if(!$this->prepareHeaders()){
19
  return false;
20
  }
21
 
22
+ // $logger->log("Beginning ".$this->_fileName." export for store #".$storeId);
23
  $logger->logMemoryUsage();
24
+ // $logger->log("Initialising file writers...");
25
  $this->initWriters($oStore, $this->_fileName);
26
 
27
  // Prepare the csv file header
28
+ // $logger->log("Begin preparing header rows...");
29
 
30
  //if any error occur during header writing, it will return false
31
  if(!$this->prepareHeaders()){
app/code/community/Expertrec/Recommendation/Model/Feed/Feedconfig.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  class Expertrec_Recommendation_Model_Feed_Feedconfig {
4
 
5
- var $pageSize=500;
6
  var $imageWidth = 250;
7
  var $imageHeight = 250;
8
  var $generateImage=false;
@@ -72,7 +72,7 @@ class Expertrec_Recommendation_Model_Feed_Feedconfig {
72
  $this->pageEnd = (int)$en;
73
  return $this;
74
  }
75
- public function setPageSize($size=500) {
76
  $this->pageSize = (int)$size;
77
  return $this;
78
  }
2
 
3
  class Expertrec_Recommendation_Model_Feed_Feedconfig {
4
 
5
+ var $pageSize=50;
6
  var $imageWidth = 250;
7
  var $imageHeight = 250;
8
  var $generateImage=false;
72
  $this->pageEnd = (int)$en;
73
  return $this;
74
  }
75
+ public function setPageSize($size=50) {
76
  $this->pageSize = (int)$size;
77
  return $this;
78
  }
app/code/community/Expertrec/Recommendation/Model/Feed/Feedcreator.php CHANGED
@@ -22,11 +22,11 @@ class Expertrec_Recommendation_Model_Feed_Feedcreator {
22
  try{
23
  $logger->log("Beginning $vFeedname export for store #".$oStore->getId()." - ".$oStore->getName());
24
  $logger->logMemoryUsage();
25
- $logger->log("Initialising file writers...");
26
  $this->initWriters($oStore, $vFeedname);
27
 
28
  // Prepare the csv file header
29
- $logger->log("Begin preparing header rows...");
30
  $logger->logMemoryUsage();
31
 
32
  //if any error occur during header writing, it will return false
@@ -35,10 +35,10 @@ class Expertrec_Recommendation_Model_Feed_Feedcreator {
35
  }
36
 
37
  // Initialise the formatter
38
- $logger->log("Initialising Feed Formatter...");
39
  $formatter = Mage::getSingleton('expertrec_recommendation/feed_formatter');
40
  $formatter->init();
41
- $logger->log("Initialised Feed Formatter.");
42
 
43
  $logger->logMemoryUsage();
44
 
22
  try{
23
  $logger->log("Beginning $vFeedname export for store #".$oStore->getId()." - ".$oStore->getName());
24
  $logger->logMemoryUsage();
25
+ // $logger->log("Initialising file writers...");
26
  $this->initWriters($oStore, $vFeedname);
27
 
28
  // Prepare the csv file header
29
+ // $logger->log("Begin preparing header rows...");
30
  $logger->logMemoryUsage();
31
 
32
  //if any error occur during header writing, it will return false
35
  }
36
 
37
  // Initialise the formatter
38
+ // $logger->log("Initialising Feed Formatter...");
39
  $formatter = Mage::getSingleton('expertrec_recommendation/feed_formatter');
40
  $formatter->init();
41
+ // $logger->log("Initialised Feed Formatter.");
42
 
43
  $logger->logMemoryUsage();
44
 
app/code/community/Expertrec/Recommendation/Model/Feed/Formatter.php CHANGED
@@ -50,15 +50,6 @@ class Expertrec_Recommendation_Model_Feed_Formatter {
50
  case 'qty':
51
  $vValue = (int)$product->getData("qty");
52
  break;
53
- // case 'filter_by_stock':
54
- // $vValue = 0;
55
- // break;
56
- // case 'filter_by_status':
57
- // $vValue = 2;
58
- // break;
59
- // case 'filter_by_visiblity':
60
- // $vValue = array(1,2,3,4);
61
- // break;
62
  default:
63
  $attributedata = Mage::getSingleton("eav/config")->getAttribute('catalog_product', $skey)->getData();
64
  $vValue =$product->getData($skey);
50
  case 'qty':
51
  $vValue = (int)$product->getData("qty");
52
  break;
 
 
 
 
 
 
 
 
 
53
  default:
54
  $attributedata = Mage::getSingleton("eav/config")->getAttribute('catalog_product', $skey)->getData();
55
  $vValue =$product->getData($skey);
app/code/community/Expertrec/Recommendation/Model/Observer.php CHANGED
@@ -325,7 +325,7 @@ class Expertrec_Recommendation_Model_Observer {
325
  $logger = Mage::getSingleton('expertrec_recommendation/log');
326
  $category = $observer->getEvent()->getCategory();
327
 
328
- $logger->log("Hook on category after save");
329
 
330
  // get category url
331
  $store = Mage::app()->getStore();
@@ -344,9 +344,13 @@ class Expertrec_Recommendation_Model_Observer {
344
  array_shift($pathNameArray);
345
  $category_path = implode('/', $pathNameArray);
346
 
 
 
 
347
  $categoryArray = array('categoryId' => $category->getId(),
348
  'categoryName' => $category->getName(),
349
- 'categoryPath' => $category_path,
 
350
  'categoryUrl' => $category_url);
351
 
352
  // passing category to identify category url
@@ -382,9 +386,6 @@ class Expertrec_Recommendation_Model_Observer {
382
  ->setPrepareRequestStatus(true)
383
  ->sendRequest();
384
 
385
-
386
-
387
-
388
  if(!$response) {
389
  $logger->log('request failed for category with Id #'.$category->getId());
390
  }
@@ -453,62 +454,62 @@ class Expertrec_Recommendation_Model_Observer {
453
  // }
454
 
455
 
456
- //public function addWishlist(Varien_Event_Observer $observer) {
457
 
458
- //$wishListItemCollection = $observer->getItems();
459
- //if (count($wishListItemCollection)) {
460
- //$arrProductIds = array();
461
- //foreach ($wishListItemCollection as $item) {
462
  /* @var $product Mage_Catalog_Model_Product */
463
- // $product = $item->getProduct();
464
  // $arrProductIds[] = $product->getId();
465
- //}
466
- //}else{
467
- // Mage::getSingleton('expertrec_recommendation/log')->log('AddToWishlist_Track: wishListItemCollection count is 0',Zend_Log::ERR);
468
- //return $this;
469
- //}
470
 
471
- //if(!$product instanceof Mage_Catalog_Model_Product) {
472
- // Mage::getSingleton('expertrec_recommendation/log')->log('AddToWishlist_Track: product is not a valid type',Zend_Log::ERR);
473
- // return $this;
474
- //}
475
 
476
  // added url to track rtr
477
- //$lastUrl = Mage::getSingleton('core/session')->getLastUrl();
478
- //$currUrl = Mage::helper('core/url')->getCurrentUrl();
479
- //$ci_id = $_COOKIE['ci_id'];
480
 
481
  // Mage::getSingleton('core/session')->setCartLastUrl($lastUrl);
482
  // Mage::getSingleton('core/session')->setCartCurrUrl($currUrl);
483
 
484
  //return unique product id
485
- //$uniqueId = Mage::helper('expertrec_recommendation')->getUniqueId($product);
486
 
487
  //sending request
488
  //return boolean
489
- //$response = Mage::getModel('expertrec_recommendation/api_request')
490
- // ->setPrepareRequestStatus(false)
491
- // ->setData(array(
492
- // 'ci_id' => $ci_id,
493
- // 'lastUrl' => $lastUrl,
494
- // 'currUrl' => $currUrl,
495
- // 'item' => $uniqueId,
496
- // 'event' => 17,
497
- // 'sku' => $product->getSku(),
498
- // 'domain' => $_SERVER['HTTP_HOST'],
499
- // 'ip' => isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'])
500
-
501
- // )
502
- // ->setHeader("User-Agent",$_SERVER['HTTP_USER_AGENT'])
503
- // ->prepareRequest()
504
- // ->sendRequest();
505
 
506
  // Mage::getSingleton('expertrec_recommendation/log')->log("AddToWishlist_Track: request made with uniqueId ".$uniqueId);
507
- //if(!$response) {
508
- // Mage::getSingleton('expertrec_recommendation/log')->log('AddToWishlist_Track: request failed for product with uniqueId #'.$uniqueId,Zend_Log::ERR);
509
- //}
510
- //return $this;
511
- //}
512
 
513
 
514
 
325
  $logger = Mage::getSingleton('expertrec_recommendation/log');
326
  $category = $observer->getEvent()->getCategory();
327
 
328
+ // $logger->log("Hook on category after save");
329
 
330
  // get category url
331
  $store = Mage::app()->getStore();
344
  array_shift($pathNameArray);
345
  $category_path = implode('/', $pathNameArray);
346
 
347
+ array_shift($pathIdArray);
348
+ $category_id_path = implode('/', $pathIdArray);
349
+
350
  $categoryArray = array('categoryId' => $category->getId(),
351
  'categoryName' => $category->getName(),
352
+ 'categoryIdPath' => $category_id_path,
353
+ 'categoryNamePath' => $category_path,
354
  'categoryUrl' => $category_url);
355
 
356
  // passing category to identify category url
386
  ->setPrepareRequestStatus(true)
387
  ->sendRequest();
388
 
 
 
 
389
  if(!$response) {
390
  $logger->log('request failed for category with Id #'.$category->getId());
391
  }
454
  // }
455
 
456
 
457
+ public function addWishlist(Varien_Event_Observer $observer) {
458
 
459
+ $wishListItemCollection = $observer->getItems();
460
+ if (count($wishListItemCollection)) {
461
+ $arrProductIds = array();
462
+ foreach ($wishListItemCollection as $item) {
463
  /* @var $product Mage_Catalog_Model_Product */
464
+ $product = $item->getProduct();
465
  // $arrProductIds[] = $product->getId();
466
+ }
467
+ }else{
468
+ Mage::getSingleton('expertrec_recommendation/log')->log('AddToWishlist_Track: wishListItemCollection count is 0',Zend_Log::ERR);
469
+ return $this;
470
+ }
471
 
472
+ if(!$product instanceof Mage_Catalog_Model_Product) {
473
+ Mage::getSingleton('expertrec_recommendation/log')->log('AddToWishlist_Track: product is not a valid type',Zend_Log::ERR);
474
+ return $this;
475
+ }
476
 
477
  // added url to track rtr
478
+ $lastUrl = Mage::getSingleton('core/session')->getLastUrl();
479
+ $currUrl = Mage::helper('core/url')->getCurrentUrl();
480
+ $ci_id = $_COOKIE['ci_id'];
481
 
482
  // Mage::getSingleton('core/session')->setCartLastUrl($lastUrl);
483
  // Mage::getSingleton('core/session')->setCartCurrUrl($currUrl);
484
 
485
  //return unique product id
486
+ $uniqueId = Mage::helper('expertrec_recommendation')->getUniqueId($product);
487
 
488
  //sending request
489
  //return boolean
490
+ $response = Mage::getModel('expertrec_recommendation/api_request')
491
+ ->setPrepareRequestStatus(false)
492
+ ->setData(array(
493
+ 'ci_id' => $ci_id,
494
+ 'lastUrl' => $lastUrl,
495
+ 'currUrl' => $currUrl,
496
+ 'item' => $uniqueId,
497
+ 'event' => 17,
498
+ 'sku' => $product->getSku(),
499
+ 'domain' => $_SERVER['HTTP_HOST'],
500
+ 'ip' => isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'])
501
+
502
+ )
503
+ ->setHeader("User-Agent",$_SERVER['HTTP_USER_AGENT'])
504
+ ->prepareRequest()
505
+ ->sendRequest();
506
 
507
  // Mage::getSingleton('expertrec_recommendation/log')->log("AddToWishlist_Track: request made with uniqueId ".$uniqueId);
508
+ if(!$response) {
509
+ Mage::getSingleton('expertrec_recommendation/log')->log('AddToWishlist_Track: request failed for product with uniqueId #'.$uniqueId,Zend_Log::ERR);
510
+ }
511
+ return $this;
512
+ }
513
 
514
 
515
 
app/code/community/Expertrec/Recommendation/Model/Translator/Category.php CHANGED
@@ -29,7 +29,7 @@ class Expertrec_Recommendation_Model_Translator_Category {
29
  $curPath=$this->_getCategoryIdPath($category_id);
30
  }
31
 
32
- if(!empty($curPath) && !in_array($curPath, $categoryPathArray)){
33
  $categoryPathArray[] = $curPath;
34
  }
35
  }
29
  $curPath=$this->_getCategoryIdPath($category_id);
30
  }
31
 
32
+ if(!empty($curPath)){
33
  $categoryPathArray[] = $curPath;
34
  }
35
  }
app/code/community/Expertrec/Recommendation/controllers/ApiController.php CHANGED
@@ -17,17 +17,20 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
17
  const SEARCH_CUSTOM_TEMPLATE = 'search/custom_template';
18
  const FEED_LOG_ENDPOINT = 'expertrec/general/log_endpoint';
19
  const FEED_UPLOAD_ENDPOINT = 'expertrec/general/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
  const CONFIG_SECRET = 'expertrec/general/secret';
 
27
 
28
 
29
- const BUILD_NO = "1490608866";
30
  private $_password;
 
 
31
 
32
  //main function which loads the feed API
33
  public function infoAction()
@@ -119,6 +122,7 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
119
  <th>Store Name</th>
120
  <th>Store Language</th>
121
  <th>Total# Products</th>
 
122
  <th>Url</th>
123
  </tr>
124
  </thead>
@@ -154,6 +158,13 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
154
  }catch(Exception $e){
155
  echo '<td style="text-align:center;"><b style="color:red;">Error: </b>'.$e->getMessage().'</td>';
156
  }
 
 
 
 
 
 
 
157
 
158
  echo '<td>
159
  <form method="post" action="'.$store_url.'">
@@ -242,7 +253,7 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
242
 
243
  echo $this->displaySuggestionApi($baseUrl);
244
  echo $this->displayLogApi($baseUrl);
245
- // pull feed from info page
246
  echo $this->displayPullFeed($baseUrl);
247
  ?>
248
 
@@ -498,7 +509,8 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
498
 
499
  $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);
500
 
501
- $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);
 
502
 
503
  // input
504
  foreach ($textArray as $tKey => $tValue) {
@@ -724,7 +736,7 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
724
  $result .= '</fieldset>';
725
  return $result;
726
  }
727
- // pull feed from info page
728
  public function displayPullFeed($baseUrl){
729
  $result = '<div style="margin-top:20px">';
730
  $result .= '<fieldset>';
@@ -750,19 +762,37 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
750
  */
751
  public function getMidSecret(){
752
 
753
- $logger = Mage::getSingleton('expertrec_recommendation/log');;
754
  $feedConfig = Mage::getSingleton('expertrec_recommendation/feed_feedconfig');
755
 
756
  $mid = Mage::getStoreConfig(self::MERCHANT_ID);
757
  $secret = Mage::getStoreConfig(self::CONFIG_SECRET);
758
- $website_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
759
- $admin_email = Mage::getStoreConfig('trans_email/ident_general/email'); //fetch sender email Admin
760
- $admin_name = Mage::getStoreConfig('trans_email/ident_general/name'); //fetch sender name Admin
761
 
762
  // checking mid set/not
763
  if($mid == "new_user"){
764
 
765
- $siteArray =array('website_url' => $website_url, 'admin_email'=>$admin_email,'admin_name'=>$admin_name);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766
  $apiUrl = "http://magento.expertrec.com/20ff3ab58c9cd8ad52e24501cc46c84c/getSecretMid";
767
  try{
768
  // send request
@@ -814,6 +844,8 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
814
  $websitecount = $websiteCollection->getSize();
815
  foreach ($websiteCollection as $website){
816
  $websiteId=$website->getWebsiteId();
 
 
817
  foreach ($website->getGroups() as $group) {
818
  // all stores
819
  $stores = $group->getStores();
@@ -821,6 +853,8 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
821
  foreach ($stores as $oStore) {
822
 
823
  $storeId=$oStore->getId();
 
 
824
  // get all products
825
  $collection = $filter->addBasicFilter($website,$oStore);
826
  $count = $collection->getSize();
@@ -829,13 +863,11 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
829
  $storeCount--;
830
  }
831
  $collection->clear();
832
-
833
  }
834
  }
835
 
836
- // $logger->log("product count ".print_r($array,1));
837
 
838
- $array_count = array('secrete' => $secret, 'product_count' => $array );
839
  // sending request
840
  $response = Mage::getModel('expertrec_recommendation/api_request')
841
  ->setPrepareRequestStatus(false)
@@ -847,24 +879,64 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
847
  ->setPrepareRequestStatus(true)
848
  ->sendRequest();
849
 
850
- //$logger->log('UserFeedPush_Track: request with product count sent');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
851
  if(!$response) {
852
  $logger->log('UserFeedPush_Track: request failed for total_count');
853
  }
854
  }
855
 
 
856
  /*
857
- Push feed per product
858
  */
859
  public function pushFeedAction(){
860
  $logger = Mage::getSingleton('expertrec_recommendation/log');
861
 
 
 
 
862
  //Increase memory limit
863
  ini_set('memory_limit', '1024M');
864
  //Increase maximum execution time to 5 hours (default in magento)
865
  set_time_limit(18000);
866
 
867
- //$logger->log("checking for mid and secret");
868
  // set&get mid and secret if mid is new_user
869
  $data = $this->getMidSecret();
870
  $mid = $data['merchantid'];
@@ -874,12 +946,25 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
874
  $feedUrl = "https://feed.expertrec.com/magento/n01eba6261ad7f174cd3a16523e86e65/";
875
  // finalurl added with merchant id
876
  $finalUrl = $feedUrl.''.$mid.'/';
 
 
 
 
 
 
 
 
877
  // calculate number of products and send
878
  $this->getProductCount($finalUrl,$secret);
879
 
 
 
 
 
 
880
  $filter = Mage::getSingleton('expertrec_recommendation/feed_feedfilter');
881
  $formatter = Mage::getSingleton('expertrec_recommendation/feed_formatter')
882
- ->init();
883
  $feedConfig = Mage::getSingleton('expertrec_recommendation/feed_feedconfig');
884
  // get headers
885
  $storedHeaders = Mage::getStoreConfig(self::CONFIG_HEADERS);
@@ -891,106 +976,121 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
891
  $header = array();
892
  }
893
  if(!empty($header)){
894
- // all website
895
- $websiteCollection = Mage::getModel('core/website')->getCollection()->load();
896
- // $websitecount = count($websiteCollection);
897
- $websitecount = $websiteCollection->getSize();
898
- foreach ($websiteCollection as $website){
899
- $websiteId=$website->getWebsiteId();
900
- foreach ($website->getGroups() as $group) {
901
- // all stores
902
- $stores = $group->getStores();
903
- foreach ($stores as $oStore) {
904
- $storeId=$oStore->getId();
905
-
906
- $collection=$filter->addBasicFilter($website,$oStore)
907
- ->setPageSize($feedConfig->pageSize);
908
 
909
- $pageEnd = $feedConfig->pageEnd;
910
- $lastPageNumber = $collection->getLastPageNumber();
911
 
912
- if($pageEnd != 0 && $pageEnd < $lastPageNumber){
913
- $pages = $pageEnd;
 
 
 
 
 
914
  }
915
  else{
916
- $pages = $lastPageNumber;
917
- }
918
- $logger->log("Total no. of pages for which we are collecting feed in this reqeust: #".$pages);
919
-
920
- for($currentPage = $feedConfig->pageStart; $currentPage <= $pages; $currentPage++) {
921
- $logger->log("Collecting feed for page: #".$currentPage);
922
- $collection->setCurPage($currentPage);
923
-
924
- // // get all products
925
- // $collection = $filter->addBasicFilter($website,$oStore);
926
- foreach ($collection as $product) {
927
- try{
928
-
929
- $resultArray = $formatter->prepareRow($header,$product);
930
- $resultArray['storeId'] = $storeId;
931
- $resultArray['websiteId'] = $websiteId;
932
- // $logger->log("Result Array ".print_r($resultArray,1));
933
-
934
- //sending request
935
- $response = Mage::getModel('expertrec_recommendation/api_request')
936
- ->setPrepareRequestStatus(false)
937
- ->setUserId('expertrec')
938
- ->setUrl($finalUrl)
939
- ->setMethod(Zend_Http_Client::POST)
940
- ->setData($resultArray)
941
- ->setHeader("Content-Type",'application/json')
942
- ->setPrepareRequestStatus(true)
943
- ->sendRequest();
944
-
945
- // $logger->log('UserFeedPush_Track: request succeded for product with Id #'.$product->getId().' of store '.$storeId);
946
- if(!$response) {
947
- $logger->log('UserFeedPush_Track: request failed for product with Id #'.$product->getId());
948
- }
949
-
950
  }
951
- catch (Exception $e) {
952
- $logger->log("UserFeedPush_Track error: ".$e->getMessage());
953
  }
954
- }
955
- $collection->clear();
956
- }
957
- }
958
- }
959
- $websitecount--;
960
- }
961
- // check for feed completion
962
- if($websitecount == 0){
963
- $array = array('completed' => 1, );
964
- $response = Mage::getModel('expertrec_recommendation/api_request')
965
- ->setPrepareRequestStatus(false)
966
- ->setUserId('expertrec')
967
- ->setUrl($finalUrl)
968
- ->setMethod(Zend_Http_Client::GET)
969
- ->setData($array)
970
- ->setHeader("Content-Type",'application/json')
971
- ->setPrepareRequestStatus(true)
972
- ->sendRequest();
973
-
974
- $logger->log('UserFeedPush_Track: request completed');
975
- if(!$response) {
976
- $logger->log('UserFeedPush_Track: Request not complete');
977
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
978
  }
979
- $logger->logMemoryUsage();
980
- // update db to 1 once feed pushed
981
- Mage::helper("expertrec_recommendation")->saveConfig('expertrec_feed_push','1');
982
  }
 
983
  }
984
 
985
  /*
986
  upload feed by user
987
  */
988
  public function feedAction(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
989
  $this->pushFeedAction();
990
- return $this->_redirectReferer();
991
  }
992
-
993
- /*
994
  pull feed from info page
995
  */
996
  public function pullFeedAction(){
@@ -1020,4 +1120,4 @@ class Expertrec_Recommendation_ApiController extends Mage_Core_Controller_Front_
1020
  }
1021
  }
1022
 
1023
- }
17
  const SEARCH_CUSTOM_TEMPLATE = 'search/custom_template';
18
  const FEED_LOG_ENDPOINT = 'expertrec/general/log_endpoint';
19
  const FEED_UPLOAD_ENDPOINT = 'expertrec/general/upload_endpoint';
20
+ const IS_UPLOAD_FEED = 'expertrec/general/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
  const CONFIG_SECRET = 'expertrec/general/secret';
27
+ const PUSHED_FEED_PAGES = 'expertrec/general/expertrec_feed_pushed_pages';
28
 
29
 
30
+ const BUILD_NO = "1491991376";
31
  private $_password;
32
+ private $_websiteId = array();
33
+ private $_storeId = array();
34
 
35
  //main function which loads the feed API
36
  public function infoAction()
122
  <th>Store Name</th>
123
  <th>Store Language</th>
124
  <th>Total# Products</th>
125
+ <th>Filtered Products</th>
126
  <th>Url</th>
127
  </tr>
128
  </thead>
158
  }catch(Exception $e){
159
  echo '<td style="text-align:center;"><b style="color:red;">Error: </b>'.$e->getMessage().'</td>';
160
  }
161
+ try{
162
+ $filteredCollection = $feedFilter->addBasicFilter($website,$oStore);
163
+ $fcount = $filteredCollection->getSize();
164
+ echo '<td style="text-align:center;">'.$fcount.'</td>';
165
+ }catch(Exception $e){
166
+ echo '<td style="text-align:center;"><b style="color:red;">Error: </b>'.$e->getMessage().'</td>';
167
+ }
168
 
169
  echo '<td>
170
  <form method="post" action="'.$store_url.'">
253
 
254
  echo $this->displaySuggestionApi($baseUrl);
255
  echo $this->displayLogApi($baseUrl);
256
+ // pull feed from info page
257
  echo $this->displayPullFeed($baseUrl);
258
  ?>
259
 
509
 
510
  $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);
511
 
512
+ $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);
513
+ // ,"custom_template"=>self::SEARCH_CUSTOM_TEMPLATE);
514
 
515
  // input
516
  foreach ($textArray as $tKey => $tValue) {
736
  $result .= '</fieldset>';
737
  return $result;
738
  }
739
+ // pull feed from info page
740
  public function displayPullFeed($baseUrl){
741
  $result = '<div style="margin-top:20px">';
742
  $result .= '<fieldset>';
762
  */
763
  public function getMidSecret(){
764
 
765
+ $logger = Mage::getSingleton('expertrec_recommendation/log');
766
  $feedConfig = Mage::getSingleton('expertrec_recommendation/feed_feedconfig');
767
 
768
  $mid = Mage::getStoreConfig(self::MERCHANT_ID);
769
  $secret = Mage::getStoreConfig(self::CONFIG_SECRET);
 
 
 
770
 
771
  // checking mid set/not
772
  if($mid == "new_user"){
773
 
774
+ $siteArray = array();
775
+ //get admin-user details
776
+ $userData = Mage::getResourceModel('admin/user_collection')->getData();
777
+ $siteArray['admin_email'] = $userData[0]['email'];
778
+ $siteArray['admin_name'] = $userData[0]['firstname'].' '.$userData[0]['lastname'];
779
+ //get site details
780
+ $siteArray['website_url'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
781
+ $siteArray['site_email'] = Mage::getStoreConfig('trans_email/ident_general/email');
782
+ $siteArray['site_name'] = Mage::getStoreConfig('trans_email/ident_general/name');
783
+ $siteArray['site_host'] = $_SERVER['HTTP_HOST'];
784
+ $siteArray['site_subdomain'] = $_SERVER['SCRIPT_NAME'];
785
+ $siteArray['site_protocol'] = $_SERVER['REQUEST_SCHEME'];
786
+ //ver & host
787
+ $siteArray['mage_ver'] = Mage::getVersion();
788
+ $siteArray['php_ver'] = phpversion();
789
+ $siteArray['expertrec_ver'] = '1.2.7';
790
+ // currency details
791
+ $siteArray['baseCurrency'] = Mage::app()->getStore()->getBaseCurrencyCode();
792
+ $baseCurrencyCode = Mage::app()->getBaseCurrencyCode();
793
+ $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
794
+ $siteArray['currencyRates'] = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));
795
+
796
  $apiUrl = "http://magento.expertrec.com/20ff3ab58c9cd8ad52e24501cc46c84c/getSecretMid";
797
  try{
798
  // send request
844
  $websitecount = $websiteCollection->getSize();
845
  foreach ($websiteCollection as $website){
846
  $websiteId=$website->getWebsiteId();
847
+
848
+ $this->_websiteId[] = $websiteId;
849
  foreach ($website->getGroups() as $group) {
850
  // all stores
851
  $stores = $group->getStores();
853
  foreach ($stores as $oStore) {
854
 
855
  $storeId=$oStore->getId();
856
+
857
+ $this->_storeId[] = $storeId;
858
  // get all products
859
  $collection = $filter->addBasicFilter($website,$oStore);
860
  $count = $collection->getSize();
863
  $storeCount--;
864
  }
865
  $collection->clear();
 
866
  }
867
  }
868
 
869
+ $array_count = array('site_host' => $_SERVER['HTTP_HOST'], 'secrete' => $secret, 'product_count' => $array );
870
 
 
871
  // sending request
872
  $response = Mage::getModel('expertrec_recommendation/api_request')
873
  ->setPrepareRequestStatus(false)
879
  ->setPrepareRequestStatus(true)
880
  ->sendRequest();
881
 
882
+ $logger->log('UserFeedPush_Track: request with product count sent');
883
+ if(!$response) {
884
+ $logger->log('UserFeedPush_Track: request failed for total_count');
885
+ }
886
+ }
887
+
888
+ /*
889
+ Send currency details
890
+ */
891
+ public function getCurrency($finalUrl){
892
+ $logger = Mage::getSingleton('expertrec_recommendation/log');
893
+
894
+ $baseCurrency = Mage::app()->getStore()->getBaseCurrencyCode();
895
+ $currCurrency = Mage::app()->getStore()->getCurrentCurrencyCode();
896
+
897
+ $baseCurrencyCode = Mage::app()->getBaseCurrencyCode();
898
+ $allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
899
+ $allCurrencyRates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));
900
+
901
+ $array_currency = array(
902
+ 'baseCurrency' => $baseCurrency,
903
+ 'currCurrency' => $currCurrency,
904
+ 'currencyRates' => $allCurrencyRates);
905
+
906
+ // $logger->log("currency ".print_r($array_currency,1));
907
+
908
+ // sending request
909
+ $response = Mage::getModel('expertrec_recommendation/api_request')
910
+ ->setPrepareRequestStatus(false)
911
+ ->setUserId('expertrec')
912
+ ->setUrl($finalUrl)
913
+ ->setMethod(Zend_Http_Client::GET)
914
+ ->setData($array_currency)
915
+ ->setHeader("Content-Type",'application/json')
916
+ ->setPrepareRequestStatus(true)
917
+ ->sendRequest();
918
+
919
+ $logger->log('UserFeedPush_Track: request with currency details sent');
920
  if(!$response) {
921
  $logger->log('UserFeedPush_Track: request failed for total_count');
922
  }
923
  }
924
 
925
+
926
  /*
927
+ Push feed per product
928
  */
929
  public function pushFeedAction(){
930
  $logger = Mage::getSingleton('expertrec_recommendation/log');
931
 
932
+ // update db to 1 once feed pushed
933
+ Mage::helper("expertrec_recommendation")->saveConfig('expertrec_feed_push','1');
934
+
935
  //Increase memory limit
936
  ini_set('memory_limit', '1024M');
937
  //Increase maximum execution time to 5 hours (default in magento)
938
  set_time_limit(18000);
939
 
 
940
  // set&get mid and secret if mid is new_user
941
  $data = $this->getMidSecret();
942
  $mid = $data['merchantid'];
946
  $feedUrl = "https://feed.expertrec.com/magento/n01eba6261ad7f174cd3a16523e86e65/";
947
  // finalurl added with merchant id
948
  $finalUrl = $feedUrl.''.$mid.'/';
949
+
950
+ // check for feed pushed
951
+ $feed_pushed_page_info = Mage::getStoreConfig(self::PUSHED_FEED_PAGES);
952
+ $feed_pushed_page_info_array = explode(',', $feed_pushed_page_info);
953
+ $website_Id_pushed = $feed_pushed_page_info_array[0];
954
+ $store_Id_pushed = $feed_pushed_page_info_array[1];
955
+ $pages_pushed = $feed_pushed_page_info_array[2];
956
+
957
  // calculate number of products and send
958
  $this->getProductCount($finalUrl,$secret);
959
 
960
+ if($website_Id_pushed == 0){
961
+ // collect currencies
962
+ $this->getCurrency($finalUrl);
963
+ }
964
+
965
  $filter = Mage::getSingleton('expertrec_recommendation/feed_feedfilter');
966
  $formatter = Mage::getSingleton('expertrec_recommendation/feed_formatter')
967
+ ->init();
968
  $feedConfig = Mage::getSingleton('expertrec_recommendation/feed_feedconfig');
969
  // get headers
970
  $storedHeaders = Mage::getStoreConfig(self::CONFIG_HEADERS);
976
  $header = array();
977
  }
978
  if(!empty($header)){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
979
 
980
+ foreach ($this->_websiteId as $websiteId){
 
981
 
982
+ if($websiteId < $website_Id_pushed){
983
+ continue;
984
+ }
985
+ else{
986
+ foreach ($this->_storeId as $storeId) {
987
+ if($websiteId <= $website_Id_pushed && $storeId < $store_Id_pushed){
988
+ continue;
989
  }
990
  else{
991
+ $website = Mage::getModel('core/website')->load($websiteId);
992
+ $oStore = Mage::app()->getStore($StoreId);
993
+ $collection=$filter->addBasicFilter($website,$oStore)
994
+ ->setPageSize($feedConfig->pageSize);
995
+
996
+ $pageEnd = $feedConfig->pageEnd;
997
+ $lastPageNumber = $collection->getLastPageNumber();
998
+ if($pageEnd != 0 && $pageEnd < $lastPageNumber){
999
+ $pages = $pageEnd;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1000
  }
1001
+ else{
1002
+ $pages = $lastPageNumber;
1003
  }
1004
+ $logger->log("Total no. of pages for which we are collecting feed in this reqeust: #".$pages." for store #".$storeId);
1005
+ for($currentPage = $feedConfig->pageStart; $currentPage <= $pages; $currentPage++) {
1006
+ if($websiteId <= $website_Id_pushed && $storeId <= $store_Id_pushed && $currentPage < $pages_pushed){
1007
+ continue;
1008
+ }
1009
+ else{
1010
+ $logger->log("Collecting feed for page: #".$currentPage);
1011
+ $collection->setCurPage($currentPage);
1012
+ // get all products
1013
+ foreach ($collection as $product) {
1014
+ try{
1015
+ $resultArray = $formatter->prepareRow($header,$product);
1016
+ $resultArray['storeId'] = $storeId;
1017
+ $resultArray['websiteId'] = $websiteId;
1018
+ // sending request
1019
+ $response = Mage::getModel('expertrec_recommendation/api_request')
1020
+ ->setPrepareRequestStatus(false)
1021
+ ->setUserId('expertrec')
1022
+ ->setUrl($finalUrl)
1023
+ ->setMethod(Zend_Http_Client::POST)
1024
+ ->setData($resultArray)
1025
+ ->setHeader("Content-Type",'application/json')
1026
+ ->setPrepareRequestStatus(true)
1027
+ ->sendRequest();
1028
+ // $logger->log('UserFeedPush_Track: request succeded for product with Id #'.$product->getId().' of store '.$storeId);
1029
+ if(!$response) {
1030
+ $logger->log('UserFeedPush_Track: request failed for product with Id #'.$product->getId());
1031
+ }
1032
+ $page = $websiteId.','.$storeId.','.$currentPage;
1033
+ Mage::helper("expertrec_recommendation")->saveConfig('expertrec_feed_pushed_pages',$page);
1034
+ }
1035
+ catch (Exception $e) {
1036
+ $logger->log("UserFeedPush_Track error: ".$e->getMessage());
1037
+ }
1038
+ } // if page is not pushed
1039
+ } // foreach collection
1040
+ $collection->clear();
1041
+ } // for current page
1042
+ } // if store is not pushed
1043
+ } // for each store
1044
+ } // if website is not pushed
1045
+ } // for each websites
1046
+ $websitecount--;
1047
+ $page = '0,0,0';
1048
+ Mage::helper("expertrec_recommendation")->saveConfig('expertrec_feed_pushed_pages',$page);
1049
+ } // if not empty headers
1050
+ // check for feed completion
1051
+ if($websitecount == 0){
1052
+ $array = array('completed' => 1, );
1053
+ $response = Mage::getModel('expertrec_recommendation/api_request')
1054
+ ->setPrepareRequestStatus(false)
1055
+ ->setUserId('expertrec')
1056
+ ->setUrl($finalUrl)
1057
+ ->setMethod(Zend_Http_Client::GET)
1058
+ ->setData($array)
1059
+ ->setHeader("Content-Type",'application/json')
1060
+ ->setPrepareRequestStatus(true)
1061
+ ->sendRequest();
1062
+ $logger->log('UserFeedPush_Track: request completed');
1063
+ if(!$response) {
1064
+ $logger->log('UserFeedPush_Track: Request not complete');
1065
  }
 
 
 
1066
  }
1067
+ $logger->logMemoryUsage();
1068
  }
1069
 
1070
  /*
1071
  upload feed by user
1072
  */
1073
  public function feedAction(){
1074
+
1075
+ Mage::app()->getResponse()->setRedirect($_SERVER['HTTP_REFERER']);
1076
+ Mage::app()->getResponse()->sendResponse();
1077
+
1078
+ ob_end_clean();
1079
+ //avoid apache to kill the php running
1080
+ ignore_user_abort(true);
1081
+ ob_start();//start buffer output
1082
+ //close session file on server side to avoid blocking other requests
1083
+ session_write_close();
1084
+ //send header to avoid the browser side to take content as gzip format
1085
+ header("Content-Encoding: none");
1086
+ header("Content-Length: ".ob_get_length());
1087
+ header("Connection: close");
1088
+ ob_end_flush();
1089
+ flush();
1090
  $this->pushFeedAction();
 
1091
  }
1092
+
1093
+ /*
1094
  pull feed from info page
1095
  */
1096
  public function pullFeedAction(){
1120
  }
1121
  }
1122
 
1123
+ }
app/code/community/Expertrec/Recommendation/etc/adminhtml.xml CHANGED
@@ -11,7 +11,7 @@
11
  <action>expertrec-signup</action>
12
  </expertrec>
13
  <!-- added user upload feed -->
14
- <feed>
15
  <title>Upload Feed</title>
16
  <sort_order>15</sort_order>
17
  <action>expertrec_recommendation/api/feed</action>
11
  <action>expertrec-signup</action>
12
  </expertrec>
13
  <!-- added user upload feed -->
14
+ <feed translate="title">
15
  <title>Upload Feed</title>
16
  <sort_order>15</sort_order>
17
  <action>expertrec_recommendation/api/feed</action>
app/code/community/Expertrec/Recommendation/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Expertrec_Recommendation>
5
- <version>1.2.6</version>
6
  </Expertrec_Recommendation>
7
  </modules>
8
  <global>
2
  <config>
3
  <modules>
4
  <Expertrec_Recommendation>
5
+ <version>1.2.7</version>
6
  </Expertrec_Recommendation>
7
  </modules>
8
  <global>
app/code/community/Expertrec/Recommendation/sql/expertrec_setup/{mysql4-install-1.2.6.php → mysql4-install-1.2.7.php} RENAMED
@@ -5,8 +5,10 @@
5
 
6
  $installer = $this;
7
  $mage_ver = Mage::getVersion();
 
8
  $host = $_SERVER['HTTP_HOST'];
9
- $uri = $_SERVER['REQUEST_URI'];
 
10
  $installer->startSetup();
11
 
12
  $result =array();
@@ -15,10 +17,12 @@ $result['status'] = "Installed";
15
  //magento version
16
  $result['mage_ver'] = $mage_ver;
17
  //expertrec version
18
- $result['expertrec_ver'] = '1.2.6';
 
19
  //Subdomain
20
  $result['site_subdomain'] = $uri;
21
  //hostname
 
22
  $result['site_host'] = $host;
23
  //selecting for site_details
24
  $site_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('core_config_data')} where `path` like '%trans_email%'");
@@ -63,7 +67,8 @@ $installer->run("
63
  ('default',0,'expertrec/general/expertrec_thumbnail_width',80),
64
  ('default',0,'expertrec/general/expertrec_thumbnail_height',80),
65
  ('default',0,'expertrec/general/expertrec_feed_push',0),
66
- ('default',0,'expertrec/general/filters','filter_by_stock,filter_by_status,visible_catalog,visible_search,visible_catalog_search')
 
67
  ON DUPLICATE KEY UPDATE `value`=`value`;
68
  ");
69
 
5
 
6
  $installer = $this;
7
  $mage_ver = Mage::getVersion();
8
+ $php_ver = phpversion();
9
  $host = $_SERVER['HTTP_HOST'];
10
+ $uri = $_SERVER['SCRIPT_NAME'];
11
+ $protocol = $_SERVER['REQUEST_SCHEME'];
12
  $installer->startSetup();
13
 
14
  $result =array();
17
  //magento version
18
  $result['mage_ver'] = $mage_ver;
19
  //expertrec version
20
+ $result['expertrec_ver'] = '1.2.7';
21
+ $result['php_ver'] = $php_ver;
22
  //Subdomain
23
  $result['site_subdomain'] = $uri;
24
  //hostname
25
+ $result['site_protocol'] = $protocol;
26
  $result['site_host'] = $host;
27
  //selecting for site_details
28
  $site_data = $installer->getConnection()->fetchAll("select * from {$this->getTable('core_config_data')} where `path` like '%trans_email%'");
67
  ('default',0,'expertrec/general/expertrec_thumbnail_width',80),
68
  ('default',0,'expertrec/general/expertrec_thumbnail_height',80),
69
  ('default',0,'expertrec/general/expertrec_feed_push',0),
70
+ ('default',0,'expertrec/general/expertrec_feed_pushed_pages','0,0,0'),
71
+ ('default',0,'expertrec/general/filters','filter_by_stock,filter_by_status')
72
  ON DUPLICATE KEY UPDATE `value`=`value`;
73
  ");
74
 
app/code/community/Expertrec/Recommendation/sql/expertrec_setup/{mysql4-upgrade-1.2.5-1.2.6.php → mysql4-upgrade-1.2.6-1.2.7.php} RENAMED
@@ -5,9 +5,10 @@
5
 
6
  $installer = $this;
7
  $mage_ver = Mage::getVersion();
 
8
  $host = $_SERVER['HTTP_HOST'];
9
- $uri = $_SERVER['REQUEST_URI'];
10
-
11
 
12
  $installer->startSetup();
13
 
@@ -17,8 +18,10 @@ $result['status'] = "Upgraded";
17
  //magento version
18
  $result['mage_ver'] = $mage_ver;
19
  //expertrec version
20
- $result['expertrec_ver'] = '1.2.6';
 
21
  //hostname
 
22
  $result['site_host'] = $host;
23
  //Subdomain
24
  $result['site_subdomain'] = $uri;
@@ -54,19 +57,7 @@ $response = curl_exec($curl);
54
  curl_close($curl);
55
 
56
  $installer->run("
57
- INSERT INTO {$this->getTable('core_config_data')} (`scope`, `scope_id`, `path`, `value`)
58
- VALUES
59
- ('default',0,'expertrec/general/mid','new_user'),
60
- ('default',0,'expertrec/general/secret','NTE5NTQ1Zjk4OGExYzYxOWFkOTkyN2Y3MDQ5MTQ3NTM='),
61
- ('default',0,'expertrec/general/log_endpoint','https://feed.expertrec.com/magento/9418bba77c3b75abd2842e93b8c52c4a'),
62
- ('default',0,'expertrec/general/headers','is_in_stock,expert_image,expert_thumbnail,expert_category,expert_category_ids,final_price,entity_id,rating_summary,expert_url,created_at,image,msrp,name,price,short_description,sku,small_image,special_price,category_ids,minimal_price'),
63
- ('default',0,'expertrec/general/expertrec_image_width',250),
64
- ('default',0,'expertrec/general/expertrec_image_height',250),
65
- ('default',0,'expertrec/general/expertrec_thumbnail_width',80),
66
- ('default',0,'expertrec/general/expertrec_thumbnail_height',80),
67
- ('default',0,'expertrec/general/expertrec_feed_push',0),
68
- ('default',0,'expertrec/general/filters','filter_by_stock,filter_by_status,visible_catalog,visible_search,visible_catalog_search')
69
- ON DUPLICATE KEY UPDATE `value`=`value`;
70
  ");
71
 
72
  $installer->endSetup();
5
 
6
  $installer = $this;
7
  $mage_ver = Mage::getVersion();
8
+ $php_ver = phpversion();
9
  $host = $_SERVER['HTTP_HOST'];
10
+ $uri = $_SERVER['SCRIPT_NAME'];
11
+ $protocol = $_SERVER['REQUEST_SCHEME'];
12
 
13
  $installer->startSetup();
14
 
18
  //magento version
19
  $result['mage_ver'] = $mage_ver;
20
  //expertrec version
21
+ $result['expertrec_ver'] = '1.2.7';
22
+ $result['php_ver'] = $php_ver;
23
  //hostname
24
+ $result['site_protocol'] = $protocol;
25
  $result['site_host'] = $host;
26
  //Subdomain
27
  $result['site_subdomain'] = $uri;
57
  curl_close($curl);
58
 
59
  $installer->run("
60
+ UPDATE {$this->getTable('core_config_data')} SET `value`=0 WHERE `path`='expertrec/general/expertrec_feed_push';
 
 
 
 
 
 
 
 
 
 
 
 
61
  ");
62
 
63
  $installer->endSetup();
app/design/frontend/base/default/template/expertrec/feed/info.phtml CHANGED
@@ -90,6 +90,7 @@
90
  <th>Store Name</th>
91
  <th>Store Language</th>
92
  <th>Total# Products</th>
 
93
  <th>Url</th>
94
  </tr>
95
  </thead>
@@ -108,7 +109,15 @@
108
  <td style="text-align:center;"><b style="color:red;">Error: </b>
109
  <?php echo $_item['pcounterr'] ?>
110
  </td>
111
- <?php endif;?>
 
 
 
 
 
 
 
 
112
 
113
  <!-- <td><a href = "<?php //echo $_item['surl'] ?>"><?php //echo $_item['surl'] ?></a></td> -->
114
  <!-- form post request -->
@@ -364,7 +373,7 @@
364
  </form>
365
  </fieldset>
366
  <!--Displaying selected headers-->
367
- <?php if(!empty($storedHeaders) &&
368
  isset($storedHeaders) && count($storedHeaders) > 0): ?>
369
  <fieldset style="margin-top:20px;">
370
  <legend>Selected Headers</legend>
@@ -376,8 +385,10 @@
376
  </div>
377
  </fieldset>
378
  <?php endif;?>
 
379
  <!--Displaying selected filters-->
380
- <?php if(!empty(Mage::getStoreConfig('expertrec/general/filters')) &&
 
381
  isset($storedFilters) && count($storedFilters) > 0): ?>
382
  <fieldset style="margin-top:20px;">
383
  <legend>Selected Filters</legend>
90
  <th>Store Name</th>
91
  <th>Store Language</th>
92
  <th>Total# Products</th>
93
+ <th>Filtered Products</th>
94
  <th>Url</th>
95
  </tr>
96
  </thead>
109
  <td style="text-align:center;"><b style="color:red;">Error: </b>
110
  <?php echo $_item['pcounterr'] ?>
111
  </td>
112
+ <?php endif;?>
113
+ <?php if(isset($_item['fcount'])): ?>
114
+ <td style="text-align:center;"><?php echo $_item['fcount'] ?></td>
115
+ <?php endif;?>
116
+ <?php if(isset($_item['fcounterr'])): ?>
117
+ <td style="text-align:center;"><b style="color:red;">Error: </b>
118
+ <?php echo $_item['fcounterr'] ?>
119
+ </td>
120
+ <?php endif;?>
121
 
122
  <!-- <td><a href = "<?php //echo $_item['surl'] ?>"><?php //echo $_item['surl'] ?></a></td> -->
123
  <!-- form post request -->
373
  </form>
374
  </fieldset>
375
  <!--Displaying selected headers-->
376
+ <?php if($storedHeaders != "" &&
377
  isset($storedHeaders) && count($storedHeaders) > 0): ?>
378
  <fieldset style="margin-top:20px;">
379
  <legend>Selected Headers</legend>
385
  </div>
386
  </fieldset>
387
  <?php endif;?>
388
+
389
  <!--Displaying selected filters-->
390
+ <?php $filter = Mage::getStoreConfig('expertrec/general/filters');
391
+ if($filter != "" &&
392
  isset($storedFilters) && count($storedFilters) > 0): ?>
393
  <fieldset style="margin-top:20px;">
394
  <legend>Selected Filters</legend>
app/design/frontend/base/default/template/expertrec/recommendation/tracker.phtml CHANGED
@@ -29,6 +29,13 @@ if(typeof expertSiteConf == 'undefined' || expertSiteConf == null) {
29
  };
30
  }
31
 
 
 
 
 
 
 
 
32
  /* * * DON'T EDIT BELOW LINE * * */
33
 
34
  (function(){var domain=window.location.hostname.replace(/\./g,""),ea=document.createElement('script');ea.type='text/javascript';ea.async=true;ea.src='//d3qm5o86jyjko6.cloudfront.net/rec/expertrec_'+domain+'.js';var m=document.getElementsByTagName('script')[0];m.parentNode.insertBefore(ea,m)})();var _eaq=_eaq || [];function expertApi(){if(window.expertrec_true){var args=Array.prototype.slice.call(arguments);window.ea_apispec[args[0]](args.slice(1,args.length))}else{_eaq.push(arguments);}}
29
  };
30
  }
31
 
32
+ //Add website and store id
33
+ <?php
34
+ Mage::getModel('core/cookie')->set("webId",Mage::app()->getWebsite()->getId());
35
+ Mage::getModel('core/cookie')->set("storeId",Mage::app()->getStore()->getId());
36
+ Mage::getModel('core/cookie')->set("currency",Mage::app()->getStore()->getCurrentCurrencyCode());
37
+ ?>
38
+
39
  /* * * DON'T EDIT BELOW LINE * * */
40
 
41
  (function(){var domain=window.location.hostname.replace(/\./g,""),ea=document.createElement('script');ea.type='text/javascript';ea.async=true;ea.src='//d3qm5o86jyjko6.cloudfront.net/rec/expertrec_'+domain+'.js';var m=document.getElementsByTagName('script')[0];m.parentNode.insertBefore(ea,m)})();var _eaq=_eaq || [];function expertApi(){if(window.expertrec_true){var args=Array.prototype.slice.call(arguments);window.ea_apispec[args[0]](args.slice(1,args.length))}else{_eaq.push(arguments);}}
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Expertrec_Recommendation</name>
4
- <version>1.2.6</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-03-27</date>
14
- <time>10:01:29</time>
15
- <contents><target name="magecommunity"><dir name="Expertrec"><dir name="Recommendation"><dir name="Block"><file name="Api.php" hash="46ce038ecace7b3b35bea9bc05cac4e5"/></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="dd34241f00c6bea36700f768a3feef6e"/></dir><dir name="Feed"><file name="Feedconfig.php" hash="013bd447dccc7cc4f073be5bd53a18c9"/><file name="Feedcreator.php" hash="34fafb9a24913a99606056f33728cf7d"/><file name="Feedfilter.php" hash="c278681d9cf0fa03d62c308a73151eb2"/><file name="Formatter.php" hash="316fe0f30af7ca946dffcc2f16a2193d"/></dir><file name="Feed.php" hash="ddac87d6a060bc77fb7718e7b19e1273"/><file name="Log.php" hash="27fcee49e67fe2be761b4af94aecff2b"/><file name="Observer.php" hash="751f3f10ee652522ce0ffc87f28e3bc6"/><dir name="Translator"><file name="Category.php" hash="0050de4918d73af310008aa8f49239d1"/></dir><file name="Validate.php" hash="f15e87fc29af912376b149307c731acc"/><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="a7c78b3019bbaa4896b2fd0c928acebc"/><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="90e0a400e62e045883cb9624b69c3f78"/><file name="config.xml" hash="f3672c1f6a9ea6fd493e2c8a6df7c96d"/></dir><dir name="sql"><dir name="expertrec_setup"><file name="mysql4-install-1.2.6.php" hash="da0193daebe54cfc42c9059ff38ebd93"/><file name="mysql4-upgrade-1.2.5-1.2.6.php" hash="7229f8a229f10fc43247e035d2807f5c"/></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="3c508f764463bf900613a3c2a239214d"/></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><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="expertrec"><file name="recommendation.xml" hash="115d3023af9566c37e39d003a25e031a"/></dir></dir><dir name="template"><dir name="expertrec"><dir name="recommendation"><file name="notifications.phtml" hash="4f965be2e3ed310a8b4ce271ad064ee4"/></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.2.7</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-04-12</date>
14
+ <time>10:03:21</time>
15
+ <contents><target name="magecommunity"><dir name="Expertrec"><dir name="Recommendation"><dir name="Block"><file name="Api.php" hash="c3c8aaecba77a27e228cb3cec34fa8dc"/></dir><dir name="Helper"><file name="Autocompletehelper.php" hash="7bd733d91f69091c1f6f5bb162467a43"/><file name="Data.php" hash="c3d423049c2d2b347258171b59d61848"/><file name="Filehelper.php" hash="deeb1e764f7fc7c1d749cb0ab2be64aa"/><dir name="Search"><file name="Layout.php" hash="c68c9d6c4def7daca0a0ae332dceaff3"/></dir><file name="Suggestionhelper.php" hash="1c34f031a920b07950420e148dff8e93"/></dir><dir name="Model"><dir name="Api"><file name="Request.php" hash="dd34241f00c6bea36700f768a3feef6e"/></dir><dir name="Feed"><file name="Feedconfig.php" hash="de0c332e9e1b4eb6c021feaa927d8250"/><file name="Feedcreator.php" hash="1115f203ea1bda87b423078c19ce543e"/><file name="Feedfilter.php" hash="c278681d9cf0fa03d62c308a73151eb2"/><file name="Formatter.php" hash="51866f6b6dcd8af0661cc31ff22a0ae1"/></dir><file name="Feed.php" hash="ddac87d6a060bc77fb7718e7b19e1273"/><file name="Log.php" hash="27fcee49e67fe2be761b4af94aecff2b"/><file name="Observer.php" hash="3363ad0e7f5cce5873d61bd88e6b2f1c"/><dir name="Translator"><file name="Category.php" hash="45402cee2ff6e204dac6471a3a9d5ea4"/></dir><file name="Validate.php" hash="f15e87fc29af912376b149307c731acc"/><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="6155ce4754226517f5a5e261470ab42f"/><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="0b24b4132ac25269fecc9fcee0d0d446"/><file name="config.xml" hash="ab9dd100c318f7d5014937cfd21be334"/></dir><dir name="sql"><dir name="expertrec_setup"><file name="mysql4-install-1.2.7.php" hash="aa260dc58973fc027a162e5a2fa81a8a"/><file name="mysql4-upgrade-1.2.6-1.2.7.php" hash="f7b1e4cfd4ea1b220974d3db6a2ae829"/></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="12aa7b095144dddd925369209a2f4478"/></dir><dir name="recommendation"><file name="tracker.phtml" hash="38b5d2ac10a6710a0a6b1dd93a068e84"/><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><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="expertrec"><file name="recommendation.xml" hash="115d3023af9566c37e39d003a25e031a"/></dir></dir><dir name="template"><dir name="expertrec"><dir name="recommendation"><file name="notifications.phtml" hash="4f965be2e3ed310a8b4ce271ad064ee4"/></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>