Version Notes
bug fix - product special price
Download this release
Release Info
Developer | Adar |
Extension | autocompleteplus_autosuggest |
Version | 3.0.0.8 |
Comparing to | |
See all releases |
Code changes from version 3.0.0.7 to 3.0.0.8
- app/code/local/Autocompleteplus/Autosuggest/Catalog.php +366 -0
- app/code/local/Autocompleteplus/Autosuggest/Model/Catalog.php +38 -70
- app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsController.php +1 -1
- app/code/local/Autocompleteplus/Autosuggest/etc/config.xml +1 -1
- package.xml +5 -5
app/code/local/Autocompleteplus/Autosuggest/Catalog.php
ADDED
@@ -0,0 +1,366 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
protected $imageField;
|
6 |
+
protected $standardImageFields = array('image', 'small_image', 'thumbnail');
|
7 |
+
protected $useAttributes;
|
8 |
+
protected $attributes;
|
9 |
+
protected $currency;
|
10 |
+
protected $pageNum;
|
11 |
+
protected $_productCollection;
|
12 |
+
protected $_xmlGenerator;
|
13 |
+
protected $_helper;
|
14 |
+
protected $_attributes;
|
15 |
+
|
16 |
+
public function getXmlGenerator()
|
17 |
+
{
|
18 |
+
if (!$this->_xmlGenerator) {
|
19 |
+
$this->_xmlGenerator = new Autocompleteplus_Autosuggest_Xml_Generator();
|
20 |
+
}
|
21 |
+
|
22 |
+
return $this->_xmlGenerator;
|
23 |
+
}
|
24 |
+
|
25 |
+
public function getHelper()
|
26 |
+
{
|
27 |
+
if (!$this->_helper) {
|
28 |
+
$this->_helper = Mage::helper('autocompleteplus_autosuggest');
|
29 |
+
}
|
30 |
+
return $this->_helper;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function getAttributes()
|
34 |
+
{
|
35 |
+
if (!$this->_attributes) {
|
36 |
+
|
37 |
+
$productModel = Mage::getModel('catalog/product');
|
38 |
+
$this->_attributes = Mage::getResourceModel('eav/entity_attribute_collection')
|
39 |
+
->setEntityTypeFilter($productModel->getResource()->getTypeId())
|
40 |
+
->addFieldToFilter('is_user_defined', '1')
|
41 |
+
;
|
42 |
+
}
|
43 |
+
return $this->_attributes;
|
44 |
+
}
|
45 |
+
|
46 |
+
public function getProductCollection($new = false)
|
47 |
+
{
|
48 |
+
if (!$this->_productCollection) {
|
49 |
+
$this->_productCollection = Mage::getModel('catalog/product')->getCollection();
|
50 |
+
}
|
51 |
+
|
52 |
+
if ($new === true) {
|
53 |
+
return Mage::getModel('catalog/product')->getCollection();
|
54 |
+
}
|
55 |
+
|
56 |
+
return $this->_productCollection;
|
57 |
+
}
|
58 |
+
|
59 |
+
public function getProductRenderer()
|
60 |
+
{
|
61 |
+
return Mage::getSingleton('autocompleteplus_autosuggest/renderer_catalog_product');
|
62 |
+
}
|
63 |
+
|
64 |
+
public function getBatchRenderer()
|
65 |
+
{
|
66 |
+
return Mage::getSingleton('autocompleteplus_autosuggest/renderer_batches');
|
67 |
+
}
|
68 |
+
|
69 |
+
public function renderCatalogXml($startInd = 0,
|
70 |
+
$count = 10000,
|
71 |
+
$storeId = false,
|
72 |
+
$orders = false,
|
73 |
+
$monthInterval = 12,
|
74 |
+
$checksum = false)
|
75 |
+
{
|
76 |
+
$xmlGenerator = $this->getXmlGenerator();
|
77 |
+
$count = ($count > 10000) ? 10000 : $count;
|
78 |
+
$this->setStoreId($storeId);
|
79 |
+
$this->setOrders($orders);
|
80 |
+
$this->setMonthInterval($monthInterval);
|
81 |
+
$this->setChecksum($checksum);
|
82 |
+
|
83 |
+
|
84 |
+
$xmlGenerator->setRootAttributes(array(
|
85 |
+
'version' => $this->getHelper()->getVersion(),
|
86 |
+
'magento' => $this->getHelper()->getMageVersion()
|
87 |
+
))->setRootElementName('catalog');
|
88 |
+
|
89 |
+
$productCollection = $this->getProductCollection();
|
90 |
+
|
91 |
+
// @codingStandardsIgnoreLine
|
92 |
+
$productCollection->getSelect()->limit($count, $startInd);
|
93 |
+
if (is_numeric($storeId)) {
|
94 |
+
$productCollection->addStoreFilter($storeId);
|
95 |
+
$productCollection->setStoreId($storeId);
|
96 |
+
}
|
97 |
+
|
98 |
+
$attributesToSelect = array(
|
99 |
+
'store_id',
|
100 |
+
'name',
|
101 |
+
'description',
|
102 |
+
'short_description',
|
103 |
+
'visibility',
|
104 |
+
'thumbnail',
|
105 |
+
'image',
|
106 |
+
'small_image',
|
107 |
+
'url',
|
108 |
+
'status',
|
109 |
+
'updated_at',
|
110 |
+
'price',
|
111 |
+
'meta_title',
|
112 |
+
'meta_description');
|
113 |
+
|
114 |
+
if($this->canUseAttributes()){
|
115 |
+
foreach ($this->getAttributes() as $attr) {
|
116 |
+
$action = $attr->getAttributeCode();
|
117 |
+
|
118 |
+
$attributesToSelect[] = $action;
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
$productCollection->addAttributeToSelect($attributesToSelect);
|
123 |
+
|
124 |
+
Mage::getModel('review/review')->appendSummary($productCollection);
|
125 |
+
|
126 |
+
if ($this->getChecksum() !== false) {
|
127 |
+
$this->setHasChecksum($checksum);
|
128 |
+
}
|
129 |
+
|
130 |
+
foreach ($productCollection as $product) {
|
131 |
+
$this->getProductRenderer()
|
132 |
+
->setAction('insert')
|
133 |
+
->setProduct($product)
|
134 |
+
->setStoreId($this->getStoreId())
|
135 |
+
->setOrders($this->getOrders())
|
136 |
+
->setMonthInterval($this->getMonthInterval())
|
137 |
+
->setXmlElement($xmlGenerator)
|
138 |
+
->setAttributes($this->getAttributes())
|
139 |
+
->renderXml();
|
140 |
+
if ($this->getHasChecksum()) {
|
141 |
+
if ($this->getHelper()->isChecksumTableExists()) {
|
142 |
+
$checksum = $this->getHelper()->calculateChecksum($product);
|
143 |
+
$this->getHelper()->updateSavedProductChecksum($product->getId(), $product->getSku(), $this->getStoreId(), $checksum);
|
144 |
+
}
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
return $xmlGenerator->generateXml();
|
149 |
+
}
|
150 |
+
|
151 |
+
public function canUseAttributes()
|
152 |
+
{
|
153 |
+
if (!$this->_useAttributes) {
|
154 |
+
$this->_useAttributes = Mage::getStoreConfigFlag('autocompleteplus/config/attributes');
|
155 |
+
}
|
156 |
+
return $this->_useAttributes;
|
157 |
+
}
|
158 |
+
|
159 |
+
public function renderUpdatesCatalogXml($count, $from, $to, $storeId)
|
160 |
+
{
|
161 |
+
$updates = Mage::getModel('autocompleteplus_autosuggest/batches')->getCollection()
|
162 |
+
->addFieldToFilter('update_date', array(
|
163 |
+
'from' => $from,
|
164 |
+
'to' => $to
|
165 |
+
))
|
166 |
+
->addFieldToFilter('store_id', $storeId);
|
167 |
+
|
168 |
+
$this->setStoreId($storeId);
|
169 |
+
$updates->setOrder('update_date', 'ASC');
|
170 |
+
|
171 |
+
$updates->setPageSize($count);
|
172 |
+
$updates->setCurPage(1);
|
173 |
+
$xmlGenerator= $this->getXmlGenerator();
|
174 |
+
|
175 |
+
$xmlGenerator->setRootAttributes(array(
|
176 |
+
'version' => $this->getHelper()->getVersion(),
|
177 |
+
'magento' => $this->getHelper()->getMageVersion(),
|
178 |
+
'fromdatetime' => $from
|
179 |
+
))->setRootElementName('catalog');
|
180 |
+
|
181 |
+
foreach ($updates as $batch) {
|
182 |
+
if ($batch['action'] == 'update') {
|
183 |
+
$productId = $batch['product_id'];
|
184 |
+
$batchStoreId = $batch['store_id'];
|
185 |
+
|
186 |
+
if ($storeId != $batchStoreId) {
|
187 |
+
$this->currency = Mage::app()->getStore($batchStoreId)->getCurrentCurrencyCode();
|
188 |
+
}
|
189 |
+
|
190 |
+
$productModel = null;
|
191 |
+
|
192 |
+
if ($productId != null) {
|
193 |
+
// load product by id
|
194 |
+
try {
|
195 |
+
$productModel = Mage::getModel('catalog/product')
|
196 |
+
->setStoreId($batchStoreId)
|
197 |
+
->load($productId);
|
198 |
+
} catch (Exception $e) {
|
199 |
+
$batch['action'] = 'remove';
|
200 |
+
$this->getBatchRenderer()
|
201 |
+
->setXmlElement($xmlGenerator)
|
202 |
+
->makeRemoveRow($batch);
|
203 |
+
continue;
|
204 |
+
}
|
205 |
+
} else {
|
206 |
+
// product not found - changing action to remove
|
207 |
+
$batch['action'] = 'remove';
|
208 |
+
$this->getBatchRenderer()
|
209 |
+
->setXmlElement($xmlGenerator)
|
210 |
+
->makeRemoveRow($batch);
|
211 |
+
continue;
|
212 |
+
}
|
213 |
+
|
214 |
+
if ($productModel == null) {
|
215 |
+
continue;
|
216 |
+
}
|
217 |
+
|
218 |
+
$updatedate = $batch['update_date'];
|
219 |
+
$action = $batch['action'];
|
220 |
+
$this->getProductRenderer()
|
221 |
+
->setXmlElement($xmlGenerator)
|
222 |
+
->setAction($action)
|
223 |
+
->setProduct($productModel)
|
224 |
+
->setStoreId($this->getStoreId())
|
225 |
+
->setOrders($this->getOrders())
|
226 |
+
->setMonthInterval($this->getMonthInterval())
|
227 |
+
->setXmlElement($xmlGenerator)
|
228 |
+
->setAttributes($this->getAttributes())
|
229 |
+
->setUpdateDate($updatedate)
|
230 |
+
->renderXml();
|
231 |
+
} else {
|
232 |
+
$this->getBatchRenderer()
|
233 |
+
->setXmlElement($xmlGenerator)
|
234 |
+
->makeRemoveRow($batch);
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
return $xmlGenerator->generateXml();
|
239 |
+
}
|
240 |
+
|
241 |
+
public function renderCatalogFromIds($count, $fromId, $storeId)
|
242 |
+
{
|
243 |
+
$xmlGenerator = $this->getXmlGenerator();
|
244 |
+
$xmlGenerator->setRootAttributes(array(
|
245 |
+
'version' => $this->getHelper()->getVersion(),
|
246 |
+
'magento' => $this->getHelper()->getMageVersion()
|
247 |
+
))->setRootElementName('catalog');
|
248 |
+
|
249 |
+
$productCollection = $this->getProductCollection();
|
250 |
+
if (is_numeric($storeId)) {
|
251 |
+
$productCollection->addStoreFilter($storeId);
|
252 |
+
$productCollection->setStoreId($storeId);
|
253 |
+
}
|
254 |
+
|
255 |
+
$attributesToSelect = array(
|
256 |
+
'store_id',
|
257 |
+
'name',
|
258 |
+
'description',
|
259 |
+
'short_description',
|
260 |
+
'visibility',
|
261 |
+
'thumbnail',
|
262 |
+
'image',
|
263 |
+
'small_image',
|
264 |
+
'url',
|
265 |
+
'status',
|
266 |
+
'updated_at',
|
267 |
+
'price',
|
268 |
+
'meta_title',
|
269 |
+
'meta_description');
|
270 |
+
|
271 |
+
if($this->canUseAttributes()){
|
272 |
+
foreach ($this->getAttributes() as $attr) {
|
273 |
+
$action = $attr->getAttributeCode();
|
274 |
+
|
275 |
+
$attributesToSelect[] = $action;
|
276 |
+
}
|
277 |
+
}
|
278 |
+
|
279 |
+
$productCollection->addAttributeToSelect($attributesToSelect);
|
280 |
+
|
281 |
+
$productCollection->addAttributeToFilter('entity_id', array('from' => $fromId));
|
282 |
+
$productCollection->setPageSize($count);
|
283 |
+
$productCollection->setCurPage(1);
|
284 |
+
|
285 |
+
Mage::getModel('review/review')->appendSummary($productCollection);
|
286 |
+
|
287 |
+
foreach ($productCollection as $product) {
|
288 |
+
$this->getProductRenderer()
|
289 |
+
->setAction('getfromid')
|
290 |
+
->setProduct($product)
|
291 |
+
->setStoreId($storeId)
|
292 |
+
->setXmlElement($xmlGenerator)
|
293 |
+
->setAttributes($this->getAttributes())
|
294 |
+
->setGetByIdStatus(1)
|
295 |
+
->renderXml();
|
296 |
+
}
|
297 |
+
|
298 |
+
return $xmlGenerator->generateXml();
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Creates an XML representation of catalog by ids.
|
303 |
+
*
|
304 |
+
* @param array $ids
|
305 |
+
* @param int $storeId
|
306 |
+
*
|
307 |
+
* @return string
|
308 |
+
*/
|
309 |
+
public function renderCatalogByIds($ids, $storeId = 0)
|
310 |
+
{
|
311 |
+
$xmlGenerator = $this->getXmlGenerator();
|
312 |
+
$xmlGenerator->setRootAttributes(array(
|
313 |
+
'version' => $this->getHelper()->getVersion(),
|
314 |
+
'magento' => $this->getHelper()->getMageVersion()
|
315 |
+
))->setRootElementName('catalog');
|
316 |
+
|
317 |
+
$productCollection = $this->getProductCollection();
|
318 |
+
if (is_numeric($storeId)) {
|
319 |
+
$productCollection->addStoreFilter($storeId);
|
320 |
+
$productCollection->setStoreId($storeId);
|
321 |
+
}
|
322 |
+
|
323 |
+
$attributesToSelect = array(
|
324 |
+
'store_id',
|
325 |
+
'name',
|
326 |
+
'description',
|
327 |
+
'short_description',
|
328 |
+
'visibility',
|
329 |
+
'thumbnail',
|
330 |
+
'image',
|
331 |
+
'small_image',
|
332 |
+
'url',
|
333 |
+
'status',
|
334 |
+
'updated_at',
|
335 |
+
'price',
|
336 |
+
'meta_title',
|
337 |
+
'meta_description');
|
338 |
+
|
339 |
+
if($this->canUseAttributes()){
|
340 |
+
foreach ($this->getAttributes() as $attr) {
|
341 |
+
$action = $attr->getAttributeCode();
|
342 |
+
|
343 |
+
$attributesToSelect[] = $action;
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
$productCollection->addAttributeToSelect($attributesToSelect);
|
348 |
+
|
349 |
+
$productCollection->addAttributeToFilter('entity_id', array('in' => $ids));
|
350 |
+
|
351 |
+
Mage::getModel('review/review')->appendSummary($productCollection);
|
352 |
+
|
353 |
+
foreach ($productCollection as $product) {
|
354 |
+
$this->getProductRenderer()
|
355 |
+
->setAction('getbyid')
|
356 |
+
->setProduct($product)
|
357 |
+
->setStoreId($storeId)
|
358 |
+
->setXmlElement($xmlGenerator)
|
359 |
+
->setAttributes($this->getAttributes())
|
360 |
+
->setGetByIdStatus(1)
|
361 |
+
->renderXml();
|
362 |
+
}
|
363 |
+
|
364 |
+
return $xmlGenerator->generateXml();
|
365 |
+
}
|
366 |
+
}
|
app/code/local/Autocompleteplus/Autosuggest/Model/Catalog.php
CHANGED
@@ -87,7 +87,7 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
87 |
))->setRootElementName('catalog');
|
88 |
|
89 |
$productCollection = $this->getProductCollection();
|
90 |
-
|
91 |
// @codingStandardsIgnoreLine
|
92 |
$productCollection->getSelect()->limit($count, $startInd);
|
93 |
if (is_numeric($storeId)) {
|
@@ -95,29 +95,7 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
95 |
$productCollection->setStoreId($storeId);
|
96 |
}
|
97 |
|
98 |
-
$attributesToSelect =
|
99 |
-
'store_id',
|
100 |
-
'name',
|
101 |
-
'description',
|
102 |
-
'short_description',
|
103 |
-
'visibility',
|
104 |
-
'thumbnail',
|
105 |
-
'image',
|
106 |
-
'small_image',
|
107 |
-
'url',
|
108 |
-
'status',
|
109 |
-
'updated_at',
|
110 |
-
'price',
|
111 |
-
'meta_title',
|
112 |
-
'meta_description');
|
113 |
-
|
114 |
-
if($this->canUseAttributes()){
|
115 |
-
foreach ($this->getAttributes() as $attr) {
|
116 |
-
$action = $attr->getAttributeCode();
|
117 |
-
|
118 |
-
$attributesToSelect[] = $action;
|
119 |
-
}
|
120 |
-
}
|
121 |
|
122 |
$productCollection->addAttributeToSelect($attributesToSelect);
|
123 |
|
@@ -164,14 +142,14 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
164 |
'to' => $to
|
165 |
))
|
166 |
->addFieldToFilter('store_id', $storeId);
|
167 |
-
|
168 |
$this->setStoreId($storeId);
|
169 |
$updates->setOrder('update_date', 'ASC');
|
170 |
|
171 |
$updates->setPageSize($count);
|
172 |
$updates->setCurPage(1);
|
173 |
$xmlGenerator= $this->getXmlGenerator();
|
174 |
-
|
175 |
$xmlGenerator->setRootAttributes(array(
|
176 |
'version' => $this->getHelper()->getVersion(),
|
177 |
'magento' => $this->getHelper()->getMageVersion(),
|
@@ -252,29 +230,7 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
252 |
$productCollection->setStoreId($storeId);
|
253 |
}
|
254 |
|
255 |
-
$attributesToSelect =
|
256 |
-
'store_id',
|
257 |
-
'name',
|
258 |
-
'description',
|
259 |
-
'short_description',
|
260 |
-
'visibility',
|
261 |
-
'thumbnail',
|
262 |
-
'image',
|
263 |
-
'small_image',
|
264 |
-
'url',
|
265 |
-
'status',
|
266 |
-
'updated_at',
|
267 |
-
'price',
|
268 |
-
'meta_title',
|
269 |
-
'meta_description');
|
270 |
-
|
271 |
-
if($this->canUseAttributes()){
|
272 |
-
foreach ($this->getAttributes() as $attr) {
|
273 |
-
$action = $attr->getAttributeCode();
|
274 |
-
|
275 |
-
$attributesToSelect[] = $action;
|
276 |
-
}
|
277 |
-
}
|
278 |
|
279 |
$productCollection->addAttributeToSelect($attributesToSelect);
|
280 |
|
@@ -320,6 +276,33 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
320 |
$productCollection->setStoreId($storeId);
|
321 |
}
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
$attributesToSelect = array(
|
324 |
'store_id',
|
325 |
'name',
|
@@ -334,33 +317,18 @@ class Autocompleteplus_Autosuggest_Model_Catalog extends Mage_Core_Model_Abstrac
|
|
334 |
'updated_at',
|
335 |
'price',
|
336 |
'meta_title',
|
337 |
-
'meta_description'
|
|
|
|
|
338 |
|
339 |
-
if($this->canUseAttributes()){
|
340 |
foreach ($this->getAttributes() as $attr) {
|
341 |
$action = $attr->getAttributeCode();
|
342 |
|
343 |
$attributesToSelect[] = $action;
|
344 |
}
|
|
|
345 |
}
|
346 |
-
|
347 |
-
$productCollection->addAttributeToSelect($attributesToSelect);
|
348 |
-
|
349 |
-
$productCollection->addAttributeToFilter('entity_id', array('in' => $ids));
|
350 |
-
|
351 |
-
Mage::getModel('review/review')->appendSummary($productCollection);
|
352 |
-
|
353 |
-
foreach ($productCollection as $product) {
|
354 |
-
$this->getProductRenderer()
|
355 |
-
->setAction('getbyid')
|
356 |
-
->setProduct($product)
|
357 |
-
->setStoreId($storeId)
|
358 |
-
->setXmlElement($xmlGenerator)
|
359 |
-
->setAttributes($this->getAttributes())
|
360 |
-
->setGetByIdStatus(1)
|
361 |
-
->renderXml();
|
362 |
-
}
|
363 |
-
|
364 |
-
return $xmlGenerator->generateXml();
|
365 |
}
|
366 |
}
|
87 |
))->setRootElementName('catalog');
|
88 |
|
89 |
$productCollection = $this->getProductCollection();
|
90 |
+
|
91 |
// @codingStandardsIgnoreLine
|
92 |
$productCollection->getSelect()->limit($count, $startInd);
|
93 |
if (is_numeric($storeId)) {
|
95 |
$productCollection->setStoreId($storeId);
|
96 |
}
|
97 |
|
98 |
+
$attributesToSelect = $this->_getAttributesToSelect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
$productCollection->addAttributeToSelect($attributesToSelect);
|
101 |
|
142 |
'to' => $to
|
143 |
))
|
144 |
->addFieldToFilter('store_id', $storeId);
|
145 |
+
|
146 |
$this->setStoreId($storeId);
|
147 |
$updates->setOrder('update_date', 'ASC');
|
148 |
|
149 |
$updates->setPageSize($count);
|
150 |
$updates->setCurPage(1);
|
151 |
$xmlGenerator= $this->getXmlGenerator();
|
152 |
+
|
153 |
$xmlGenerator->setRootAttributes(array(
|
154 |
'version' => $this->getHelper()->getVersion(),
|
155 |
'magento' => $this->getHelper()->getMageVersion(),
|
230 |
$productCollection->setStoreId($storeId);
|
231 |
}
|
232 |
|
233 |
+
$attributesToSelect = $this->_getAttributesToSelect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
|
235 |
$productCollection->addAttributeToSelect($attributesToSelect);
|
236 |
|
276 |
$productCollection->setStoreId($storeId);
|
277 |
}
|
278 |
|
279 |
+
$attributesToSelect = $this->_getAttributesToSelect();
|
280 |
+
|
281 |
+
$productCollection->addAttributeToSelect($attributesToSelect);
|
282 |
+
|
283 |
+
$productCollection->addAttributeToFilter('entity_id', array('in' => $ids));
|
284 |
+
|
285 |
+
Mage::getModel('review/review')->appendSummary($productCollection);
|
286 |
+
|
287 |
+
foreach ($productCollection as $product) {
|
288 |
+
$this->getProductRenderer()
|
289 |
+
->setAction('getbyid')
|
290 |
+
->setProduct($product)
|
291 |
+
->setStoreId($storeId)
|
292 |
+
->setXmlElement($xmlGenerator)
|
293 |
+
->setAttributes($this->getAttributes())
|
294 |
+
->setGetByIdStatus(1)
|
295 |
+
->renderXml();
|
296 |
+
}
|
297 |
+
|
298 |
+
return $xmlGenerator->generateXml();
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* @return array
|
303 |
+
*/
|
304 |
+
protected function _getAttributesToSelect()
|
305 |
+
{
|
306 |
$attributesToSelect = array(
|
307 |
'store_id',
|
308 |
'name',
|
317 |
'updated_at',
|
318 |
'price',
|
319 |
'meta_title',
|
320 |
+
'meta_description',
|
321 |
+
'special_price'
|
322 |
+
);
|
323 |
|
324 |
+
if ($this->canUseAttributes()) {
|
325 |
foreach ($this->getAttributes() as $attr) {
|
326 |
$action = $attr->getAttributeCode();
|
327 |
|
328 |
$attributesToSelect[] = $action;
|
329 |
}
|
330 |
+
return $attributesToSelect;
|
331 |
}
|
332 |
+
return $attributesToSelect;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
}
|
334 |
}
|
app/code/local/Autocompleteplus/Autosuggest/controllers/ProductsController.php
CHANGED
@@ -117,7 +117,6 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
117 |
$uuid = $this->_getConfig()->getUUID();
|
118 |
$site_url = $helper->getConfigDataByFullPath('web/unsecure/base_url');
|
119 |
$store_id = Mage::app()->getStore()->getStoreId();
|
120 |
-
$modules = Mage::getConfig()->getNode('modules')->children();
|
121 |
$installedModules = array();
|
122 |
|
123 |
try {
|
@@ -130,6 +129,7 @@ class Autocompleteplus_Autosuggest_ProductsController extends Autocompleteplus_A
|
|
130 |
|
131 |
if ($get_modules) {
|
132 |
try {
|
|
|
133 |
foreach ($modules as $name => $module) {
|
134 |
if ($module->codePool != 'core' && $module->active == 'true') {
|
135 |
$installedModules[$name] = $module;
|
117 |
$uuid = $this->_getConfig()->getUUID();
|
118 |
$site_url = $helper->getConfigDataByFullPath('web/unsecure/base_url');
|
119 |
$store_id = Mage::app()->getStore()->getStoreId();
|
|
|
120 |
$installedModules = array();
|
121 |
|
122 |
try {
|
129 |
|
130 |
if ($get_modules) {
|
131 |
try {
|
132 |
+
$modules = Mage::getConfig()->getNode('modules')->children();
|
133 |
foreach ($modules as $name => $module) {
|
134 |
if ($module->codePool != 'core' && $module->active == 'true') {
|
135 |
$installedModules[$name] = $module;
|
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.8</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="0af946c437fda1a02098b378a142a69c"/><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="0e3df8e01900dbdd8240e6facee4f159"/></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="
|
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.8</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>bug fix - product special price</notes>
|
12 |
<authors><author><name>Adar</name><user>Adar</user><email>magento@autocompleteplus.com</email></author></authors>
|
13 |
+
<date>2016-08-18</date>
|
14 |
+
<time>12:45:05</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="0af946c437fda1a02098b378a142a69c"/><file name="Notifications.php" hash="3ab60946b756f093585a708185d98909"/></dir><file name="Catalog.php" hash="81f6fa9ccba4bb66c546a64d201b9fbf"/><dir name="Controller"><file name="Abstract.php" hash="84b311dbc24ca94ee7f1af655430f8ea"/></dir><dir name="Helper"><file name="Data.php" hash="0e3df8e01900dbdd8240e6facee4f159"/></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="fb471a0acfd3823fdef02c8a2a9f0977"/><file name="Catalogreport.php" hash="110c05b050cffb2fec71973e36440702"/><file name="Checksum.php" hash="37550b6bd6d934f1ad2ef581dfa10eea"/><file name="Config.php" hash="3a19873f65c4c5485f2de7fb9baa1ca9"/><file name="Layer.php" hash="82538541fb58038dd308fc584454d0bd"/><dir name="Mysql4"><dir name="Batches"><file name="Collection.php" hash="06815b7ef6df1c09655024817f9fdc87"/></dir><file name="Batches.php" hash="f61cd3381a76f77989e5dbb35610c0fc"/><dir name="Checksum"><file name="Collection.php" hash="7879f033202d4618ad48f767dbfdd694"/></dir><file name="Checksum.php" hash="92ecf2e3990fd868f2d83fbd1f73d135"/><dir name="Fulltext"><file name="Collection.php" hash="b4b729b327d48457815a3f9c6e86e7f5"/></dir><dir name="Notifications"><file name="Collection.php" hash="9351b214c326de0a4195df88c6ef8f75"/></dir><file name="Notifications.php" hash="9f6514d2bfa7a89f2a663eaa06865d24"/><dir name="Pusher"><file name="Collection.php" hash="83bf9e00aceaa230fcdfe81ac4df344c"/></dir><file name="Pusher.php" hash="1e7ad77386c07fc060c554079a47d60f"/></dir><file name="Notifications.php" hash="7f4037e171c63de662370aeceaeed1d6"/><file name="Observer.php" hash="fc049474b276bb4c38af23e129391958"/><file name="Pusher.php" hash="518825e11c9d8fd0b91ac78f6916c40b"/><dir name="Renderer"><file name="Abstract.php" hash="e7298546a4e47a835a9b69ab873a95da"/><file name="Batches.php" hash="5d73a56a9760df0620f8c0bf28c4e4be"/><dir name="Catalog"><file name="Product.php" hash="84bedcb2c59f49835b759cec5ec7a77e"/></dir></dir><dir name="Resource"><dir name="Batches"><file name="Collection.php" hash="4cff894b990b3b80e95c4224b12050da"/></dir><file name="Batches.php" hash="bfff3c8f471bb5c19cfbc9420d7736a7"/><dir name="Checksum"><file name="Collection.php" hash="43580b863c0040783ffa59230c1fa5e2"/></dir><file name="Checksum.php" hash="e991bdba8c981fa67f46d1f06be10e11"/><dir name="Fulltext"><file name="Collection.php" hash="1a2ff4fb035bccf2424e3ecb0e0e4c93"/></dir><dir name="Notifications"><file name="Collection.php" hash="ca5fbd3f52d9fc2c575588f4d3208c69"/></dir><file name="Notifications.php" hash="5a62daeaba13c72b8f5eb40381642c8d"/><dir name="Pusher"><file name="Collection.php" hash="844299f9264313e6182816c8cbf58a37"/></dir><file name="Pusher.php" hash="fe212dffaaebc28665a3ff4244b78bcd"/></dir><file name="Service.php" hash="4c0e98c7abfa3319768ee850ed5d8e77"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Autocompleteplus"><file name="PushController.php" hash="59ca72fc498a4a190474b46706e1dd18"/><file name="RedirectController.php" hash="8361d1e5922d75763eb82cd916480fb1"/></dir></dir><dir name="CatalogSearch"><file name="ResultController.php" hash="8d2c03b7849b7dbeeb9a08cfa37e63ea"/></dir><file name="CatalogsearchController.php" hash="e534d0933da8a0a1deb4b0618cea5665"/><file name="CategoriesController.php" hash="2222f02aa99ac14c465143462e581270"/><file name="LayeredController.php" hash="444cb30c34aa499092b0007bcbb84cca"/><file name="ProductsController.php" hash="c6109926d37a058ce8a0fbdcab83a09a"/><file name="ProductsbyidController.php" hash="1589840233143b6e91fe95624638789b"/><file name="ResultController.php" hash="182f65ce4ccdf154aa0326512ec37140"/><file name="SearchesController.php" hash="7a4e94bb9456b4ac6b48c30b0cd389db"/></dir><dir name="data"><dir name="autosuggest_setup"><file name="data-install-3.0.0.5.php" hash="2b1ec2380f5c0a2d585b71eb73b8e573"/></dir></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="0676dc3e2134b05a7bb9fba7bd34ddad"/><file name="config.xml.bak" hash="51745fa3e5b736f8f03d68af5ee6f4b4"/><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="56a45f752e553280bb9242cde2aa76ce"/><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="cf59ec04f2329243abac26bd79fa5818"/><file name="mysql4-upgrade-2.0.8.8-3.0.0.0.php" hash="9f60147846d67ecff6d7a28b39798f9b"/><file name="mysql4-upgrade-3.0.0.3-3.0.0.4.php" hash="9574b75e9a733be858a14588978cd21a"/><file name="mysql4-upgrade-3.0.0.4-3.0.0.5.php" hash="69094243b4af4e87a0e0186e76095099"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Autocompleteplus_Autosuggest.xml" hash="530931765807be8a21baa5e070bc4bc2"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="autocompleteplus.xml" hash="3998429f613fcc7842b7ea31cb423ec8"/></dir><dir name="template"><dir name="autocompleteplus"><dir name="catalog"><dir name="layer"><file name="view.phtml" hash="57066d2ac5fa051c15c3ed8bb43b5d08"/></dir><dir name="product"><file name="list.phtml" hash="c269d5b27302efb51cefb86a71027a0d"/></dir></dir><file name="inject.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="process.phtml" hash="a7dd67e17a838d437fe9d9a2e9323d0c"/><dir name="system"><dir name="config"><file name="button.phtml" hash="3adf3f3f4ab989cf643f2fc49719b59d"/><file name="sync.phtml" hash="e0392aac8584e98ef4260419750e1cbb"/></dir></dir></dir></dir><dir name="layout"><file name="autocompleteplus.xml" hash="d69295113bbb7beb7b9e32cc84a9b129"/></dir></dir></dir></dir></target><target name="magelib"><dir name="Autocompleteplus"><dir name="Autosuggest"><dir name="Xml"><file name="Generator.php" hash="c2fe75e398a73b82229999a08948f56b"/><file name="GeneratorInterface.php" hash="d3d6ea3a712fdbdb60d8994230a65f1c"/></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|