Version Notes
Changes since last release:
* Removed ability to produce feeds concurrently
* Added customer logged in state and username to the cart API
* Updated ability to add custom search form code via admin UI
Download this release
Release Info
Developer | Platform support |
Extension | slisearch |
Version | 2.1.3 |
Comparing to | |
See all releases |
Code changes from version 2.1.2 to 2.1.3
- app/code/local/SLI/CartInfo/Helper/Data.php +0 -137
- app/code/local/SLI/CartInfo/controllers/ApiController.php +0 -38
- app/code/local/SLI/CartInfo/etc/config.xml +0 -35
- app/code/local/SLI/Search/Block/Search/Form/Mini.php +14 -1
- app/code/local/SLI/Search/Helper/Data.php +38 -12
- app/code/local/SLI/Search/Helper/Feed.php +9 -13
- app/code/local/SLI/Search/controllers/ApiController.php +21 -6
- app/code/local/SLI/Search/etc/config.xml +14 -10
- app/code/local/SLI/Search/etc/system.xml +30 -9
- app/design/frontend/base/default/template/sli/search/form.mini.phtml +1 -1
- package.xml +7 -9
app/code/local/SLI/CartInfo/Helper/Data.php
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Helper class to render the JSONP object for SLI
|
4 |
-
*
|
5 |
-
*/
|
6 |
-
class SLI_CartInfo_Helper_Data extends Mage_Core_Helper_Abstract
|
7 |
-
{
|
8 |
-
/**
|
9 |
-
* Render the cart grand total and total item within the cart
|
10 |
-
* @param Mage_Sales_Model_Quote $quote
|
11 |
-
* @return array
|
12 |
-
*/
|
13 |
-
private function _renderCartTotal( $quote )
|
14 |
-
{
|
15 |
-
if( !$quote ) return false;
|
16 |
-
|
17 |
-
//Declare the array container
|
18 |
-
$cartInfoArray = array();
|
19 |
-
$quoteItemCount = $quote->getItemsCount();
|
20 |
-
|
21 |
-
//Store the item count to array
|
22 |
-
$cartInfoArray['NumberOfItems'] = $quoteItemCount;
|
23 |
-
|
24 |
-
$totals = $quote->getTotals();
|
25 |
-
if( $totals )
|
26 |
-
{
|
27 |
-
if( $totals['grand_total'] )
|
28 |
-
$cartInfoArray['TotalPrice'] = $totals['grand_total']->getValue();
|
29 |
-
|
30 |
-
if( $totals['tax'] )
|
31 |
-
$cartInfoArray['TotalGST'] = $totals['tax']->getValue();
|
32 |
-
}
|
33 |
-
|
34 |
-
//Get The Cart Total Discount Amount
|
35 |
-
$items = $quote->getAllVisibleItems();
|
36 |
-
$itemDiscount = 0;
|
37 |
-
foreach( $items as $item )
|
38 |
-
{
|
39 |
-
if( !$item ) continue;
|
40 |
-
$itemDiscount += $item->getDiscountAmount();
|
41 |
-
}
|
42 |
-
$cartInfoArray['TotalDiscount'] = $itemDiscount;
|
43 |
-
|
44 |
-
//Get The Delivery Cost if applicable
|
45 |
-
$shippingCost = $quote->getShippingAddress()->getShippingAmount();
|
46 |
-
$shippingCostTax = $quote->getShippingAddress()->getShippingTaxAmount();
|
47 |
-
if($shippingCost == (float)0){
|
48 |
-
$cartInfoArray['DeliveryCost'] = 0;
|
49 |
-
}else{
|
50 |
-
$cartInfoArray['DeliveryCost'] = (float)$shippingCost + (float)$shippingCostTax;
|
51 |
-
}
|
52 |
-
|
53 |
-
return $cartInfoArray;
|
54 |
-
}
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Render the cart item detail
|
58 |
-
* @param Mage_Sales_Model_Quote $quote
|
59 |
-
* @return array
|
60 |
-
*/
|
61 |
-
private function _renderItemsDetail( $quote )
|
62 |
-
{
|
63 |
-
//Array of items
|
64 |
-
$itemsArray = array();
|
65 |
-
if( !$quote ) return false;
|
66 |
-
|
67 |
-
$items = $quote->getAllVisibleItems();
|
68 |
-
|
69 |
-
foreach( $items as $item )
|
70 |
-
{
|
71 |
-
if( !$item ) continue;
|
72 |
-
|
73 |
-
//Declare an array to store item information
|
74 |
-
$itemInfo = array();
|
75 |
-
$itemProduct = $item->getProduct();
|
76 |
-
|
77 |
-
$itemInfo[ 'title' ] = $item->getName();
|
78 |
-
$itemInfo[ 'sku' ] = $item->getSku();
|
79 |
-
$itemInfo[ 'qty' ] = $item->getQty();
|
80 |
-
//Get the item Product Object
|
81 |
-
$product = $item->getProduct();
|
82 |
-
//Get the original price for item product
|
83 |
-
$itemInfo[ 'price' ] = $product->getPrice();
|
84 |
-
//Get the sale price
|
85 |
-
$itemInfo[ 'sale_price' ] = $item->getPriceInclTax();
|
86 |
-
|
87 |
-
$itemInfo[ 'item_url' ] = $this->getItemUrl($item);
|
88 |
-
$itemInfo[ 'remove_url' ] = Mage::getUrl('checkout/cart/delete/', array('id'=>$item->getId()));
|
89 |
-
$itemInfo[ 'image_url' ] = Mage::getModel('catalog/product_media_config')->getMediaUrl($itemProduct->getThumbnail());
|
90 |
-
|
91 |
-
$itemsArray[] = $itemInfo;
|
92 |
-
}
|
93 |
-
return $itemsArray;
|
94 |
-
}
|
95 |
-
|
96 |
-
/**
|
97 |
-
* Get the item url
|
98 |
-
* @param cart item
|
99 |
-
* @return string
|
100 |
-
*/
|
101 |
-
|
102 |
-
public function getItemUrl($item)
|
103 |
-
{
|
104 |
-
if ($item->getRedirectUrl()) {
|
105 |
-
return $item->getRedirectUrl();
|
106 |
-
}
|
107 |
-
|
108 |
-
$product = $item->getProduct();
|
109 |
-
$option = $item->getOptionByCode('product_type');
|
110 |
-
if ($option) {
|
111 |
-
$product = $option->getProduct();
|
112 |
-
}
|
113 |
-
return $product->getUrlModel()->getUrl($product);
|
114 |
-
|
115 |
-
}
|
116 |
-
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Render the JSONP object for SLI
|
120 |
-
*
|
121 |
-
* @param Mage_Sales_Model_Quote $quote
|
122 |
-
* @return string
|
123 |
-
*/
|
124 |
-
public function getCartJSONP( $quote )
|
125 |
-
{
|
126 |
-
$form_key['form_key'] = Mage::getSingleton('core/session')->getFormKey();
|
127 |
-
$cart = $this->_renderCartTotal( $quote );
|
128 |
-
$items = $this->_renderItemsDetail( $quote );
|
129 |
-
|
130 |
-
$result = array_merge($form_key, $cart, $items);
|
131 |
-
$jsonResult = json_encode( $result );
|
132 |
-
//Wrap up as jsonp object
|
133 |
-
$jsonpResult = "sliCartRequest($jsonResult)";
|
134 |
-
return $jsonpResult;
|
135 |
-
}
|
136 |
-
|
137 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/SLI/CartInfo/controllers/ApiController.php
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Provide the URL for SLI to retrieve the current shopping cart items and all relative informations
|
4 |
-
* An JSON file will be passback
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
class SLI_CartInfo_ApiController extends Mage_Core_Controller_Front_Action
|
8 |
-
{
|
9 |
-
//Decare the quote
|
10 |
-
private $_quote = NULL;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Load the quote by passing the quote id
|
14 |
-
*
|
15 |
-
* @param int $quoteId
|
16 |
-
* @return Mage_Sales_Model_Quote
|
17 |
-
*/
|
18 |
-
private function _getQuote()
|
19 |
-
{
|
20 |
-
if( $this->_quote ) return $this->_quote;
|
21 |
-
else return Mage::getSingleton('checkout/session')->getQuote();
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Allow SLI to call this url to get the cart jsonp object
|
26 |
-
*
|
27 |
-
*/
|
28 |
-
public function cartAction()
|
29 |
-
{
|
30 |
-
$jsonpResult = Mage::helper( 'sli_cartinfo' )->getCartJSONP( $this->_getQuote() );
|
31 |
-
|
32 |
-
if( $jsonpResult )
|
33 |
-
$this->getResponse()->setBody( $jsonpResult );
|
34 |
-
}
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/SLI/CartInfo/etc/config.xml
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
-
<!--
|
3 |
-
/**
|
4 |
-
* Custom SLI API, which allows SLI retrives customer cart by calling the URL
|
5 |
-
*
|
6 |
-
*
|
7 |
-
*/
|
8 |
-
-->
|
9 |
-
<config>
|
10 |
-
<modules>
|
11 |
-
<SLI_CartInfo>
|
12 |
-
<version>0.1.0</version>
|
13 |
-
</SLI_CartInfo>
|
14 |
-
</modules>
|
15 |
-
|
16 |
-
<global>
|
17 |
-
<helpers>
|
18 |
-
<sli_cartinfo>
|
19 |
-
<class>SLI_CartInfo_Helper</class>
|
20 |
-
</sli_cartinfo>
|
21 |
-
</helpers>
|
22 |
-
</global>
|
23 |
-
|
24 |
-
<frontend>
|
25 |
-
<routers>
|
26 |
-
<cartinfo>
|
27 |
-
<use>standard</use>
|
28 |
-
<args>
|
29 |
-
<module>SLI_CartInfo</module>
|
30 |
-
<frontName>cartinfo</frontName>
|
31 |
-
</args>
|
32 |
-
</cartinfo>
|
33 |
-
</routers>
|
34 |
-
</frontend>
|
35 |
-
</config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/SLI/Search/Block/Search/Form/Mini.php
CHANGED
@@ -46,6 +46,15 @@ class SLI_Search_Block_Search_Form_Mini extends Mage_Core_Block_Template {
|
|
46 |
return $url;
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
/**
|
50 |
* Switch out the default form mini template for the sli version
|
51 |
*
|
@@ -53,7 +62,11 @@ class SLI_Search_Block_Search_Form_Mini extends Mage_Core_Block_Template {
|
|
53 |
*/
|
54 |
protected function _toHtml() {
|
55 |
if (Mage::helper('sli_search')->isEnabled(Mage::app()->getStore()->getId())) {
|
56 |
-
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
return parent::_toHtml();
|
59 |
}
|
46 |
return $url;
|
47 |
}
|
48 |
|
49 |
+
/**
|
50 |
+
* Retrieve the form code from the database for this site
|
51 |
+
*
|
52 |
+
* @return string
|
53 |
+
*/
|
54 |
+
public function getFormData() {
|
55 |
+
return $data = Mage::helper('sli_search')->getFormData();
|
56 |
+
}
|
57 |
+
|
58 |
/**
|
59 |
* Switch out the default form mini template for the sli version
|
60 |
*
|
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 |
}
|
app/code/local/SLI/Search/Helper/Data.php
CHANGED
@@ -22,6 +22,7 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
22 |
const GENERAL_GROUP = "general/";
|
23 |
const FEED_GROUP = "feed/";
|
24 |
const FTP_GROUP = "ftp/";
|
|
|
25 |
const JS_GROUP = "js/";
|
26 |
const CRON_GROUP = "cron/";
|
27 |
const ATTR_GROUP = "attributes/";
|
@@ -384,6 +385,27 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
384 |
|
385 |
return $returnJS;
|
386 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
/**
|
388 |
* Render the cart grand total and total item within the cart
|
389 |
* @param Mage_Sales_Model_Quote $quote
|
@@ -399,14 +421,14 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
399 |
|
400 |
//Store the item count to array
|
401 |
$cartInfoArray['NumberOfItems'] = $quoteItemCount;
|
402 |
-
|
403 |
$totals = $quote->getTotals();
|
404 |
if( $totals )
|
405 |
{
|
406 |
-
if( $totals['grand_total'] )
|
407 |
$cartInfoArray['TotalPrice'] = $totals['grand_total']->getValue();
|
408 |
|
409 |
-
if( $totals['tax'] )
|
410 |
$cartInfoArray['TotalTax'] = $totals['tax']->getValue();
|
411 |
}
|
412 |
|
@@ -442,20 +464,22 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
442 |
//Array of items
|
443 |
$itemsArray = array();
|
444 |
if( !$quote ) return false;
|
445 |
-
|
446 |
$items = $quote->getAllVisibleItems();
|
447 |
|
448 |
foreach( $items as $item )
|
449 |
{
|
|
|
450 |
if( !$item ) continue;
|
451 |
|
452 |
//Declare an array to store item information
|
453 |
$itemInfo = array();
|
|
|
454 |
$itemProduct = $item->getProduct();
|
455 |
-
|
456 |
$itemInfo[ 'title' ] = $item->getName();
|
457 |
$itemInfo[ 'sku' ] = $item->getSku();
|
458 |
-
$itemInfo[ 'qty' ] = $item->getQty();
|
459 |
//Get the item Product Object
|
460 |
$product = $item->getProduct();
|
461 |
//Get the original price for item product
|
@@ -465,8 +489,8 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
465 |
|
466 |
$itemInfo[ 'item_url' ] = $this->getItemUrl($item);
|
467 |
$itemInfo[ 'remove_url' ] = Mage::getUrl('checkout/cart/delete/', array('id'=>$item->getId()));
|
468 |
-
$itemInfo[ 'image_url' ] = Mage::getModel('catalog/product_media_config')->getMediaUrl($itemProduct->getThumbnail());
|
469 |
-
|
470 |
$itemsArray[] = $itemInfo;
|
471 |
}
|
472 |
return $itemsArray;
|
@@ -474,10 +498,9 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
474 |
|
475 |
/**
|
476 |
* Get the item url
|
477 |
-
* @param
|
478 |
* @return string
|
479 |
*/
|
480 |
-
|
481 |
public function getItemUrl($item)
|
482 |
{
|
483 |
if ($item->getRedirectUrl()) {
|
@@ -502,11 +525,14 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
502 |
*/
|
503 |
public function getCartJSONP( $quote )
|
504 |
{
|
505 |
-
$
|
|
|
|
|
|
|
506 |
$cart = $this->_renderCartTotal( $quote );
|
507 |
$items['items'] = $this->_renderItemsDetail( $quote );
|
508 |
|
509 |
-
$result = array_merge($
|
510 |
$jsonResult = json_encode( $result );
|
511 |
//Wrap up as jsonp object
|
512 |
$jsonpResult = "sliCartRequest($jsonResult)";
|
22 |
const GENERAL_GROUP = "general/";
|
23 |
const FEED_GROUP = "feed/";
|
24 |
const FTP_GROUP = "ftp/";
|
25 |
+
const FORM_GROUP = "form/";
|
26 |
const JS_GROUP = "js/";
|
27 |
const CRON_GROUP = "cron/";
|
28 |
const ATTR_GROUP = "attributes/";
|
385 |
|
386 |
return $returnJS;
|
387 |
}
|
388 |
+
|
389 |
+
|
390 |
+
/**
|
391 |
+
* Checks to see if the the custom form code should be used
|
392 |
+
*
|
393 |
+
* @return bool
|
394 |
+
*/
|
395 |
+
public function useCustomForm() {
|
396 |
+
return (bool) Mage::getStoreConfig(self::SECTION . self::FORM_GROUP . "customform");
|
397 |
+
}
|
398 |
+
|
399 |
+
|
400 |
+
/**
|
401 |
+
* This returns the form code from the DB
|
402 |
+
*
|
403 |
+
* @return string
|
404 |
+
*/
|
405 |
+
public function getFormData() {
|
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
|
421 |
|
422 |
//Store the item count to array
|
423 |
$cartInfoArray['NumberOfItems'] = $quoteItemCount;
|
424 |
+
|
425 |
$totals = $quote->getTotals();
|
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 |
|
464 |
//Array of items
|
465 |
$itemsArray = array();
|
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 */
|
478 |
$itemProduct = $item->getProduct();
|
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
|
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;
|
498 |
|
499 |
/**
|
500 |
* Get the item url
|
501 |
+
* @param $item Mage_Sales_Model_Quote_Item
|
502 |
* @return string
|
503 |
*/
|
|
|
504 |
public function getItemUrl($item)
|
505 |
{
|
506 |
if ($item->getRedirectUrl()) {
|
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)";
|
app/code/local/SLI/Search/Helper/Feed.php
CHANGED
@@ -22,10 +22,13 @@ class SLI_Search_Helper_Feed {
|
|
22 |
|
23 |
/**
|
24 |
* Open socket to feed generation url with store id as passed parameter.
|
25 |
-
*
|
|
|
|
|
26 |
* @param Mage_Core_Model_Store $store
|
27 |
* @param array $urlParts
|
28 |
-
* @throws Mage_Core_Exception
|
|
|
29 |
*/
|
30 |
public function postToGenerateFeed($store, $urlParts) {
|
31 |
$feedSocket = @fsockopen($urlParts['host'], 80, $errNo, $errStr, 10);
|
@@ -79,17 +82,10 @@ class SLI_Search_Helper_Feed {
|
|
79 |
try{
|
80 |
$stores = Mage::getResourceModel('core/store_collection');
|
81 |
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
Mage::getModel('sli_search/feed')->setData('store_id', $storeId)->generateFeed(true);
|
87 |
-
}
|
88 |
-
}
|
89 |
-
else{
|
90 |
-
foreach($stores as $store) {
|
91 |
-
$this->postToGenerateFeed($store, $urlParts);
|
92 |
-
}
|
93 |
}
|
94 |
}
|
95 |
catch (Exception $e) {
|
22 |
|
23 |
/**
|
24 |
* Open socket to feed generation url with store id as passed parameter.
|
25 |
+
*
|
26 |
+
*
|
27 |
+
* @deprecated
|
28 |
* @param Mage_Core_Model_Store $store
|
29 |
* @param array $urlParts
|
30 |
+
* @throws Mage_Core_Exception
|
31 |
+
* @throws SLI_Search_Exception
|
32 |
*/
|
33 |
public function postToGenerateFeed($store, $urlParts) {
|
34 |
$feedSocket = @fsockopen($urlParts['host'], 80, $errNo, $errStr, 10);
|
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) {
|
app/code/local/SLI/Search/controllers/ApiController.php
CHANGED
@@ -1,7 +1,22 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
*
|
6 |
*/
|
7 |
class SLI_Search_ApiController extends Mage_Core_Controller_Front_Action
|
@@ -32,7 +47,7 @@ class SLI_Search_ApiController extends Mage_Core_Controller_Front_Action
|
|
32 |
if( $jsonpResult )
|
33 |
$this->getResponse()->setBody( $jsonpResult );
|
34 |
}
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
}
|
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 |
+
* Provide the URL for SLI to retrieve the current shopping cart items and all relative information
|
19 |
+
* An JSON file will be passedback
|
20 |
*
|
21 |
*/
|
22 |
class SLI_Search_ApiController extends Mage_Core_Controller_Front_Action
|
47 |
if( $jsonpResult )
|
48 |
$this->getResponse()->setBody( $jsonpResult );
|
49 |
}
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
}
|
app/code/local/SLI/Search/etc/config.xml
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
<config>
|
21 |
<modules>
|
22 |
<SLI_Search>
|
23 |
-
<version>2.1.
|
24 |
</SLI_Search>
|
25 |
</modules>
|
26 |
<global>
|
@@ -79,26 +79,30 @@
|
|
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>
|
88 |
<ftp>
|
89 |
<enabled>1</enabled>
|
90 |
-
<user
|
91 |
-
<pass backend_model="adminhtml/system_config_backend_encrypted"
|
92 |
-
<path
|
93 |
</ftp>
|
|
|
|
|
|
|
|
|
94 |
<js>
|
95 |
<header><!-- Please get configuration from SLI Systems !--></header>
|
96 |
-
<footer
|
97 |
-
<autocomplete
|
98 |
-
<domain
|
99 |
</js>
|
100 |
<cron>
|
101 |
-
<email
|
102 |
<frequency backend_model="sli_search/system_config_backend_cron">D</frequency>
|
103 |
<time>2,00,00</time>
|
104 |
<disabled>0</disabled>
|
20 |
<config>
|
21 |
<modules>
|
22 |
<SLI_Search>
|
23 |
+
<version>2.1.3</version>
|
24 |
</SLI_Search>
|
25 |
</modules>
|
26 |
<global>
|
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>
|
88 |
<ftp>
|
89 |
<enabled>1</enabled>
|
90 |
+
<user/>
|
91 |
+
<pass backend_model="adminhtml/system_config_backend_encrypted"/>
|
92 |
+
<path/>
|
93 |
</ftp>
|
94 |
+
<form>
|
95 |
+
<customform>0</customform>
|
96 |
+
<formcode><!-- Please get configuration from SLI Systems !--></formcode>
|
97 |
+
</form>
|
98 |
<js>
|
99 |
<header><!-- Please get configuration from SLI Systems !--></header>
|
100 |
+
<footer/>
|
101 |
+
<autocomplete/>
|
102 |
+
<domain/>
|
103 |
</js>
|
104 |
<cron>
|
105 |
+
<email/>
|
106 |
<frequency backend_model="sli_search/system_config_backend_cron">D</frequency>
|
107 |
<time>2,00,00</time>
|
108 |
<disabled>0</disabled>
|
app/code/local/SLI/Search/etc/system.xml
CHANGED
@@ -127,15 +127,6 @@
|
|
127 |
<show_in_website>1</show_in_website>
|
128 |
<show_in_store>1</show_in_store>
|
129 |
</categorystatus>
|
130 |
-
<sequential translate="label">
|
131 |
-
<label>Generate Feeds Sequentially</label>
|
132 |
-
<frontend_type>select</frontend_type>
|
133 |
-
<source_model>adminhtml/system_config_source_yesno</source_model>
|
134 |
-
<sort_order>190</sort_order>
|
135 |
-
<show_in_default>1</show_in_default>
|
136 |
-
<show_in_website>0</show_in_website>
|
137 |
-
<show_in_store>0</show_in_store>
|
138 |
-
</sequential>
|
139 |
<generate translate="label">
|
140 |
<label>Generate Feed</label>
|
141 |
<frontend_type>button</frontend_type>
|
@@ -204,6 +195,36 @@
|
|
204 |
</path>
|
205 |
</fields>
|
206 |
</ftp>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
<js translate="label" module="sli_search">
|
208 |
<label>JavaScript</label>
|
209 |
<frontend_type>text</frontend_type>
|
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>
|
195 |
</path>
|
196 |
</fields>
|
197 |
</ftp>
|
198 |
+
<form translate="label" module="sli_search">
|
199 |
+
<label>Search Form Code</label>
|
200 |
+
<frontend_type>text</frontend_type>
|
201 |
+
<sort_order>250</sort_order>
|
202 |
+
<show_in_default>1</show_in_default>
|
203 |
+
<show_in_website>1</show_in_website>
|
204 |
+
<show_in_store>1</show_in_store>
|
205 |
+
<fields>
|
206 |
+
<customform translate="label">
|
207 |
+
<label>Use Custom Search Form Code</label>
|
208 |
+
<comment>Enable use of a custom form rather than default form.mini.phtml</comment>
|
209 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
210 |
+
<frontend_type>select</frontend_type>
|
211 |
+
<sort_order>1</sort_order>
|
212 |
+
<show_in_default>1</show_in_default>
|
213 |
+
<show_in_website>1</show_in_website>
|
214 |
+
<show_in_store>1</show_in_store>
|
215 |
+
</customform>
|
216 |
+
<formcode translate="label">
|
217 |
+
<label>Custom Form Code</label>
|
218 |
+
<comment>Provided by SLI.</comment>
|
219 |
+
<frontend_type>textarea</frontend_type>
|
220 |
+
<sort_order>2</sort_order>
|
221 |
+
<show_in_default>1</show_in_default>
|
222 |
+
<show_in_website>1</show_in_website>
|
223 |
+
<show_in_store>1</show_in_store>
|
224 |
+
<depends><customform>1</customform></depends>
|
225 |
+
</formcode>
|
226 |
+
</fields>
|
227 |
+
</form>
|
228 |
<js translate="label" module="sli_search">
|
229 |
<label>JavaScript</label>
|
230 |
<frontend_type>text</frontend_type>
|
app/design/frontend/base/default/template/sli/search/form.mini.phtml
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
<form name="searchform" action="<?php echo $this->getSearchUrl() ?>" method="get" id="SliSearchProductForm" onsubmit="ajaxsearchsubmit(this);return false;">
|
22 |
<div class="form-search">
|
23 |
<label for="sli_search_1">Search:</label>
|
24 |
-
<input type="text" name="w" id="sli_search_1" class="input-text" autocomplete="off" />
|
25 |
<button type="submit" title="<?php echo $this->__('Search') ?>" class="button"><span><span><?php echo $this->__('Search') ?></span></span></button>
|
26 |
</div>
|
27 |
<script type="text/javascript">
|
21 |
<form name="searchform" action="<?php echo $this->getSearchUrl() ?>" method="get" id="SliSearchProductForm" onsubmit="ajaxsearchsubmit(this);return false;">
|
22 |
<div class="form-search">
|
23 |
<label for="sli_search_1">Search:</label>
|
24 |
+
<input type="text" name="w" id="sli_search_1" class="input-text" autocomplete="off" data-provide="rac" />
|
25 |
<button type="submit" title="<?php echo $this->__('Search') ?>" class="button"><span><span><?php echo $this->__('Search') ?></span></span></button>
|
26 |
</div>
|
27 |
<script type="text/javascript">
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>slisearch</name>
|
4 |
-
<version>2.1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://sli-systems.com/lsc">SLI Feed Generation</license>
|
7 |
<channel>community</channel>
|
@@ -9,15 +9,13 @@
|
|
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:
|
12 |
-
*
|
13 |
-
*
|
14 |
-
*
|
15 |
-
* Automatic clearing of old .lock files
|
16 |
-
* Changes to default attributes</notes>
|
17 |
<authors><author><name>Platform support</name><user>SLI-Systems</user><email>support@sli-system.com</email></author></authors>
|
18 |
-
<date>
|
19 |
-
<time>
|
20 |
-
<contents><target name="magelocal"><dir name="SLI"><dir name="
|
21 |
<compatible/>
|
22 |
<dependencies><required><php><min>5.3.19</min><max>5.5.0</max></php></required></dependencies>
|
23 |
</package>
|
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>
|
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:
|
12 |
+
* Removed ability to produce feeds concurrently
|
13 |
+
* Added customer logged in state and username to the cart API
|
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>
|