slisearch - Version 2.1.4

Version Notes

Changes since last release:
* Added ability to disable/enable the feed generation and the search form separately
* Updated ability to send feed generation success/failure notifications
* Fixed issue with the pricing for configurable products whose children are out of stock
* Fixed issue with the price feed in multiple stores

Download this release

Release Info

Developer Platform support
Extension slisearch
Version 2.1.4
Comparing to
See all releases


Code changes from version 2.1.3 to 2.1.4

app/code/local/SLI/Search/Block/Search/Form/Mini.php CHANGED
@@ -56,17 +56,15 @@ class SLI_Search_Block_Search_Form_Mini extends Mage_Core_Block_Template {
56
  }
57
 
58
  /**
59
- * Switch out the default form mini template for the sli version
60
  *
61
  * @return string
62
  */
63
  protected function _toHtml() {
64
- if (Mage::helper('sli_search')->isEnabled(Mage::app()->getStore()->getId())) {
65
- if(Mage::helper('sli_search')->useCustomForm()) {
66
- return $this->getFormData();
67
- }else {
68
- $this->setTemplate('sli/search/form.mini.phtml');
69
- }
70
  }
71
  return parent::_toHtml();
72
  }
56
  }
57
 
58
  /**
59
+ * Use the default SLI layout or the custom layout from the DB
60
  *
61
  * @return string
62
  */
63
  protected function _toHtml() {
64
+ if(Mage::helper('sli_search')->useCustomForm()) {
65
+ return $this->getFormData();
66
+ }else {
67
+ $this->setTemplate('sli/search/form.mini.phtml');
 
 
68
  }
69
  return parent::_toHtml();
70
  }
