Version Notes
* Performance improvements
Download this release
Release Info
Developer | Adar |
Extension | autocompleteplus_autosuggest |
Version | 2.0.8.3 |
Comparing to | |
See all releases |
Code changes from version 2.0.8.2 to 2.0.8.3
- app/code/local/Autocompleteplus/Autosuggest/Block/Inject.php +1 -1
- app/code/local/Autocompleteplus/Autosuggest/Helper/Data.php +6 -1
- app/code/local/Autocompleteplus/Autosuggest/Model/Catalog.php +93 -79
- app/code/local/Autocompleteplus/Autosuggest/Model/Observer.php +1 -1
- app/code/local/Autocompleteplus/Autosuggest/Model/Resource/Fulltext/Collection.php +1 -1
- app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsController.php +1 -1
- app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsbyidController.php +43 -42
- app/code/local/Autocompleteplus/Autosuggest/etc/config.xml +1 -1
- package.xml +5 -9
app/code/local/Autocompleteplus/Autosuggest/Block/Inject.php
CHANGED
@@ -74,7 +74,7 @@ class Autocompleteplus_Autosuggest_Block_Inject extends Mage_Checkout_Block_Cart
|
|
74 |
*/
|
75 |
public function getVersion()
|
76 |
{
|
77 |
-
return
|
78 |
}
|
79 |
|
80 |
/**
|
74 |
*/
|
75 |
public function getVersion()
|
76 |
{
|
77 |
+
return Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
78 |
}
|
79 |
|
80 |
/**
|
app/code/local/Autocompleteplus/Autosuggest/Helper/Data.php
CHANGED
@@ -25,6 +25,11 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
25 |
return $this->server_url;
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
28 |
public function getConfigDataByFullPath($path){
|
29 |
|
30 |
if (!$row = Mage::getSingleton('core/config_data')->getCollection()->getItemByColumnValue('path', $path)) {
|
@@ -230,7 +235,7 @@ class Autocompleteplus_Autosuggest_Helper_Data extends Mage_Core_Helper_Abstract
|
|
230 |
$multistoreJson='';
|
231 |
$useStoreCode=$this->getConfigDataByFullPath('web/url/use_store');
|
232 |
$mage=Mage::getVersion();
|
233 |
-
$ext=
|
234 |
$version=array('mage'=>$mage,'ext'=>$ext);
|
235 |
|
236 |
//getting site url
|
25 |
return $this->server_url;
|
26 |
}
|
27 |
|
28 |
+
public function getVersion()
|
29 |
+
{
|
30 |
+
return (string)Mage::getConfig()->getNode()->modules->Autocompleteplus_Autosuggest->version;
|
31 |
+
}
|
32 |
+
|
33 |
public function getConfigDataByFullPath($path){
|
34 |
|
35 |
if (!$row = Mage::getSingleton('core/config_data')->getCollection()->getItemByColumnValue('path', $path)) {
|
235 |
$multistoreJson='';
|
236 |
$useStoreCode=$this->getConfigDataByFullPath('web/url/use_store');
|
237 |
$mage=Mage::getVersion();
|
238 |
+
$ext=Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
239 |
$version=array('mage'=>$mage,'ext'=>$ext);
|
240 |
|
241 |
//getting site url
|
app/code/local/Autocompleteplus/Autosuggest/Model/Catalog.php
CHANGED
@@ -24,7 +24,7 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
24 |
$this->pageNum=floor(($startInd/$count));
|
25 |
|
26 |
$mage=Mage::getVersion();
|
27 |
-
$ext=
|
28 |
|
29 |
$xml='<?xml version="1.0"?>';
|
30 |
$xml.='<catalog version="'.$ext.'" magento="'.$mage.'">';
|
@@ -32,6 +32,9 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
32 |
$collection=Mage::getModel('catalog/product')->getCollection();
|
33 |
if(isset($storeId)&& $storeId!=''){
|
34 |
$collection->addStoreFilter($storeId);
|
|
|
|
|
|
|
35 |
}
|
36 |
|
37 |
//setting page+products on the page
|
@@ -44,11 +47,6 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
44 |
foreach ($collection as $product){
|
45 |
$product_id_list[] = $product->getId();
|
46 |
}
|
47 |
-
if(isset($storeId)&& $storeId!=''){
|
48 |
-
$store_id = $storeId;
|
49 |
-
} else {
|
50 |
-
$store_id = 1;
|
51 |
-
}
|
52 |
|
53 |
if(isset($month_interval)&& $month_interval!=''){
|
54 |
$month_interval = $month_interval;
|
@@ -59,6 +57,8 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
59 |
} else {// end - number of orderes per product section
|
60 |
$orders_per_product = null;
|
61 |
}
|
|
|
|
|
62 |
|
63 |
if(isset($checksum) && $checksum != ''){
|
64 |
$is_checksum = $checksum;
|
@@ -115,7 +115,8 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
115 |
$updates=$read->fetchAll($sql,array($from,$to));
|
116 |
|
117 |
$mage=Mage::getVersion();
|
118 |
-
$ext=
|
|
|
119 |
|
120 |
$xml='<?xml version="1.0"?>';
|
121 |
$xml.='<catalog fromdatetime="'.$from.'" version="'.$ext.'" magento="'.$mage.'">';
|
@@ -174,46 +175,41 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
174 |
return $xml;
|
175 |
}
|
176 |
|
177 |
-
public function renderCatalogFromIds($count,$
|
178 |
|
179 |
$this->_initCatalogCommonFields($storeId);
|
180 |
|
181 |
-
$mage=Mage::getVersion();
|
182 |
-
|
183 |
-
$
|
184 |
-
|
185 |
-
$xml='<catalog version="'.$ext.'" magento="'.$mage.'">';
|
186 |
|
187 |
$_productCollection = Mage::getModel('catalog/product')->getCollection()
|
188 |
-
|
189 |
-
|
190 |
-
->addAttributeToFilter('entity_id', array(
|
191 |
-
|
192 |
-
));
|
193 |
-
|
194 |
$_productCollection->getSelect()->limit($count);
|
195 |
-
|
|
|
196 |
|
197 |
$action= 'getfromid';
|
198 |
|
199 |
foreach($_productCollection as $product){
|
|
|
|
|
|
|
200 |
|
201 |
-
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
-
$
|
204 |
-
|
205 |
-
$productModel=Mage::getModel('catalog/product')
|
206 |
-
->setStoreId($storeId)
|
207 |
-
->load($id);
|
208 |
|
209 |
-
|
210 |
-
|
211 |
-
$xmlAttrs='last_updated="'.$lastUpdateddt.'" get_by_id_status="1" action="'.$action.'" storeid="'.$storeId.'"' ;
|
212 |
-
|
213 |
-
$xml.=$this->renderProductXmlRow($productModel,null,$xmlAttrs);
|
214 |
-
|
215 |
-
}else{
|
216 |
-
$xml.='<product action="'.$action.'" product="'.$id.'" get_by_id_status="0"></product>';
|
217 |
}
|
218 |
|
219 |
}
|
@@ -223,15 +219,20 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
223 |
return $xml;
|
224 |
}
|
225 |
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
|
228 |
$this->_initCatalogCommonFields($storeId);
|
229 |
|
230 |
-
$mage=Mage::getVersion();
|
231 |
-
|
232 |
-
$
|
233 |
-
|
234 |
-
$xml='<catalog version="'.$ext.'" magento="'.$mage.'">';
|
235 |
|
236 |
$_productCollection = Mage::getModel('catalog/product')->getCollection()
|
237 |
//->addStoreFilter($storeId)
|
@@ -239,6 +240,8 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
239 |
->addAttributeToFilter('entity_id', array(
|
240 |
'in' => $ids
|
241 |
));
|
|
|
|
|
242 |
|
243 |
$action= 'getbyid';
|
244 |
|
@@ -267,45 +270,56 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
267 |
return $xml;
|
268 |
}
|
269 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
-
|
272 |
-
|
273 |
-
$categoriesNames='';
|
274 |
-
$categories = $productModel->getCategoryCollection()
|
275 |
-
->addAttributeToSelect('name');
|
276 |
|
277 |
-
|
278 |
-
|
279 |
-
$parent = $category->getParentCategory();
|
280 |
-
try{
|
281 |
-
$threshold = 100;
|
282 |
-
while ($parent){
|
283 |
-
$category_name .= ':'.$parent->getId();
|
284 |
-
if ($parent->getId() == Mage::app()->getStore(Mage::app()->getStore()->getStoreId())->getRootCategoryId()){
|
285 |
-
break;
|
286 |
-
}
|
287 |
-
if ($parent->getLevel() == 0){
|
288 |
-
$category_name = '';
|
289 |
-
break;
|
290 |
-
}
|
291 |
-
$parent = $parent->getParentCategory();
|
292 |
|
293 |
-
|
294 |
-
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
}
|
297 |
-
|
298 |
-
|
299 |
-
}
|
300 |
-
if ($category_name != ''){
|
301 |
-
$categoriesNames .= $category_name . ';';
|
302 |
}
|
303 |
-
}
|
304 |
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
|
310 |
if($stockItem){
|
311 |
if($stockItem->getIsInStock() && $stock_status){
|
@@ -346,11 +360,11 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
346 |
$productUrl = Mage::helper('catalog/product')->getProductUrl($productModel->getId());
|
347 |
}
|
348 |
|
349 |
-
$prodId
|
350 |
-
$prodDesc
|
351 |
-
$prodShortDesc
|
352 |
-
$prodName
|
353 |
-
$visibility
|
354 |
|
355 |
if(defined('Mage_Catalog_Model_Product_Status::STATUS_ENABLED')){
|
356 |
if ($productModel->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED){
|
@@ -591,7 +605,7 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
591 |
}
|
592 |
}
|
593 |
|
594 |
-
$row.='<categories><![CDATA['
|
595 |
$row.='</product>';
|
596 |
return $helper->escapeXml($row);
|
597 |
}
|
24 |
$this->pageNum=floor(($startInd/$count));
|
25 |
|
26 |
$mage=Mage::getVersion();
|
27 |
+
$ext=Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
28 |
|
29 |
$xml='<?xml version="1.0"?>';
|
30 |
$xml.='<catalog version="'.$ext.'" magento="'.$mage.'">';
|
32 |
$collection=Mage::getModel('catalog/product')->getCollection();
|
33 |
if(isset($storeId)&& $storeId!=''){
|
34 |
$collection->addStoreFilter($storeId);
|
35 |
+
$store_id = $storeId;
|
36 |
+
} else {
|
37 |
+
$store_id = Mage::app()->getStore()->getStoreId();
|
38 |
}
|
39 |
|
40 |
//setting page+products on the page
|
47 |
foreach ($collection as $product){
|
48 |
$product_id_list[] = $product->getId();
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
if(isset($month_interval)&& $month_interval!=''){
|
52 |
$month_interval = $month_interval;
|
57 |
} else {// end - number of orderes per product section
|
58 |
$orders_per_product = null;
|
59 |
}
|
60 |
+
|
61 |
+
$this->_root_category_id = Mage::app()->getStore($store_id)->getRootCategoryId();
|
62 |
|
63 |
if(isset($checksum) && $checksum != ''){
|
64 |
$is_checksum = $checksum;
|
115 |
$updates=$read->fetchAll($sql,array($from,$to));
|
116 |
|
117 |
$mage=Mage::getVersion();
|
118 |
+
$ext=Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
119 |
+
$this->_root_category_id = Mage::app()->getStore($storeId)->getRootCategoryId();
|
120 |
|
121 |
$xml='<?xml version="1.0"?>';
|
122 |
$xml.='<catalog fromdatetime="'.$from.'" version="'.$ext.'" magento="'.$mage.'">';
|
175 |
return $xml;
|
176 |
}
|
177 |
|
178 |
+
public function renderCatalogFromIds($count,$fromId,$storeId){
|
179 |
|
180 |
$this->_initCatalogCommonFields($storeId);
|
181 |
|
182 |
+
$mage = Mage::getVersion();
|
183 |
+
$ext = Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
184 |
+
$xml = '<catalog version="'.$ext.'" magento="'.$mage.'">';
|
|
|
|
|
185 |
|
186 |
$_productCollection = Mage::getModel('catalog/product')->getCollection()
|
187 |
+
->addStoreFilter($storeId)
|
188 |
+
->addAttributeToSelect('*')
|
189 |
+
->addAttributeToFilter('entity_id', array('from' => $fromId));
|
190 |
+
|
|
|
|
|
191 |
$_productCollection->getSelect()->limit($count);
|
192 |
+
|
193 |
+
//add media gallery to collection
|
194 |
|
195 |
$action= 'getfromid';
|
196 |
|
197 |
foreach($_productCollection as $product){
|
198 |
+
if($product){
|
199 |
+
$id = $product->getId();
|
200 |
+
$lastUpdateddt = $product->getUpdatedAt();
|
201 |
|
202 |
+
$xmlAttrTemplate = 'last_updated="%s" get_by_id_status="1" action="%s" storeid="%s"';
|
203 |
+
$xmlAttrs = sprintf($xmlAttrTemplate,
|
204 |
+
$lastUpdateddt,
|
205 |
+
$action,
|
206 |
+
$storeId
|
207 |
+
);
|
208 |
|
209 |
+
$xml .= $this->renderProductXmlRow($product, null, $xmlAttrs);
|
|
|
|
|
|
|
|
|
210 |
|
211 |
+
} else {
|
212 |
+
$xml .= '<product action="' . $action . '" product="' . $id . '" get_by_id_status="0"></product>';
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
}
|
214 |
|
215 |
}
|
219 |
return $xml;
|
220 |
}
|
221 |
|
222 |
+
/**
|
223 |
+
* Creates an XML representation of catalog by ids
|
224 |
+
* @param array $ids
|
225 |
+
* @param integer $storeId
|
226 |
+
* @return string
|
227 |
+
*/
|
228 |
+
public function renderCatalogByIds($ids, $storeId = 0)
|
229 |
+
{
|
230 |
|
231 |
$this->_initCatalogCommonFields($storeId);
|
232 |
|
233 |
+
$mage = Mage::getVersion();
|
234 |
+
$ext = Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
235 |
+
$xml = '<catalog version="'.$ext.'" magento="'.$mage.'">';
|
|
|
|
|
236 |
|
237 |
$_productCollection = Mage::getModel('catalog/product')->getCollection()
|
238 |
//->addStoreFilter($storeId)
|
240 |
->addAttributeToFilter('entity_id', array(
|
241 |
'in' => $ids
|
242 |
));
|
243 |
+
|
244 |
+
$this->_root_category_id = Mage::app()->getStore($storeId)->getRootCategoryId();
|
245 |
|
246 |
$action= 'getbyid';
|
247 |
|
270 |
return $xml;
|
271 |
}
|
272 |
|
273 |
+
public function getCategoryMap()
|
274 |
+
{
|
275 |
+
if(!$this->_categories){
|
276 |
+
Mage::log('creating categories once',false,'pjackson.log');
|
277 |
+
$categoryMap = array();
|
278 |
+
$categories = Mage::getModel('catalog/category')->getCollection()->load();
|
279 |
+
|
280 |
+
foreach($categories as $category){
|
281 |
+
$categoryMap[] = new Varien_Object(array(
|
282 |
+
'id'=>$category->getId(),
|
283 |
+
'path'=>$category->getPath(),
|
284 |
+
'parent_id'=>$category->getParentId()
|
285 |
+
));
|
286 |
+
}
|
287 |
|
288 |
+
$this->_categories = $categoryMap;
|
289 |
+
}
|
|
|
|
|
|
|
290 |
|
291 |
+
return $this->_categories;
|
292 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
|
294 |
+
public function getCategoryPathsByProduct(Mage_Catalog_Model_Product $product)
|
295 |
+
{
|
296 |
+
$productCategories = $product->getCategoryIds();
|
297 |
+
|
298 |
+
$paths = array_map(function($category) use ($productCategories) {
|
299 |
+
if(in_array($category->getId(), $productCategories)){
|
300 |
+
$path = explode('/', $category->getPath());
|
301 |
+
//we don't want the root category for the entire site
|
302 |
+
array_shift($path);
|
303 |
+
if ($this->_root_category_id && is_array($path) && $path[0] != $this->_root_category_id){
|
304 |
+
// remove/skip categories of a non-default tree
|
305 |
+
return array();
|
306 |
}
|
307 |
+
//we want more specific categories first
|
308 |
+
return implode(':', array_reverse($path));
|
|
|
|
|
|
|
309 |
}
|
310 |
+
}, $this->getCategoryMap());
|
311 |
|
312 |
+
return array_filter($paths);
|
313 |
+
}
|
314 |
+
|
315 |
+
public function renderProductXmlRow($productModel,$orders_per_product,$xmlAttrs='action="insert"')
|
316 |
+
{
|
317 |
+
$helper = Mage::helper('autocompleteplus_autosuggest');
|
318 |
+
$categories = $this->getCategoryPathsByProduct($productModel);
|
319 |
+
$price = $this->_getPrice($productModel);
|
320 |
+
$sku = $productModel->getSku();
|
321 |
+
$stock_status = $productModel->isInStock();
|
322 |
+
$stockItem = $productModel->getStockItem();
|
323 |
|
324 |
if($stockItem){
|
325 |
if($stockItem->getIsInStock() && $stock_status){
|
360 |
$productUrl = Mage::helper('catalog/product')->getProductUrl($productModel->getId());
|
361 |
}
|
362 |
|
363 |
+
$prodId = $productModel->getId();
|
364 |
+
$prodDesc = $productModel->getDescription();
|
365 |
+
$prodShortDesc = $productModel->getShortDescription();
|
366 |
+
$prodName = $productModel->getName();
|
367 |
+
$visibility = $productModel->getVisibility();
|
368 |
|
369 |
if(defined('Mage_Catalog_Model_Product_Status::STATUS_ENABLED')){
|
370 |
if ($productModel->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_ENABLED){
|
605 |
}
|
606 |
}
|
607 |
|
608 |
+
$row.='<categories><![CDATA[' . implode(';', $categories) . ']]></categories>';
|
609 |
$row.='</product>';
|
610 |
return $helper->escapeXml($row);
|
611 |
}
|
app/code/local/Autocompleteplus/Autosuggest/Model/Observer.php
CHANGED
@@ -123,7 +123,7 @@ class Autocompleteplus_Autosuggest_Model_Observer extends Mage_Core_Model_Abstra
|
|
123 |
$key =$helper->getUUID();
|
124 |
|
125 |
$mage=Mage::getVersion();
|
126 |
-
$ext=
|
127 |
|
128 |
$xml='<?xml version="1.0"?>';
|
129 |
|
123 |
$key =$helper->getUUID();
|
124 |
|
125 |
$mage=Mage::getVersion();
|
126 |
+
$ext=Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
127 |
|
128 |
$xml='<?xml version="1.0"?>';
|
129 |
|
app/code/local/Autocompleteplus/Autosuggest/Model/Resource/Fulltext/Collection.php
CHANGED
@@ -90,7 +90,7 @@ class Autocompleteplus_Autosuggest_Model_Resource_Fulltext_Collection extends Ma
|
|
90 |
$url_domain = 'http://magento.instantsearchplus.com/ma_search';
|
91 |
}
|
92 |
|
93 |
-
$extension_version =
|
94 |
$site_url = $helper->getConfigDataByFullPath('web/unsecure/base_url');
|
95 |
$url = $url_domain.'?q='.urlencode($query).'&p=1&products_per_page=1000&v='.$extension_version.'&store_id='.$storeId.'&UUID='.$key.'&h='.$site_url;
|
96 |
|
90 |
$url_domain = 'http://magento.instantsearchplus.com/ma_search';
|
91 |
}
|
92 |
|
93 |
+
$extension_version = Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
94 |
$site_url = $helper->getConfigDataByFullPath('web/unsecure/base_url');
|
95 |
$url = $url_domain.'?q='.urlencode($query).'&p=1&products_per_page=1000&v='.$extension_version.'&store_id='.$storeId.'&UUID='.$key.'&h='.$site_url;
|
96 |
|
app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsController.php
CHANGED
@@ -129,7 +129,7 @@ class Autocompleteplus_Autosuggest_ProductsController extends Mage_Core_Controll
|
|
129 |
|
130 |
public function versAction(){
|
131 |
$mage = Mage::getVersion();
|
132 |
-
$ext =
|
133 |
try{
|
134 |
$num_of_products = Mage::getModel('catalog/product')->getCollection()
|
135 |
->addStoreFilter(Mage::app()->getStore()->getStoreId())
|
129 |
|
130 |
public function versAction(){
|
131 |
$mage = Mage::getVersion();
|
132 |
+
$ext = Mage::helper('autocompleteplus_autosuggest')->getVersion();
|
133 |
try{
|
134 |
$num_of_products = Mage::getModel('catalog/product')->getCollection()
|
135 |
->addStoreFilter(Mage::app()->getStore()->getStoreId())
|
app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsbyidController.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* InstantSearchPlus (Autosuggest)
|
4 |
-
|
5 |
*
|
6 |
* NOTICE OF LICENSE
|
7 |
*
|
@@ -16,55 +15,57 @@
|
|
16 |
*/
|
17 |
class Autocompleteplus_Autosuggest_ProductsbyidController extends Mage_Core_Controller_Front_Action
|
18 |
{
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
);
|
31 |
-
|
32 |
-
|
|
|
|
|
33 |
}
|
34 |
|
35 |
-
$ids
|
36 |
-
|
37 |
-
$
|
38 |
-
|
39 |
-
$catalogModel=Mage::getModel('autocompleteplus_autosuggest/catalog');
|
40 |
-
|
41 |
-
$idsArr=explode(',',$ids);
|
42 |
|
43 |
-
$
|
44 |
-
|
45 |
-
|
46 |
-
echo $xml;
|
47 |
-
die;
|
48 |
}
|
49 |
|
50 |
-
public function getfromidAction()
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
$
|
55 |
-
|
56 |
-
$
|
57 |
-
|
58 |
-
$storeId = isset($post['store']) ? $post['store'] : 1;
|
59 |
-
|
60 |
-
$count = isset($post['count']) ? $post['count'] : 100;
|
61 |
-
|
62 |
-
$catalogModel=Mage::getModel('autocompleteplus_autosuggest/catalog');
|
63 |
|
64 |
-
$
|
|
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
}
|
70 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* InstantSearchPlus (Autosuggest)
|
|
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
15 |
*/
|
16 |
class Autocompleteplus_Autosuggest_ProductsbyidController extends Mage_Core_Controller_Front_Action
|
17 |
{
|
18 |
+
const PHP_SCRIPT_TIMEOUT = 1800;
|
19 |
+
const MISSING_PARAMETER = 767;
|
20 |
+
const STATUS_FAILURE = 'failure';
|
21 |
+
|
22 |
+
public function preDispatch()
|
23 |
+
{
|
24 |
+
parent::preDispatch();
|
25 |
+
set_time_limit(self::PHP_SCRIPT_TIMEOUT);
|
26 |
+
}
|
27 |
|
28 |
+
public function getbyidAction()
|
29 |
+
{
|
30 |
+
$request = $this->getRequest();
|
31 |
+
$response = $this->getResponse();
|
32 |
+
$storeId = $request->getParam('store', 1);
|
33 |
+
$id = $request->getParam('id');
|
34 |
+
|
35 |
+
if(!$id){
|
36 |
+
$returnArr = array(
|
37 |
+
'status' => self::STATUS_FAILURE,
|
38 |
+
'error_code' => self::MISSING_PARAMETER,
|
39 |
+
'error_details' => $this->__('The "id" parameter is mandatory')
|
40 |
);
|
41 |
+
$response->setHeader('Content-type', 'application/json');
|
42 |
+
$response->setHttpResponseCode(400);
|
43 |
+
$response->setBody(json_encode($returnArr));
|
44 |
+
return;
|
45 |
}
|
46 |
|
47 |
+
$ids = explode(',', $id);
|
48 |
+
$catalogModel = Mage::getModel('autocompleteplus_autosuggest/catalog');
|
49 |
+
$xml = $catalogModel->renderCatalogByIds($ids, $storeId);
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
$response->clearHeaders();
|
52 |
+
$response->setHeader('Content-type', 'text/xml');
|
53 |
+
$response->setBody($xml);
|
|
|
|
|
54 |
}
|
55 |
|
56 |
+
public function getfromidAction()
|
57 |
+
{
|
58 |
+
$request = $this->getRequest();
|
59 |
+
$response = $this->getResponse();
|
60 |
+
$fromId = $request->getParam('id', 0);
|
61 |
+
$storeId = $request->getParam('store', 1);
|
62 |
+
$count = $request->getParam('count', 100);
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
+
$catalogModel = Mage::getModel('autocompleteplus_autosuggest/catalog');
|
65 |
+
$xml = $catalogModel->renderCatalogFromIds($count, $fromId, $storeId);
|
66 |
|
67 |
+
$response->clearHeaders();
|
68 |
+
$response->setHeader('Content-type', 'text/xml');
|
69 |
+
$response->setBody($xml);
|
70 |
}
|
71 |
}
|
app/code/local/Autocompleteplus/Autosuggest/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Autocompleteplus_Autosuggest>
|
5 |
-
<version>2.0.8.
|
6 |
<url>http://autocompleteplus.com/</url>
|
7 |
<modulename>Autocompleteplus_Autosuggest</modulename>
|
8 |
</Autocompleteplus_Autosuggest>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Autocompleteplus_Autosuggest>
|
5 |
+
<version>2.0.8.3</version>
|
6 |
<url>http://autocompleteplus.com/</url>
|
7 |
<modulename>Autocompleteplus_Autosuggest</modulename>
|
8 |
</Autocompleteplus_Autosuggest>
|
package.xml
CHANGED
@@ -1,22 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>autocompleteplus_autosuggest</name>
|
4 |
-
<version>2.0.8.
|
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 |
-
http://magento.com/security/patches/supee-6788-technical-details
|
13 |
-
* Categories wrong url bug fix
|
14 |
-
* error fix: Call to a member function getId() on a non-object
|
15 |
-
</notes>
|
16 |
<authors><author><name>Adar</name><user>Adar</user><email>magento@autocompleteplus.com</email></author></authors>
|
17 |
-
<date>2015-
|
18 |
-
<time>
|
19 |
-
<contents><target name="magelocal"><dir name="Autocompleteplus"><dir name="Autosuggest"><dir name="Adminhtml"><dir name="Model"><file name="Attributes.php" hash="4fc7b546eb9cbff0b5067bc09fb62597"/><file name="Button.php" hash="afd78d0d80b4af60ea70fcfcffea5d8b"/></dir></dir><dir name="Block"><dir name="Adminhtml"><file name="Button.php" hash="2f302e3591671c3d7c153f0f7977c64c"/><file name="Process.php" hash="e50cf29c2b8893817eb0de4aeacf9ba3"/><file name="Sync.php" hash="0329b6920b67a5c05b38fafe7142df48"/></dir><file name="Autocomplete.php" hash="3a63d5c743d8dda3552f8c0b717c8d2e"/><file name="Autocorrection.php" hash="08da843c04cf9176cefb8588a0da3e77"/><file name="Inject.php" hash="
|
20 |
<compatible/>
|
21 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
22 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>autocompleteplus_autosuggest</name>
|
4 |
+
<version>2.0.8.3</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>* Performance improvements</notes>
|
|
|
|
|
|
|
|
|
12 |
<authors><author><name>Adar</name><user>Adar</user><email>magento@autocompleteplus.com</email></author></authors>
|
13 |
+
<date>2015-12-02</date>
|
14 |
+
<time>16:14:00</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Autocompleteplus"><dir name="Autosuggest"><dir name="Adminhtml"><dir name="Model"><file name="Attributes.php" hash="4fc7b546eb9cbff0b5067bc09fb62597"/><file name="Button.php" hash="afd78d0d80b4af60ea70fcfcffea5d8b"/></dir></dir><dir name="Block"><dir name="Adminhtml"><file name="Button.php" hash="2f302e3591671c3d7c153f0f7977c64c"/><file name="Process.php" hash="e50cf29c2b8893817eb0de4aeacf9ba3"/><file name="Sync.php" hash="0329b6920b67a5c05b38fafe7142df48"/></dir><file name="Autocomplete.php" hash="3a63d5c743d8dda3552f8c0b717c8d2e"/><file name="Autocorrection.php" hash="08da843c04cf9176cefb8588a0da3e77"/><file name="Inject.php" hash="b3e5663b46b64b8b8bc0483b01508848"/><file name="Notifications.php" hash="825fcc830917a22aff36e859fd63b16f"/></dir><dir name="Helper"><file name="Data.php" hash="3c1934354d5144cd33de0e4a3da63777"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Attributes.php" hash="1e321486e5c3bea159e4a7d8a79926ab"/></dir><dir name="Api"><file name="V2.php" hash="f7bfd6626466de0fe860484ab2bc7a00"/></dir><file name="Api.php" hash="4dd5882dcfd219087c1cec3cff46f7a9"/><file name="Catalog.php" hash="026acab4f7088df4133de8fd60f32827"/><file name="Catalogreport.php" hash="05f88adba656366d814f259056f92c73"/><file name="Config.php" hash="57d8e278d1cd13fea31504ee8f8ee304"/><file name="Layer.php" hash="ef1b5ddaa4fd12354e349d64f09ba1af"/><dir name="Mysql4"><dir name="Config"><file name="Collection.php" hash="110486b53b74e5b1cba1d552814a4b7c"/></dir><file name="Config.php" hash="991a9f1e674756a0a57577febb2f48cd"/><dir name="Fulltext"><file name="Collection.php" hash="709f6d0a955ec7bc1d31c577858101e6"/></dir><file name="Fulltext.php" hash="eada3fc83bd7976d8e3a38f8bb6e0e5f"/><dir name="Notifications"><file name="Collection.php" hash="d306a8690255ba7c444d30f94f780df4"/></dir><file name="Notifications.php" hash="c74b9b6a8f639318c828d3d5984bcf5d"/><dir name="Pusher"><file name="Collection.php" hash="28f0c11f2a3dd26fd06c508a342becd9"/></dir><file name="Pusher.php" hash="9337bd6a280f35f4694e7a1351f39e7d"/></dir><file name="Notifications.php" hash="6467b4765964afba40e452e564c7347d"/><file name="Observer.php" hash="7f5e4891ff139789998808a49dfd1e24"/><file name="Pusher.php" hash="cb55bd677f131dc4370429c2cb485be9"/><dir name="Resource"><dir name="Fulltext"><file name="Collection.php" hash="d0f2d8fc0c2adcd1dfcf05fd653909ca"/></dir></dir><file name="Service.php" hash="2c1e4d7764f7d99d2f54e442f3652918"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Autocompleteplus"><file name="PushController.php" hash="ec366543519b206339ca39ce3320ad12"/><file name="RedirectController.php" hash="a63c7811b54470e26dcd1c22d707e67b"/></dir></dir><dir name="CatalogSearch"><file name="ResultController.php" hash="67333080dc7d7cf748667b53616f1457"/></dir><file name="CatalogsearchController.php" hash="0327c979fc357504147d7caff7079d69"/><file name="CategoriesController.php" hash="8f120263586178c0c96e4cb74aea8f00"/><file name="LayeredController.php" hash="f43274329a4e8cfbae6c994beea25653"/><file name="ProductsController.php" hash="8e9cb59b76d1ce10013d957bfd517828"/><file name="ProductsbyidController.php" hash="4e71f60a5289c6d398dc21f645c9f9d7"/><file name="ResultController.php" hash="1c0df6c89ec836c305105342ced5c400"/><file name="SearchesController.php" hash="344ab1717d1b25d746d033074ae22ade"/></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="c26487f43e1a49facbe054ad2a9de04e"/><file name="config_no_fulltext.xml" hash="50a757335937264e0886bf2b6ac72288"/><file name="config_with_crontab.xml" hash="3ea8556899a84435c11c6f526bccec27"/><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="fd4018c6752ba72af7af2f5f14a0dc12"/><file name="mysql4-upgrade-2.0.1.3-2.0.2.2.php" hash="275c674ba7ef38beb03d20dd16c56d79"/><file name="mysql4-upgrade-2.0.2.5-2.0.2.6.php" hash="4db99239287c64410ac1d7abf6517b59"/><file name="mysql4-upgrade-2.0.4.6-2.0.4.7.php" hash="9a37396d35fec0e3b911455ec61b18d6"/><file name="mysql4-upgrade-2.0.5.4-2.0.5.5.php" hash="2f43b1c32617ea88ef02bab870788807"/><file name="mysql4-upgrade-2.0.5.6-2.0.5.7.php" hash="6a77ea58afed1b6937f0c6d0aa831392"/><file name="mysql4-upgrade-2.0.6.1-2.0.6.4.php" hash="fa5411870fa2eef5ed21a6db1373b651"/><file name="mysql4-upgrade-2.0.7.0-2.0.7.1.php" hash="02c07e5d0c94299165dce4bd140ee547"/><file name="mysql4-upgrade-2.0.7.2-2.0.7.3.php" hash="9ea280adb0ba238fcb6b92b0fe86219b"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Autocompleteplus_Autosuggest.xml" hash="e2279cfe50ac070fcfabcf9d327a25fc"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="autocompleteplus.xml" hash="286290139b776909e423c0f4c346d82a"/></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="50977af122c417fd534f372be86a03cc"/></dir></dir><file name="inject.phtml" hash="8cdcb15176db3b14c9c135e87d31e7ad"/><file name="inject_new.phtml" hash="e1e8e050631fe65417edb7a8f25155c8"/></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="notifications_old.php" hash="8824edf5a99aa011a1d123233b6a513d"/><dir name="system"><dir name="config"><file name="button.phtml" hash="4762e2343ede91cdee6ecdbf1fd85030"/><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>
|