Version Notes
* code optimizations - reduce server workload
* added support for Magento flat categories
* missing search sku bug fix
* few more minor bugs fix
Download this release
Release Info
Developer | Adar |
Extension | autocompleteplus_autosuggest |
Version | 3.0.0.10 |
Comparing to | |
See all releases |
Code changes from version 3.0.0.9 to 3.0.0.10
- app/code/local/Autocompleteplus/Autosuggest/Controller/Abstract.php +1 -0
- app/code/local/Autocompleteplus/Autosuggest/Helper/Data.php +159 -52
- app/code/local/Autocompleteplus/Autosuggest/Model/Catalog.php +41 -39
- app/code/local/Autocompleteplus/Autosuggest/Model/Observer.php +19 -9
- app/code/local/Autocompleteplus/Autosuggest/Model/Renderer/Catalog/Product.php +35 -17
- app/code/local/Autocompleteplus/Autosuggest/Model/Resource/Batches/Collection.php +18 -0
- app/code/local/Autocompleteplus/Autosuggest/controllers/CatalogsearchController.php +0 -2
- app/code/local/Autocompleteplus/Autosuggest/controllers/CategoriesController.php +28 -3
- app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsController.php +6 -4
- app/code/local/Autocompleteplus/Autosuggest/controllers/SearchesController.php +10 -10
- app/code/local/Autocompleteplus/Autosuggest/data/autosuggest_setup/data-upgrade-3.0.0.9-3.0.0.10.php +3 -0
- app/code/local/Autocompleteplus/Autosuggest/etc/config.xml +1 -1
- app/design/frontend/base/default/template/autocompleteplus/catalog/product/list.phtml +15 -5
- app/design/frontend/base/default/template/autocompleteplus/inject.phtml +2 -2
- package.xml +8 -6
app/code/local/Autocompleteplus/Autosuggest/Controller/Abstract.php
CHANGED
@@ -5,6 +5,7 @@ abstract class Autocompleteplus_Autosuggest_Controller_Abstract extends Mage_Cor
|
|
5 |
const PHP_SCRIPT_TIMEOUT = 1800;
|
6 |
const MISSING_PARAMETER = 767;
|
7 |
const STATUS_FAILURE = 'failure';
|
|
|
8 |
|
9 |
public function preDispatch()
|
10 |
{
|
5 |
const PHP_SCRIPT_TIMEOUT = 1800;
|
6 |
const MISSING_PARAMETER = 767;
|
7 |
const STATUS_FAILURE = 'failure';
|
8 |
+
const STATUS_SUCCESS = 'success';
|
9 |
|
10 |
public function preDispatch()
|
11 |
{
|
app/code/local/Autocompleteplus/Autosuggest/Helper/Data.php
CHANGED
@@ -15,6 +15,16 @@
|
|
15 |
*/
|
16 |
class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
17 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
// private $server_url = 'http://0-2vk.acp-magento.appspot.com';
|
19 |
private $server_url = 'http://magento.instantsearchplus.com';
|
20 |
|
@@ -53,15 +63,12 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
53 |
|
54 |
public function getConfigDataByFullPath($path)
|
55 |
{
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
}
|
63 |
-
} else {
|
64 |
-
$value = $row->getValue();
|
65 |
}
|
66 |
|
67 |
return $value;
|
@@ -75,14 +82,48 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
75 |
$conf = Mage::getSingleton('core/config')->init()->getXpath('/config/default/'.$path);
|
76 |
$values[] = array_shift($conf);
|
77 |
} else {
|
|
|
78 |
foreach ($rows as $row) {
|
79 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
}
|
82 |
|
83 |
return $values;
|
84 |
}
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
public function sendCurl($command)
|
87 |
{
|
88 |
if (isset($ch)) {
|
@@ -207,10 +248,6 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
207 |
public function getMultiStoreDataJson()
|
208 |
{
|
209 |
$websites = Mage::getModel('core/website')->getCollection();
|
210 |
-
|
211 |
-
$multistoreData = array();
|
212 |
-
$multistoreJson = '';
|
213 |
-
$useStoreCode = $this->getConfigDataByFullPath('web/url/use_store');
|
214 |
$mage = Mage::getVersion();
|
215 |
$ext = Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
216 |
$version = array('mage' => $mage, 'ext' => $ext);
|
@@ -225,9 +262,6 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
225 |
$storeMail = $this->getConfigDataByFullPath('trans_email/ident_general/email');
|
226 |
}
|
227 |
|
228 |
-
$collection = Mage::getModel('catalog/product')->getCollection();
|
229 |
-
//$productCount=$collection->count();
|
230 |
-
|
231 |
$storesArr = array();
|
232 |
foreach ($websites as $website) {
|
233 |
$code = $website->getCode();
|
@@ -240,13 +274,12 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
240 |
if (count($storesArr) == 1) {
|
241 |
try {
|
242 |
$dataArr = array(
|
243 |
-
|
244 |
-
|
245 |
-
'version' => $version,
|
246 |
);
|
247 |
} catch (Exception $e) {
|
248 |
$dataArr = array(
|
249 |
-
'stores' =>
|
250 |
'version' => $version,
|
251 |
);
|
252 |
}
|
@@ -256,44 +289,18 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
256 |
|
257 |
$multistoreJson = json_encode($dataArr);
|
258 |
} else {
|
259 |
-
$
|
260 |
-
$locales = $this->getConfigMultiDataByFullPath('general/locale/code');
|
261 |
-
$storeComplete = array();
|
262 |
|
263 |
-
|
264 |
-
if (!$value['is_active']) {
|
265 |
-
continue;
|
266 |
-
}
|
267 |
-
|
268 |
-
$storeComplete = $value;
|
269 |
-
if (array_key_exists($key, $locales)) {
|
270 |
-
$storeComplete['lang'] = $locales[$key];
|
271 |
-
} else {
|
272 |
-
$storeComplete['lang'] = $locales[0];
|
273 |
-
}
|
274 |
-
|
275 |
-
if (array_key_exists($key, $storeUrls)) {
|
276 |
-
$storeComplete['url'] = $storeUrls[$key];
|
277 |
-
} else {
|
278 |
-
$storeComplete['url'] = $storeUrls[0];
|
279 |
-
}
|
280 |
-
|
281 |
-
if ($useStoreCode) {
|
282 |
-
$storeComplete['url'] = $storeUrls[0].$value['code'];
|
283 |
-
}
|
284 |
-
|
285 |
-
$multistoreData[] = $storeComplete;
|
286 |
-
}
|
287 |
|
288 |
$dataArr = array(
|
289 |
'stores' => $multistoreData,
|
|
|
290 |
'version' => $version,
|
291 |
);
|
292 |
|
293 |
$dataArr['site'] = $url;
|
294 |
$dataArr['email'] = $storeMail;
|
295 |
-
//$dataArr['product_count']=$productCount;
|
296 |
-
|
297 |
$multistoreJson = json_encode($dataArr);
|
298 |
}
|
299 |
|
@@ -424,7 +431,7 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
424 |
$product_type = $product->getTypeID();
|
425 |
|
426 |
$checksum_string = $product_id.$product_title.$product_description.$product_short_desc.$product_url.
|
427 |
-
|
428 |
|
429 |
$checksum_md5 = md5($checksum_string);
|
430 |
|
@@ -732,7 +739,7 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
732 |
|
733 |
public function escapeXml($xml)
|
734 |
{
|
735 |
-
|
736 |
// "\x03" => "",
|
737 |
// "\x05" => "",
|
738 |
// "\x0E" => "",
|
@@ -767,4 +774,104 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
767 |
{
|
768 |
return (string) Mage::getConfig()->getNode('global/crypt/key');
|
769 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
770 |
}
|
15 |
*/
|
16 |
class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
17 |
{
|
18 |
+
|
19 |
+
const WEBSITES_SCOPE = 'websites';
|
20 |
+
|
21 |
+
const STORES_SCOPE = 'stores';
|
22 |
+
|
23 |
+
const DEFAULT_SCOPE = 'default';
|
24 |
+
|
25 |
+
|
26 |
+
const WEBSITE_ID = 'website_id';
|
27 |
+
|
28 |
// private $server_url = 'http://0-2vk.acp-magento.appspot.com';
|
29 |
private $server_url = 'http://magento.instantsearchplus.com';
|
30 |
|
63 |
|
64 |
public function getConfigDataByFullPath($path)
|
65 |
{
|
66 |
+
$valsArr = $this->getConfigMultiDataByFullPath($path);
|
67 |
+
|
68 |
+
$value = '';
|
69 |
+
|
70 |
+
if (is_array($valsArr) && count($valsArr) > 0) {
|
71 |
+
$value = array_shift($valsArr);
|
|
|
|
|
|
|
72 |
}
|
73 |
|
74 |
return $value;
|
82 |
$conf = Mage::getSingleton('core/config')->init()->getXpath('/config/default/'.$path);
|
83 |
$values[] = array_shift($conf);
|
84 |
} else {
|
85 |
+
|
86 |
foreach ($rows as $row) {
|
87 |
+
$scopeId = $row->getScopeId();
|
88 |
+
|
89 |
+
$rowValue = $row->getValue();
|
90 |
+
|
91 |
+
if ($scopeId != null && $rowValue != null) {
|
92 |
+
$values[$scopeId] = $rowValue;
|
93 |
+
}
|
94 |
}
|
95 |
}
|
96 |
|
97 |
return $values;
|
98 |
}
|
99 |
|
100 |
+
public function getConfigMultiScopesDataByFullPath($path)
|
101 |
+
{
|
102 |
+
$values = array();
|
103 |
+
|
104 |
+
$rows = Mage::getSingleton('core/config_data')->getCollection()->getItemsByColumnValue('path', $path);
|
105 |
+
|
106 |
+
foreach ($rows as $row) {
|
107 |
+
$scope = $row->getScope();
|
108 |
+
|
109 |
+
$scopeId = $row->getScopeId();
|
110 |
+
|
111 |
+
$rowValue = $row->getValue();
|
112 |
+
|
113 |
+
if ($scope != null && $scopeId != null && $rowValue != null) {
|
114 |
+
|
115 |
+
if (!array_key_exists($scope,$values)) {
|
116 |
+
$values[$scope] = array();
|
117 |
+
}
|
118 |
+
|
119 |
+
$values[$scope][$scopeId] = $rowValue;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
return $values;
|
125 |
+
}
|
126 |
+
|
127 |
public function sendCurl($command)
|
128 |
{
|
129 |
if (isset($ch)) {
|
248 |
public function getMultiStoreDataJson()
|
249 |
{
|
250 |
$websites = Mage::getModel('core/website')->getCollection();
|
|
|
|
|
|
|
|
|
251 |
$mage = Mage::getVersion();
|
252 |
$ext = Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
253 |
$version = array('mage' => $mage, 'ext' => $ext);
|
262 |
$storeMail = $this->getConfigDataByFullPath('trans_email/ident_general/email');
|
263 |
}
|
264 |
|
|
|
|
|
|
|
265 |
$storesArr = array();
|
266 |
foreach ($websites as $website) {
|
267 |
$code = $website->getCode();
|
274 |
if (count($storesArr) == 1) {
|
275 |
try {
|
276 |
$dataArr = array(
|
277 |
+
'stores' => array_pop($storesArr),
|
278 |
+
'version' => $version,
|
|
|
279 |
);
|
280 |
} catch (Exception $e) {
|
281 |
$dataArr = array(
|
282 |
+
'stores' => array(),
|
283 |
'version' => $version,
|
284 |
);
|
285 |
}
|
289 |
|
290 |
$multistoreJson = json_encode($dataArr);
|
291 |
} else {
|
292 |
+
$multistoreData = $this->_createMultiStoreJson($storesArr);
|
|
|
|
|
293 |
|
294 |
+
$multistoreDataByScope = $this->_createMultiStoreByScopeJson($storesArr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
295 |
|
296 |
$dataArr = array(
|
297 |
'stores' => $multistoreData,
|
298 |
+
'stores2' => $multistoreDataByScope,
|
299 |
'version' => $version,
|
300 |
);
|
301 |
|
302 |
$dataArr['site'] = $url;
|
303 |
$dataArr['email'] = $storeMail;
|
|
|
|
|
304 |
$multistoreJson = json_encode($dataArr);
|
305 |
}
|
306 |
|
431 |
$product_type = $product->getTypeID();
|
432 |
|
433 |
$checksum_string = $product_id.$product_title.$product_description.$product_short_desc.$product_url.
|
434 |
+
$product_visibility.$product_in_stock.$product_price.$product_thumb_url.$product_type;
|
435 |
|
436 |
$checksum_md5 = md5($checksum_string);
|
437 |
|
739 |
|
740 |
public function escapeXml($xml)
|
741 |
{
|
742 |
+
// $pairs = array(
|
743 |
// "\x03" => "",
|
744 |
// "\x05" => "",
|
745 |
// "\x0E" => "",
|
774 |
{
|
775 |
return (string) Mage::getConfig()->getNode('global/crypt/key');
|
776 |
}
|
777 |
+
|
778 |
+
/**
|
779 |
+
* @param $storesArr
|
780 |
+
* @param $multistoreData
|
781 |
+
* @return array
|
782 |
+
*/
|
783 |
+
protected function _createMultiStoreByScopeJson($storesArr)
|
784 |
+
{
|
785 |
+
$multistoreData = array();
|
786 |
+
$storeComplete = array();
|
787 |
+
|
788 |
+
$storeUrls = $this->getConfigMultiScopesDataByFullPath('web/unsecure/base_url');
|
789 |
+
$locales = $this->getConfigMultiScopesDataByFullPath('general/locale/code');
|
790 |
+
$useStoreCode = $this->getConfigDataByFullPath('web/url/use_store');
|
791 |
+
|
792 |
+
foreach ($storesArr as $storeId => $value) {
|
793 |
+
if (!$value['is_active']) {
|
794 |
+
continue;
|
795 |
+
}
|
796 |
+
|
797 |
+
$storeComplete = $value;
|
798 |
+
|
799 |
+
if (array_key_exists(self::STORES_SCOPE, $locales) &&
|
800 |
+
array_key_exists($storeId, $locales[self::STORES_SCOPE]))
|
801 |
+
{
|
802 |
+
$storeComplete['lang'] = $locales[self::STORES_SCOPE][$storeId];
|
803 |
+
} elseif (array_key_exists(self::WEBSITES_SCOPE, $locales) &&
|
804 |
+
array_key_exists($storeComplete[self::WEBSITE_ID],$locales[self::WEBSITES_SCOPE]))
|
805 |
+
{
|
806 |
+
$storeComplete['lang'] = $locales[self::WEBSITES_SCOPE][$storeComplete[self::WEBSITE_ID]];
|
807 |
+
}else if (array_key_exists(self::DEFAULT_SCOPE, $locales) &&
|
808 |
+
array_key_exists(0,$locales[self::DEFAULT_SCOPE]))
|
809 |
+
{
|
810 |
+
$storeComplete['lang'] = $locales[self::DEFAULT_SCOPE][0];
|
811 |
+
}
|
812 |
+
|
813 |
+
|
814 |
+
if (!$useStoreCode) {
|
815 |
+
if (array_key_exists(self::STORES_SCOPE, $storeUrls) &&
|
816 |
+
array_key_exists($storeId, $storeUrls[self::STORES_SCOPE]))
|
817 |
+
{
|
818 |
+
$storeComplete['url'] = $storeUrls[self::STORES_SCOPE][$storeId];
|
819 |
+
} elseif (array_key_exists(self::WEBSITES_SCOPE, $storeUrls) &&
|
820 |
+
array_key_exists($storeComplete[self::WEBSITE_ID],$storeUrls[self::WEBSITES_SCOPE]))
|
821 |
+
{
|
822 |
+
$storeComplete['url'] = $storeUrls[self::WEBSITES_SCOPE][$storeComplete[self::WEBSITE_ID]];
|
823 |
+
}else if (array_key_exists(self::DEFAULT_SCOPE, $storeUrls) &&
|
824 |
+
array_key_exists(0,$storeUrls[self::DEFAULT_SCOPE]))
|
825 |
+
{
|
826 |
+
$storeComplete['url'] = $storeUrls[self::DEFAULT_SCOPE][0];
|
827 |
+
}
|
828 |
+
} else {
|
829 |
+
$storeComplete['url'] = $storeUrls[0] . $value['code'];
|
830 |
+
}
|
831 |
+
|
832 |
+
$multistoreData[] = $storeComplete;
|
833 |
+
}
|
834 |
+
return $multistoreData;
|
835 |
+
}
|
836 |
+
|
837 |
+
/**
|
838 |
+
* @param $storesArr
|
839 |
+
* @param $multistoreData
|
840 |
+
* @return array
|
841 |
+
*/
|
842 |
+
protected function _createMultiStoreJson($storesArr)
|
843 |
+
{
|
844 |
+
$multistoreData = array();
|
845 |
+
$storeComplete = array();
|
846 |
+
|
847 |
+
$storeUrls = $this->getConfigMultiDataByFullPath('web/unsecure/base_url');
|
848 |
+
$locales = $this->getConfigMultiDataByFullPath('general/locale/code');
|
849 |
+
$useStoreCode = $this->getConfigDataByFullPath('web/url/use_store');
|
850 |
+
|
851 |
+
foreach ($storesArr as $key => $value) {
|
852 |
+
if (!$value['is_active']) {
|
853 |
+
continue;
|
854 |
+
}
|
855 |
+
|
856 |
+
$storeComplete = $value;
|
857 |
+
if (array_key_exists($key, $locales)) {
|
858 |
+
$storeComplete['lang'] = $locales[$key];
|
859 |
+
} else {
|
860 |
+
$storeComplete['lang'] = $locales[0];
|
861 |
+
}
|
862 |
+
|
863 |
+
if (array_key_exists($key, $storeUrls)) {
|
864 |
+
$storeComplete['url'] = $storeUrls[$key];
|
865 |
+
} else {
|
866 |
+
$storeComplete['url'] = $storeUrls[0];
|
867 |
+
}
|
868 |
+
|
869 |
+
if ($useStoreCode) {
|
870 |
+
$storeComplete['url'] = $storeUrls[0] . $value['code'];
|
871 |
+
}
|
872 |
+
|
873 |
+
$multistoreData[] = $storeComplete;
|
874 |
+
}
|
875 |
+
return $multistoreData;
|
876 |
+
}
|
877 |
}
|
app/code/local/Autocompleteplus/Autosuggest/Model/Catalog.php
CHANGED
@@ -156,61 +156,63 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
156 |
'fromdatetime' => $from
|
157 |
))->setRootElementName('catalog');
|
158 |
|
|
|
|
|
|
|
|
|
159 |
foreach ($updates as $batch) {
|
|
|
160 |
if ($batch['action'] == 'update') {
|
161 |
-
$productId = $batch['product_id'];
|
162 |
-
$batchStoreId = $batch['store_id'];
|
163 |
|
164 |
-
if ($
|
165 |
-
$
|
166 |
-
|
|
|
167 |
|
168 |
-
$productModel = null;
|
169 |
-
|
170 |
-
if ($productId != null) {
|
171 |
-
// load product by id
|
172 |
-
try {
|
173 |
-
$productModel = Mage::getModel('catalog/product')
|
174 |
-
->setStoreId($batchStoreId)
|
175 |
-
->load($productId);
|
176 |
-
} catch (Exception $e) {
|
177 |
-
$batch['action'] = 'remove';
|
178 |
-
$this->getBatchRenderer()
|
179 |
-
->setXmlElement($xmlGenerator)
|
180 |
-
->makeRemoveRow($batch);
|
181 |
-
continue;
|
182 |
-
}
|
183 |
} else {
|
184 |
-
// product not found - changing action to remove
|
185 |
$batch['action'] = 'remove';
|
186 |
$this->getBatchRenderer()
|
187 |
->setXmlElement($xmlGenerator)
|
188 |
->makeRemoveRow($batch);
|
189 |
-
continue;
|
190 |
}
|
191 |
|
192 |
-
|
193 |
-
continue;
|
194 |
-
}
|
195 |
|
196 |
-
$updatedate = $batch['update_date'];
|
197 |
-
$action = $batch['action'];
|
198 |
-
$this->getProductRenderer()
|
199 |
-
->setXmlElement($xmlGenerator)
|
200 |
-
->setAction($action)
|
201 |
-
->setProduct($productModel)
|
202 |
-
->setStoreId($this->getStoreId())
|
203 |
-
->setOrders($this->getOrders())
|
204 |
-
->setMonthInterval($this->getMonthInterval())
|
205 |
-
->setXmlElement($xmlGenerator)
|
206 |
-
->setAttributes($this->getAttributes())
|
207 |
-
->setUpdateDate($updatedate)
|
208 |
-
->renderXml();
|
209 |
-
} else {
|
210 |
$this->getBatchRenderer()
|
211 |
->setXmlElement($xmlGenerator)
|
212 |
->makeRemoveRow($batch);
|
213 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
}
|
215 |
|
216 |
return $xmlGenerator->generateXml();
|
156 |
'fromdatetime' => $from
|
157 |
))->setRootElementName('catalog');
|
158 |
|
159 |
+
$updatesBulk=array();
|
160 |
+
|
161 |
+
$productIds=array();
|
162 |
+
|
163 |
foreach ($updates as $batch) {
|
164 |
+
|
165 |
if ($batch['action'] == 'update') {
|
|
|
|
|
166 |
|
167 |
+
if ($batch['product_id'] != null) {
|
168 |
+
$updatesBulk[$batch['product_id']] = $batch;
|
169 |
+
|
170 |
+
$productIds[] = $batch['product_id'];
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
} else {
|
|
|
173 |
$batch['action'] = 'remove';
|
174 |
$this->getBatchRenderer()
|
175 |
->setXmlElement($xmlGenerator)
|
176 |
->makeRemoveRow($batch);
|
|
|
177 |
}
|
178 |
|
179 |
+
} elseif ($batch['action'] == 'remove') {
|
|
|
|
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
$this->getBatchRenderer()
|
182 |
->setXmlElement($xmlGenerator)
|
183 |
->makeRemoveRow($batch);
|
184 |
}
|
185 |
+
|
186 |
+
}
|
187 |
+
|
188 |
+
$this->currency = Mage::app()->getStore($storeId)->getCurrentCurrencyCode();
|
189 |
+
|
190 |
+
$productCollection = $this->getProductCollection();
|
191 |
+
|
192 |
+
$productCollection->addStoreFilter($storeId);
|
193 |
+
|
194 |
+
$productCollection->setStoreId($storeId);
|
195 |
+
|
196 |
+
$attributesToSelect = $this->_getAttributesToSelect();
|
197 |
+
|
198 |
+
$productCollection->addAttributeToSelect($attributesToSelect)
|
199 |
+
->addAttributeToFilter('entity_id', array('in' => $productIds));
|
200 |
+
|
201 |
+
foreach ($productCollection as $product) {
|
202 |
+
|
203 |
+
$updatedate = $updatesBulk[$product->getId()]['update_date'];
|
204 |
+
|
205 |
+
$this->getProductRenderer()
|
206 |
+
->setXmlElement($xmlGenerator)
|
207 |
+
->setAction('update')
|
208 |
+
->setProduct($product)
|
209 |
+
->setStoreId($storeId)
|
210 |
+
->setOrders($this->getOrders())
|
211 |
+
->setMonthInterval($this->getMonthInterval())
|
212 |
+
->setXmlElement($xmlGenerator)
|
213 |
+
->setAttributes($this->getAttributes())
|
214 |
+
->setUpdateDate($updatedate)
|
215 |
+
->renderXml();
|
216 |
}
|
217 |
|
218 |
return $xmlGenerator->generateXml();
|
app/code/local/Autocompleteplus/Autosuggest/Model/Observer.php
CHANGED
@@ -164,7 +164,7 @@ class Autocompleteplus_Autosuggest_Model_Observer extends Mage_Core_Model_Abstra
|
|
164 |
}
|
165 |
}
|
166 |
$dt = Mage::getSingleton('core/date')->gmtTimestamp();
|
167 |
-
|
168 |
$simple_product_parents = ($product->getTypeID() == 'simple') ? Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId()) : array();
|
169 |
|
170 |
$product_stores = ($storeId == 0 && method_exists($product, 'getStoreIds')) ? $product->getStoreIds() : array($storeId);
|
@@ -175,7 +175,9 @@ class Autocompleteplus_Autosuggest_Model_Observer extends Mage_Core_Model_Abstra
|
|
175 |
->addFieldToFilter('product_id', $productId)
|
176 |
->addFieldToFilter('store_id', $product_store);
|
177 |
|
178 |
-
$updates->getSelect()
|
|
|
|
|
179 |
|
180 |
if ($updates && $updates->getSize() > 0) {
|
181 |
// @codingStandardsIgnoreLine
|
@@ -204,18 +206,22 @@ class Autocompleteplus_Autosuggest_Model_Observer extends Mage_Core_Model_Abstra
|
|
204 |
} catch (Exception $e) {
|
205 |
Mage::logException($e);
|
206 |
}
|
|
|
207 |
// trigger update for simple product's configurable parent
|
208 |
if (!empty($simple_product_parents)) { // simple product has configural parent
|
209 |
foreach ($simple_product_parents as $configurable_product) {
|
|
|
210 |
$batches = Mage::getModel('autocompleteplus_autosuggest/batches')->getCollection()
|
211 |
->addFieldToFilter('product_id', $configurable_product)
|
212 |
->addFieldToFilter('store_id', $product_store);
|
213 |
|
214 |
-
$batches->getSelect()
|
|
|
|
|
215 |
|
216 |
// @codingStandardsIgnoreLine
|
217 |
-
|
218 |
-
|
219 |
$batch->setUpdateDate($dt)
|
220 |
->setAction('update')
|
221 |
// @codingStandardsIgnoreLine
|
@@ -287,11 +293,15 @@ class Autocompleteplus_Autosuggest_Model_Observer extends Mage_Core_Model_Abstra
|
|
287 |
->addFieldToFilter('product_id', $productId)
|
288 |
->addFieldToFilter('store_id', $product_store);
|
289 |
|
|
|
|
|
|
|
|
|
290 |
// @codingStandardsIgnoreLine
|
291 |
-
|
292 |
-
|
293 |
$batch->setUpdateDate($dt)
|
294 |
-
->setAction('
|
295 |
// @codingStandardsIgnoreLine
|
296 |
->save();
|
297 |
} else {
|
@@ -299,7 +309,7 @@ class Autocompleteplus_Autosuggest_Model_Observer extends Mage_Core_Model_Abstra
|
|
299 |
$newBatch->setProductId($productId)
|
300 |
->setStoreId($product_store)
|
301 |
->setUpdateDate($dt)
|
302 |
-
->setAction('
|
303 |
->setSku($sku)
|
304 |
// @codingStandardsIgnoreLine
|
305 |
->save();
|
164 |
}
|
165 |
}
|
166 |
$dt = Mage::getSingleton('core/date')->gmtTimestamp();
|
167 |
+
|
168 |
$simple_product_parents = ($product->getTypeID() == 'simple') ? Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($product->getId()) : array();
|
169 |
|
170 |
$product_stores = ($storeId == 0 && method_exists($product, 'getStoreIds')) ? $product->getStoreIds() : array($storeId);
|
175 |
->addFieldToFilter('product_id', $productId)
|
176 |
->addFieldToFilter('store_id', $product_store);
|
177 |
|
178 |
+
$updates->getSelect()
|
179 |
+
->order('update_date','DESC')
|
180 |
+
->limit(1);
|
181 |
|
182 |
if ($updates && $updates->getSize() > 0) {
|
183 |
// @codingStandardsIgnoreLine
|
206 |
} catch (Exception $e) {
|
207 |
Mage::logException($e);
|
208 |
}
|
209 |
+
|
210 |
// trigger update for simple product's configurable parent
|
211 |
if (!empty($simple_product_parents)) { // simple product has configural parent
|
212 |
foreach ($simple_product_parents as $configurable_product) {
|
213 |
+
|
214 |
$batches = Mage::getModel('autocompleteplus_autosuggest/batches')->getCollection()
|
215 |
->addFieldToFilter('product_id', $configurable_product)
|
216 |
->addFieldToFilter('store_id', $product_store);
|
217 |
|
218 |
+
$batches->getSelect()
|
219 |
+
->order('update_date','DESC')
|
220 |
+
->limit(1);
|
221 |
|
222 |
// @codingStandardsIgnoreLine
|
223 |
+
if ($batches->getSize() > 0) {
|
224 |
+
$batch = $batches->getFirstItem();
|
225 |
$batch->setUpdateDate($dt)
|
226 |
->setAction('update')
|
227 |
// @codingStandardsIgnoreLine
|
293 |
->addFieldToFilter('product_id', $productId)
|
294 |
->addFieldToFilter('store_id', $product_store);
|
295 |
|
296 |
+
$batches->getSelect()
|
297 |
+
->order('update_date','DESC')
|
298 |
+
->limit(1);
|
299 |
+
|
300 |
// @codingStandardsIgnoreLine
|
301 |
+
if ($batches->getSize() > 0) {
|
302 |
+
$batch = $batches->getFirstItem();
|
303 |
$batch->setUpdateDate($dt)
|
304 |
+
->setAction('remove')
|
305 |
// @codingStandardsIgnoreLine
|
306 |
->save();
|
307 |
} else {
|
309 |
$newBatch->setProductId($productId)
|
310 |
->setStoreId($product_store)
|
311 |
->setUpdateDate($dt)
|
312 |
+
->setAction('remove')
|
313 |
->setSku($sku)
|
314 |
// @codingStandardsIgnoreLine
|
315 |
->save();
|
app/code/local/Autocompleteplus/Autosuggest/Model/Renderer/Catalog/Product.php
CHANGED
@@ -389,23 +389,33 @@ class Autocompleteplus_Autosuggest_Model_Renderer_Catalog_Product extends Autoco
|
|
389 |
$attrValue = null;
|
390 |
$_helper=$this->_getOutputHelper();
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
|
|
|
|
405 |
->getAttribute($action)->getFrontend()->getValue($this->getProduct());
|
406 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
}
|
408 |
|
|
|
409 |
if ($attrValue) {
|
410 |
$attributeElem = $this->getXmlElement()->createChild('attribute', array(
|
411 |
'is_filterable' => $is_filterable,
|
@@ -423,7 +433,16 @@ class Autocompleteplus_Autosuggest_Model_Renderer_Catalog_Product extends Autoco
|
|
423 |
public function renderXml()
|
424 |
{
|
425 |
$categories = $this->getCategoryPathsByProduct();
|
426 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
427 |
|
428 |
if ($this->getProduct()->isConfigurable()) {
|
429 |
$priceRange = $this->getPriceRange();
|
@@ -449,12 +468,11 @@ class Autocompleteplus_Autosuggest_Model_Renderer_Catalog_Product extends Autoco
|
|
449 |
'base_image' => utf8_encode(htmlspecialchars((Mage::getModel('catalog/product_media_config')->getMediaUrl($this->getProduct()->getImage())))),
|
450 |
'selleable' => ($saleable),
|
451 |
'action' => ($this->getAction()),
|
452 |
-
'get_by_id_status' => 1,
|
453 |
'last_updated' => ($this->getProduct()->getUpdatedAt()),
|
454 |
'updatedate' => ($this->getUpdateDate()),
|
455 |
'get_by_id_status' => intval($this->getGetByIdStatus())
|
456 |
));
|
457 |
-
|
458 |
$productRating = $this->getProduct()->getRatingSummary();
|
459 |
$this->getXmlElement()->createChild('description', false,
|
460 |
$this->getProduct()->getDescription(), $productElement);
|
389 |
$attrValue = null;
|
390 |
$_helper=$this->_getOutputHelper();
|
391 |
|
392 |
+
try {
|
393 |
+
|
394 |
+
switch ($attr->getFrontendInput()) {
|
395 |
+
case 'select':
|
396 |
+
$attrValue = method_exists($this->getProduct(), 'getAttributeText') ?
|
397 |
+
$_helper->productAttribute($this->getProduct(),$this->getProduct()->getAttributeText($action),$action) :
|
398 |
+
$this->getProduct()->getData($action);
|
399 |
+
break;
|
400 |
+
case 'textarea':
|
401 |
+
case 'price':
|
402 |
+
case 'text':
|
403 |
+
$attrValue = $this->getProduct()->getData($action);
|
404 |
+
break;
|
405 |
+
case 'multiselect':
|
406 |
+
$attrValue = $this->getProduct()->getResource()
|
407 |
->getAttribute($action)->getFrontend()->getValue($this->getProduct());
|
408 |
+
break;
|
409 |
+
default:
|
410 |
+
$attrValue = null;
|
411 |
+
break;
|
412 |
+
}
|
413 |
+
|
414 |
+
} catch(Exception $e) {
|
415 |
+
Mage::log($e->getMessage(), null, 'autocomplete.log', true);
|
416 |
}
|
417 |
|
418 |
+
|
419 |
if ($attrValue) {
|
420 |
$attributeElem = $this->getXmlElement()->createChild('attribute', array(
|
421 |
'is_filterable' => $is_filterable,
|
433 |
public function renderXml()
|
434 |
{
|
435 |
$categories = $this->getCategoryPathsByProduct();
|
436 |
+
|
437 |
+
$saleable = 0;
|
438 |
+
|
439 |
+
try {
|
440 |
+
if ($this->getProduct()->isSalable()) {
|
441 |
+
$saleable = 1;
|
442 |
+
}
|
443 |
+
}catch (Exception $e) {
|
444 |
+
Mage::log($e->getMessage(), null, 'autocomplete.log', true);
|
445 |
+
}
|
446 |
|
447 |
if ($this->getProduct()->isConfigurable()) {
|
448 |
$priceRange = $this->getPriceRange();
|
468 |
'base_image' => utf8_encode(htmlspecialchars((Mage::getModel('catalog/product_media_config')->getMediaUrl($this->getProduct()->getImage())))),
|
469 |
'selleable' => ($saleable),
|
470 |
'action' => ($this->getAction()),
|
|
|
471 |
'last_updated' => ($this->getProduct()->getUpdatedAt()),
|
472 |
'updatedate' => ($this->getUpdateDate()),
|
473 |
'get_by_id_status' => intval($this->getGetByIdStatus())
|
474 |
));
|
475 |
+
|
476 |
$productRating = $this->getProduct()->getRatingSummary();
|
477 |
$this->getXmlElement()->createChild('description', false,
|
478 |
$this->getProduct()->getDescription(), $productElement);
|
app/code/local/Autocompleteplus/Autosuggest/Model/Resource/Batches/Collection.php
CHANGED
@@ -9,4 +9,22 @@ class Autocompleteplus_Autosuggest_Model_Resource_Batches_Collection extends Mag
|
|
9 |
{
|
10 |
$this->_init('autocompleteplus_autosuggest/batches');
|
11 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
9 |
{
|
10 |
$this->_init('autocompleteplus_autosuggest/batches');
|
11 |
}
|
12 |
+
|
13 |
+
protected function _getWriteAdapter() {
|
14 |
+
return Mage::getSingleton('core/resource')->getConnection('core_write');
|
15 |
+
}
|
16 |
+
|
17 |
+
public function clear() {
|
18 |
+
$dbAdapter = $this->_getWriteAdapter();
|
19 |
+
|
20 |
+
Zend_Db_Table::setDefaultAdapter($dbAdapter);
|
21 |
+
|
22 |
+
$batchesTable = new Zend_Db_Table($this->getMainTable());
|
23 |
+
|
24 |
+
$where = $batchesTable->getAdapter()->quoteInto('1 > ?', 0);
|
25 |
+
|
26 |
+
$batchesTable->delete($where);
|
27 |
+
|
28 |
+
return $this;
|
29 |
+
}
|
30 |
}
|
app/code/local/Autocompleteplus/Autosuggest/controllers/CatalogsearchController.php
CHANGED
@@ -43,8 +43,6 @@ class Autocompleteplus_Autosuggest_CatalogSearchController extends Mage_Core_Con
|
|
43 |
*/
|
44 |
public function indexAction()
|
45 |
{
|
46 |
-
//die('moshe');
|
47 |
-
|
48 |
$query = Mage::helper('catalogsearch')->getQuery();
|
49 |
/* @var $query Mage_CatalogSearch_Model_Query */
|
50 |
|
43 |
*/
|
44 |
public function indexAction()
|
45 |
{
|
|
|
|
|
46 |
$query = Mage::helper('catalogsearch')->getQuery();
|
47 |
/* @var $query Mage_CatalogSearch_Model_Query */
|
48 |
|
app/code/local/Autocompleteplus/Autosuggest/controllers/CategoriesController.php
CHANGED
@@ -65,6 +65,7 @@ class Autocompleteplus_Autosuggest_CategoriesController extends Mage_Core_Contro
|
|
65 |
$tree = Mage::getResourceSingleton('catalog/category_tree')->load();
|
66 |
$store = $this->getRequest()->getParam('store', $storeContext);
|
67 |
$parentId = Mage::app()->getStore($store)->getRootCategoryId();
|
|
|
68 |
|
69 |
$root = $tree->getNodeById($parentId);
|
70 |
|
@@ -76,11 +77,35 @@ class Autocompleteplus_Autosuggest_CategoriesController extends Mage_Core_Contro
|
|
76 |
->setStoreId($store)
|
77 |
->addAttributeToSelect('name')
|
78 |
->addAttributeToSelect('url_path')
|
79 |
-
->addAttributeToSelect('image')
|
80 |
-
->addAttributeToSelect('thumbnail')
|
81 |
-
->addAttributeToSelect('description')
|
82 |
->addAttributeToFilter('is_active', array('eq' => true));
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
$tree->addCollectionData($collection, true);
|
85 |
|
86 |
$mediaUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
|
65 |
$tree = Mage::getResourceSingleton('catalog/category_tree')->load();
|
66 |
$store = $this->getRequest()->getParam('store', $storeContext);
|
67 |
$parentId = Mage::app()->getStore($store)->getRootCategoryId();
|
68 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
69 |
|
70 |
$root = $tree->getNodeById($parentId);
|
71 |
|
77 |
->setStoreId($store)
|
78 |
->addAttributeToSelect('name')
|
79 |
->addAttributeToSelect('url_path')
|
|
|
|
|
|
|
80 |
->addAttributeToFilter('is_active', array('eq' => true));
|
81 |
|
82 |
+
if (!$helper->getConfigDataByFullPath('catalog/frontend/flat_catalog_category')) {
|
83 |
+
$collection=$collection->addAttributeToSelect('image')
|
84 |
+
->addAttributeToSelect('description')
|
85 |
+
->addAttributeToSelect('thumbnail');
|
86 |
+
} else {
|
87 |
+
$resource = Mage::getSingleton('core/resource');
|
88 |
+
|
89 |
+
$readConnection = $resource->getConnection('core_read');
|
90 |
+
|
91 |
+
$tableName=$resource->getTableName('catalog/category_flat') . '_store_' . $store;
|
92 |
+
|
93 |
+
$tableInfo=$readConnection->describeTable($tableName);
|
94 |
+
|
95 |
+
if (array_key_exists('thumbnail',$tableInfo)) {
|
96 |
+
$collection=$collection->addAttributeToSelect('thumbnail');
|
97 |
+
}
|
98 |
+
|
99 |
+
if (array_key_exists('image',$tableInfo)) {
|
100 |
+
$collection=$collection->addAttributeToSelect('image');
|
101 |
+
}
|
102 |
+
|
103 |
+
if (array_key_exists('description',$tableInfo)) {
|
104 |
+
$collection=$collection->addAttributeToSelect('description');
|
105 |
+
}
|
106 |
+
|
107 |
+
}
|
108 |
+
|
109 |
$tree->addCollectionData($collection, true);
|
110 |
|
111 |
$mediaUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
|
app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsController.php
CHANGED
@@ -119,6 +119,8 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
119 |
$store_id = Mage::app()->getStore()->getStoreId();
|
120 |
$installedModules = array();
|
121 |
|
|
|
|
|
122 |
try {
|
123 |
$num_of_products = Mage::getModel('catalog/product')->getCollection()
|
124 |
->addStoreFilter($store_id)
|
@@ -149,6 +151,7 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
149 |
'site_url' => $site_url,
|
150 |
'store_id' => $store_id,
|
151 |
'modules' => $installedModules,
|
|
|
152 |
);
|
153 |
|
154 |
$response->clearHeaders();
|
@@ -168,7 +171,7 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
168 |
'uuid' => $this->_getConfig()->getUUID(),
|
169 |
'site_url' => $helper->getConfigDataByFullPath('web/unsecure/base_url'),
|
170 |
'store_id' => $catalogReport->getCurrentStoreId(),
|
171 |
-
|
172 |
|
173 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
174 |
$this->getResponse()->setBody(json_encode($result));
|
@@ -286,7 +289,7 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
286 |
$url = $url_domain.http_build_query(array(
|
287 |
'store_id' => $storeId,
|
288 |
'site_url' => $site_url,
|
289 |
-
|
290 |
|
291 |
$helper = Mage::helper('autocompleteplus_autosuggest');
|
292 |
$resp = $helper->sendCurl($url);
|
@@ -451,7 +454,6 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
451 |
$this->getResponse()->setBody(1);
|
452 |
}
|
453 |
|
454 |
-
|
455 |
/**
|
456 |
* Bulk Push to ISP with JSON
|
457 |
* @return void
|
@@ -461,7 +463,7 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
461 |
set_time_limit(1800);
|
462 |
$request = $this->getRequest();
|
463 |
$response = $this->getResponse();
|
464 |
-
|
465 |
$response->clearHeaders();
|
466 |
$response->setHeader('Content-type', 'application/json');
|
467 |
$pushId = $request->getParam('pushid', null);
|
119 |
$store_id = Mage::app()->getStore()->getStoreId();
|
120 |
$installedModules = array();
|
121 |
|
122 |
+
$enabled=Mage::getStoreConfigFlag('autocompleteplus/config/enabled',0);
|
123 |
+
|
124 |
try {
|
125 |
$num_of_products = Mage::getModel('catalog/product')->getCollection()
|
126 |
->addStoreFilter($store_id)
|
151 |
'site_url' => $site_url,
|
152 |
'store_id' => $store_id,
|
153 |
'modules' => $installedModules,
|
154 |
+
'enabled' => $enabled
|
155 |
);
|
156 |
|
157 |
$response->clearHeaders();
|
171 |
'uuid' => $this->_getConfig()->getUUID(),
|
172 |
'site_url' => $helper->getConfigDataByFullPath('web/unsecure/base_url'),
|
173 |
'store_id' => $catalogReport->getCurrentStoreId(),
|
174 |
+
);
|
175 |
|
176 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
177 |
$this->getResponse()->setBody(json_encode($result));
|
289 |
$url = $url_domain.http_build_query(array(
|
290 |
'store_id' => $storeId,
|
291 |
'site_url' => $site_url,
|
292 |
+
));
|
293 |
|
294 |
$helper = Mage::helper('autocompleteplus_autosuggest');
|
295 |
$resp = $helper->sendCurl($url);
|
454 |
$this->getResponse()->setBody(1);
|
455 |
}
|
456 |
|
|
|
457 |
/**
|
458 |
* Bulk Push to ISP with JSON
|
459 |
* @return void
|
463 |
set_time_limit(1800);
|
464 |
$request = $this->getRequest();
|
465 |
$response = $this->getResponse();
|
466 |
+
|
467 |
$response->clearHeaders();
|
468 |
$response->setHeader('Content-type', 'application/json');
|
469 |
$pushId = $request->getParam('pushid', null);
|
app/code/local/Autocompleteplus/Autosuggest/controllers/SearchesController.php
CHANGED
@@ -21,10 +21,7 @@ class Autocompleteplus_Autosuggest_SearchesController extends Mage_Core_Controll
|
|
21 |
|
22 |
$post = $this->getRequest()->getParams();
|
23 |
|
24 |
-
|
25 |
-
// if($enabled=='0'){
|
26 |
-
// die('The user has disabled autocompleteplus.');
|
27 |
-
// }
|
28 |
|
29 |
$startInd = $post['offset'];
|
30 |
if (!$startInd) {
|
@@ -53,10 +50,13 @@ class Autocompleteplus_Autosuggest_SearchesController extends Mage_Core_Controll
|
|
53 |
$xml .= '<searches>';
|
54 |
|
55 |
if ($searchesCount < $startInd) {
|
56 |
-
//if the products count is smaller then specified offset then we return empty xml node
|
57 |
$xml .= '</searches>';
|
58 |
-
|
59 |
-
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
|
62 |
$connection = $this->_getConnection('core_write');
|
@@ -76,9 +76,9 @@ class Autocompleteplus_Autosuggest_SearchesController extends Mage_Core_Controll
|
|
76 |
|
77 |
$xml .= '</searches>';
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
}
|
83 |
|
84 |
private function _xmlEscape($term)
|
21 |
|
22 |
$post = $this->getRequest()->getParams();
|
23 |
|
24 |
+
$response = $this->getResponse();
|
|
|
|
|
|
|
25 |
|
26 |
$startInd = $post['offset'];
|
27 |
if (!$startInd) {
|
50 |
$xml .= '<searches>';
|
51 |
|
52 |
if ($searchesCount < $startInd) {
|
|
|
53 |
$xml .= '</searches>';
|
54 |
+
|
55 |
+
$response->clearHeaders();
|
56 |
+
$response->setHeader('Content-type', 'text/xml');
|
57 |
+
$response->setBody($xml);
|
58 |
+
|
59 |
+
return;
|
60 |
}
|
61 |
|
62 |
$connection = $this->_getConnection('core_write');
|
76 |
|
77 |
$xml .= '</searches>';
|
78 |
|
79 |
+
$response->clearHeaders();
|
80 |
+
$response->setHeader('Content-type', 'text/xml');
|
81 |
+
$response->setBody($xml);
|
82 |
}
|
83 |
|
84 |
private function _xmlEscape($term)
|
app/code/local/Autocompleteplus/Autosuggest/data/autosuggest_setup/data-upgrade-3.0.0.9-3.0.0.10.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
Mage::getModel('autocompleteplus_autosuggest/batches')->getCollection()->clear();
|
app/code/local/Autocompleteplus/Autosuggest/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Autocompleteplus_Autosuggest>
|
5 |
-
<version>3.0.0.
|
6 |
<url>http://autocompleteplus.com/</url>
|
7 |
<modulename>Autocompleteplus_Autosuggest</modulename>
|
8 |
</Autocompleteplus_Autosuggest>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Autocompleteplus_Autosuggest>
|
5 |
+
<version>3.0.0.10</version>
|
6 |
<url>http://autocompleteplus.com/</url>
|
7 |
<modulename>Autocompleteplus_Autosuggest</modulename>
|
8 |
</Autocompleteplus_Autosuggest>
|
app/design/frontend/base/default/template/autocompleteplus/catalog/product/list.phtml
CHANGED
@@ -30,9 +30,19 @@ try{
|
|
30 |
</script>
|
31 |
<?php
|
32 |
$helper = Mage::helper('autocompleteplus_autosuggest');
|
33 |
-
|
34 |
-
$
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
?>
|
30 |
</script>
|
31 |
<?php
|
32 |
$helper = Mage::helper('autocompleteplus_autosuggest');
|
33 |
+
|
34 |
+
$html=Mage::app()->getCacheInstance()->load('autocomplete_template_serp');
|
35 |
+
|
36 |
+
if(!$html) {
|
37 |
+
$server_url = $helper->getServerUrl();
|
38 |
+
$url = $server_url . '/ma_load_search_page?isp_platform=magento&r=002';
|
39 |
+
$resp = $helper->sendCurl($url);
|
40 |
+
$response_json = json_decode($resp);
|
41 |
+
$html = $response_json->html;
|
42 |
+
|
43 |
+
Mage::app()->getCacheInstance()->save($html, 'autocomplete_template_serp', array("autocomplete_cache"), 60);
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
echo $html;
|
48 |
?>
|
app/design/frontend/base/default/template/autocompleteplus/inject.phtml
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
<?php if(Mage::getStoreConfigFlag('autocompleteplus/config/enabled')): ?>
|
2 |
-
<script data-cfasync="false" async type="text/javascript" src="<?php echo $this->getSrc()?>"></script>
|
3 |
<?php endif; ?>
|
1 |
+
<?php if (Mage::getStoreConfigFlag('autocompleteplus/config/enabled')): ?>
|
2 |
+
<script data-cfasync="false" async type="text/javascript" src="<?php echo $this->getSrc()?>"></script>
|
3 |
<?php endif; ?>
|
package.xml
CHANGED
@@ -1,19 +1,21 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>autocompleteplus_autosuggest</name>
|
4 |
-
<version>3.0.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.autocompleteplus.com/privacy">AC+</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>AutoComplete+ InstantSearch</summary>
|
10 |
<description>AutoComplete+ InstantSearch triples visitor conversion, optimizes search, and offers promotions through state-of-the-art contextual suggestions dropdown. Since suggestions are lightning fast, accurate, and contextual - visitors find exactly what they want - faster.</description>
|
11 |
-
<notes
|
12 |
-
|
|
|
|
|
13 |
<authors><author><name>Adar</name><user>Adar</user><email>magento@autocompleteplus.com</email></author></authors>
|
14 |
-
<date>2016-09-
|
15 |
-
<time>
|
16 |
-
<contents><target name="magelocal"><dir name="Autocompleteplus"><dir name="Autosuggest"><dir name="Adminhtml"><dir name="Model"><file name="Attributes.php" hash="5e480167310365ad57785ef2a2da39be"/><file name="Button.php" hash="ad2429ce8a2c172237e41faef5fce322"/></dir></dir><dir name="Block"><dir name="Adminhtml"><file name="Button.php" hash="262987c852813741a2562fe927054469"/><file name="Process.php" hash="30f02cc873ac8d6eaeaaeca5c3d328e5"/><file name="Sync.php" hash="3c668febd558dd7c2db75c314378e0d5"/></dir><file name="Autocomplete.php" hash="1bb5bd66e55b477e6639863a6e71d8b2"/><file name="Autocorrection.php" hash="6676f140f9da260f52e59478e1af2b47"/><file name="Inject.php" hash="0af946c437fda1a02098b378a142a69c"/><file name="Notifications.php" hash="3ab60946b756f093585a708185d98909"/></dir><dir name="Controller"><file name="Abstract.php" hash="
|
17 |
<compatible/>
|
18 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
19 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>autocompleteplus_autosuggest</name>
|
4 |
+
<version>3.0.0.10</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.autocompleteplus.com/privacy">AC+</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>AutoComplete+ InstantSearch</summary>
|
10 |
<description>AutoComplete+ InstantSearch triples visitor conversion, optimizes search, and offers promotions through state-of-the-art contextual suggestions dropdown. Since suggestions are lightning fast, accurate, and contextual - visitors find exactly what they want - faster.</description>
|
11 |
+
<notes>* code optimizations - reduce server workload
|
12 |
+
* added support for Magento flat categories
|
13 |
+
* missing search sku bug fix
|
14 |
+
* few more minor bugs fix</notes>
|
15 |
<authors><author><name>Adar</name><user>Adar</user><email>magento@autocompleteplus.com</email></author></authors>
|
16 |
+
<date>2016-09-21</date>
|
17 |
+
<time>12:54:11</time>
|
18 |
+
<contents><target name="magelocal"><dir name="Autocompleteplus"><dir name="Autosuggest"><dir name="Adminhtml"><dir name="Model"><file name="Attributes.php" hash="5e480167310365ad57785ef2a2da39be"/><file name="Button.php" hash="ad2429ce8a2c172237e41faef5fce322"/></dir></dir><dir name="Block"><dir name="Adminhtml"><file name="Button.php" hash="262987c852813741a2562fe927054469"/><file name="Process.php" hash="30f02cc873ac8d6eaeaaeca5c3d328e5"/><file name="Sync.php" hash="3c668febd558dd7c2db75c314378e0d5"/></dir><file name="Autocomplete.php" hash="1bb5bd66e55b477e6639863a6e71d8b2"/><file name="Autocorrection.php" hash="6676f140f9da260f52e59478e1af2b47"/><file name="Inject.php" hash="0af946c437fda1a02098b378a142a69c"/><file name="Notifications.php" hash="3ab60946b756f093585a708185d98909"/></dir><dir name="Controller"><file name="Abstract.php" hash="898dd2fc7c14c9f80c4fd4b4a50c9db9"/></dir><dir name="Helper"><file name="Data.php" hash="a6f92c6f0705b565f85423a45f268ca4"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Attributes.php" hash="8f8581590b3b2eee69704aa1715dfdd4"/></dir><dir name="Api"><file name="V2.php" hash="f764e775bf087dad35a0351ff2c04539"/></dir><file name="Api.php" hash="298fcc3db05af5fad34375457b5001d4"/><file name="Batches.php" hash="bfa0c53ff502dbb99f120a8ac7626819"/><file name="Catalog.php" hash="b6226b2709902c6fab052e6668e1fd15"/><file name="Catalogreport.php" hash="110c05b050cffb2fec71973e36440702"/><file name="Checksum.php" hash="37550b6bd6d934f1ad2ef581dfa10eea"/><file name="Config.php" hash="3a19873f65c4c5485f2de7fb9baa1ca9"/><file name="Layer.php" hash="82538541fb58038dd308fc584454d0bd"/><dir name="Mysql4"><dir name="Batches"><file name="Collection.php" hash="06815b7ef6df1c09655024817f9fdc87"/></dir><file name="Batches.php" hash="f61cd3381a76f77989e5dbb35610c0fc"/><dir name="Checksum"><file name="Collection.php" hash="7879f033202d4618ad48f767dbfdd694"/></dir><file name="Checksum.php" hash="92ecf2e3990fd868f2d83fbd1f73d135"/><dir name="Fulltext"><file name="Collection.php" hash="b4b729b327d48457815a3f9c6e86e7f5"/></dir><dir name="Notifications"><file name="Collection.php" hash="9351b214c326de0a4195df88c6ef8f75"/></dir><file name="Notifications.php" hash="9f6514d2bfa7a89f2a663eaa06865d24"/><dir name="Pusher"><file name="Collection.php" hash="83bf9e00aceaa230fcdfe81ac4df344c"/></dir><file name="Pusher.php" hash="1e7ad77386c07fc060c554079a47d60f"/></dir><file name="Notifications.php" hash="7f4037e171c63de662370aeceaeed1d6"/><file name="Observer.php" hash="efb79baf4721a21d11da4b7c65262eaa"/><file name="Pusher.php" hash="518825e11c9d8fd0b91ac78f6916c40b"/><dir name="Renderer"><file name="Abstract.php" hash="e7298546a4e47a835a9b69ab873a95da"/><file name="Batches.php" hash="5d73a56a9760df0620f8c0bf28c4e4be"/><dir name="Catalog"><file name="Product.php" hash="3dff4a1f69edae00e7855ed9f70dbbaa"/></dir></dir><dir name="Resource"><dir name="Batches"><file name="Collection.php" hash="b7437e02a9609bbcae054509bf9fbdf7"/></dir><file name="Batches.php" hash="bfff3c8f471bb5c19cfbc9420d7736a7"/><dir name="Checksum"><file name="Collection.php" hash="43580b863c0040783ffa59230c1fa5e2"/></dir><file name="Checksum.php" hash="e991bdba8c981fa67f46d1f06be10e11"/><dir name="Fulltext"><file name="Collection.php" hash="1a2ff4fb035bccf2424e3ecb0e0e4c93"/></dir><dir name="Notifications"><file name="Collection.php" hash="ca5fbd3f52d9fc2c575588f4d3208c69"/></dir><file name="Notifications.php" hash="5a62daeaba13c72b8f5eb40381642c8d"/><dir name="Pusher"><file name="Collection.php" hash="844299f9264313e6182816c8cbf58a37"/></dir><file name="Pusher.php" hash="fe212dffaaebc28665a3ff4244b78bcd"/></dir><file name="Service.php" hash="4c0e98c7abfa3319768ee850ed5d8e77"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Autocompleteplus"><file name="PushController.php" hash="59ca72fc498a4a190474b46706e1dd18"/><file name="RedirectController.php" hash="8361d1e5922d75763eb82cd916480fb1"/></dir></dir><dir name="CatalogSearch"><file name="ResultController.php" hash="8d2c03b7849b7dbeeb9a08cfa37e63ea"/></dir><file name="CatalogsearchController.php" hash="f37f4b5286a4867257a2803dcc91fc62"/><file name="CategoriesController.php" hash="12700dbaf3d3071e17333da22e8ee458"/><file name="LayeredController.php" hash="444cb30c34aa499092b0007bcbb84cca"/><file name="ProductsController.php" hash="5ae1a126973bbd81a1a209311b00ce48"/><file name="ProductsbyidController.php" hash="1589840233143b6e91fe95624638789b"/><file name="ResultController.php" hash="182f65ce4ccdf154aa0326512ec37140"/><file name="SearchesController.php" hash="79412f6ed516a26e33aba41588f29ceb"/></dir><dir name="data"><dir name="autosuggest_setup"><file name="data-install-3.0.0.5.php" hash="2b1ec2380f5c0a2d585b71eb73b8e573"/><file name="data-upgrade-3.0.0.9-3.0.0.10.php" hash="e7b232e791472853e2f1e9b9fc5b1b9c"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="34b9d24ddc4565311f6cc83d7e337478"/><file name="cache.xml" hash="b57472bc9410d67af3843825fba5b420"/><file name="config.xml" hash="91a4cf6c084f323a44cdd22242e35436"/><file name="system.xml" hash="6bed22fbdfc336254126cf4a8c49aa09"/></dir><dir name="sql"><dir name="autosuggest_setup"><file name="mysql4-install-2.0.1.1.php" hash="c891e1836f3df18eba24821371c85bfa"/><file name="mysql4-upgrade-2.0.1.3-2.0.2.2.php" hash="ddc7001e761dce3b4970f3d4adac2aa3"/><file name="mysql4-upgrade-2.0.2.5-2.0.2.6.php" hash="ea94264608685c51f008382d42d499fd"/><file name="mysql4-upgrade-2.0.4.6-2.0.4.7.php" hash="8166f765780956ea87bbe62b9f709f46"/><file name="mysql4-upgrade-2.0.5.4-2.0.5.5.php" hash="56a45f752e553280bb9242cde2aa76ce"/><file name="mysql4-upgrade-2.0.7.0-2.0.7.1.php" hash="3837250beee18106d0f043493dde3382"/><file name="mysql4-upgrade-2.0.7.2-2.0.7.3.php" hash="cf59ec04f2329243abac26bd79fa5818"/><file name="mysql4-upgrade-2.0.8.8-3.0.0.0.php" hash="9f60147846d67ecff6d7a28b39798f9b"/><file name="mysql4-upgrade-3.0.0.3-3.0.0.4.php" hash="9574b75e9a733be858a14588978cd21a"/><file name="mysql4-upgrade-3.0.0.4-3.0.0.5.php" hash="69094243b4af4e87a0e0186e76095099"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Autocompleteplus_Autosuggest.xml" hash="530931765807be8a21baa5e070bc4bc2"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="autocompleteplus.xml" hash="3998429f613fcc7842b7ea31cb423ec8"/></dir><dir name="template"><dir name="autocompleteplus"><dir name="catalog"><dir name="layer"><file name="view.phtml" hash="57066d2ac5fa051c15c3ed8bb43b5d08"/></dir><dir name="product"><file name="list.phtml" hash="e2eec925c31eec15218d0adc8436057d"/></dir></dir><file name="inject.phtml" hash="dc0d60d3f0364e389b9f78d75e96a26d"/></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="autocompleteplus"><file name="notifications.phtml" hash="c1d08659e65020dcb9e62cf8bc28f73b"/><file name="process.phtml" hash="a7dd67e17a838d437fe9d9a2e9323d0c"/><dir name="system"><dir name="config"><file name="button.phtml" hash="3adf3f3f4ab989cf643f2fc49719b59d"/><file name="sync.phtml" hash="e0392aac8584e98ef4260419750e1cbb"/></dir></dir></dir></dir><dir name="layout"><file name="autocompleteplus.xml" hash="d69295113bbb7beb7b9e32cc84a9b129"/></dir></dir></dir></dir></target><target name="magelib"><dir name="Autocompleteplus"><dir name="Autosuggest"><dir name="Xml"><file name="Generator.php" hash="c2fe75e398a73b82229999a08948f56b"/><file name="GeneratorInterface.php" hash="d3d6ea3a712fdbdb60d8994230a65f1c"/></dir></dir></dir></target></contents>
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
21 |
</package>
|