app/code/local/SLI/Search/Block/Search/Js/Bottom.php CHANGED
@@ -25,7 +25,7 @@ class SLI_Search_Block_Search_JS_Bottom extends Mage_Core_Block_Text {
25
  protected function _construct() {
26
  parent::_construct();
27
  $helper = Mage::helper('sli_search');
28
- if ($helper->isEnabled(Mage::app()->getStore()->getId())) {
29
  $this->addText($helper->getFooterJs());
30
  }
31
  }
25
  protected function _construct() {
26
  parent::_construct();
27
  $helper = Mage::helper('sli_search');
28
+ if ($helper->isFormEnabled(Mage::app()->getStore()->getId())) {
29
  $this->addText($helper->getFooterJs());
30
  }
31
  }
app/code/local/SLI/Search/Block/Search/Js/Top.php CHANGED
@@ -24,7 +24,7 @@ class SLI_Search_Block_Search_JS_Top extends Mage_Core_Block_Text {
24
  protected function _construct() {
25
  parent::_construct();
26
  $helper = Mage::helper('sli_search');
27
- if ($helper->isEnabled(Mage::app()->getStore()->getId())) {
28
  $this->addText($helper->getSLIDomainJs());
29
  $this->addText($helper->getHeaderJs());
30
  }
24
  protected function _construct() {
25
  parent::_construct();
26
  $helper = Mage::helper('sli_search');
27
+ if ($helper->isFormEnabled(Mage::app()->getStore()->getId())) {
28
  $this->addText($helper->getSLIDomainJs());
29
  $this->addText($helper->getHeaderJs());
30
  }
app/code/local/SLI/Search/Block/System/Config/Form/Field/Minigrid.php CHANGED
@@ -112,8 +112,13 @@ class SLI_Search_Block_System_Config_Form_Field_Minigrid extends Varien_Data_For
112
  </tr>
113
  </tfoot>
114
  </table>
 
115
  </div>
116
-
 
 
 
 
117
  <script type="text/javascript">
118
  Event.observe(window,'load', function(){
119
  (new baMiniGrid()).init($("ba-<?php echo $tableId?>"),
112
  </tr>
113
  </tfoot>
114
  </table>
115
+ <input type="text" class="validate-minigrid-attributes" style="opacity:0" value="">
116
  </div>
117
+ <style>
118
+ select.validation-failed {
119
+ border: 1px solid red;
120
+ }
121
+ </style>
122
  <script type="text/javascript">
123
  Event.observe(window,'load', function(){
124
  (new baMiniGrid()).init($("ba-<?php echo $tableId?>"),
app/code/local/SLI/Search/Block/System/Config/Form/Field/Minigrid/Js.php CHANGED
@@ -132,6 +132,8 @@ function baMiniGrid() {
132
  input = new Element(this.rowData[field]['type'], {style:"width:98%;",name: rowName + "["+rowId+"][" +field + "]"});
133
  input.addClassName("minigrid-field");
134
  input.addClassName("minigrid-field-" + field);
 
 
135
  if (typeof this.rowData[field]['options'] != 'undefined') {
136
  var options = this.rowData[field]['options'];
137
  if (Object.isArray(options)) {
@@ -176,6 +178,32 @@ function baMiniGrid() {
176
  }
177
  }
178
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  </script>
180
  <?php
181
  return $html . ob_get_clean();
132
  input = new Element(this.rowData[field]['type'], {style:"width:98%;",name: rowName + "["+rowId+"][" +field + "]"});
133
  input.addClassName("minigrid-field");
134
  input.addClassName("minigrid-field-" + field);
135
+ input.addClassName("validate-minigrid-attribute");
136
+
137
  if (typeof this.rowData[field]['options'] != 'undefined') {
138
  var options = this.rowData[field]['options'];
139
  if (Object.isArray(options)) {
178
  }
179
  }
180
  }
181
+
182
+ Validation.add('validate-minigrid-attributes', 'Please remove duplicate attributes.', function (v) {
183
+ var selectedAttributes = document.getElementsByClassName("validate-minigrid-attribute");
184
+
185
+ var hasDuplicates = false;
186
+ for(var i = 0; i < selectedAttributes.length; i++)
187
+ {
188
+ var occurrences = 1;
189
+ var icurrent = selectedAttributes.item(i).value;
190
+ for(var j = i+1; j < selectedAttributes.length; j++) {
191
+ var jcurrent = selectedAttributes.item(j).value;
192
+ if (icurrent == jcurrent) {
193
+ occurrences++;
194
+ if(occurrences > 1){
195
+ selectedAttributes.item(i).addClassName('validation-failed');
196
+ selectedAttributes.item(j).addClassName('validation-failed');
197
+ }
198
+ }
199
+ }
200
+ if(occurrences > 1) hasDuplicates = true;
201
+ }
202
+ if(hasDuplicates == true) return false;
203
+ else return true;
204
+ });
205
+
206
+
207
  </script>
208
  <?php
209
  return $html . ob_get_clean();
app/code/local/SLI/Search/Helper/Data.php CHANGED
@@ -9,9 +9,9 @@
9
  * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
10
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
11
  * PARTICULAR PURPOSE.
12
- *
13
  * Translation and systems configuration helper
14
- *
15
  * @package SLI
16
  * @subpackage Search
17
  */
@@ -26,19 +26,17 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
26
  const JS_GROUP = "js/";
27
  const CRON_GROUP = "cron/";
28
  const ATTR_GROUP = "attributes/";
29
- const DEFAULT_ATTRS = "default_attributes/";
30
  const ENABLED = 1;
31
- const DISABLED = 2;
32
- const FEEDENABLED = 3;
33
 
34
  /**
35
  * Returns true/false on whether or not the module is enabled
36
  *
37
  * @return boolean
38
  */
39
- public function isEnabled($store_id = 0) {
40
- $enabled = Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::GENERAL_GROUP . 'enabled');
41
- return (bool) ($enabled == self::ENABLED) ? 1 : 0;
42
  }
43
 
44
  /**
@@ -47,8 +45,8 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
47
  * @return boolean
48
  */
49
  public function isFeedEnabled($store_id = 0) {
50
- $feedEnabled = Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::GENERAL_GROUP . 'enabled');
51
- return (bool) ($feedEnabled != self::DISABLED) ? 1 : 0;
52
  }
53
 
54
  /**
@@ -58,8 +56,8 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
58
  */
59
  public function isPriceFeedEnabled($store_id = 0) {
60
  return (bool) Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::GENERAL_GROUP . 'price_feed');
61
- }
62
-
63
  /**
64
  * Returns an integer which is the log level
65
  *
@@ -67,7 +65,25 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
67
  */
68
  public function getLogLevel($store_id = 0) {
69
  return (int) Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::GENERAL_GROUP . 'log_level');
70
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
  /**
73
  * Returns true/false on whether or not we should backup feeds
@@ -94,8 +110,8 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
94
  */
95
  public function isIncludeOutOfStockItems($store_id = 0) {
96
  return (bool) Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::FEED_GROUP . "stockstatus");
97
- }
98
-
99
  /**
100
  * Returns true/false on whether or not to include disabled categories in feed
101
  *
@@ -103,8 +119,8 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
103
  */
104
  public function isIncludeDisabledCategories($store_id = 0) {
105
  return (bool) Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::FEED_GROUP . "categorystatus");
106
- }
107
-
108
  /**
109
  * Returns true/false on whether or not we should drop tables;
110
  *
@@ -365,7 +381,7 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
365
  return ((float) $usec + (float) $sec);
366
  }
367
 
368
- /**
369
  * Returns domain(s) as a js var
370
  *
371
  * @return url
@@ -379,7 +395,7 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
379
  preg_match('/http(s|):\/\/(.+?)\//',$searchURL,$matches);
380
  $searchURLBase = $searchURL;
381
  if (isset($matches[2])) {
382
- $searchURLBase = $matches[2];
383
  }
384
  $returnJS = "\n<script type=\"text/javascript\">\nvar slibaseurlsearch = '" . $searchURL ."';\nvar slibaseurl = '" . $searchURLBase . "';\n</script>\n";
385
 
@@ -406,19 +422,19 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
406
  return Mage::getStoreConfig(self::SECTION . self::FORM_GROUP . "formcode");
407
  }
408
 
409
- /**
410
  * Render the cart grand total and total item within the cart
411
  * @param Mage_Sales_Model_Quote $quote
412
  * @return array
413
  */
414
- private function _renderCartTotal( $quote )
415
- {
416
  if( !$quote ) return false;
417
-
418
  //Declare the array container
419
  $cartInfoArray = array();
420
- $quoteItemCount = $quote->getItemsCount();
421
-
422
  //Store the item count to array
423
  $cartInfoArray['NumberOfItems'] = $quoteItemCount;
424
 
@@ -426,12 +442,12 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
426
  if( $totals )
427
  {
428
  if( isset($totals['grand_total']) )
429
- $cartInfoArray['TotalPrice'] = $totals['grand_total']->getValue();
430
-
431
  if( isset($totals['tax']) )
432
- $cartInfoArray['TotalTax'] = $totals['tax']->getValue();
433
  }
434
-
435
  //Get The Cart Total Discount Amount
436
  $items = $quote->getAllVisibleItems();
437
  $itemDiscount = 0;
@@ -440,20 +456,20 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
440
  if( !$item ) continue;
441
  $itemDiscount += $item->getDiscountAmount();
442
  }
443
- $cartInfoArray['TotalDiscount'] = $itemDiscount;
444
-
445
  //Get The Delivery Cost if applicable
446
- $shippingCost = $quote->getShippingAddress()->getShippingAmount();
447
  $shippingCostTax = $quote->getShippingAddress()->getShippingTaxAmount();
448
  if($shippingCost == (float)0){
449
- $cartInfoArray['DeliveryCost'] = 0;
450
  }else{
451
- $cartInfoArray['DeliveryCost'] = (float)$shippingCost + (float)$shippingCostTax;
452
  }
453
-
454
  return $cartInfoArray;
455
  }
456
-
457
  /**
458
  * Render the cart item detail
459
  * @param Mage_Sales_Model_Quote $quote
@@ -466,12 +482,12 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
466
  if( !$quote ) return false;
467
 
468
  $items = $quote->getAllVisibleItems();
469
-
470
  foreach( $items as $item )
471
  {
472
  /** @var $item Mage_Sales_Model_Quote_Item */
473
  if( !$item ) continue;
474
-
475
  //Declare an array to store item information
476
  $itemInfo = array();
477
  /** @var $itemProduct Mage_Catalog_Model_Product */
@@ -479,20 +495,20 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
479
 
480
  $itemInfo[ 'title' ] = $item->getName();
481
  $itemInfo[ 'sku' ] = $item->getSku();
482
- $itemInfo[ 'qty' ] = $item->getQty();
483
  //Get the item Product Object
484
  $product = $item->getProduct();
485
  //Get the original price for item product
486
- $itemInfo[ 'price' ] = $product->getPrice();
487
- //Get the sale price
488
- $itemInfo[ 'sale_price' ] = $item->getPriceInclTax();
489
-
490
  $itemInfo[ 'item_url' ] = $this->getItemUrl($item);
491
- $itemInfo[ 'remove_url' ] = Mage::getUrl('checkout/cart/delete/', array('id'=>$item->getId()));
492
  $itemInfo[ 'image_url' ] = Mage::getModel('catalog/product_media_config')->getMediaUrl($itemProduct->getThumbnail());
493
 
494
  $itemsArray[] = $itemInfo;
495
- }
496
  return $itemsArray;
497
  }
498
 
@@ -506,37 +522,81 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
506
  if ($item->getRedirectUrl()) {
507
  return $item->getRedirectUrl();
508
  }
509
-
510
  $product = $item->getProduct();
511
  $option = $item->getOptionByCode('product_type');
512
  if ($option) {
513
  $product = $option->getProduct();
514
  }
515
  return $product->getUrlModel()->getUrl($product);
516
-
517
  }
518
-
519
-
520
  /**
521
  * Render the JSONP object for SLI
522
- *
523
  * @param Mage_Sales_Model_Quote $quote
524
  * @return string
525
  */
526
  public function getCartJSONP( $quote )
527
  {
528
- $key_values['form_key'] = Mage::getSingleton('core/session')->getFormKey();
529
  $key_values['logged_in'] = Mage::getSingleton('customer/session')->isLoggedIn();
530
  $key_values['user_name'] = $this->escapeHtml(Mage::getSingleton('customer/session')->getCustomer()->getName());
531
 
532
  $cart = $this->_renderCartTotal( $quote );
533
  $items['items'] = $this->_renderItemsDetail( $quote );
534
-
535
  $result = array_merge($key_values, $cart, $items);
536
- $jsonResult = json_encode( $result );
537
  //Wrap up as jsonp object
538
  $jsonpResult = "sliCartRequest($jsonResult)";
539
  return $jsonpResult;
540
  }
541
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
  }
9
  * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
10
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
11
  * PARTICULAR PURPOSE.
12
+ *
13
  * Translation and systems configuration helper
14
+ *
15
  * @package SLI
16
  * @subpackage Search
17
  */
26
  const JS_GROUP = "js/";
27
  const CRON_GROUP = "cron/";
28
  const ATTR_GROUP = "attributes/";
29
+ const DEFAULT_ATTRS = "default_attributes/";
30
  const ENABLED = 1;
 
 
31
 
32
  /**
33
  * Returns true/false on whether or not the module is enabled
34
  *
35
  * @return boolean
36
  */
37
+ public function isFormEnabled($store_id = 0) {
38
+ $formEnabled = Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::GENERAL_GROUP . 'form_enabled');
39
+ return (bool) ($formEnabled == self::ENABLED) ? 1 : 0;
40
  }
41
 
42
  /**
45
  * @return boolean
46
  */
47
  public function isFeedEnabled($store_id = 0) {
48
+ $feedEnabled = Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::GENERAL_GROUP . 'feed_enabled');
49
+ return (bool) ($feedEnabled == self::ENABLED) ? 1 : 0;
50
  }
51
 
52
  /**
56
  */
57
  public function isPriceFeedEnabled($store_id = 0) {
58
  return (bool) Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::GENERAL_GROUP . 'price_feed');
59
+ }
60
+
61
  /**
62
  * Returns an integer which is the log level
63
  *
65
  */
