Version Notes
Changes since last release:
* Shopping Cart API with form key support
* extended logging information
* JS injection based on store configuration
* bug fixes
Download this release
Release Info
Developer | Platform support |
Extension | slisearch |
Version | 2.1.0 |
Comparing to | |
See all releases |
Code changes from version 2.0.6 to 2.1.0
- app/code/local/SLI/CartInfo/Helper/Data.php +137 -0
- app/code/local/SLI/CartInfo/controllers/ApiController.php +38 -0
- app/code/local/SLI/CartInfo/etc/config.xml +35 -0
- app/code/local/SLI/Search/Block/Search/Js/Bottom.php +1 -1
- app/code/local/SLI/Search/Block/Search/Js/Top.php +1 -1
- app/code/local/SLI/Search/Helper/Data.php +127 -0
- app/code/local/SLI/Search/Model/Cron.php +1 -1
- app/code/local/SLI/Search/Model/System/Config/Source/Attributes.php +5 -1
- app/code/local/SLI/Search/controllers/ApiController.php +38 -0
- app/code/local/SLI/Search/etc/config.xml +1 -1
- package.xml +8 -8
- shell/sli/feed.php +4 -5
app/code/local/SLI/CartInfo/Helper/Data.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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/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()) {
|
29 |
$this->addText($helper->getFooterJs());
|
30 |
}
|
31 |
}
|
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 |
}
|
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()) {
|
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->isEnabled(Mage::app()->getStore()->getId())) {
|
28 |
$this->addText($helper->getSLIDomainJs());
|
29 |
$this->addText($helper->getHeaderJs());
|
30 |
}
|
app/code/local/SLI/Search/Helper/Data.php
CHANGED
@@ -342,6 +342,133 @@ class SLI_Search_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
342 |
|
343 |
return $returnJS;
|
344 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
|
347 |
}
|
342 |
|
343 |
return $returnJS;
|
344 |
}
|
345 |
+
/**
|
346 |
+
* Render the cart grand total and total item within the cart
|
347 |
+
* @param Mage_Sales_Model_Quote $quote
|
348 |
+
* @return array
|
349 |
+
*/
|
350 |
+
private function _renderCartTotal( $quote )
|
351 |
+
{
|
352 |
+
if( !$quote ) return false;
|
353 |
+
|
354 |
+
//Declare the array container
|
355 |
+
$cartInfoArray = array();
|
356 |
+
$quoteItemCount = $quote->getItemsCount();
|
357 |
+
|
358 |
+
//Store the item count to array
|
359 |
+
$cartInfoArray['NumberOfItems'] = $quoteItemCount;
|
360 |
+
|
361 |
+
$totals = $quote->getTotals();
|
362 |
+
if( $totals )
|
363 |
+
{
|
364 |
+
if( $totals['grand_total'] )
|
365 |
+
$cartInfoArray['TotalPrice'] = $totals['grand_total']->getValue();
|
366 |
+
|
367 |
+
if( $totals['tax'] )
|
368 |
+
$cartInfoArray['TotalTax'] = $totals['tax']->getValue();
|
369 |
+
}
|
370 |
+
|
371 |
+
//Get The Cart Total Discount Amount
|
372 |
+
$items = $quote->getAllVisibleItems();
|
373 |
+
$itemDiscount = 0;
|
374 |
+
foreach( $items as $item )
|
375 |
+
{
|
376 |
+
if( !$item ) continue;
|
377 |
+
$itemDiscount += $item->getDiscountAmount();
|
378 |
+
}
|
379 |
+
$cartInfoArray['TotalDiscount'] = $itemDiscount;
|
380 |
+
|
381 |
+
//Get The Delivery Cost if applicable
|
382 |
+
$shippingCost = $quote->getShippingAddress()->getShippingAmount();
|
383 |
+
$shippingCostTax = $quote->getShippingAddress()->getShippingTaxAmount();
|
384 |
+
if($shippingCost == (float)0){
|
385 |
+
$cartInfoArray['DeliveryCost'] = 0;
|
386 |
+
}else{
|
387 |
+
$cartInfoArray['DeliveryCost'] = (float)$shippingCost + (float)$shippingCostTax;
|
388 |
+
}
|
389 |
+
|
390 |
+
return $cartInfoArray;
|
391 |
+
}
|
392 |
+
|
393 |
+
/**
|
394 |
+
* Render the cart item detail
|
395 |
+
* @param Mage_Sales_Model_Quote $quote
|
396 |
+
* @return array
|
397 |
+
*/
|
398 |
+
private function _renderItemsDetail( $quote )
|
399 |
+
{
|
400 |
+
//Array of items
|
401 |
+
$itemsArray = array();
|
402 |
+
if( !$quote ) return false;
|
403 |
+
|
404 |
+
$items = $quote->getAllVisibleItems();
|
405 |
+
|
406 |
+
foreach( $items as $item )
|
407 |
+
{
|
408 |
+
if( !$item ) continue;
|
409 |
+
|
410 |
+
//Declare an array to store item information
|
411 |
+
$itemInfo = array();
|
412 |
+
$itemProduct = $item->getProduct();
|
413 |
+
|
414 |
+
$itemInfo[ 'title' ] = $item->getName();
|
415 |
+
$itemInfo[ 'sku' ] = $item->getSku();
|
416 |
+
$itemInfo[ 'qty' ] = $item->getQty();
|
417 |
+
//Get the item Product Object
|
418 |
+
$product = $item->getProduct();
|
419 |
+
//Get the original price for item product
|
420 |
+
$itemInfo[ 'price' ] = $product->getPrice();
|
421 |
+
//Get the sale price
|
422 |
+
$itemInfo[ 'sale_price' ] = $item->getPriceInclTax();
|
423 |
+
|
424 |
+
$itemInfo[ 'item_url' ] = $this->getItemUrl($item);
|
425 |
+
$itemInfo[ 'remove_url' ] = Mage::getUrl('checkout/cart/delete/', array('id'=>$item->getId()));
|
426 |
+
$itemInfo[ 'image_url' ] = Mage::getModel('catalog/product_media_config')->getMediaUrl($itemProduct->getThumbnail());
|
427 |
+
|
428 |
+
$itemsArray[] = $itemInfo;
|
429 |
+
}
|
430 |
+
return $itemsArray;
|
431 |
+
}
|
432 |
|
433 |
+
/**
|
434 |
+
* Get the item url
|
435 |
+
* @param cart item
|
436 |
+
* @return string
|
437 |
+
*/
|
438 |
+
|
439 |
+
public function getItemUrl($item)
|
440 |
+
{
|
441 |
+
if ($item->getRedirectUrl()) {
|
442 |
+
return $item->getRedirectUrl();
|
443 |
+
}
|
444 |
+
|
445 |
+
$product = $item->getProduct();
|
446 |
+
$option = $item->getOptionByCode('product_type');
|
447 |
+
if ($option) {
|
448 |
+
$product = $option->getProduct();
|
449 |
+
}
|
450 |
+
return $product->getUrlModel()->getUrl($product);
|
451 |
+
|
452 |
+
}
|
453 |
+
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Render the JSONP object for SLI
|
457 |
+
*
|
458 |
+
* @param Mage_Sales_Model_Quote $quote
|
459 |
+
* @return string
|
460 |
+
*/
|
461 |
+
public function getCartJSONP( $quote )
|
462 |
+
{
|
463 |
+
$form_key['form_key'] = Mage::getSingleton('core/session')->getFormKey();
|
464 |
+
$cart = $this->_renderCartTotal( $quote );
|
465 |
+
$items['items'] = $this->_renderItemsDetail( $quote );
|
466 |
+
|
467 |
+
$result = array_merge($form_key, $cart, $items);
|
468 |
+
$jsonResult = json_encode( $result );
|
469 |
+
//Wrap up as jsonp object
|
470 |
+
$jsonpResult = "sliCartRequest($jsonResult)";
|
471 |
+
return $jsonpResult;
|
472 |
+
}
|
473 |
|
474 |
}
|
app/code/local/SLI/Search/Model/Cron.php
CHANGED
@@ -43,6 +43,6 @@ class SLI_Search_Model_Cron {
|
|
43 |
* email.
|
44 |
*/
|
45 |
protected function _sendEmail($msg) {
|
46 |
-
Mage::getModel('sli_search/email')->setData('msg',
|
47 |
}
|
48 |
}
|
43 |
* email.
|
44 |
*/
|
45 |
protected function _sendEmail($msg) {
|
46 |
+
Mage::getModel('sli_search/email')->setData('msg', $msg)->send();
|
47 |
}
|
48 |
}
|
app/code/local/SLI/Search/Model/System/Config/Source/Attributes.php
CHANGED
@@ -23,6 +23,9 @@ class SLI_Search_Model_System_Config_Source_Attributes {
|
|
23 |
//to be selectable on the configuration
|
24 |
protected $_automaticAttributes = array('name', 'url_path', 'status', 'type_id');
|
25 |
|
|
|
|
|
|
|
26 |
/**
|
27 |
* We want these attributes to appear in the drop down configuration menu, but they are not included in the
|
28 |
* EAV selection. We must add them in individually.
|
@@ -94,7 +97,8 @@ class SLI_Search_Model_System_Config_Source_Attributes {
|
|
94 |
|
95 |
foreach ($attributes as $attribute) {
|
96 |
$code = $attribute['code'];
|
97 |
-
if (!in_array($attribute['code'], $this->_automaticAttributes)
|
|
|
98 |
$options[$code] = $code;
|
99 |
}
|
100 |
}
|
23 |
//to be selectable on the configuration
|
24 |
protected $_automaticAttributes = array('name', 'url_path', 'status', 'type_id');
|
25 |
|
26 |
+
//Remove attributes that do not need to be included in the feed.
|
27 |
+
protected $_blockedAttributes = array('category_id');
|
28 |
+
|
29 |
/**
|
30 |
* We want these attributes to appear in the drop down configuration menu, but they are not included in the
|
31 |
* EAV selection. We must add them in individually.
|
97 |
|
98 |
foreach ($attributes as $attribute) {
|
99 |
$code = $attribute['code'];
|
100 |
+
if (!in_array($attribute['code'], $this->_automaticAttributes) &&
|
101 |
+
!in_array($attribute['code'], $this->_blockedAttributes)) {
|
102 |
$options[$code] = $code;
|
103 |
}
|
104 |
}
|
app/code/local/SLI/Search/controllers/ApiController.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_Search_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_search' )->getCartJSONP( $this->_getQuote() );
|
31 |
+
|
32 |
+
if( $jsonpResult )
|
33 |
+
$this->getResponse()->setBody( $jsonpResult );
|
34 |
+
}
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
}
|
app/code/local/SLI/Search/etc/config.xml
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
<config>
|
21 |
<modules>
|
22 |
<SLI_Search>
|
23 |
-
<version>2.0
|
24 |
</SLI_Search>
|
25 |
</modules>
|
26 |
<global>
|
20 |
<config>
|
21 |
<modules>
|
22 |
<SLI_Search>
|
23 |
+
<version>2.1.0</version>
|
24 |
</SLI_Search>
|
25 |
</modules>
|
26 |
<global>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>slisearch</name>
|
4 |
-
<version>2.0
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://sli-systems.com/lsc">SLI Feed Generation</license>
|
7 |
<channel>community</channel>
|
@@ -9,14 +9,14 @@
|
|
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 |
-
*
|
16 |
<authors><author><name>Platform support</name><user>SLI-Systems</user><email>support@sli-system.com</email></author></authors>
|
17 |
-
<date>2014-
|
18 |
-
<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="7abb2d4708fae5018a214c3c04c626bf"/></dir><dir name="Js"><file name="Bottom.php" hash="
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.3.19</min><max>5.5.0</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>slisearch</name>
|
4 |
+
<version>2.1.0</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 |
+
* Shopping Cart API with form key support
|
13 |
+
* extended logging information
|
14 |
+
* JS injection based on store configuration
|
15 |
+
* bug fixes</notes>
|
16 |
<authors><author><name>Platform support</name><user>SLI-Systems</user><email>support@sli-system.com</email></author></authors>
|
17 |
+
<date>2014-07-09</date>
|
18 |
+
<time>05:36:54</time>
|
19 |
+
<contents><target name="magelocal"><dir name="SLI"><dir name="CartInfo"><dir name="Helper"><file name="Data.php" hash="e21fab6e74d644a9f2509fab1f9f099b"/></dir><dir name="controllers"><file name="ApiController.php" hash="829a8a8cb1252a03f3037d0a34c1bbc7"/></dir><dir name="etc"><file name="config.xml" hash="a99af741f52449605d7bb2150a8730e6"/></dir></dir><dir name="Search"><dir name="Block"><dir name="Search"><dir name="Form"><file name="Mini.php" hash="7abb2d4708fae5018a214c3c04c626bf"/></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="3ba76026119adb36aed4d1d052eb464c"/></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="fa704e45dc1d0d1482b7ab297768a2ba"/><file name="Feed.php" hash="2b376df484f19339d49d755a7d3768f2"/></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="1f3cb6f7ed75d17fce7e0746287d5681"/><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="1ad1d4d008f2021642992e6ec058f515"/><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><file name="dropdown.sql" hash="dc15502900071cb30caa144ddeb21a0d"/><dir name="etc"><file name="adminhtml.xml" hash="868b799465f118e2212bcff9048994bb"/><file name="config.xml" hash="b4173397c94d9945a4d2e06add87cf0a"/><file name="system.xml" hash="7b4e9e3fd6d12ed8aa98fd20b2dfb96c"/></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="5778ded4b39229cc77ab4906b740c94e"/></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>
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.3.19</min><max>5.5.0</max></php></required></dependencies>
|
22 |
</package>
|
shell/sli/feed.php
CHANGED
@@ -9,7 +9,7 @@
|
|
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 |
*
|
14 |
* @package SLI
|
15 |
* @subpackage Search
|
@@ -30,13 +30,12 @@ class SLI_Search_Shell_Feed extends Mage_Shell_Abstract {
|
|
30 |
$id = $this->getArg('store');
|
31 |
if (!is_bool($id)) {
|
32 |
Mage::getModel('sli_search/feed')->setData('store_id', $id)->generateFeed(); //Standard feed
|
33 |
-
Mage::getModel('sli_search/feed')->setData('store_id', $id)->generateFeed(true); //Price feed
|
34 |
echo "Feed generated for store $id.\n";
|
35 |
return true;
|
36 |
}
|
37 |
else if (count($this->_args) == 1){
|
38 |
-
Mage::
|
39 |
-
echo "
|
40 |
return true;
|
41 |
}
|
42 |
}
|
@@ -72,4 +71,4 @@ USAGE;
|
|
72 |
}
|
73 |
|
74 |
$sliSearchFeed = new SLI_Search_Shell_Feed();
|
75 |
-
$sliSearchFeed->run();
|
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 |
*
|
14 |
* @package SLI
|
15 |
* @subpackage Search
|
30 |
$id = $this->getArg('store');
|
31 |
if (!is_bool($id)) {
|
32 |
Mage::getModel('sli_search/feed')->setData('store_id', $id)->generateFeed(); //Standard feed
|
|
|
33 |
echo "Feed generated for store $id.\n";
|
34 |
return true;
|
35 |
}
|
36 |
else if (count($this->_args) == 1){
|
37 |
+
Mage::getModel('sli_search/feed')->setData('store_id', 1)->generateFeed(); //Standard feed
|
38 |
+
echo "Feed generated for store 1.\n";
|
39 |
return true;
|
40 |
}
|
41 |
}
|
71 |
}
|
72 |
|
73 |
$sliSearchFeed = new SLI_Search_Shell_Feed();
|
74 |
+
$sliSearchFeed->run();
|