Version Notes
* Fixing SQL injection security vulnerability
Download this release
Release Info
Developer | Adar |
Extension | autocompleteplus_autosuggest |
Version | 3.0.0.6 |
Comparing to | |
See all releases |
Code changes from version 3.0.0.5 to 3.0.0.6
- app/code/local/Autocompleteplus/Autosuggest/Helper/Data.php +21 -0
- app/code/local/Autocompleteplus/Autosuggest/Helper/Data.php.bak +783 -0
- app/code/local/Autocompleteplus/Autosuggest/Model/Catalog.php +3 -3
- app/code/local/Autocompleteplus/Autosuggest/Model/Catalogreport.php +5 -7
- app/code/local/Autocompleteplus/Autosuggest/controllers/CategoriesController.php +5 -1
- app/code/local/Autocompleteplus/Autosuggest/controllers/LayeredController.php +16 -4
- app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsController.php +53 -84
- app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsbyidController.php +8 -5
- app/code/local/Autocompleteplus/Autosuggest/controllers/SearchesController.php +5 -8
- app/code/local/Autocompleteplus/Autosuggest/etc/config.xml +1 -1
- package.xml +5 -5
app/code/local/Autocompleteplus/Autosuggest/Helper/Data.php
CHANGED
@@ -759,4 +759,25 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
759 |
{
|
760 |
return (string) Mage::getConfig()->getNode('global/crypt/key');
|
761 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
762 |
}
|
759 |
{
|
760 |
return (string) Mage::getConfig()->getNode('global/crypt/key');
|
761 |
}
|
762 |
+
|
763 |
+
public function validateInput($input, $type = "integer", $default = null, $on_failure = null){
|
764 |
+
$validated_input = $default;
|
765 |
+
$sanity_type = FILTER_SANITIZE_NUMBER_INT;
|
766 |
+
$type = strtolower($type);
|
767 |
+
if ($type == "integer" || $type == 'int'){
|
768 |
+
$sanity_type = FILTER_SANITIZE_NUMBER_INT;
|
769 |
+
} else if ($type == 'boolean' || $type == 'bool'){
|
770 |
+
$sanity_type = FILTER_VALIDATE_BOOLEAN;
|
771 |
+
}
|
772 |
+
|
773 |
+
$filter_input = filter_var($input, $sanity_type, FILTER_NULL_ON_FAILURE);
|
774 |
+
if ($filter_input || ($sanity_type == FILTER_SANITIZE_NUMBER_INT && $filter_input === "0")){
|
775 |
+
$validated_input = $filter_input;
|
776 |
+
$status = settype($validated_input, $type);
|
777 |
+
if (!$status){
|
778 |
+
$validated_input = $on_failure;
|
779 |
+
}
|
780 |
+
}
|
781 |
+
return $validated_input;
|
782 |
+
}
|
783 |
}
|
app/code/local/Autocompleteplus/Autosuggest/Helper/Data.php.bak
ADDED
@@ -0,0 +1,783 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* InstantSearchPlus (Autosuggest).
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is available through the world-wide-web at this URL:
|
9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
10 |
+
*
|
11 |
+
* @category Mage
|
12 |
+
*
|
13 |
+
* @copyright Copyright (c) 2014 Fast Simon (http://www.instantsearchplus.com)
|
14 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
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 |
+
|
21 |
+
protected $_authKey;
|
22 |
+
|
23 |
+
public function getServerUrl()
|
24 |
+
{
|
25 |
+
return $this->server_url;
|
26 |
+
}
|
27 |
+
|
28 |
+
public function validateUuid($uuid)
|
29 |
+
{
|
30 |
+
if (strlen($uuid) == 36
|
31 |
+
&& substr_count($uuid, '-') == 4
|
32 |
+
) {
|
33 |
+
return true;
|
34 |
+
}
|
35 |
+
|
36 |
+
return false;
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getConfig()
|
40 |
+
{
|
41 |
+
return Mage::getModel('autocompleteplus_autosuggest/config');
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getVersion()
|
45 |
+
{
|
46 |
+
return (string) Mage::getConfig()->getModuleConfig('Autocompleteplus_Autosuggest')->version;
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getConfigDataByFullPath($path)
|
50 |
+
{
|
51 |
+
if (!$row = Mage::getSingleton('core/config_data')->getCollection()->getItemByColumnValue('path', $path)) {
|
52 |
+
$conf = Mage::getSingleton('core/config')->init()->getXpath('/config/default/'.$path);
|
53 |
+
if (is_array($conf)) {
|
54 |
+
$value = array_shift($conf);
|
55 |
+
} else {
|
56 |
+
return '';
|
57 |
+
}
|
58 |
+
} else {
|
59 |
+
$value = $row->getValue();
|
60 |
+
}
|
61 |
+
|
62 |
+
return $value;
|
63 |
+
}
|
64 |
+
|
65 |
+
public function getConfigMultiDataByFullPath($path)
|
66 |
+
{
|
67 |
+
$values = array();
|
68 |
+
|
69 |
+
if (!$rows = Mage::getSingleton('core/config_data')->getCollection()->getItemsByColumnValue('path', $path)) {
|
70 |
+
$conf = Mage::getSingleton('core/config')->init()->getXpath('/config/default/'.$path);
|
71 |
+
$values[] = array_shift($conf);
|
72 |
+
} else {
|
73 |
+
foreach ($rows as $row) {
|
74 |
+
$values[$row->getScopeId()] = $row->getValue();
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
return $values;
|
79 |
+
}
|
80 |
+
|
81 |
+
public function sendCurl($command)
|
82 |
+
{
|
83 |
+
if (isset($ch)) {
|
84 |
+
unset($ch);
|
85 |
+
}
|
86 |
+
|
87 |
+
if (function_exists('curl_setopt')) {
|
88 |
+
$ch = curl_init();
|
89 |
+
curl_setopt($ch, CURLOPT_URL, $command);
|
90 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
91 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
92 |
+
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
|
93 |
+
$str = curl_exec($ch);
|
94 |
+
} else {
|
95 |
+
$str = 'failed';
|
96 |
+
}
|
97 |
+
|
98 |
+
return $str;
|
99 |
+
}
|
100 |
+
|
101 |
+
public static function sendPostCurl($command, $data = array(), $cookie_file = 'genCookie.txt')
|
102 |
+
{
|
103 |
+
if (isset($ch)) {
|
104 |
+
unset($ch);
|
105 |
+
}
|
106 |
+
|
107 |
+
if (function_exists('curl_setopt')) {
|
108 |
+
$ch = curl_init();
|
109 |
+
curl_setopt($ch, CURLOPT_URL, $command);
|
110 |
+
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
|
111 |
+
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
|
112 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
113 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
114 |
+
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
|
115 |
+
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20100101 Firefox/21.0');
|
116 |
+
//curl_setopt($ch,CURLOPT_POST,0);
|
117 |
+
if (!empty($data)) {
|
118 |
+
curl_setopt_array($ch, array(
|
119 |
+
CURLOPT_POSTFIELDS => $data,
|
120 |
+
));
|
121 |
+
}
|
122 |
+
|
123 |
+
// curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
124 |
+
// 'Connection: Keep-Alive',
|
125 |
+
// 'Keep-Alive: 800'
|
126 |
+
// ));
|
127 |
+
|
128 |
+
$str = curl_exec($ch);
|
129 |
+
} else {
|
130 |
+
$str = 'failed';
|
131 |
+
}
|
132 |
+
|
133 |
+
return $str;
|
134 |
+
}
|
135 |
+
|
136 |
+
public function prepareGroupedProductPrice($groupedProduct)
|
137 |
+
{
|
138 |
+
$aProductIds = $groupedProduct->getTypeInstance()->getChildrenIds($groupedProduct->getId());
|
139 |
+
|
140 |
+
$prices = array();
|
141 |
+
foreach ($aProductIds as $ids) {
|
142 |
+
foreach ($ids as $id) {
|
143 |
+
try {
|
144 |
+
$aProduct = Mage::getModel('catalog/product')->load($id);
|
145 |
+
$prices[] = $aProduct->getPriceModel()->getPrice($aProduct);
|
146 |
+
} catch (Exception $e) {
|
147 |
+
continue;
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
krsort($prices);
|
153 |
+
try {
|
154 |
+
if (count($prices) > 0) {
|
155 |
+
$groupedProduct->setPrice($prices[0]);
|
156 |
+
} else {
|
157 |
+
$groupedProduct->setPrice(0);
|
158 |
+
}
|
159 |
+
} catch (Exception $e) {
|
160 |
+
$groupedProduct->setPrice(0);
|
161 |
+
}
|
162 |
+
|
163 |
+
// or you can return price
|
164 |
+
}
|
165 |
+
|
166 |
+
public function getBundlePrice($product)
|
167 |
+
{
|
168 |
+
$optionCol = $product->getTypeInstance(true)
|
169 |
+
->getOptionsCollection($product);
|
170 |
+
$selectionCol = $product->getTypeInstance(true)
|
171 |
+
->getSelectionsCollection(
|
172 |
+
$product->getTypeInstance(true)->getOptionsIds($product),
|
173 |
+
$product
|
174 |
+
);
|
175 |
+
$optionCol->appendSelections($selectionCol);
|
176 |
+
$price = $product->getPrice();
|
177 |
+
|
178 |
+
foreach ($optionCol as $option) {
|
179 |
+
if ($option->required) {
|
180 |
+
$selections = $option->getSelections();
|
181 |
+
$selPricesArr = array();
|
182 |
+
|
183 |
+
if (is_array($selections)) {
|
184 |
+
foreach ($selections as $s) {
|
185 |
+
$selPricesArr[] = $s->price;
|
186 |
+
}
|
187 |
+
|
188 |
+
$minPrice = min($selPricesArr);
|
189 |
+
|
190 |
+
if ($product->getSpecialPrice() > 0) {
|
191 |
+
$minPrice *= $product->getSpecialPrice() / 100;
|
192 |
+
}
|
193 |
+
|
194 |
+
$price += round($minPrice, 2);
|
195 |
+
}
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
return $price;
|
200 |
+
}
|
201 |
+
|
202 |
+
public function getMultiStoreDataJson()
|
203 |
+
{
|
204 |
+
$websites = Mage::getModel('core/website')->getCollection();
|
205 |
+
|
206 |
+
$multistoreData = array();
|
207 |
+
$multistoreJson = '';
|
208 |
+
$useStoreCode = $this->getConfigDataByFullPath('web/url/use_store');
|
209 |
+
$mage = Mage::getVersion();
|
210 |
+
$ext = Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
211 |
+
$version = array('mage' => $mage, 'ext' => $ext);
|
212 |
+
|
213 |
+
//getting site url
|
214 |
+
$url = $this->getConfigDataByFullPath('web/unsecure/base_url');
|
215 |
+
|
216 |
+
//getting site owner email
|
217 |
+
$storeMail = $this->getConfigDataByFullPath('autocompleteplus/config/store_email');
|
218 |
+
|
219 |
+
if (!$storeMail) {
|
220 |
+
$storeMail = $this->getConfigDataByFullPath('trans_email/ident_general/email');
|
221 |
+
}
|
222 |
+
|
223 |
+
$collection = Mage::getModel('catalog/product')->getCollection();
|
224 |
+
//$productCount=$collection->count();
|
225 |
+
|
226 |
+
$storesArr = array();
|
227 |
+
foreach ($websites as $website) {
|
228 |
+
$code = $website->getCode();
|
229 |
+
$stores = $website->getStores();
|
230 |
+
foreach ($stores as $store) {
|
231 |
+
$storesArr[$store->getStoreId()] = $store->getData();
|
232 |
+
}
|
233 |
+
}
|
234 |
+
|
235 |
+
if (count($storesArr) == 1) {
|
236 |
+
try {
|
237 |
+
$dataArr = array(
|
238 |
+
// 'stores' => array(array_pop($storesArr)),
|
239 |
+
'stores' => array_pop($storesArr),
|
240 |
+
'version' => $version,
|
241 |
+
);
|
242 |
+
} catch (Exception $e) {
|
243 |
+
$dataArr = array(
|
244 |
+
'stores' => $multistoreData,
|
245 |
+
'version' => $version,
|
246 |
+
);
|
247 |
+
}
|
248 |
+
|
249 |
+
$dataArr['site'] = $url;
|
250 |
+
$dataArr['email'] = $storeMail;
|
251 |
+
|
252 |
+
$multistoreJson = json_encode($dataArr);
|
253 |
+
} else {
|
254 |
+
$storeUrls = $this->getConfigMultiDataByFullPath('web/unsecure/base_url');
|
255 |
+
$locales = $this->getConfigMultiDataByFullPath('general/locale/code');
|
256 |
+
$storeComplete = array();
|
257 |
+
|
258 |
+
foreach ($storesArr as $key => $value) {
|
259 |
+
if (!$value['is_active']) {
|
260 |
+
continue;
|
261 |
+
}
|
262 |
+
|
263 |
+
$storeComplete = $value;
|
264 |
+
if (array_key_exists($key, $locales)) {
|
265 |
+
$storeComplete['lang'] = $locales[$key];
|
266 |
+
} else {
|
267 |
+
$storeComplete['lang'] = $locales[0];
|
268 |
+
}
|
269 |
+
|
270 |
+
if (array_key_exists($key, $storeUrls)) {
|
271 |
+
$storeComplete['url'] = $storeUrls[$key];
|
272 |
+
} else {
|
273 |
+
$storeComplete['url'] = $storeUrls[0];
|
274 |
+
}
|
275 |
+
|
276 |
+
if ($useStoreCode) {
|
277 |
+
$storeComplete['url'] = $storeUrls[0].$value['code'];
|
278 |
+
}
|
279 |
+
|
280 |
+
$multistoreData[] = $storeComplete;
|
281 |
+
}
|
282 |
+
|
283 |
+
$dataArr = array(
|
284 |
+
'stores' => $multistoreData,
|
285 |
+
'version' => $version,
|
286 |
+
);
|
287 |
+
|
288 |
+
$dataArr['site'] = $url;
|
289 |
+
$dataArr['email'] = $storeMail;
|
290 |
+
//$dataArr['product_count']=$productCount;
|
291 |
+
|
292 |
+
$multistoreJson = json_encode($dataArr);
|
293 |
+
}
|
294 |
+
|
295 |
+
return $multistoreJson;
|
296 |
+
}
|
297 |
+
|
298 |
+
public function getExtensionConflict($all_conflicts = false)
|
299 |
+
{
|
300 |
+
$all_rewrite_classes = array();
|
301 |
+
$node_type_list = array('model', 'helper', 'block');
|
302 |
+
|
303 |
+
foreach ($node_type_list as $node_type) {
|
304 |
+
foreach (Mage::getConfig()->getNode('modules')->children() as $name => $module) {
|
305 |
+
if ($module->codePool == 'core' || $module->active != 'true') {
|
306 |
+
continue;
|
307 |
+
}
|
308 |
+
$config_file_path = Mage::getConfig()->getModuleDir('etc', $name).DS.'config.xml';
|
309 |
+
$config = new Varien_Simplexml_Config();
|
310 |
+
$config->loadString('<config/>');
|
311 |
+
$config->loadFile($config_file_path);
|
312 |
+
$config->extend($config, true);
|
313 |
+
|
314 |
+
$nodes = $config->getNode()->global->{$node_type.'s'};
|
315 |
+
if (!$nodes) {
|
316 |
+
continue;
|
317 |
+
}
|
318 |
+
foreach ($nodes->children() as $node_name => $config) {
|
319 |
+
if ($config->rewrite) { // there is rewrite for current config
|
320 |
+
foreach ($config->rewrite->children() as $class_tag => $derived_class) {
|
321 |
+
$base_class_name = $this->_getMageBaseClass($node_type, $node_name, $class_tag);
|
322 |
+
|
323 |
+
$lead_derived_class = '';
|
324 |
+
$conf = Mage::getConfig()->getNode()->global->{$node_type.'s'}->{$node_name};
|
325 |
+
if (isset($conf->rewrite->$class_tag)) {
|
326 |
+
$lead_derived_class = (string) $conf->rewrite->$class_tag;
|
327 |
+
}
|
328 |
+
if ($derived_class == '') {
|
329 |
+
$derived_class = $lead_derived_class;
|
330 |
+
}
|
331 |
+
|
332 |
+
if (empty($all_rewrite_classes[$base_class_name])) {
|
333 |
+
$all_rewrite_classes[$base_class_name] = array(
|
334 |
+
'derived' => array((string) $derived_class),
|
335 |
+
'lead' => (string) $lead_derived_class,
|
336 |
+
'tag' => $class_tag,
|
337 |
+
'name' => array((string) $name),
|
338 |
+
);
|
339 |
+
} else {
|
340 |
+
array_push($all_rewrite_classes[$base_class_name]['derived'], (string) $derived_class);
|
341 |
+
array_push($all_rewrite_classes[$base_class_name]['name'], (string) $name);
|
342 |
+
}
|
343 |
+
}
|
344 |
+
}
|
345 |
+
}
|
346 |
+
}
|
347 |
+
}
|
348 |
+
if ($all_conflicts) {
|
349 |
+
return $all_rewrite_classes;
|
350 |
+
}
|
351 |
+
|
352 |
+
$isp_rewrite_classes = array();
|
353 |
+
$isp_module_name = 'Autocompleteplus_Autosuggest';
|
354 |
+
foreach ($all_rewrite_classes as $base => $conflict_info) {
|
355 |
+
if (in_array($isp_module_name, $conflict_info['name'])) { // if isp extension rewrite this base class
|
356 |
+
if (count($conflict_info['derived']) > 1) { // more then 1 class rewrite this base class => there is a conflict
|
357 |
+
$isp_rewrite_classes[$base] = $conflict_info;
|
358 |
+
}
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
return $isp_rewrite_classes;
|
363 |
+
}
|
364 |
+
|
365 |
+
protected function _getMageBaseClass($node_type, $node_name, $class_tag)
|
366 |
+
{
|
367 |
+
$config = Mage::getConfig()->getNode()->global->{$node_type.'s'}->$node_name;
|
368 |
+
|
369 |
+
if (!empty($config)) {
|
370 |
+
$className = $config->getClassName();
|
371 |
+
}
|
372 |
+
if (empty($className)) {
|
373 |
+
$className = 'mage_'.$node_name.'_'.$node_type;
|
374 |
+
}
|
375 |
+
if (!empty($class_tag)) {
|
376 |
+
$className .= '_'.$class_tag;
|
377 |
+
}
|
378 |
+
|
379 |
+
return uc_words($className);
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* Checksum functionality.
|
384 |
+
*/
|
385 |
+
public function isChecksumTableExists()
|
386 |
+
{
|
387 |
+
$table_prefix = (string) Mage::getConfig()->getTablePrefix();
|
388 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
389 |
+
if ($read->showTableStatus($table_prefix.'autocompleteplus_checksum')) {
|
390 |
+
return true;
|
391 |
+
} else {
|
392 |
+
return false;
|
393 |
+
}
|
394 |
+
}
|
395 |
+
|
396 |
+
public function calculateChecksum($product)
|
397 |
+
{
|
398 |
+
$product_id = $product->getId();
|
399 |
+
$product_title = $product->getName();
|
400 |
+
$product_description = $product->getDescription();
|
401 |
+
$product_short_desc = $product->getShortDescription();
|
402 |
+
$product_url = $product->getUrlPath(); //Mage::helper('catalog/product')->getProductUrl($product_id); | $product->getProductUrl()
|
403 |
+
$product_visibility = $product->getVisibility();
|
404 |
+
$product_in_stock = $product->isInStock();
|
405 |
+
$product_price = (float) $product->getPrice();
|
406 |
+
try {
|
407 |
+
$product_thumb_url = '/'.$product->getImage();
|
408 |
+
|
409 |
+
// $product_thumb_url = $product->getThumbnailUrl(); //Mage::helper('catalog/image')->init($product, 'thumbnail');
|
410 |
+
// $thumb_pattern = '/\/[^\/]+(?![^\/]*\/)/';
|
411 |
+
// if (preg_match($thumb_pattern, $product_thumb_url, $matches) && count($matches) > 0){
|
412 |
+
// $product_thumb_url = $matches[0];
|
413 |
+
// } else {
|
414 |
+
// $product_thumb_url = '';
|
415 |
+
// }
|
416 |
+
} catch (Exception $e) {
|
417 |
+
$product_thumb_url = '';
|
418 |
+
}
|
419 |
+
$product_type = $product->getTypeID();
|
420 |
+
|
421 |
+
$checksum_string = $product_id.$product_title.$product_description.$product_short_desc.$product_url.
|
422 |
+
$product_visibility.$product_in_stock.$product_price.$product_thumb_url.$product_type;
|
423 |
+
|
424 |
+
$checksum_md5 = md5($checksum_string);
|
425 |
+
|
426 |
+
return $checksum_md5;
|
427 |
+
}
|
428 |
+
|
429 |
+
public function getSavedChecksum($table_prefix, $read, $product_id, $store_id)
|
430 |
+
{
|
431 |
+
$sql_fetch = 'SELECT checksum FROM '.$table_prefix.'autocompleteplus_checksum WHERE identifier=? AND store_id=?';
|
432 |
+
$updates = $read->fetchAll($sql_fetch, array($product_id, $store_id));
|
433 |
+
if ($updates && (count($updates) != 0)) {
|
434 |
+
return $updates[0]['checksum'];
|
435 |
+
} else {
|
436 |
+
return '';
|
437 |
+
}
|
438 |
+
}
|
439 |
+
|
440 |
+
public function updateSavedProductChecksum($product_id, $sku, $store_id, $checksum)
|
441 |
+
{
|
442 |
+
if ($product_id == null || $sku == null) {
|
443 |
+
return;
|
444 |
+
}
|
445 |
+
$checksumModel = Mage::getModel('autocompleteplus_autosuggest/checksum');
|
446 |
+
$collection = $checksumModel->getCollection()
|
447 |
+
->addFieldToFilter('identifier', $product_id)
|
448 |
+
->addFieldToFilter('store_id', $store_id);
|
449 |
+
|
450 |
+
$row = $collection->getFirstItem();
|
451 |
+
|
452 |
+
if ($row && $collection->getSize() > 0) {
|
453 |
+
if ($row->getChecksum() != $checksum) {
|
454 |
+
$row->setChecksum($checksum)->save();
|
455 |
+
}
|
456 |
+
} else {
|
457 |
+
$checksumModel->setIdentifier($product_id)
|
458 |
+
->setSku($sku)
|
459 |
+
->setStoreId($store_id)
|
460 |
+
->setChecksum($checksum)
|
461 |
+
->save();
|
462 |
+
}
|
463 |
+
}
|
464 |
+
|
465 |
+
public function updateDeletedProductChecksum($table_prefix, $read, $write, $product_id, $sku, $store_id)
|
466 |
+
{
|
467 |
+
if ($product_id == null) {
|
468 |
+
return;
|
469 |
+
}
|
470 |
+
|
471 |
+
$checksums = Mage::getModel('autocompleteplus_autosuggest/checksum')->getCollection()
|
472 |
+
->addFieldToFilter('identifier', $product_id)
|
473 |
+
->addFieldToFilter('store_id', $store_id);
|
474 |
+
|
475 |
+
if ($checksums->getSize() > 0) {
|
476 |
+
// @codingStandardsIgnoreLine
|
477 |
+
$checksum = $checksums->getFirstItem();
|
478 |
+
$checksum->delete();
|
479 |
+
}
|
480 |
+
}
|
481 |
+
|
482 |
+
private function setUpdateNeededForProduct($read, $write, $product_id, $product_sku, $store_id)
|
483 |
+
{
|
484 |
+
if ($product_id == null) {
|
485 |
+
return;
|
486 |
+
}
|
487 |
+
if ($product_sku == null) {
|
488 |
+
$product_sku = 'dummy_sku';
|
489 |
+
}
|
490 |
+
try {
|
491 |
+
$table_prefix = (string) Mage::getConfig()->getTablePrefix();
|
492 |
+
$is_table_exist = $write->showTableStatus($table_prefix.'autocompleteplus_batches');
|
493 |
+
if (!$is_table_exist) { // table not exists
|
494 |
+
return;
|
495 |
+
}
|
496 |
+
|
497 |
+
$sql_fetch = 'SELECT * FROM '.$table_prefix.'autocompleteplus_batches WHERE product_id=? AND store_id=?';
|
498 |
+
$updates = $read->fetchAll($sql_fetch, array($product_id, $store_id));
|
499 |
+
|
500 |
+
if ($updates && (count($updates) != 0)) {
|
501 |
+
$sql = 'UPDATE '.$table_prefix.'autocompleteplus_batches SET update_date=?,action=? WHERE product_id=? AND store_id=?';
|
502 |
+
$write->query($sql, array(strtotime('now'), 'update', $product_id, $store_id));
|
503 |
+
} else {
|
504 |
+
$sql = 'INSERT INTO '.$table_prefix.'autocompleteplus_batches (product_id,store_id,update_date,action,sku) VALUES (?,?,?,?,?)';
|
505 |
+
$write->query($sql, array($product_id, $store_id, strtotime('now'), 'update', $product_sku));
|
506 |
+
}
|
507 |
+
} catch (Exception $e) {
|
508 |
+
Mage::log('Exception raised in setUpdateNeededForProduct() - '.$e->getMessage(), null, 'autocompleteplus.log');
|
509 |
+
$this->ispErrorLog('Exception raised in setUpdateNeededForProduct() - '.$e->getMessage());
|
510 |
+
}
|
511 |
+
}
|
512 |
+
|
513 |
+
public function compareProductsChecksum($from, $count, $store_id = null)
|
514 |
+
{
|
515 |
+
$num_of_updates = 0;
|
516 |
+
if (!$this->isChecksumTableExists()) {
|
517 |
+
return;
|
518 |
+
}
|
519 |
+
|
520 |
+
$products = Mage::getModel('catalog/product')->getCollection();
|
521 |
+
if ($store_id) {
|
522 |
+
$products->addStoreFilter($store_id);
|
523 |
+
}
|
524 |
+
$products->getSelect()->limit($count, $from);
|
525 |
+
$products->load();
|
526 |
+
|
527 |
+
$table_prefix = (string) Mage::getConfig()->getTablePrefix();
|
528 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
529 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
530 |
+
|
531 |
+
foreach ($products as $product) {
|
532 |
+
try {
|
533 |
+
$product_collection_data = $product->getData();
|
534 |
+
$product_model = Mage::getModel('catalog/product')
|
535 |
+
->setStore($store_id)->setStoreId($store_id)
|
536 |
+
->load($product_collection_data['entity_id']);
|
537 |
+
|
538 |
+
$current_checksum = $this->getSavedChecksum($table_prefix, $read, $product_model->getId(), $store_id);
|
539 |
+
$new_checksum = $this->calculateChecksum($product_model);
|
540 |
+
} catch (Exception $e) {
|
541 |
+
Mage::log('Exception raised in compareProductsChecksum() on id: '.$product->getId().' -> '.$e->getMessage(), null, 'autocompleteplus.log');
|
542 |
+
$this->ispErrorLog('Exception raised in compareProductsChecksum() on id: '.$product->getId().' -> '.$e->getMessage());
|
543 |
+
|
544 |
+
return 0;
|
545 |
+
}
|
546 |
+
if ($current_checksum == '' || $current_checksum != $new_checksum) {
|
547 |
+
++$num_of_updates;
|
548 |
+
$this->updateSavedProductChecksum($table_prefix, $read, $write, $product_model->getId(), $product_model->getSku(),
|
549 |
+
$store_id, $new_checksum);
|
550 |
+
$this->setUpdateNeededForProduct($read, $write, $product_model->getId(), $product_model->getSku(), $store_id);
|
551 |
+
}
|
552 |
+
}
|
553 |
+
|
554 |
+
return $num_of_updates;
|
555 |
+
}
|
556 |
+
|
557 |
+
public function deleteProductFromTables($read, $write, $table_prefix, $product_id, $store_id)
|
558 |
+
{
|
559 |
+
$dt = strtotime('now');
|
560 |
+
$sku = 'dummy_sku';
|
561 |
+
$sqlFetch = 'SELECT * FROM '.$table_prefix.'autocompleteplus_batches WHERE product_id = ? AND store_id=?';
|
562 |
+
$updates = $read->fetchAll($sqlFetch, array($product_id, $store_id));
|
563 |
+
|
564 |
+
if ($updates && count($updates) != 0) {
|
565 |
+
$sql = 'UPDATE '.$table_prefix.'autocompleteplus_batches SET update_date=?,action=? WHERE product_id = ? AND store_id = ?';
|
566 |
+
$write->query($sql, array($dt, 'remove', $product_id, $store_id));
|
567 |
+
} else {
|
568 |
+
$sql = 'INSERT INTO '.$table_prefix.'autocompleteplus_batches (product_id,store_id,update_date,action,sku) VALUES (?,?,?,?,?)';
|
569 |
+
$write->query($sql, array($product_id, $store_id, $dt, 'remove', $sku));
|
570 |
+
}
|
571 |
+
|
572 |
+
$this->updateDeletedProductChecksum($table_prefix, $read, $write, $product_id, $sku, $store_id);
|
573 |
+
}
|
574 |
+
|
575 |
+
public function ispLog($log)
|
576 |
+
{
|
577 |
+
Mage::log($log, null, 'autocompleteplus.log');
|
578 |
+
}
|
579 |
+
|
580 |
+
public function ispErrorLog($log)
|
581 |
+
{
|
582 |
+
$uuid = $this->getUUID();
|
583 |
+
$site_url = $this->getConfigDataByFullPath('web/unsecure/base_url');
|
584 |
+
$store_id = Mage::app()->getStore()->getStoreId();
|
585 |
+
|
586 |
+
$server_url = $this->server_url.'/magento_logging_error';
|
587 |
+
$request = $server_url.'?uuid='.$uuid.'&site_url='.$site_url.'&store_id='.$store_id.'&msg='.urlencode($log);
|
588 |
+
|
589 |
+
$resp = $this->sendCurl($request);
|
590 |
+
}
|
591 |
+
|
592 |
+
public function getUUID()
|
593 |
+
{
|
594 |
+
return $this->getConfig()->getUUID();
|
595 |
+
}
|
596 |
+
|
597 |
+
public function getIsReachable()
|
598 |
+
{
|
599 |
+
return $this->getConfig()->isReachable();
|
600 |
+
}
|
601 |
+
|
602 |
+
public function getServerEndPoint()
|
603 |
+
{
|
604 |
+
try {
|
605 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
606 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
607 |
+
$_tableprefix = (string) Mage::getConfig()->getTablePrefix();
|
608 |
+
$tblExist = $write->showTableStatus($_tableprefix.'autocompleteplus_config');
|
609 |
+
|
610 |
+
if (!$tblExist) {
|
611 |
+
return '';
|
612 |
+
}
|
613 |
+
|
614 |
+
$sql = 'SELECT * FROM `'.$_tableprefix.'autocompleteplus_config` WHERE `id` =1';
|
615 |
+
$licenseData = $read->fetchAll($sql);
|
616 |
+
if (array_key_exists('server_type', $licenseData[0])) {
|
617 |
+
$key = $licenseData[0]['server_type'];
|
618 |
+
} else {
|
619 |
+
$key = '';
|
620 |
+
}
|
621 |
+
} catch (Exception $e) {
|
622 |
+
$key = '';
|
623 |
+
}
|
624 |
+
|
625 |
+
return $key;
|
626 |
+
}
|
627 |
+
|
628 |
+
public function setServerEndPoint($end_point)
|
629 |
+
{
|
630 |
+
try {
|
631 |
+
$_tableprefix = (string) Mage::getConfig()->getTablePrefix();
|
632 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
633 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
634 |
+
$tblExist = $write->showTableStatus($_tableprefix.'autocompleteplus_config');
|
635 |
+
|
636 |
+
if (!$tblExist) {
|
637 |
+
return;
|
638 |
+
}
|
639 |
+
|
640 |
+
$sqlFetch = 'SELECT * FROM '.$_tableprefix.'autocompleteplus_config WHERE id = 1';
|
641 |
+
$updates = $write->fetchAll($sqlFetch);
|
642 |
+
|
643 |
+
if ($updates && count($updates) != 0) {
|
644 |
+
$sql = 'UPDATE '.$_tableprefix.'autocompleteplus_config SET server_type=? WHERE id = 1';
|
645 |
+
$write->query($sql, array($end_point));
|
646 |
+
} else {
|
647 |
+
Mage::log('cant update server_type', null, 'autocompleteplus.log');
|
648 |
+
}
|
649 |
+
} catch (Exception $e) {
|
650 |
+
Mage::log($e->getMessage(), null, 'autocompleteplus.log');
|
651 |
+
}
|
652 |
+
}
|
653 |
+
|
654 |
+
public function getErrormessage()
|
655 |
+
{
|
656 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
657 |
+
|
658 |
+
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
|
659 |
+
|
660 |
+
$_tableprefix = (string) Mage::getConfig()->getTablePrefix();
|
661 |
+
|
662 |
+
$tblExist = $write->showTableStatus($_tableprefix.'autocompleteplus_config');
|
663 |
+
|
664 |
+
if (!$tblExist) {
|
665 |
+
return '';
|
666 |
+
}
|
667 |
+
|
668 |
+
$sql = 'SELECT * FROM `'.$_tableprefix.'autocompleteplus_config` WHERE `id` =1';
|
669 |
+
|
670 |
+
$licenseData = $read->fetchAll($sql);
|
671 |
+
|
672 |
+
$errormessage = $licenseData[0]['errormessage'];
|
673 |
+
|
674 |
+
return $errormessage;
|
675 |
+
}
|
676 |
+
|
677 |
+
public function getIfSyncWasInitiated()
|
678 |
+
{
|
679 |
+
$collection = Mage::getModel('autocompleteplus_autosuggest/pusher')->getCollection();
|
680 |
+
|
681 |
+
$count = $collection->count();
|
682 |
+
|
683 |
+
if ($count == 0) {
|
684 |
+
return false;
|
685 |
+
} else {
|
686 |
+
return true;
|
687 |
+
}
|
688 |
+
}
|
689 |
+
|
690 |
+
public function getPushId()
|
691 |
+
{
|
692 |
+
$collection = Mage::getModel('autocompleteplus_autosuggest/pusher')->getCollection()
|
693 |
+
->addFilter('sent', 0);
|
694 |
+
|
695 |
+
$collection->getSelect()->limit(1);
|
696 |
+
|
697 |
+
$collection->load();
|
698 |
+
|
699 |
+
$id = '';
|
700 |
+
|
701 |
+
foreach ($collection as $p) {
|
702 |
+
$id = $p->getId();
|
703 |
+
}
|
704 |
+
|
705 |
+
return $id;
|
706 |
+
}
|
707 |
+
|
708 |
+
public function getPushUrl($id = null)
|
709 |
+
{
|
710 |
+
if ($id == null) {
|
711 |
+
$id = $this->getPushId();
|
712 |
+
}
|
713 |
+
|
714 |
+
$url = Mage::getUrl();//'',array('pushid'=>$id));
|
715 |
+
|
716 |
+
if (strpos($url, 'index.php') !== false) {
|
717 |
+
$url = $url.'/autocompleteplus/products/pushbulk/pushid/'.$id;
|
718 |
+
} else {
|
719 |
+
$url = $url.'index.php/autocompleteplus/products/pushbulk/pushid/'.$id;
|
720 |
+
}
|
721 |
+
|
722 |
+
return $url;
|
723 |
+
}
|
724 |
+
|
725 |
+
public function escapeXml($xml)
|
726 |
+
{
|
727 |
+
// $pairs = array(
|
728 |
+
// "\x03" => "",
|
729 |
+
// "\x05" => "",
|
730 |
+
// "\x0E" => "",
|
731 |
+
// "\x16" => "",
|
732 |
+
// );
|
733 |
+
// $xml = strtr($xml, $pairs);
|
734 |
+
|
735 |
+
$xml = preg_replace('/[\x00-\x1f]/', '', $xml);
|
736 |
+
|
737 |
+
return $xml;
|
738 |
+
}
|
739 |
+
|
740 |
+
/**
|
741 |
+
* Get the session cookie value
|
742 |
+
* protected with a salt (the store encryption key).
|
743 |
+
*
|
744 |
+
* @return string
|
745 |
+
*/
|
746 |
+
public function getSessionId()
|
747 |
+
{
|
748 |
+
return md5(Mage::app()->getCookie()->get('frontend').$this->_getEncryptionKey());
|
749 |
+
}
|
750 |
+
|
751 |
+
/**
|
752 |
+
* Return encryption key in Magento to use as salt
|
753 |
+
* Requires getting from configNode so that it is backward
|
754 |
+
* compatible with later versions.
|
755 |
+
*
|
756 |
+
* @return string
|
757 |
+
*/
|
758 |
+
protected function _getEncryptionKey()
|
759 |
+
{
|
760 |
+
return (string) Mage::getConfig()->getNode('global/crypt/key');
|
761 |
+
}
|
762 |
+
|
763 |
+
public function validateInput($input, $type = "integer", $default = null, $on_failure = null){
|
764 |
+
$validated_input = $default;
|
765 |
+
$sanity_type = FILTER_SANITIZE_NUMBER_INT;
|
766 |
+
$type = strtolower($type);
|
767 |
+
if ($type == "integer" || $type == 'int'){
|
768 |
+
$sanity_type = FILTER_SANITIZE_NUMBER_INT;
|
769 |
+
} else if ($type == 'boolean' || $type == 'bool'){
|
770 |
+
$sanity_type = FILTER_VALIDATE_BOOLEAN;
|
771 |
+
}
|
772 |
+
|
773 |
+
$filter_input = filter_var($input, $sanity_type, FILTER_NULL_ON_FAILURE);
|
774 |
+
if ($filter_input || ($sanity_type == FILTER_SANITIZE_NUMBER_INT && $filter_input === "0")){
|
775 |
+
$validated_input = $filter_input;
|
776 |
+
$status = settype($validated_input, $type);
|
777 |
+
if (!$status){
|
778 |
+
$validated_input = $on_failure;
|
779 |
+
}
|
780 |
+
}
|
781 |
+
return $validated_input;
|
782 |
+
}
|
783 |
+
}
|
app/code/local/Autocompleteplus/Autosuggest/Model/Catalog.php
CHANGED
@@ -17,9 +17,9 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
17 |
$startInd = 0;
|
18 |
}
|
19 |
|
20 |
-
//maxim products on one page is
|
21 |
-
if (!$count || $count >
|
22 |
-
$count =
|
23 |
}
|
24 |
//retrieving page number
|
25 |
$this->pageNum = floor(($startInd / $count));
|
17 |
$startInd = 0;
|
18 |
}
|
19 |
|
20 |
+
//maxim products on one page is 1000
|
21 |
+
if (!$count || $count > 1000) {
|
22 |
+
$count = 1000;
|
23 |
}
|
24 |
//retrieving page number
|
25 |
$this->pageNum = floor(($startInd / $count));
|
app/code/local/Autocompleteplus/Autosuggest/Model/Catalogreport.php
CHANGED
@@ -93,13 +93,11 @@ class Autocompleteplus_Autosuggest_Model_Catalogreport extends Mage_Core_Model_A
|
|
93 |
public function getCurrentStoreId()
|
94 |
{
|
95 |
if (!$this->_storeId) {
|
96 |
-
$
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
$this->_storeId = $
|
101 |
-
} else {
|
102 |
-
$this->_storeId = Mage::app()->getStore()->getStoreId();
|
103 |
}
|
104 |
}
|
105 |
|
93 |
public function getCurrentStoreId()
|
94 |
{
|
95 |
if (!$this->_storeId) {
|
96 |
+
$request = $this->getRequest();
|
97 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
98 |
+
$this->_storeId = $helper->validateInput($request->getParam('store_id'), 'integer', null, null);
|
99 |
+
if (!$this->_storeId){
|
100 |
+
$this->_storeId = $helper->validateInput($request->getParam('store', Mage::app()->getStore()->getStoreId()), 'integer', Mage::app()->getStore()->getStoreId(), null);
|
|
|
|
|
101 |
}
|
102 |
}
|
103 |
|
app/code/local/Autocompleteplus/Autosuggest/controllers/CategoriesController.php
CHANGED
@@ -63,7 +63,11 @@ class Autocompleteplus_Autosuggest_CategoriesController extends Mage_Core_Contro
|
|
63 |
{
|
64 |
$storeContext = Mage::app()->getStore()->getStoreId();
|
65 |
$tree = Mage::getResourceSingleton('catalog/category_tree')->load();
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
$parentId = Mage::app()->getStore($store)->getRootCategoryId();
|
68 |
|
69 |
$root = $tree->getNodeById($parentId);
|
63 |
{
|
64 |
$storeContext = Mage::app()->getStore()->getStoreId();
|
65 |
$tree = Mage::getResourceSingleton('catalog/category_tree')->load();
|
66 |
+
|
67 |
+
$request = $this->getRequest();
|
68 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
69 |
+
$store = $helper->validateInput($request->getParam('store', $storeContext), 'integer', $storeContext, $storeContext);
|
70 |
+
|
71 |
$parentId = Mage::app()->getStore($store)->getRootCategoryId();
|
72 |
|
73 |
$root = $tree->getNodeById($parentId);
|
app/code/local/Autocompleteplus/Autosuggest/controllers/LayeredController.php
CHANGED
@@ -19,10 +19,16 @@ class Autocompleteplus_Autosuggest_LayeredController extends Mage_Core_Controlle
|
|
19 |
{
|
20 |
$response = $this->getResponse();
|
21 |
$request = $this->getRequest();
|
|
|
|
|
22 |
$authkey = $request->getParam('authentication_key');
|
23 |
$uuid = $request->getParam('uuid');
|
|
|
24 |
$scope = $request->getParam('scope', 'stores');
|
25 |
-
$
|
|
|
|
|
|
|
26 |
|
27 |
if (!$this->valid($uuid, $authkey)) {
|
28 |
$resp = json_encode(array('status' => 'error: '.'Authentication failed'));
|
@@ -54,11 +60,16 @@ class Autocompleteplus_Autosuggest_LayeredController extends Mage_Core_Controlle
|
|
54 |
{
|
55 |
$request = $this->getRequest();
|
56 |
$response = $this->getResponse();
|
|
|
57 |
$authkey = $request->getParam('authentication_key');
|
58 |
$uuid = $request->getParam('uuid');
|
|
|
59 |
$scope = $request->getParam('scope', 'stores');
|
60 |
-
$
|
61 |
-
|
|
|
|
|
|
|
62 |
if (!$this->valid($uuid, $authkey)) {
|
63 |
$resp = json_encode(array('status' => 'error: '.'Authentication failed'));
|
64 |
|
@@ -90,10 +101,11 @@ class Autocompleteplus_Autosuggest_LayeredController extends Mage_Core_Controlle
|
|
90 |
{
|
91 |
$request = $this->getRequest();
|
92 |
$response = $this->getResponse();
|
|
|
93 |
|
94 |
$authkey = $request->getParam('authentication_key');
|
95 |
$uuid = $request->getParam('uuid');
|
96 |
-
$scopeId = $request->getParam('store_id', 1);
|
97 |
|
98 |
if (!$this->valid($uuid, $authkey)) {
|
99 |
$resp = json_encode(array('status' => $this->__('error: Authentication failed')));
|
19 |
{
|
20 |
$response = $this->getResponse();
|
21 |
$request = $this->getRequest();
|
22 |
+
|
23 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
24 |
$authkey = $request->getParam('authentication_key');
|
25 |
$uuid = $request->getParam('uuid');
|
26 |
+
|
27 |
$scope = $request->getParam('scope', 'stores');
|
28 |
+
if ($scope != 'stores' && $scope != 'default' && $scope != ''){
|
29 |
+
$scope = 'stores';
|
30 |
+
}
|
31 |
+
$scopeId = $helper->validateInput($request->getParam('store_id', Mage::app()->getStore()->getStoreId()), 'integer', 1, null);
|
32 |
|
33 |
if (!$this->valid($uuid, $authkey)) {
|
34 |
$resp = json_encode(array('status' => 'error: '.'Authentication failed'));
|
60 |
{
|
61 |
$request = $this->getRequest();
|
62 |
$response = $this->getResponse();
|
63 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
64 |
$authkey = $request->getParam('authentication_key');
|
65 |
$uuid = $request->getParam('uuid');
|
66 |
+
|
67 |
$scope = $request->getParam('scope', 'stores');
|
68 |
+
if ($scope != 'stores' && $scope != 'default' && $scope != ''){
|
69 |
+
$scope = 'stores';
|
70 |
+
}
|
71 |
+
$scopeId = $helper->validateInput($request->getParam('store_id', Mage::app()->getStore()->getStoreId()), 'integer', 1, null);
|
72 |
+
|
73 |
if (!$this->valid($uuid, $authkey)) {
|
74 |
$resp = json_encode(array('status' => 'error: '.'Authentication failed'));
|
75 |
|
101 |
{
|
102 |
$request = $this->getRequest();
|
103 |
$response = $this->getResponse();
|
104 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
105 |
|
106 |
$authkey = $request->getParam('authentication_key');
|
107 |
$uuid = $request->getParam('uuid');
|
108 |
+
$scopeId = $helper->validateInput($request->getParam('store_id', Mage::app()->getStore()->getStoreId()), 'integer', 1, null);
|
109 |
|
110 |
if (!$this->valid($uuid, $authkey)) {
|
111 |
$resp = json_encode(array('status' => $this->__('error: Authentication failed')));
|
app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsController.php
CHANGED
@@ -34,13 +34,27 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
34 |
{
|
35 |
$response = $this->getResponse();
|
36 |
$request = $this->getRequest();
|
37 |
-
$
|
38 |
-
|
39 |
-
$
|
40 |
-
$
|
41 |
-
$
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
$catalogModel = Mage::getModel('autocompleteplus_autosuggest/catalog');
|
45 |
|
46 |
$xml = $catalogModel->renderCatalogXml($startInd, $count, $storeId, $orders, $monthInterval, $checksum);
|
@@ -55,10 +69,23 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
55 |
|
56 |
$request = $this->getRequest();
|
57 |
$response = $this->getResponse();
|
58 |
-
$
|
59 |
-
|
60 |
-
$
|
61 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
if (!$storeId) {
|
64 |
$returnArr = array(
|
@@ -97,16 +124,16 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
97 |
}
|
98 |
|
99 |
return $this->__('no key inside');
|
100 |
-
}
|
101 |
-
|
102 |
public function versAction()
|
103 |
{
|
104 |
$response = $this->getResponse();
|
105 |
-
$get_modules = $this->getRequest()->getParam('modules', false);
|
106 |
$mage = Mage::getVersion();
|
107 |
$ext = Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
108 |
$edition = method_exists('Mage', 'getEdition') ? Mage::getEdition() : 'Community';
|
109 |
$helper = Mage::helper('autocompleteplus_autosuggest');
|
|
|
110 |
$uuid = $this->_getConfig()->getUUID();
|
111 |
$site_url = $helper->getConfigDataByFullPath('web/unsecure/base_url');
|
112 |
$store_id = Mage::app()->getStore()->getStoreId();
|
@@ -301,13 +328,9 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
301 |
|
302 |
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
303 |
$table_prefix = (string) Mage::getConfig()->getTablePrefix();
|
304 |
-
|
305 |
-
$
|
306 |
-
|
307 |
-
$store_id = $post['store_id'];
|
308 |
-
} else {
|
309 |
-
$store_id = Mage::app()->getStore()->getStoreId(); // default
|
310 |
-
}
|
311 |
|
312 |
$sql_fetch = 'SELECT identifier FROM '.$table_prefix.'autocompleteplus_checksum WHERE store_id=?';
|
313 |
$updates = $read->fetchPairs($sql_fetch, array($store_id)); // empty array if fails
|
@@ -351,11 +374,13 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
351 |
$request = $this->getRequest();
|
352 |
$response = $this->getResponse();
|
353 |
$helper = Mage::helper('autocompleteplus_autosuggest');
|
354 |
-
|
355 |
-
$
|
356 |
-
$
|
357 |
-
$
|
358 |
-
$
|
|
|
|
|
359 |
$uuid = $this->_getConfig()->getUUID();
|
360 |
$checksum_server = $helper->getServerUrl();
|
361 |
$collection = Mage::getModel('catalog/product')->getCollection();
|
@@ -444,71 +469,15 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
444 |
$this->getResponse()->setBody(1);
|
445 |
}
|
446 |
|
447 |
-
public function changeSerpAction()
|
448 |
-
{
|
449 |
-
$scope_name = 'stores';
|
450 |
-
$request = $this->getRequest();
|
451 |
-
$response = $this->getResponse();
|
452 |
-
|
453 |
-
$helper = Mage::helper('autocompleteplus_autosuggest');
|
454 |
-
$site_url = $helper->getConfigDataByFullPath('web/unsecure/base_url');
|
455 |
-
$is_new_serp = $request->getParam('new_serp', 0);
|
456 |
-
|
457 |
-
$store_id = $request->getParam('store_id', 0);
|
458 |
-
if (!$store_id) {
|
459 |
-
$scope_name = 'default';
|
460 |
-
}
|
461 |
-
|
462 |
-
define('SOAP_WSDL', $site_url.'/api/?wsdl');
|
463 |
-
define('SOAP_USER', 'instant_search');
|
464 |
-
define('SOAP_PASS', 'Rilb@kped3');
|
465 |
-
|
466 |
-
try {
|
467 |
-
$client = new SoapClient(SOAP_WSDL, array('trace' => 1, 'cache_wsdl' => 0));
|
468 |
-
$session = $client->login(SOAP_USER, SOAP_PASS);
|
469 |
-
|
470 |
-
switch ($is_new_serp) {
|
471 |
-
|
472 |
-
case 'status':
|
473 |
-
$current_state = $client->call($session, 'autocompleteplus_autosuggest.getLayeredSearchConfig', array($store_id));
|
474 |
-
$resp = array('current_status' => $current_state);
|
475 |
-
$response->setBody(json_encode($resp));
|
476 |
-
|
477 |
-
return;
|
478 |
-
|
479 |
-
case '1':
|
480 |
-
$status = $client->call($session, 'autocompleteplus_autosuggest.setLayeredSearchOn', array($scope_name, $store_id));
|
481 |
-
break;
|
482 |
-
default:
|
483 |
-
$status = $client->call($session, 'autocompleteplus_autosuggest.setLayeredSearchOff', array($scope_name, $store_id));
|
484 |
-
break;
|
485 |
-
}
|
486 |
-
|
487 |
-
$new_state = $client->call($session, 'autocompleteplus_autosuggest.getLayeredSearchConfig', array($store_id));
|
488 |
-
|
489 |
-
$resp = array(
|
490 |
-
'request_state' => $is_new_serp,
|
491 |
-
'new_state' => $new_state,
|
492 |
-
'site_url' => $site_url,
|
493 |
-
'status' => $status,
|
494 |
-
);
|
495 |
-
|
496 |
-
$response->setBody(json_encode($resp));
|
497 |
-
} catch (Exception $e) {
|
498 |
-
$resp = array('status' => 'exception: '.print_r($e, true));
|
499 |
-
$response->setBody(json_encode($resp));
|
500 |
-
Mage::logException($e);
|
501 |
-
throw $e;
|
502 |
-
}
|
503 |
-
}
|
504 |
|
505 |
public function pushbulkAction()
|
506 |
{
|
507 |
$request = $this->getRequest();
|
508 |
$response = $this->getResponse();
|
509 |
$helper = Mage::helper('autocompleteplus_autosuggest');
|
|
|
|
|
510 |
|
511 |
-
$pushId = $request->getParam('pushid', null);
|
512 |
$response->clearHeaders();
|
513 |
$response->setHeader('Content-type', 'application/json');
|
514 |
$catalogModel = Mage::getModel('autocompleteplus_autosuggest/catalog');
|
34 |
{
|
35 |
$response = $this->getResponse();
|
36 |
$request = $this->getRequest();
|
37 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
38 |
+
|
39 |
+
$startInd = $helper->validateInput($request->getParam('offset'), 'integer', null, null);
|
40 |
+
$count = $helper->validateInput($request->getParam('count'), 'integer', null, null);
|
41 |
+
if ($count === null || $startInd === null){
|
42 |
+
$returnArr = array(
|
43 |
+
'status' => self::STATUS_FAILURE,
|
44 |
+
'error_code' => self::MISSING_PARAMETER,
|
45 |
+
'error_details' => $this->__('The "offset" and "count" parameters are mandatory'),
|
46 |
+
);
|
47 |
+
$response->setHeader('Content-type', 'application/json');
|
48 |
+
$response->setHttpResponseCode(400);
|
49 |
+
$response->setBody(json_encode($returnArr));
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
$store = $helper->validateInput($request->getParam('store_id'), 'integer', null, null);
|
53 |
+
$storeId = $helper->validateInput($request->getParam('store'), 'integer', $store, null);
|
54 |
+
$orders = (string)$helper->validateInput($request->getParam('orders', ''), 'integer', '', ''); // check that input is integer if exists, if not exists we want it to be "" (string)
|
55 |
+
$monthInterval = (string)$helper->validateInput($request->getParam('month_interval', ''), 'integer', '', ''); // check that input is integer if exists, if not exists we want it to be "" (string)
|
56 |
+
$checksum = (string)$helper->validateInput($request->getParam('checksum', ''), 'integer', '', ''); // check that input is integer if exists, if not exists we want it to be "" (string)
|
57 |
+
|
58 |
$catalogModel = Mage::getModel('autocompleteplus_autosuggest/catalog');
|
59 |
|
60 |
$xml = $catalogModel->renderCatalogXml($startInd, $count, $storeId, $orders, $monthInterval, $checksum);
|
69 |
|
70 |
$request = $this->getRequest();
|
71 |
$response = $this->getResponse();
|
72 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
73 |
+
|
74 |
+
$count = $helper->validateInput($request->getParam('count'), 'integer', null, null);
|
75 |
+
$from = $helper->validateInput($request->getParam('from'), 'integer', null, null);
|
76 |
+
if ($count === null || $from === null){
|
77 |
+
$returnArr = array(
|
78 |
+
'status' => self::STATUS_FAILURE,
|
79 |
+
'error_code' => self::MISSING_PARAMETER,
|
80 |
+
'error_details' => $this->__('The "from" and "count" parameters are mandatory'),
|
81 |
+
);
|
82 |
+
$response->setHeader('Content-type', 'application/json');
|
83 |
+
$response->setHttpResponseCode(400);
|
84 |
+
$response->setBody(json_encode($returnArr));
|
85 |
+
return;
|
86 |
+
}
|
87 |
+
$to = $helper->validateInput($request->getParam('to', strtotime('now')), 'integer', strtotime('now'), null);
|
88 |
+
$storeId = $helper->validateInput($request->getParam('store_id'), 'integer', null, null);
|
89 |
|
90 |
if (!$storeId) {
|
91 |
$returnArr = array(
|
124 |
}
|
125 |
|
126 |
return $this->__('no key inside');
|
127 |
+
}
|
128 |
+
|
129 |
public function versAction()
|
130 |
{
|
131 |
$response = $this->getResponse();
|
|
|
132 |
$mage = Mage::getVersion();
|
133 |
$ext = Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
134 |
$edition = method_exists('Mage', 'getEdition') ? Mage::getEdition() : 'Community';
|
135 |
$helper = Mage::helper('autocompleteplus_autosuggest');
|
136 |
+
$get_modules = $helper->validateInput($this->getRequest()->getParam('modules'), 'integer', false, false);
|
137 |
$uuid = $this->_getConfig()->getUUID();
|
138 |
$site_url = $helper->getConfigDataByFullPath('web/unsecure/base_url');
|
139 |
$store_id = Mage::app()->getStore()->getStoreId();
|
328 |
|
329 |
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
330 |
$table_prefix = (string) Mage::getConfig()->getTablePrefix();
|
331 |
+
|
332 |
+
$request = $this->getRequest();
|
333 |
+
$store_id = $helper->validateInput($request->getParam('store_id', Mage::app()->getStore()->getStoreId()), 'integer', null, null);
|
|
|
|
|
|
|
|
|
334 |
|
335 |
$sql_fetch = 'SELECT identifier FROM '.$table_prefix.'autocompleteplus_checksum WHERE store_id=?';
|
336 |
$updates = $read->fetchPairs($sql_fetch, array($store_id)); // empty array if fails
|
374 |
$request = $this->getRequest();
|
375 |
$response = $this->getResponse();
|
376 |
$helper = Mage::helper('autocompleteplus_autosuggest');
|
377 |
+
|
378 |
+
$store_id = $helper->validateInput($request->getParam('store_id', Mage::app()->getStore()->getStoreId()), 'integer', Mage::app()->getStore()->getStoreId(), null);
|
379 |
+
$count = $helper->validateInput($request->getParam('count', self::MAX_NUM_OF_PRODUCTS_CHECKSUM_ITERATION), 'integer', self::MAX_NUM_OF_PRODUCTS_CHECKSUM_ITERATION, null);
|
380 |
+
$start_index = $helper->validateInput($request->getParam('offset', 0), 'integer', 0, null);
|
381 |
+
$php_timeout = $helper->validateInput($request->getParam('timeout', -1), 'integer', -1, null);
|
382 |
+
$is_single = $helper->validateInput($request->getParam('is_single', 0), 'integer', 0, null);
|
383 |
+
|
384 |
$uuid = $this->_getConfig()->getUUID();
|
385 |
$checksum_server = $helper->getServerUrl();
|
386 |
$collection = Mage::getModel('catalog/product')->getCollection();
|
469 |
$this->getResponse()->setBody(1);
|
470 |
}
|
471 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
|
473 |
public function pushbulkAction()
|
474 |
{
|
475 |
$request = $this->getRequest();
|
476 |
$response = $this->getResponse();
|
477 |
$helper = Mage::helper('autocompleteplus_autosuggest');
|
478 |
+
|
479 |
+
$pushId = $helper->validateInput($request->getParam('pushid'), 'integer', null, null);
|
480 |
|
|
|
481 |
$response->clearHeaders();
|
482 |
$response->setHeader('Content-type', 'application/json');
|
483 |
$catalogModel = Mage::getModel('autocompleteplus_autosuggest/catalog');
|
app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsbyidController.php
CHANGED
@@ -19,8 +19,9 @@ class Autocompleteplus_Autosuggest_ProductsbyidController extends Autocompletepl
|
|
19 |
{
|
20 |
$request = $this->getRequest();
|
21 |
$response = $this->getResponse();
|
22 |
-
$
|
23 |
-
$
|
|
|
24 |
|
25 |
if (!$id) {
|
26 |
$returnArr = array(
|
@@ -48,9 +49,11 @@ class Autocompleteplus_Autosuggest_ProductsbyidController extends Autocompletepl
|
|
48 |
{
|
49 |
$request = $this->getRequest();
|
50 |
$response = $this->getResponse();
|
51 |
-
$
|
52 |
-
|
53 |
-
$
|
|
|
|
|
54 |
|
55 |
$catalogModel = Mage::getModel('autocompleteplus_autosuggest/catalog');
|
56 |
$xml = $catalogModel->renderCatalogFromIds($count, $fromId, $storeId);
|
19 |
{
|
20 |
$request = $this->getRequest();
|
21 |
$response = $this->getResponse();
|
22 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
23 |
+
$storeId = $helper->validateInput($request->getParam('store', Mage::app()->getStore()->getStoreId()), 'integer', 1, null);
|
24 |
+
$id = $helper->validateInput($request->getParam('id'), 'integer', null, null);
|
25 |
|
26 |
if (!$id) {
|
27 |
$returnArr = array(
|
49 |
{
|
50 |
$request = $this->getRequest();
|
51 |
$response = $this->getResponse();
|
52 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
53 |
+
|
54 |
+
$fromId = $helper->validateInput($request->getParam('id', 0), 'integer', null, null);
|
55 |
+
$storeId = $helper->validateInput($request->getParam('store', Mage::app()->getStore()->getStoreId()), 'integer', null, null);
|
56 |
+
$count = $helper->validateInput($request->getParam('count', 100), 'integer', null, null);
|
57 |
|
58 |
$catalogModel = Mage::getModel('autocompleteplus_autosuggest/catalog');
|
59 |
$xml = $catalogModel->renderCatalogFromIds($count, $fromId, $storeId);
|
app/code/local/Autocompleteplus/Autosuggest/controllers/SearchesController.php
CHANGED
@@ -18,21 +18,18 @@ class Autocompleteplus_Autosuggest_SearchesController extends Mage_Core_Controll
|
|
18 |
public function sendAction()
|
19 |
{
|
20 |
set_time_limit(1800);
|
21 |
-
|
|
|
22 |
$post = $this->getRequest()->getParams();
|
|
|
|
|
|
|
23 |
|
24 |
// $enabled= Mage::getStoreConfig('autocompleteplus/config/enabled');
|
25 |
// if($enabled=='0'){
|
26 |
// die('The user has disabled autocompleteplus.');
|
27 |
// }
|
28 |
|
29 |
-
$startInd = $post['offset'];
|
30 |
-
if (!$startInd) {
|
31 |
-
$startInd = 0;
|
32 |
-
}
|
33 |
-
|
34 |
-
$count = $post['count'];
|
35 |
-
|
36 |
//maxim products on one page is 10000
|
37 |
if (!$count || $count > 10000) {
|
38 |
$count = 10000;
|
18 |
public function sendAction()
|
19 |
{
|
20 |
set_time_limit(1800);
|
21 |
+
|
22 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
23 |
$post = $this->getRequest()->getParams();
|
24 |
+
|
25 |
+
$startInd = $helper->validateInput($post['offset'], 'integer', 0, null);
|
26 |
+
$count = $helper->validateInput($post['count'], 'integer', 0, null);
|
27 |
|
28 |
// $enabled= Mage::getStoreConfig('autocompleteplus/config/enabled');
|
29 |
// if($enabled=='0'){
|
30 |
// die('The user has disabled autocompleteplus.');
|
31 |
// }
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
//maxim products on one page is 10000
|
34 |
if (!$count || $count > 10000) {
|
35 |
$count = 10000;
|
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.6</version>
|
6 |
<url>http://autocompleteplus.com/</url>
|
7 |
<modulename>Autocompleteplus_Autosuggest</modulename>
|
8 |
</Autocompleteplus_Autosuggest>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
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 |
<authors><author><name>Adar</name><user>Adar</user><email>magento@autocompleteplus.com</email></author></authors>
|
13 |
-
<date>2016-
|
14 |
-
<time>
|
15 |
-
<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="cc694575438fe43fc086b89f2d4826c9"/><file name="Autocorrection.php" hash="6676f140f9da260f52e59478e1af2b47"/><file name="Inject.php" hash="bc001de5e9d27bc1e41b8df80d482117"/><file name="Notifications.php" hash="3ab60946b756f093585a708185d98909"/></dir><dir name="Controller"><file name="Abstract.php" hash="84b311dbc24ca94ee7f1af655430f8ea"/></dir><dir name="Helper"><file name="Data.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>autocompleteplus_autosuggest</name>
|
4 |
+
<version>3.0.0.6</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>* Fixing SQL injection security vulnerability</notes>
|
12 |
<authors><author><name>Adar</name><user>Adar</user><email>magento@autocompleteplus.com</email></author></authors>
|
13 |
+
<date>2016-06-01</date>
|
14 |
+
<time>13:04:54</time>
|
15 |
+
<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="cc694575438fe43fc086b89f2d4826c9"/><file name="Autocorrection.php" hash="6676f140f9da260f52e59478e1af2b47"/><file name="Inject.php" hash="bc001de5e9d27bc1e41b8df80d482117"/><file name="Notifications.php" hash="3ab60946b756f093585a708185d98909"/></dir><dir name="Controller"><file name="Abstract.php" hash="84b311dbc24ca94ee7f1af655430f8ea"/></dir><dir name="Helper"><file name="Data.php" hash="d7e6f54f8285e82b125c53d18a698f44"/><file name="Data.php.bak" hash="183e152c97a13977047e950b87b3ccee"/></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="ee57d1ab64525318a6dc5962bd98c513"/><file name="Catalogreport.php" hash="2bfa54c42bf20418d75847a08cc114a0"/><file name="Checksum.php" hash="37550b6bd6d934f1ad2ef581dfa10eea"/><file name="Config.php" hash="42f37cd6513488738a9c97f1373d8c03"/><file name="Layer.php" hash="82538541fb58038dd308fc584454d0bd"/><file name="Notifications.php" hash="7f4037e171c63de662370aeceaeed1d6"/><file name="Observer.php" hash="216a02f7cc87e5f84d0806e48897a03d"/><file name="Pusher.php" hash="518825e11c9d8fd0b91ac78f6916c40b"/><dir name="Resource"><dir name="Batches"><file name="Collection.php" hash="5d3f333f7383f040654cfb402a089823"/></dir><file name="Batches.php" hash="c5c012179db3636e503f48d0a6de59d5"/><dir name="Checksum"><file name="Collection.php" hash="4c2c32f787763cef11ae9bf175c8813f"/></dir><file name="Checksum.php" hash="5e2d0ece6ea043e517a0c777fc165de4"/><dir name="Fulltext"><file name="Collection.php" hash="5096155efa1f4973f702778673c62507"/></dir><dir name="Notifications"><file name="Collection.php" hash="d7ef7e0ee228b48238b727de349a61b0"/></dir><file name="Notifications.php" hash="f4f1111bd0144c7bcc62ae456d7b36be"/><dir name="Pusher"><file name="Collection.php" hash="8f15379bc010d2a25bf01a8ed3f10fbb"/></dir><file name="Pusher.php" hash="e25a14c317dfe3ae1134f3afc654e8d3"/></dir><file name="Service.php" hash="4c0e98c7abfa3319768ee850ed5d8e77"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Autocompleteplus"><file name="PushController.php" hash="c708e07e9b5ae23b4d27c5df0c04cc7f"/><file name="RedirectController.php" hash="8361d1e5922d75763eb82cd916480fb1"/></dir></dir><dir name="CatalogSearch"><file name="ResultController.php" hash="8d2c03b7849b7dbeeb9a08cfa37e63ea"/></dir><file name="CatalogsearchController.php" hash="e534d0933da8a0a1deb4b0618cea5665"/><file name="CategoriesController.php" hash="4b3cd4774c37e5678bb292e4a4665c39"/><file name="LayeredController.php" hash="fa2f88699a15a36da7d6761f74ffa265"/><file name="ProductsController.php" hash="bf213973d747235a01d1f658f933e0b3"/><file name="ProductsbyidController.php" hash="467987d12edd5216ed44ba02cc3e66e1"/><file name="ResultController.php" hash="182f65ce4ccdf154aa0326512ec37140"/><file name="SearchesController.php" hash="28f023a85ecbf6e1b1151c1ea3f64058"/></dir><dir name="etc"><file name="adminhtml.xml" hash="34b9d24ddc4565311f6cc83d7e337478"/><file name="api.xml" hash="25ab859fc8312c4aa308f2e3306c6b66"/><file name="cache.xml" hash="b57472bc9410d67af3843825fba5b420"/><file name="config.xml" hash="19f0ba6f3098bfb71c297a7ada882019"/><file name="system.xml" hash="6bed22fbdfc336254126cf4a8c49aa09"/><file name="wsdl.xml" hash="97b1503c710c79376cd85e7f971c1587"/></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="00b8f4401d59f42359baec70ef2de8bb"/><file name="mysql4-upgrade-2.0.5.6-2.0.5.7.php" hash="b40aa51ca00369caa28a0030dc2490e7"/><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="f858517837a97200e3b5c36339a0b200"/><file name="mysql4-upgrade-2.0.8.8-3.0.0.0.php" hash="bc1082a892dd8c222f2fc73917a8f6e3"/><file name="mysql4-upgrade-3.0.0.3-3.0.0.4.php" hash="9574b75e9a733be858a14588978cd21a"/></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="c269d5b27302efb51cefb86a71027a0d"/></dir></dir><file name="inject.phtml" hash="e1e8e050631fe65417edb7a8f25155c8"/><file name="process.phtml" hash="2bb8f334e6d1d64c9042c10d55ac5155"/></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"/><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="939f8a52905dfef7b81a0f4552042376"/></dir></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|