66
  public function getLogLevel($store_id = 0) {
67
  return (int) Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::GENERAL_GROUP . 'log_level');
68
+ }
69
+
70
+ /**
71
+ * Return the email setting
72
+ *
73
+ * @return int
74
+ */
75
+ public function getEmailSetting() {
76
+ return Mage::getStoreConfig(self::SECTION . self::FEED_GROUP . 'email_setting');
77
+ }
78
+
79
+ /**
80
+ * Return the email address of the person to send to
81
+ *
82
+ * @return string
83
+ */
84
+ public function getFeedEmail() {
85
+ return Mage::getStoreConfig(self::SECTION . self::FEED_GROUP . "emailto");
86
+ }
87
 
88
  /**
89
  * Returns true/false on whether or not we should backup feeds
110
  */
111
  public function isIncludeOutOfStockItems($store_id = 0) {
112
  return (bool) Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::FEED_GROUP . "stockstatus");
113
+ }
114
+
115
  /**
116
  * Returns true/false on whether or not to include disabled categories in feed
117
  *
119
  */
120
  public function isIncludeDisabledCategories($store_id = 0) {
121
  return (bool) Mage::app()->getStore($store_id)->getConfig(self::SECTION . self::FEED_GROUP . "categorystatus");
122
+ }
123
+
124
  /**
125
  * Returns true/false on whether or not we should drop tables;
126
  *
381
  return ((float) $usec + (float) $sec);
382
  }
383
 
384
+ /**
385
  * Returns domain(s) as a js var
386
  *
387
  * @return url
395
  preg_match('/http(s|):\/\/(.+?)\//',$searchURL,$matches);
396
  $searchURLBase = $searchURL;
397
  if (isset($matches[2])) {
398
+ $searchURLBase = $matches[2];
399
  }
400
  $returnJS = "\n<script type=\"text/javascript\">\nvar slibaseurlsearch = '" . $searchURL ."';\nvar slibaseurl = '" . $searchURLBase . "';\n</script>\n";
401
 
422
  return Mage::getStoreConfig(self::SECTION . self::FORM_GROUP . "formcode");
423
  }
424
 
425
+ /**
426
  * Render the cart grand total and total item within the cart
427
  * @param Mage_Sales_Model_Quote $quote
428
  * @return array
429
  */
430
+ private function _renderCartTotal( $quote )
431
+ {
432
  if( !$quote ) return false;
433
+
434
  //Declare the array container
435
  $cartInfoArray = array();
436
+ $quoteItemCount = intval($quote->getItemsQty());
437
+
438
  //Store the item count to array
439
  $cartInfoArray['NumberOfItems'] = $quoteItemCount;
440
 
442
  if( $totals )
443
  {
444
  if( isset($totals['grand_total']) )
445
+ $cartInfoArray['TotalPrice'] = $this->formatCurrency($totals['grand_total']->getValue());
446
+
447
  if( isset($totals['tax']) )
448
+ $cartInfoArray['TotalTax'] = $this->formatCurrency($totals['tax']->getValue());
449
  }
450
+
451
  //Get The Cart Total Discount Amount
452
  $items = $quote->getAllVisibleItems();
453
  $itemDiscount = 0;
456
  if( !$item ) continue;
457
  $itemDiscount += $item->getDiscountAmount();
458
  }
459
+ $cartInfoArray['TotalDiscount'] = $this->formatCurrency($itemDiscount);
460
+
461
  //Get The Delivery Cost if applicable
462
+ $shippingCost = $quote->getShippingAddress()->getShippingAmount();
463
  $shippingCostTax = $quote->getShippingAddress()->getShippingTaxAmount();
464
  if($shippingCost == (float)0){
465
+ $cartInfoArray['DeliveryCost'] = $this->formatCurrency(0);
466
  }else{
467
+ $cartInfoArray['DeliveryCost'] = $this->formatCurrency((float)$shippingCost + (float)$shippingCostTax);
468
  }
469
+
470
  return $cartInfoArray;
471
  }
472
+
473
  /**
474
  * Render the cart item detail
475
  * @param Mage_Sales_Model_Quote $quote
482
  if( !$quote ) return false;
483
 
484
  $items = $quote->getAllVisibleItems();
485
+
486
  foreach( $items as $item )
487
  {
488
  /** @var $item Mage_Sales_Model_Quote_Item */
489
  if( !$item ) continue;
490
+
491
  //Declare an array to store item information
492
  $itemInfo = array();
493
  /** @var $itemProduct Mage_Catalog_Model_Product */
495
 
496
  $itemInfo[ 'title' ] = $item->getName();
497
  $itemInfo[ 'sku' ] = $item->getSku();
498
+ $itemInfo[ 'qty' ] = intval($item->getQty());
499
  //Get the item Product Object
500
  $product = $item->getProduct();
501
  //Get the original price for item product
502
+ $itemInfo[ 'price' ] = $this->formatCurrency($product->getPrice());
503
+ //Get the sale price
504
+ $itemInfo[ 'sale_price' ] = $this->formatCurrency($item->getPriceInclTax());
505
+
506
  $itemInfo[ 'item_url' ] = $this->getItemUrl($item);
507
+ $itemInfo[ 'remove_url' ] = Mage::getUrl('checkout/cart/delete/', array('id'=>$item->getId()));
508
  $itemInfo[ 'image_url' ] = Mage::getModel('catalog/product_media_config')->getMediaUrl($itemProduct->getThumbnail());
509
 
510
  $itemsArray[] = $itemInfo;
511
+ }
512
  return $itemsArray;
513
  }
514
 
522
  if ($item->getRedirectUrl()) {
523
  return $item->getRedirectUrl();
524
  }
525
+
526
  $product = $item->getProduct();
527
  $option = $item->getOptionByCode('product_type');
528
  if ($option) {
529
  $product = $option->getProduct();
530
  }
531
  return $product->getUrlModel()->getUrl($product);
532
+
533
  }
534
+
535
+
536
  /**
537
  * Render the JSONP object for SLI
538
+ *
539
  * @param Mage_Sales_Model_Quote $quote
540
  * @return string
541
  */
542
  public function getCartJSONP( $quote )
543
  {
544
+ $key_values['form_key'] = Mage::getSingleton('core/session')->getFormKey();
545
  $key_values['logged_in'] = Mage::getSingleton('customer/session')->isLoggedIn();
546
  $key_values['user_name'] = $this->escapeHtml(Mage::getSingleton('customer/session')->getCustomer()->getName());
547
 
548
  $cart = $this->_renderCartTotal( $quote );
549
  $items['items'] = $this->_renderItemsDetail( $quote );
550
+
551
  $result = array_merge($key_values, $cart, $items);
552
+ $jsonResult = json_encode( $result );
553
  //Wrap up as jsonp object
554
  $jsonpResult = "sliCartRequest($jsonResult)";
555
  return $jsonpResult;
556
  }
557
 
558
+
559
+ /**
560
+ * Return whether an email should be sent or not
561
+ *
562
+ * @param $error
563
+ *
564
+ * @return bool
565
+ */
566
+ public function sendEmail($error) {
567
+ $emailLevel = $this->getEmailSetting();
568
+ if($emailLevel == 3) {
569
+ return true;
570
+ }else if($emailLevel == 2 && isset($error) && $error) {
571
+ return true;
572
+ }else {
573
+ return false;
574
+ }
575
+ }
576
+
577
+ /**
578
+ * Format output for email
579
+ *
580
+ * @param $messageArray
581
+ *
582
+ * @return string
583
+ */
584
+ public function formatEmailOutput($messageArray){
585
+ $output = "";
586
+ foreach($messageArray as $key => $value) {
587
+ $output .= "$key: $value\n";
588
+ }
589
+ return $output;
590
+ }
591
+
592
+ /**
593
+ * Currency formatting
594
+ *
595
+ * @param $val
596
+ * @return string
597
+ */
598
+ public function formatCurrency( $val )
599
+ {
600
+ return Mage::helper('checkout')->getQuote()->getStore()->formatPrice($val, false);
601
+ }
602
  }
app/code/local/SLI/Search/Helper/Feed.php CHANGED
@@ -68,29 +68,47 @@ class SLI_Search_Helper_Feed {
68
  Mage::app()->setCurrentStore($curStore);
69
  return $myUrl;
70
  }
71
-
72
  /**
73
- * Asynchronously starts a feed generation for each store
 
 
74
  */
75
  public function generateFeedsForAllStores() {
76
  if ($this->thereAreFeedLocks()) {
77
  throw new SLI_Search_Exception("One or more feeds are being generated. Generation temporarily locked.");
78
  }
79
- $feedUrl = $this->getGenerateFeedUrl();
80
- $urlParts = parse_url($feedUrl);
81
 
82
- try{
83
- $stores = Mage::getResourceModel('core/store_collection');
 
 
 
 
84
 
85
- foreach($stores as $store){
86
- $storeId = $store->getId();
87
- Mage::getModel('sli_search/feed')->setData('store_id', $storeId)->generateFeed();
88
- Mage::getModel('sli_search/feed')->setData('store_id', $storeId)->generateFeed(true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  }
90
  }
91
- catch (Exception $e) {
92
- Mage::logException($e);
93
- }
94
  }
95
 
96
  /**
68
  Mage::app()->setCurrentStore($curStore);
69
  return $myUrl;
70
  }
71
+
72
  /**
73
+ * Starts a feed generation for each store
74
+ * @return array
75
+ * @throws SLI_Search_Exception
76
  */
77
  public function generateFeedsForAllStores() {
78
  if ($this->thereAreFeedLocks()) {
79
  throw new SLI_Search_Exception("One or more feeds are being generated. Generation temporarily locked.");
80
  }
 
 
81
 
82
+ $toReturn = array();
83
+ $messages = array();
84
+ $toReturn['error'] = false;
85
+
86
+ /** @var $stores Mage_Core_Model_Resource_Store_Collection */
87
+ $stores = Mage::getResourceModel('core/store_collection');
88
 
89
+ foreach($stores as $store){
90
+ $storeId = $store->getId();
91
+ try {
92
+ $productFeedStatus = Mage::getModel('sli_search/feed')->setData('store_id', $storeId)->generateFeed();
93
+ if (true === $productFeedStatus) {
94
+ $messages["Product Feed " . $storeId ] = "Success";
95
+ } else {
96
+ $messages["Product Feed " . $storeId ] = $productFeedStatus;
97
+ }
98
+ $priceFeedStatus = Mage::getModel('sli_search/feed')->setData('store_id', $storeId)->generateFeed(true);
99
+ if (true === $priceFeedStatus) {
100
+ $messages["Price Feed " . $storeId] = "Success";
101
+ } else {
102
+ $messages["Price Feed " . $storeId] = $priceFeedStatus;
103
+ }
104
+ }catch (Exception $e) {
105
+ Mage::logException($e);
106
+ $toReturn['error'] = true;
107
+ $messages["Feed " .$storeId] = "Exception generating feed $storeId -> " . $e->getMessage();
108
  }
109
  }
110
+ $toReturn['messages'] = $messages;
111
+ return $toReturn;
 
112
  }
113
 
114
  /**
app/code/local/SLI/Search/Model/Cron.php CHANGED
@@ -24,8 +24,9 @@ class SLI_Search_Model_Cron {
24
  if(!Mage::getStoreConfig('sli_search/cron/disabled'))
25
  {
26
  try {
27
- Mage::helper('sli_search/feed')->generateFeedsForAllStores();
28
- $msg = "Feeds Generating";
 
29
  }
30
  catch (SLI_Search_Exception $e) {
31
  $msg = $e->getMessage();
@@ -41,8 +42,15 @@ class SLI_Search_Model_Cron {
41
  /**
42
  * If there is a system config email set, send out the cron notification
43
  * email.
 
 
44
  */
45
  protected function _sendEmail($msg) {
46
- Mage::getModel('sli_search/email')->setData('msg', $msg)->send();
 
 
 
 
 
47
  }
48
  }
24
  if(!Mage::getStoreConfig('sli_search/cron/disabled'))
25
  {
26
  try {
27
+ /** @var $helper SLI_Search_Helper_Feed */
28
+ $helper = Mage::helper('sli_search/feed');
29
+ $msg = $helper->generateFeedsForAllStores();
30
  }
31
  catch (SLI_Search_Exception $e) {
32
  $msg = $e->getMessage();
42
  /**
43
  * If there is a system config email set, send out the cron notification
44
  * email.
45
+ *
46
+ * @param $msg String
47
  */
48
  protected function _sendEmail($msg) {
49
+ $sliHelper = Mage::helper('sli_search');
50
+ Mage::getModel('sli_search/email')
51
+ ->setData('msg', $sliHelper->formatEmailOutput($msg['messages']))
52
+ ->setData('subject', 'SLI Scheduled Feed Generation')
53
+ ->setData('email', Mage::helper('sli_search')->getCronEmail())
54
+ ->send();
55
  }
56
  }
app/code/local/SLI/Search/Model/Email.php CHANGED
@@ -33,9 +33,12 @@ class SLI_Search_Model_Email extends Mage_Core_Model_Abstract {
33
  * @return string
34
  */
35
  public function getSubject() {
36
- return "SLI Scheduled Feed Generation";
37
  }
38
 
 
 
 
39
  /**
40
  * SLI feed generation email body
41
  *
@@ -43,7 +46,8 @@ class SLI_Search_Model_Email extends Mage_Core_Model_Abstract {
43
  */
44
  public function getBody() {
45
  return <<<BODY
46
- Status: {$this->getData('msg')}
 
47
 
48
  Please check the sli log files for further information.
49
 
@@ -51,7 +55,7 @@ BODY;
51
  }
52
 
53
  public function send() {
54
- $email = Mage::helper('sli_search')->getCronEmail();
55
  if ($email) {
56
  mail($email, $this->getSubject(), $this->getBody(), "From: {$this->getFromName()} <{$this->getFromEmail()}>\r\nReply-To: {$this->getFromEmail()}");
57
  }
33
  * @return string
34
  */
35
  public function getSubject() {
36
+ return $this->getData('subject');
37
  }
38
 
39
+ public function getEmail(){
40
+ return $this->getData('email');
41
+ }
42
  /**
43
  * SLI feed generation email body
44
  *
46
  */
47
  public function getBody() {
48
  return <<<BODY
49
+ Status:
50
+ {$this->getData('msg')}
51
 
52
  Please check the sli log files for further information.
53
 
55
  }
56
 
57
  public function send() {
58
+ $email = $this->getEmail();
59
  if ($email) {
60
  mail($email, $this->getSubject(), $this->getBody(), "From: {$this->getFromName()} <{$this->getFromEmail()}>\r\nReply-To: {$this->getFromEmail()}");
61
  }
app/code/local/SLI/Search/Model/Feed.php CHANGED
@@ -31,7 +31,7 @@ class SLI_Search_Model_Feed extends Mage_Core_Model_Abstract {
31
  public function generateFeed($price_feed = false) {
32
  try {
33
  if (!$price_feed) {
34
- echo PHP_EOL."If you had the full version of Learning Search Connect, this would have created a feed containing up to {$this->_getProductCount()} products.".PHP_EOL."Please Contact SLI to receive the full version. Call us toll free in the US: (866) 240-2812 or send us an email to sales@sli-systems.com".PHP_EOL.PHP_EOL;
35
  }
36
  } catch (Exception $e) {
37
  Mage::log("Exception: {$e->getMessage()}");
31
  public function generateFeed($price_feed = false) {
32
  try {
33
  if (!$price_feed) {
34
+ return PHP_EOL."If you had the full version of Learning Search Connect, this would have created a feed containing up to {$this->_getProductCount()} products.".PHP_EOL."Please Contact SLI to receive the full version. Call us toll free in the US: (866) 240-2812 or send us an email to sales@sli-systems.com".PHP_EOL.PHP_EOL;
35
  }
36
  } catch (Exception $e) {
37
  Mage::log("Exception: {$e->getMessage()}");
app/code/local/SLI/Search/Model/System/Config/Backend/Minigrid.php CHANGED
@@ -51,7 +51,7 @@ class SLI_Search_Model_System_Config_Backend_Minigrid extends Mage_Core_Model_Co
51
 
52
  return $values;
53
  }
54
-
55
  /**
56
  * Serialize
57
  */
@@ -75,5 +75,5 @@ class SLI_Search_Model_System_Config_Backend_Minigrid extends Mage_Core_Model_Co
75
  parent::_afterLoad();
76
  $this->setValue(unserialize($this->getValue()));
77
  }
78
-
79
  }
51
 
52
  return $values;
53
  }
54
+
55
  /**
56
  * Serialize
57
  */
75
  parent::_afterLoad();
76
  $this->setValue(unserialize($this->getValue()));
77
  }
78
+
79
  }
app/code/local/SLI/Search/Model/System/Config/Source/Emailsetting.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ *
4
+ * Copyright (c) 2013 S.L.I. Systems, Inc. (www.sli-systems.com) - All Rights Reserved
5
+ * This file is part of Learning Search Connect.
6
+ * Learning Search Connect is distribute under license,
7
+ * go to www.sli-systems.com/LSC for full license details.
8
+ *
9
+ * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
10
+ * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
11
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
12
+ * PARTICULAR PURPOSE.
13
+ *
14
+ *
15
+ * @package SLI
16
+ * @subpackage Search
17
+ *
18
+ *
19
+ */
20
+ class SLI_Search_Model_System_Config_Source_Emailsetting {
21
+ /**
22
+ * Options getter
23
+ *
24
+ * @return array
25
+ */
26
+ public function toOptionArray()
27
+ {
28
+ return array(
29
+ array('value' => 1, 'label'=>Mage::helper('sli_search')->__('Disabled')),
30
+ array('value' => 2, 'label'=>Mage::helper('sli_search')->__('Failures Only')),
31
+ array('value' => 3, 'label'=>Mage::helper('sli_search')->__('All Failures and Successes')),
32
+ );
33
+ }
34
+
35
+ /**
36
+ * Get options in "key-value" format
37
+ *
38
+ * @return array
39
+ */
40
+ public function toArray()
41
+ {
42
+ return array(
43
+ 1 => Mage::helper('sli_search')->__('Disabled'),
44
+ 2 => Mage::helper('sli_search')->__('Failures Only'),
45
+ 3 => Mage::helper('sli_search')->__('All Failures and Successes'),
46
+ );
47
+ }
48
+
49
+ }
app/code/local/SLI/Search/NotificationException.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Copyright (c) 2013 S.L.I. Systems, Inc. (www.sli-systems.com) - All Rights Reserved
4
+ * This file is part of Learning Search Connect.
5
+ * Learning Search Connect is distribute under license,
6
+ * go to www.sli-systems.com/LSC for full license details.
7
+ *
8
+ * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
9
+ * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
10
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
11
+ * PARTICULAR PURPOSE.
12
+ *
13
+ * This will cause the current feed that is being generated to stop, but will allow the next feeds to continue generating.
14
+ *
15
+ * To be used when you a stores feed needs to stop, but other stores can continue
16
+ *
17
+ *
18
+ * @package SLI
19
+ * @subpackage Search
20
+ */
21
+ class SLI_Search_NotificationException extends SLI_Search_Exception{
22
+
23
+ }
app/code/local/SLI/Search/controllers/SearchController.php CHANGED
@@ -22,20 +22,36 @@ class SLI_Search_SearchController extends Mage_Core_Controller_Front_Action {
22
  }
23
 
24
  /**
25
- * Asynchronous posting to feed generation url for each store.
26
  */
27
  public function runFeedGenerationAction() {
28
- $response = array("error" => false);
 
 
 
 
 
29
 
30
  try {
31
- Mage::helper('sli_search/feed')->generateFeedsForAllStores();
32
  }
33
  catch (SLI_Search_Exception $e) {
34
- $response['error'] = $e->getMessage();
 
35
  }
36
  catch (Exception $e) {
37
  Mage::logException($e);
38
- $response['error'] = "An unknown error occurred. Please contact your SLI provider";
 
 
 
 
 
 
 
 
 
 
39
  }
40
  $this->getResponse()
41
  ->setHeader("Content-Type", "application/json")
@@ -48,6 +64,7 @@ class SLI_Search_SearchController extends Mage_Core_Controller_Front_Action {
48
  */
49
  public function generateFeedAction() {
50
  $response = "";
 
51
  try {
52
  $storeId = $this->getRequest()->getParam("storeId");
53
 
@@ -55,16 +72,31 @@ class SLI_Search_SearchController extends Mage_Core_Controller_Front_Action {
55
  $storeId = Mage::app()->getDefaultStoreView()->getId();
56
  }
57
 
58
- Mage::getModel('sli_search/feed')->setData('store_id', $storeId)->generateFeed();
59
- Mage::getModel('sli_search/feed')->setData('store_id', $storeId)->generateFeed(true);
 
 
 
 
 
 
60
  }
61
  catch (SLI_Search_Exception $e) {
62
  $response = $e->getMessage();
 
63
  }
64
  catch (Exception $e) {
65
  Mage::logException($e);
66
  $response = "An unknown error occurred. Please contact your SLI provider";
67
- //@TODO Send a magento message of feed failure
 
 
 
 
 
 
 
 
68
  }
69
  $this->getResponse()->setBody($response);
70
  }
22
  }
23
 
24
  /**
25
+ * Feed generation action, linked to from the admin UI
26
  */
27
  public function runFeedGenerationAction() {
28
+ $response = array();
29
+
30
+ /** @var $sliFeedHelper SLI_Search_Helper_Feed */
31
+ $sliFeedHelper = Mage::helper('sli_search/feed');
32
+ /** @var $sliHelper SLI_Search_Helper_Data */
33
+ $sliHelper = Mage::helper('sli_search');
34
 
35
  try {
36
+ $response = $sliFeedHelper->generateFeedsForAllStores();
37
  }
38
  catch (SLI_Search_Exception $e) {
39
+ $response['messages'] = array("Error" => $e->getMessage());
40
+ $response['error'] = true;
41
  }
42
  catch (Exception $e) {
43
  Mage::logException($e);
44
+ $response['messages'] = array("Error" => "An unknown error occurred. Please contact your SLI provider");;
45
+ $response['error'] = true;
46
+ }
47
+
48
+ //Email results
49
+ if($sliHelper->sendEmail($response['error'])) {
50
+ Mage::getModel('sli_search/email')
51
+ ->setData('msg', $sliHelper->formatEmailOutput($response['messages']))
52
+ ->setData('subject', 'Manual Feed Generation')
53
+ ->setData('email' , $sliHelper->getFeedEmail())
54
+ ->send();
55
  }
56
  $this->getResponse()
57
  ->setHeader("Content-Type", "application/json")
64
  */
65
  public function generateFeedAction() {
66
  $response = "";
67
+ $error = false;
68
  try {
69
  $storeId = $this->getRequest()->getParam("storeId");
70
 
72
  $storeId = Mage::app()->getDefaultStoreView()->getId();
73
  }
74
 
75
+ $productFeed = Mage::getModel('sli_search/feed')->setData('store_id', $storeId)->generateFeed();
76
+ $priceFeed = Mage::getModel('sli_search/feed')->setData('store_id', $storeId)->generateFeed(true);
77
+ if($productFeed && $priceFeed) {
78
+ $response = "Feed generated successfully for store {$storeId}";
79
+ }else {
80
+ $response = "Error occurred during feed generation for store {$storeId}";
81
+ $error = true;
82
+ }
83
  }
84
  catch (SLI_Search_Exception $e) {
85
  $response = $e->getMessage();
86
+ $error = true;
87
  }
88
  catch (Exception $e) {
89
  Mage::logException($e);
90
  $response = "An unknown error occurred. Please contact your SLI provider";
91
+ $error = true;
92
+ }
93
+ $sliHelper = Mage::helper('sli_search');
94
+ if($sliHelper->sendEmail($error)) {
95
+ Mage::getModel('sli_search/email')
96
+ ->setData('msg', $response)
97
+ ->setData('subject', 'Manual Feed Generation')
98
+ ->setData('email', $sliHelper->getFeedEmail())
99
+ ->send();
100
  }
101
  $this->getResponse()->setBody($response);
102
  }
app/code/local/SLI/Search/dropdown.sql ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SELECT `e`.`entity_id`
2
+ AS
3
+ `product_id`,
4
+ IF(at_name.value_id > 0, at_name.value, at_name_default.value)
5
+ AS `name`,
6
+ IF(at_url_path.value_id > 0, at_url_path.value,
7
+ at_url_path_default.value) AS
8
+ `url_path`,
9
+ IF(at_somethingspecial.value_id > 0, at_somethingspecial.value,
10
+ at_somethingspecial_default.value)
11
+ AS `somethingspecial`,
12
+ Group_concat(DISTINCT opt_somethingspecial.value SEPARATOR '|')
13
+ AS
14
+ `option_somethingspecial`
15
+ FROM `catalog_product_entity` AS `e`
16
+ INNER JOIN `catalog_product_entity_int` AS `at_status_default`
17
+ ON ( `at_status_default`.`entity_id` = `e`.`entity_id` )
18
+ AND ( `at_status_default`.`attribute_id` = '273' )
19
+ AND `at_status_default`.`store_id` = 0
20
+ LEFT JOIN `catalog_product_entity_int` AS `at_status`
21
+ ON ( `at_status`.`entity_id` = `e`.`entity_id` )
22
+ AND ( `at_status`.`attribute_id` = '273' )
23
+ AND ( `at_status`.`store_id` = 2 )
24
+ INNER JOIN `catalog_product_website` AS `product_website`
25
+ ON product_website.product_id = e.entity_id
26
+ AND product_website.website_id = '1'
27
+ LEFT JOIN `catalog_product_entity_varchar` AS `at_name_default`
28
+ ON ( `at_name_default`.`entity_id` = `e`.`entity_id` )
29
+ AND ( `at_name_default`.`attribute_id` = '96' )
30
+ AND `at_name_default`.`store_id` = 0
31
+ LEFT JOIN `catalog_product_entity_varchar` AS `at_name`
32
+ ON ( `at_name`.`entity_id` = `e`.`entity_id` )
33
+ AND ( `at_name`.`attribute_id` = '96' )
34
+ AND ( `at_name`.`store_id` = '2 OR `at_name`.`store_id` = 1' )
35
+ LEFT JOIN `catalog_product_entity_varchar` AS `at_url_path_default`
36
+ ON ( `at_url_path_default`.`entity_id` = `e`.`entity_id` )
37
+ AND ( `at_url_path_default`.`attribute_id` = '570' )
38
+ AND `at_url_path_default`.`store_id` = 0
39
+ LEFT JOIN `catalog_product_entity_varchar` AS `at_url_path`
40
+ ON ( `at_url_path`.`entity_id` = `e`.`entity_id` )
41
+ AND ( `at_url_path`.`attribute_id` = '570' )
42
+ AND ( `at_url_path`.`store_id` =
43
+ '2 OR `at_url_path`.`store_id` = 1' )
44
+ LEFT JOIN `catalog_product_entity_int` AS `at_somethingspecial_default`
45
+ ON ( `at_somethingspecial_default`.`entity_id` = `e`.`entity_id` )
46
+ AND ( `at_somethingspecial_default`.`attribute_id` = '1004' )
47
+ AND `at_somethingspecial_default`.`store_id` = 0
48
+ LEFT JOIN `catalog_product_entity_int` AS `at_somethingspecial`
49
+ ON ( `at_somethingspecial`.`entity_id` = `e`.`entity_id` )
50
+ AND ( `at_somethingspecial`.`attribute_id` = '1004' )
51
+ AND ( `at_somethingspecial`.`store_id` =
52
+ '1 OR `at_somethingspecial`.`store_id` = 1'
53
+ )
54
+ LEFT JOIN `eav_attribute_option_value` AS `opt_somethingspecial`
55
+ ON Concat(',', at_somethingspecial.value, ',') LIKE
56
+ Concat('%,', opt_somethingspecial.option_id, ',%')
57
+ WHERE ( IF(at_status.value_id > 0, at_status.value, at_status_default.value) =
58
+ '1' )
59
+ GROUP BY e.entity_id having e.entity_id = 168;
app/code/local/SLI/Search/etc/config.xml CHANGED
@@ -20,7 +20,7 @@
20
  <config>
21
  <modules>
22
  <SLI_Search>
23
- <version>2.1.3</version>
24
  </SLI_Search>
25
  </modules>
26
  <global>
@@ -73,15 +73,18 @@
73
  <default>
74
  <sli_search>
75
  <general>
76
- <enabled>2</enabled>
77
- <log_level>1</log_level>
78
  <price_feed>0</price_feed>
 
79
  </general>
80
  <feed>
81
  <backup>1</backup>
82
  <submittal/>
83
  <stockstatus>1</stockstatus>
84
- <categorystatus>0</categorystatus>
 
 
85
  <generate/>
86
  <write_batch>10000</write_batch>
87
  </feed>
20
  <config>
21
  <modules>
22
  <SLI_Search>
23
+ <version>2.1.4</version>
24
  </SLI_Search>
25
  </modules>
26
  <global>
73
  <default>
74
  <sli_search>
75
  <general>
76
+ <form_enabled>0</form_enabled>
77
+ <feed_enabled>1</feed_enabled>
78
  <price_feed>0</price_feed>
79
+ <log_level>1</log_level>
80
  </general>
81
  <feed>
82
  <backup>1</backup>
83
  <submittal/>
84
  <stockstatus>1</stockstatus>
85
+ <categorystatus>0</categorystatus>
86
+ <email_setting>1</email_setting>
87
+ <emailto/>
88
  <generate/>
89
  <write_batch>10000</write_batch>
90
  </feed>
app/code/local/SLI/Search/etc/system.xml CHANGED
@@ -44,29 +44,39 @@
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  <fields>
47
- <enabled translate="label">
48
- <label>Enabled</label>
49
  <frontend_type>select</frontend_type>
50
- <source_model>sli_search/system_config_backend_enabledsetting</source_model>
51
  <sort_order>1</sort_order>
52
  <show_in_default>1</show_in_default>
53
  <show_in_website>1</show_in_website>
54
  <show_in_store>1</show_in_store>
55
- </enabled>
 
 
 
 
 
 
 
 
 
56
  <price_feed>
57
  <label>Price Feed</label>
58
  <frontend_type>select</frontend_type>
59
- <source_model>adminhtml/system_config_source_yesno</source_model>
60
- <comment>This feature is only functional in Enterprise Edition.</comment>
61
  <sort_order>5</sort_order>
62
  <show_in_default>1</show_in_default>
63
  <show_in_website>1</show_in_website>
64
  <show_in_store>1</show_in_store>
65
- </price_feed>
66
  <log_level>
67
  <label>Log Level</label>
68
  <frontend_type>select</frontend_type>
69
  <source_model>sli_search/system_config_backend_loglevel</source_model>
 
70
  <sort_order>10</sort_order>
71
  <show_in_default>1</show_in_default>
72
  <show_in_website>1</show_in_website>
@@ -127,6 +137,23 @@
127
  <show_in_website>1</show_in_website>
128
  <show_in_store>1</show_in_store>
129
  </categorystatus>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  <generate translate="label">
131
  <label>Generate Feed</label>
132
  <frontend_type>button</frontend_type>
44
  <show_in_website>1</show_in_website>
45
  <show_in_store>1</show_in_store>
46
  <fields>
47
+ <form_enabled translate="label">
48
+ <label>SLI Search Form</label>
49
  <frontend_type>select</frontend_type>
50
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
51
  <sort_order>1</sort_order>
52
  <show_in_default>1</show_in_default>
53
  <show_in_website>1</show_in_website>
54
  <show_in_store>1</show_in_store>
55
+ </form_enabled>
56
+ <feed_enabled translate="label">
57
+ <label>Feed Generation</label>
58
+ <frontend_type>select</frontend_type>
59
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
60
+ <sort_order>1</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ </feed_enabled>
65
  <price_feed>
66
  <label>Price Feed</label>
67
  <frontend_type>select</frontend_type>
68
+ <source_model>adminhtml/system_config_source_enabledisable</source_model>
69
+ <depends><feed_enabled>1</feed_enabled></depends>
70
  <sort_order>5</sort_order>
71
  <show_in_default>1</show_in_default>
72
  <show_in_website>1</show_in_website>
73
  <show_in_store>1</show_in_store>
74
+ </price_feed>
75
  <log_level>
76
  <label>Log Level</label>
77
  <frontend_type>select</frontend_type>
78
  <source_model>sli_search/system_config_backend_loglevel</source_model>
79
+ <comment>Please set to "Trace" if SLI support is required.</comment>
80
  <sort_order>10</sort_order>
81
  <show_in_default>1</show_in_default>
82
  <show_in_website>1</show_in_website>
137
  <show_in_website>1</show_in_website>
138
  <show_in_store>1</show_in_store>
139
  </categorystatus>
140
+ <email_setting>
141
+ <label>Email Results</label>
142
+ <frontend_type>select</frontend_type>
143
+ <source_model>sli_search/system_config_source_emailsetting</source_model>
144
+ <sort_order>180</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>0</show_in_website>
147
+ <show_in_store>0</show_in_store>
148
+ </email_setting>
149
+ <emailto>
150
+ <label>Email Address</label>
151
+ <frontend_type>text</frontend_type>
152
+ <sort_order>190</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>0</show_in_website>
155
+ <show_in_store>0</show_in_store>
156
+ </emailto>
157
  <generate translate="label">
158
  <label>Generate Feed</label>
159
  <frontend_type>button</frontend_type>
app/design/adminhtml/default/default/template/sli/search/sysconfig/generate/js.phtml CHANGED
@@ -46,6 +46,13 @@
46
  var responseEl = new Element('p', {id : this.displayId}).addClassName('note');
47
  Element.insert($(this.buttonId) , {after: responseEl});
48
  }
 
 
 
 
 
 
 
49
  if (response.error) {
50
  return responseEl.innerHTML = response.error;
51
  }
46
  var responseEl = new Element('p', {id : this.displayId}).addClassName('note');
47
  Element.insert($(this.buttonId) , {after: responseEl});
48
  }
49
+ if(response.messages) {
50
+ responseEl.innerHTML = '';
51
+ for(var message in response.messages) {
52
+ responseEl.appendChild( new Element('p').update('<b>' + message + ':</b> ' + response.messages[message]));
53
+ }
54
+ return responseEl;
55
+ }
56
  if (response.error) {
57
  return responseEl.innerHTML = response.error;
58
  }
app/design/frontend/base/default/layout/sli/search.xml CHANGED
@@ -28,8 +28,14 @@
28
  <block type="sli_search/search_js_top" name="sli_search_top_js" />
29
  </reference>
30
  <reference name="header">
31
- <action method="unsetBlock"><block>top.search</block></action>
32
- <block name="top.search" as="topSearch" type="sli_search/search_form_mini" template="catalogsearch/form.mini.phtml"/>
 
 
 
 
 
 
33
  </reference>
34
  </default>
35
  <sli_search_search_template>
28
  <block type="sli_search/search_js_top" name="sli_search_top_js" />
29
  </reference>
30
  <reference name="header">
31
+ <action method="unsetChild" ifconfig="sli_search/general/form_enabled">
32
+ <name>topSearch</name>
33
+ </action>
34
+ <block name="sliSearch" type="sli_search/search_form_mini" template="sli/search/form.mini.phtml"/>
35
+ <action method="append" ifconfig="sli_search/general/form_enabled">
36
+ <block>sliSearch</block>
37
+ <alias>topSearch</alias>
38
+ </action>
39
  </reference>
40
  </default>
41
  <sli_search_search_template>
app/etc/modules/SLI_Search.xml CHANGED
@@ -6,6 +6,7 @@
6
  <codePool>local</codePool>
7
  <depends>
8
  <Mage_CatalogSearch/>
 
9
  </depends>
10
  </SLI_Search>
11
  </modules>
6
  <codePool>local</codePool>
7
  <depends>
8
  <Mage_CatalogSearch/>
9
+ <Mage_Catalog />
10
  </depends>
11
  </SLI_Search>
12
  </modules>
package.xml CHANGED
@@ -1,21 +1,22 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>slisearch</name>
4
- <version>2.1.3</version>
5
  <stability>stable</stability>
6
- <license uri="http://sli-systems.com/lsc">SLI Feed Generation</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>LSC integrates Magento with SLI's SaaS based Learning Search, Learning Navigation and user based SEO products.</summary>
10
  <description>Learning Search Connect (LSC) produces data feeds out of current Magento Community and Enterprise editions. The feeds are created and then sent to SLI's FTP servers for further processing.</description>
11
  <notes>Changes since last release:&#xD;
12
- * Removed ability to produce feeds concurrently&#xD;
13
- * Added customer logged in state and username to the cart API&#xD;
14
- * Updated ability to add custom search form code via admin UI </notes>
15
- <authors><author><name>Platform support</name><user>SLI-Systems</user><email>support@sli-system.com</email></author></authors>
16
- <date>2015-01-29</date>
17
- <time>00:36:15</time>
18
- <contents><target name="magelocal"><dir name="SLI"><dir name="Search"><dir name="Block"><dir name="Search"><dir name="Form"><file name="Mini.php" hash="429dcdb4cdef6c38cfb3311cf5740434"/></dir><dir name="Js"><file name="Bottom.php" hash="c6477910e2814c18b36d58886a588d6c"/><file name="Top.php" hash="30c9de8f8a7059af5fa7eb381ee0f368"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><dir name="Minigrid"><file name="Js.php" hash="1a9a5a3c880c11f6e99ba53956ec7101"/></dir><file name="Minigrid.php" hash="3f0810444f875bf8502ef79742a314e4"/><file name="Version.php" hash="72bcde22f1eaa0e2f8fafd3e00d717e4"/></dir></dir><file name="Form.php" hash="4a1551d259ef3510cb803cb02a026083"/><dir name="Frontend"><dir name="Feed"><dir name="Generate"><file name="Js.php" hash="c7a4f7c7cbd83c3479d8bf2cfc360597"/></dir><file name="Generate.php" hash="3ad8446e6650c5d3562574f294b4bcef"/><file name="Next.php" hash="008c3d9351c50712ea4d2b76531e0bb4"/></dir></dir></dir></dir><dir name="Widget"><dir name="Minigrid"><file name="Form.php" hash="014ef14b01cbafc9cd305e9a1caf82ae"/></dir></dir></dir><file name="Exception.php" hash="6a8fc0cab1826df68df2e447d2152e58"/><dir name="Helper"><file name="Data.php" hash="7c70b86cf43fe25e9d9ccd60c6963ae7"/><file name="Feed.php" hash="418640624e70fe70c7c565e0d11f6842"/></dir><dir name="Model"><file name="Cron.php" hash="8b5add82d7d473205556c29684393849"/><file name="Email.php" hash="701049238dca1a452e67d7bcc0d77f00"/><file name="Feed.php" hash="8d99140347d164e59e3258cd44ddf846"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="ae282d6bfc5e22e7c3320d581465f24d"/><file name="Enabledsetting.php" hash="059ac548a388b8ca02147d0d317f7bb5"/><file name="Loglevel.php" hash="31b58bfdf479b9de2380f3d741bd3175"/><file name="Minigrid.php" hash="a899cfbc25c573846b735e1170970c99"/></dir><dir name="Source"><file name="Attributes.php" hash="e777863deb4e2e17574a833202911f38"/><dir name="Cron"><file name="Frequency.php" hash="882dade19aec9b2bddf1cdb611be018c"/></dir><dir name="Minigrid"><file name="Abstract.php" hash="3f65ae2dd959bb8583cfcffb0109cffa"/><file name="Attributes.php" hash="7a97225139a38a4a0576538293980187"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="ApiController.php" hash="b2e138b49dc29b4a17836ab3436beaba"/><file name="SearchController.php" hash="44422b8daf76199590dd0d7cbfb4a76c"/></dir><dir name="doc"><file name="changelog.txt" hash="93ac6e72c6dbfb91e3ee2f2c2701d865"/><file name="design.txt" hash="ff939b286de699aed45c6d6ad103cd5c"/><file name="makeTar.txt" hash="ef75554f12dde147891fea285a7f6bc0"/></dir><dir name="etc"><file name="adminhtml.xml" hash="868b799465f118e2212bcff9048994bb"/><file name="config.xml" hash="23cdf01126e206038993143681b6a1c0"/><file name="system.xml" hash="adb6579058a1f52b64686316a47063c3"/></dir><dir name="sql"><dir name="sli_search_setup"><file name="install-1.0.0.php" hash="8b5dd72380e039eb124b804657086f77"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="sli"><dir name="search"><dir name="sysconfig"><dir name="generate"><file name="js.phtml" hash="1c319107ff81a345b1a74e35db7e9345"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="sli"><file name="search.xml" hash="577634295563f34597cbbde6978d56d1"/></dir></dir><dir name="template"><dir name="sli"><dir name="search"><file name="form.mini.phtml" hash="57c4a3ea68c2ba0678ded7949c0661a4"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SLI_Search.xml" hash="69e7e36c854f81f58e6445324aa37021"/></dir></target><target name="mage"><dir name="shell"><dir name="sli"><file name="feed.php" hash="daaf2fdb80f6cc72ddf5b35709822416"/></dir></dir></target></contents>
 
19
  <compatible/>
20
  <dependencies><required><php><min>5.3.19</min><max>5.5.0</max></php></required></dependencies>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>slisearch</name>
4
+ <version>2.1.4</version>
5
  <stability>stable</stability>
6
+ <license uri="http://www.sli-systems.com/lsc">SLI Feed Generation</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>LSC integrates Magento with SLI's SaaS based Learning Search, Learning Navigation and user based SEO products.</summary>
10
  <description>Learning Search Connect (LSC) produces data feeds out of current Magento Community and Enterprise editions. The feeds are created and then sent to SLI's FTP servers for further processing.</description>
11
  <notes>Changes since last release:&#xD;
12
+ * Added ability to disable/enable the feed generation and the search form separately&#xD;
13
+ * Updated ability to send feed generation success/failure notifications&#xD;
14
+ * Fixed issue with the pricing for configurable products whose children are out of stock&#xD;
15
+ * Fixed issue with the price feed in multiple stores</notes>
16
+ <authors><author><name>Platform Support</name><user>SLI-Systems</user><email>support@sli-systems.com</email></author></authors>
17
+ <date>2015-06-16</date>
18
+ <time>05:45:43</time>
19
+ <contents><target name="magelocal"><dir name="SLI"><dir name="Search"><dir name="Block"><dir name="Search"><dir name="Form"><file name="Mini.php" hash="3604db79a2b2f26b45805b9cb2ad2a3e"/></dir><dir name="Js"><file name="Bottom.php" hash="0a692390e55bb4023949fa031e3d4e70"/><file name="Top.php" hash="aea872cd49aa8e354e676633542aea94"/></dir></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><dir name="Minigrid"><file name="Js.php" hash="e5073c787a85d065029b210a347b8009"/></dir><file name="Minigrid.php" hash="fa2e4dec779179aae10e9bdd678429cc"/><file name="Version.php" hash="72bcde22f1eaa0e2f8fafd3e00d717e4"/></dir></dir><file name="Form.php" hash="4a1551d259ef3510cb803cb02a026083"/><dir name="Frontend"><dir name="Feed"><dir name="Generate"><file name="Js.php" hash="c7a4f7c7cbd83c3479d8bf2cfc360597"/></dir><file name="Generate.php" hash="3ad8446e6650c5d3562574f294b4bcef"/><file name="Next.php" hash="008c3d9351c50712ea4d2b76531e0bb4"/></dir></dir></dir></dir><dir name="Widget"><dir name="Minigrid"><file name="Form.php" hash="014ef14b01cbafc9cd305e9a1caf82ae"/></dir></dir></dir><file name="Exception.php" hash="6a8fc0cab1826df68df2e447d2152e58"/><dir name="Helper"><file name="Data.php" hash="93b201c553af72dcc023f702d35f18b6"/><file name="Feed.php" hash="29a34ecb802155308cd3dc023c11827b"/></dir><dir name="Model"><file name="Cron.php" hash="afb9440de8054fc20db834e7d7fb7889"/><file name="Email.php" hash="db28fb33aaf2f32ae0dbf1ceb13761e3"/><file name="Feed.php" hash="2e46a4651ffa8f13309a7a8225ad156d"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Cron.php" hash="ae282d6bfc5e22e7c3320d581465f24d"/><file name="Enabledsetting.php" hash="059ac548a388b8ca02147d0d317f7bb5"/><file name="Loglevel.php" hash="31b58bfdf479b9de2380f3d741bd3175"/><file name="Minigrid.php" hash="afc9bff695c0b3b933340c4dcb2837ad"/></dir><dir name="Source"><file name="Attributes.php" hash="e777863deb4e2e17574a833202911f38"/><dir name="Cron"><file name="Frequency.php" hash="882dade19aec9b2bddf1cdb611be018c"/></dir><file name="Emailsetting.php" hash="a5776ec69c7a1413c87d3290530741af"/><dir name="Minigrid"><file name="Abstract.php" hash="3f65ae2dd959bb8583cfcffb0109cffa"/><file name="Attributes.php" hash="7a97225139a38a4a0576538293980187"/></dir></dir></dir></dir></dir><file name="NotificationException.php" hash="79982dffb46f3e0468bc5f38d22e322e"/><dir name="controllers"><file name="ApiController.php" hash="b2e138b49dc29b4a17836ab3436beaba"/><file name="SearchController.php" hash="7403ba2b0f1223f48fe3a982d0066042"/></dir><dir name="doc"><file name="changelog.txt" hash="93ac6e72c6dbfb91e3ee2f2c2701d865"/><file name="design.txt" hash="ff939b286de699aed45c6d6ad103cd5c"/><file name="makeTar.txt" hash="ef75554f12dde147891fea285a7f6bc0"/></dir><file name="dropdown.sql" hash="dc15502900071cb30caa144ddeb21a0d"/><dir name="etc"><file name="adminhtml.xml" hash="868b799465f118e2212bcff9048994bb"/><file name="config.xml" hash="907a1309543293c61015b62c775b5a06"/><file name="system.xml" hash="603c5b3af3f8cd2fa5803764b74f1b9e"/></dir><dir name="sql"><dir name="sli_search_setup"><file name="install-1.0.0.php" hash="8b5dd72380e039eb124b804657086f77"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="sli"><dir name="search"><dir name="sysconfig"><dir name="generate"><file name="js.phtml" hash="9797355ec3189a3c37933a21f7351a18"/></dir></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="sli"><file name="search.xml" hash="06a16a544602d34c2b4fb0fa45257941"/></dir></dir><dir name="template"><dir name="sli"><dir name="search"><file name="form.mini.phtml" hash="57c4a3ea68c2ba0678ded7949c0661a4"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SLI_Search.xml" hash="56554dd94200e574eb398c59a437af4c"/></dir></target><target name="mage"><dir name="shell"><dir name="sli"><file name="feed.php" hash="daaf2fdb80f6cc72ddf5b35709822416"/></dir></dir></target></contents>
20
  <compatible/>
21
  <dependencies><required><php><min>5.3.19</min><max>5.5.0</max></php></required></dependencies>
22
  </package>