Version Notes
- NEW: allow to have custom product types
- NEW: make image generation size parameter customizable to be able to save ressources when already in cache
- UPDATED: remove root category when fetching product categories
- UPDATED: rewrite image class to be able to log the error when not being able to generate it
- UPDATED: Handle display price with AND without tax
- FIX: price issues
- FIX: Safari issue with instant search
Download this release
Release Info
Developer | Algolia Team |
Extension | algoliasearch |
Version | 1.4.8 |
Comparing to | |
See all releases |
Code changes from version 1.4.7 to 1.4.8
- app/code/community/Algolia/Algoliasearch/Helper/Config.php +42 -0
- app/code/community/Algolia/Algoliasearch/Helper/Data.php +1 -1
- app/code/community/Algolia/Algoliasearch/Helper/Entity/Helper.php +7 -0
- app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php +125 -116
- app/code/community/Algolia/Algoliasearch/Helper/Image.php +34 -0
- app/code/community/Algolia/Algoliasearch/Model/Resource/Engine.php +34 -0
- app/code/community/Algolia/Algoliasearch/Model/System/Imagetype.php +16 -0
- app/code/community/Algolia/Algoliasearch/etc/config.xml +18 -1
- app/code/community/Algolia/Algoliasearch/etc/system.xml +43 -2
- app/design/frontend/base/default/template/algoliasearch/topsearch.phtml +25 -1
- package.xml +11 -12
app/code/community/Algolia/Algoliasearch/Helper/Config.php
CHANGED
@@ -49,6 +49,10 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
|
|
49 |
const NUMBER_OF_JOB_TO_RUN = 'algoliasearch/queue/number_of_job_to_run';
|
50 |
const NO_PROCESS = 'algoliasearch/queue/noprocess';
|
51 |
|
|
|
|
|
|
|
|
|
52 |
const PARTIAL_UPDATES = 'algoliasearch/advanced/partial_update';
|
53 |
const CUSTOMER_GROUPS_ENABLE = 'algoliasearch/advanced/customer_groups_enable';
|
54 |
const MAKE_SEO_REQUEST = 'algoliasearch/advanced/make_seo_request';
|
@@ -57,6 +61,8 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
|
|
57 |
const SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock';
|
58 |
const LOGGING_ENABLED = 'dev/log/active';
|
59 |
|
|
|
|
|
60 |
public function isEnabledFrontEnd($storeId = null)
|
61 |
{
|
62 |
return Mage::getStoreConfigFlag(self::ENABLE_BACKEND, $storeId) && Mage::getStoreConfigFlag(self::ENABLE_FRONTEND, $storeId);
|
@@ -87,6 +93,21 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
|
|
87 |
return Mage::getStoreConfigFlag(self::NO_PROCESS, $storeId);
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
public function isCustomerGroupsEnabled($storeId = null)
|
91 |
{
|
92 |
return Mage::getStoreConfigFlag(self::CUSTOMER_GROUPS_ENABLE, $storeId);
|
@@ -338,4 +359,25 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
|
|
338 |
|
339 |
return $currencySymbol;
|
340 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
}
|
49 |
const NUMBER_OF_JOB_TO_RUN = 'algoliasearch/queue/number_of_job_to_run';
|
50 |
const NO_PROCESS = 'algoliasearch/queue/noprocess';
|
51 |
|
52 |
+
const XML_PATH_IMAGE_WIDTH = 'algoliasearch/image/width';
|
53 |
+
const XML_PATH_IMAGE_HEIGHT = 'algoliasearch/image/height';
|
54 |
+
const XML_PATH_IMAGE_TYPE = 'algoliasearch/image/type';
|
55 |
+
|
56 |
const PARTIAL_UPDATES = 'algoliasearch/advanced/partial_update';
|
57 |
const CUSTOMER_GROUPS_ENABLE = 'algoliasearch/advanced/customer_groups_enable';
|
58 |
const MAKE_SEO_REQUEST = 'algoliasearch/advanced/make_seo_request';
|
61 |
const SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock';
|
62 |
const LOGGING_ENABLED = 'dev/log/active';
|
63 |
|
64 |
+
protected $_productTypeMap = array();
|
65 |
+
|
66 |
public function isEnabledFrontEnd($storeId = null)
|
67 |
{
|
68 |
return Mage::getStoreConfigFlag(self::ENABLE_BACKEND, $storeId) && Mage::getStoreConfigFlag(self::ENABLE_FRONTEND, $storeId);
|
93 |
return Mage::getStoreConfigFlag(self::NO_PROCESS, $storeId);
|
94 |
}
|
95 |
|
96 |
+
public function getImageWidth($storeId = null)
|
97 |
+
{
|
98 |
+
return Mage::getStoreConfig(self::XML_PATH_IMAGE_WIDTH, $storeId);
|
99 |
+
}
|
100 |
+
|
101 |
+
public function getImageHeight($storeId = null)
|
102 |
+
{
|
103 |
+
return Mage::getStoreConfig(self::XML_PATH_IMAGE_HEIGHT, $storeId);
|
104 |
+
}
|
105 |
+
|
106 |
+
public function getImageType($storeId = null)
|
107 |
+
{
|
108 |
+
return Mage::getStoreConfig(self::XML_PATH_IMAGE_TYPE, $storeId);
|
109 |
+
}
|
110 |
+
|
111 |
public function isCustomerGroupsEnabled($storeId = null)
|
112 |
{
|
113 |
return Mage::getStoreConfigFlag(self::CUSTOMER_GROUPS_ENABLE, $storeId);
|
359 |
|
360 |
return $currencySymbol;
|
361 |
}
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Loads product type mapping from configuration (default) > algoliasearch > product_map > (product type)
|
365 |
+
*
|
366 |
+
* @param $originalType
|
367 |
+
* @return string
|
368 |
+
*/
|
369 |
+
public function getMappedProductType($originalType)
|
370 |
+
{
|
371 |
+
if (!isset($this->_productTypeMap[$originalType]))
|
372 |
+
{
|
373 |
+
$mappedType = (string)Mage::app()->getConfig()->getNode('default/algoliasearch/product_map/' . $originalType);
|
374 |
+
|
375 |
+
if ($mappedType)
|
376 |
+
$this->_productTypeMap[$originalType] = $mappedType;
|
377 |
+
else
|
378 |
+
$this->_productTypeMap[$originalType] = $originalType;
|
379 |
+
}
|
380 |
+
|
381 |
+
return $this->_productTypeMap[$originalType];
|
382 |
+
}
|
383 |
}
|
app/code/community/Algolia/Algoliasearch/Helper/Data.php
CHANGED
@@ -25,7 +25,7 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
|
|
25 |
|
26 |
public function __construct()
|
27 |
{
|
28 |
-
\AlgoliaSearch\Version::$custom_value = " Magento (1.4.
|
29 |
|
30 |
$this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
|
31 |
|
25 |
|
26 |
public function __construct()
|
27 |
{
|
28 |
+
\AlgoliaSearch\Version::$custom_value = " Magento (1.4.8)";
|
29 |
|
30 |
$this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
|
31 |
|
app/code/community/Algolia/Algoliasearch/Helper/Entity/Helper.php
CHANGED
@@ -207,13 +207,20 @@ abstract class Algolia_Algoliasearch_Helper_Entity_Helper
|
|
207 |
|
208 |
public static function getStores($store_id)
|
209 |
{
|
|
|
210 |
$store_ids = array();
|
211 |
|
212 |
if ($store_id == null)
|
213 |
{
|
214 |
foreach (Mage::app()->getStores() as $store)
|
|
|
|
|
|
|
|
|
215 |
if ($store->getIsActive())
|
216 |
$store_ids[] = $store->getId();
|
|
|
|
|
217 |
}
|
218 |
else
|
219 |
$store_ids = array($store_id);
|
207 |
|
208 |
public static function getStores($store_id)
|
209 |
{
|
210 |
+
$config = Mage::helper('algoliasearch/config');
|
211 |
$store_ids = array();
|
212 |
|
213 |
if ($store_id == null)
|
214 |
{
|
215 |
foreach (Mage::app()->getStores() as $store)
|
216 |
+
{
|
217 |
+
if ($config->isEnabledBackEnd($store->getId()) === false)
|
218 |
+
continue;
|
219 |
+
|
220 |
if ($store->getIsActive())
|
221 |
$store_ids[] = $store->getId();
|
222 |
+
|
223 |
+
}
|
224 |
}
|
225 |
else
|
226 |
$store_ids = array($store_id);
|
app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php
CHANGED
@@ -4,7 +4,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
4 |
{
|
5 |
protected static $_productAttributes;
|
6 |
|
7 |
-
protected static $_predefinedProductAttributes = array('name', 'url_key', 'description', 'image', 'thumbnail');
|
8 |
|
9 |
protected function getIndexNameSuffix()
|
10 |
{
|
@@ -233,144 +233,147 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
233 |
}
|
234 |
}
|
235 |
|
236 |
-
private function
|
237 |
{
|
238 |
-
$
|
239 |
|
240 |
-
|
241 |
-
|
242 |
|
243 |
-
if ($
|
244 |
-
|
245 |
-
foreach ($groups as $group)
|
246 |
-
{
|
247 |
-
$group_id = (int)$group->getData('customer_group_id');
|
248 |
|
249 |
-
|
250 |
-
|
251 |
-
}
|
252 |
-
}
|
253 |
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
|
256 |
-
|
257 |
{
|
258 |
-
$
|
259 |
-
Mage::app()->getLocale()->storeTimeStamp($product->getStoreId()),
|
260 |
-
Mage::app()->getStore($product->getStoreId())->getWebsiteId(),
|
261 |
-
$current_group_id,
|
262 |
-
$product->getId()
|
263 |
-
);
|
264 |
|
265 |
-
|
266 |
-
$special_price = $discounted_price;
|
267 |
|
268 |
-
|
|
|
|
|
|
|
|
|
269 |
{
|
270 |
foreach ($groups as $group)
|
271 |
{
|
272 |
$group_id = (int)$group->getData('customer_group_id');
|
|
|
273 |
|
274 |
-
$discounted_price =
|
275 |
-
Mage::app()->getLocale()->storeTimeStamp($product->getStoreId()),
|
276 |
-
Mage::app()->getStore($product->getStoreId())->getWebsiteId(),
|
277 |
-
$group_id,
|
278 |
-
$product->getId()
|
279 |
-
);
|
280 |
|
281 |
if ($discounted_price !== false)
|
282 |
{
|
283 |
-
$customData[
|
284 |
-
$customData[
|
|
|
|
|
|
|
|
|
|
|
285 |
}
|
286 |
}
|
287 |
-
}
|
288 |
|
289 |
-
|
290 |
-
|
291 |
-
{
|
292 |
-
$special_price = (double) $product->getFinalPrice();
|
293 |
-
}
|
294 |
|
295 |
-
|
296 |
-
{
|
297 |
-
$customData['price']['special_from_date'] = strtotime($product->getSpecialFromDate());
|
298 |
-
$customData['price']['special_to_date'] = strtotime($product->getSpecialToDate());
|
299 |
|
300 |
-
$
|
|
|
|
|
|
|
301 |
|
302 |
-
|
303 |
-
$customData['price']['default'] = $special_price;
|
304 |
-
$customData['price']['default_formated'] = $product->getStore()->formatPrice($special_price, false);
|
305 |
-
}
|
306 |
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
$max = 0;
|
311 |
|
312 |
-
if ($
|
313 |
{
|
314 |
-
$
|
|
|
315 |
|
316 |
-
|
317 |
-
|
|
|
318 |
|
319 |
-
|
320 |
-
|
321 |
-
|
|
|
322 |
{
|
323 |
-
|
324 |
{
|
325 |
-
|
|
|
|
|
326 |
|
327 |
-
|
328 |
-
|
|
|
329 |
}
|
|
|
|
|
330 |
}
|
331 |
-
else
|
332 |
-
$min = $max; // avoid to have PHP_INT_MAX in case of no subproducts (Corner case of visibility and stock options)
|
333 |
-
}
|
334 |
|
335 |
-
|
336 |
-
{
|
337 |
-
$customData['price']['default_formated'] = $product->getStore()->formatPrice($min, false) . ' - ' . $product->getStore()->formatPrice($max, false);
|
338 |
-
|
339 |
-
if ($this->config->isCustomerGroupsEnabled($product->getStoreId()))
|
340 |
{
|
341 |
-
|
|
|
|
|
|
|
342 |
{
|
343 |
-
$
|
|
|
|
|
344 |
|
345 |
-
|
346 |
-
|
|
|
347 |
}
|
348 |
-
}
|
349 |
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
|
355 |
-
|
356 |
-
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
|
362 |
-
|
363 |
-
|
364 |
|
365 |
-
|
366 |
-
{
|
367 |
-
foreach ($groups as $group)
|
368 |
{
|
369 |
-
$
|
370 |
-
|
|
|
|
|
371 |
|
372 |
-
|
373 |
-
|
|
|
374 |
}
|
375 |
}
|
376 |
}
|
@@ -379,8 +382,9 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
379 |
|
380 |
public function getObject(Mage_Catalog_Model_Product $product)
|
381 |
{
|
|
|
382 |
$this->logger->start('CREATE RECORD '.$product->getId(). ' '.$this->logger->getStoreName($product->storeId));
|
383 |
-
$this->logger->log('Product type ('.$product->getTypeId().')');
|
384 |
$defaultData = array();
|
385 |
|
386 |
$transport = new Varien_Object($defaultData);
|
@@ -413,6 +417,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
413 |
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
|
414 |
->addAttributeToSelect('name')
|
415 |
->addAttributeToFilter('entity_id', $_categoryIds)
|
|
|
416 |
->addIsActiveFilter();
|
417 |
|
418 |
foreach ($categoryCollection as $category)
|
@@ -475,24 +480,39 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
475 |
|
476 |
if (false === isset($defaultData['thumbnail_url']))
|
477 |
{
|
|
|
|
|
478 |
try
|
479 |
{
|
480 |
-
$customData['thumbnail_url'] = $
|
481 |
$customData['thumbnail_url'] = str_replace(array('https://', 'http://'
|
482 |
), '//', $customData['thumbnail_url']);
|
483 |
}
|
484 |
-
catch (\Exception $e)
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
}
|
486 |
|
487 |
if (false === isset($defaultData['image_url']))
|
488 |
{
|
|
|
|
|
489 |
try
|
490 |
{
|
491 |
-
$customData['image_url'] =
|
492 |
$customData['image_url'] = str_replace(array('https://', 'http://'), '//', $customData['image_url']);
|
493 |
}
|
494 |
-
catch (\Exception $e)
|
|
|
|
|
|
|
495 |
|
|
|
|
|
496 |
|
497 |
if ($this->isAttributeEnabled($additionalAttributes, 'media_gallery'))
|
498 |
{
|
@@ -508,9 +528,9 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
508 |
$sub_products = null;
|
509 |
$ids = null;
|
510 |
|
511 |
-
if ($
|
512 |
{
|
513 |
-
if ($
|
514 |
{
|
515 |
$ids = array();
|
516 |
|
@@ -520,7 +540,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
520 |
$ids[] = $option->product_id;
|
521 |
}
|
522 |
|
523 |
-
if ($
|
524 |
$ids = $product->getTypeInstance(true)->getChildrenIds($product->getId());
|
525 |
|
526 |
if (count($ids))
|
@@ -567,7 +587,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
567 |
if ($value === null)
|
568 |
{
|
569 |
/** Get values as array in children */
|
570 |
-
if ($
|
571 |
{
|
572 |
$values = array();
|
573 |
|
@@ -591,7 +611,7 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
591 |
}
|
592 |
}
|
593 |
|
594 |
-
if (count($values) > 0)
|
595 |
{
|
596 |
$customData[$attribute['attribute']] = array_values(array_unique($values));
|
597 |
}
|
@@ -619,24 +639,13 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
|
|
619 |
|
620 |
$this->handlePrice($product, $sub_products, $customData);
|
621 |
|
622 |
-
if ($this->config->isCustomerGroupsEnabled())
|
623 |
-
{
|
624 |
-
$groups = Mage::getModel('customer/group')->getCollection();
|
625 |
-
|
626 |
-
foreach ($groups as $group)
|
627 |
-
{
|
628 |
-
$group_id = (int)$group->getData('customer_group_id');
|
629 |
-
$this->handlePrice($product, $sub_products, $customData, $groups, $group_id);
|
630 |
-
}
|
631 |
-
}
|
632 |
-
|
633 |
$transport = new Varien_Object($customData);
|
634 |
Mage::dispatchEvent('algolia_subproducts_index', array('custom_data' => $transport, 'sub_products' => $sub_products));
|
635 |
$customData = $transport->getData();
|
636 |
|
637 |
$customData = array_merge($customData, $defaultData);
|
638 |
|
639 |
-
$customData['type_id'] = $
|
640 |
|
641 |
$this->castProductObject($customData);
|
642 |
|
4 |
{
|
5 |
protected static $_productAttributes;
|
6 |
|
7 |
+
protected static $_predefinedProductAttributes = array('name', 'url_key', 'description', 'image', 'small_image', 'thumbnail');
|
8 |
|
9 |
protected function getIndexNameSuffix()
|
10 |
{
|
233 |
}
|
234 |
}
|
235 |
|
236 |
+
private function getFields($store)
|
237 |
{
|
238 |
+
$tax_helper = Mage::helper('tax');
|
239 |
|
240 |
+
if ($tax_helper->getPriceDisplayType($store) == Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX)
|
241 |
+
return array('price' => false);
|
242 |
|
243 |
+
if ($tax_helper->getPriceDisplayType($store) == Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX)
|
244 |
+
return array('price' => true);
|
|
|
|
|
|
|
245 |
|
246 |
+
return array('price' => false, 'price_with_tax' => true);
|
247 |
+
}
|
|
|
|
|
248 |
|
249 |
+
private function handlePrice(&$product, $sub_products, &$customData)
|
250 |
+
{
|
251 |
+
$fields = $this->getFields($product->getStore());
|
252 |
+
$customer_groups_enabled = $this->config->isCustomerGroupsEnabled($product->getStoreId());
|
253 |
+
$store = $product->getStore();
|
254 |
+
$type = $this->config->getMappedProductType($product->getTypeId());
|
255 |
+
|
256 |
+
$groups = array();
|
257 |
+
|
258 |
+
if ($customer_groups_enabled)
|
259 |
+
$groups = Mage::getModel('customer/group')->getCollection();
|
260 |
|
261 |
+
foreach ($fields as $field => $with_tax)
|
262 |
{
|
263 |
+
$price = (double) Mage::helper('tax')->getPrice($product, $product->getPrice(), $with_tax, null, null, null, $product->getStore(), null);
|
|
|
|
|
|
|
|
|
|
|
264 |
|
265 |
+
$customData[$field] = array();
|
|
|
266 |
|
267 |
+
$customData[$field]['default'] = $price;
|
268 |
+
$customData[$field]['default_formated'] = $product->getStore()->formatPrice($price, false);
|
269 |
+
|
270 |
+
|
271 |
+
if ($customer_groups_enabled) // If fetch special price for groups
|
272 |
{
|
273 |
foreach ($groups as $group)
|
274 |
{
|
275 |
$group_id = (int)$group->getData('customer_group_id');
|
276 |
+
$product->setCustomerGroupId($group_id);
|
277 |
|
278 |
+
$discounted_price = $product->getPriceModel()->getFinalPrice(1, $product);
|
|
|
|
|
|
|
|
|
|
|
279 |
|
280 |
if ($discounted_price !== false)
|
281 |
{
|
282 |
+
$customData[$field]['group_' . $group_id] = (double) Mage::helper('tax')->getPrice($product, $discounted_price, $with_tax, null, null, null, $product->getStore(), null);
|
283 |
+
$customData[$field]['group_' . $group_id . '_formated'] = $store->formatPrice($customData[$field]['group_' . $group_id], false);
|
284 |
+
}
|
285 |
+
else
|
286 |
+
{
|
287 |
+
$customData[$field]['group_' . $group_id] = $customData[$field]['default'];
|
288 |
+
$customData[$field]['group_' . $group_id . '_formated'] = $customData[$field]['default_formated'];
|
289 |
}
|
290 |
}
|
|
|
291 |
|
292 |
+
$product->setCustomerGroupId(null);
|
293 |
+
}
|
|
|
|
|
|
|
294 |
|
295 |
+
$special_price = (double) Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), $with_tax, null, null, null, $product->getStore(), null);
|
|
|
|
|
|
|
296 |
|
297 |
+
if ($special_price && $special_price !== $customData[$field]['default'])
|
298 |
+
{
|
299 |
+
$customData[$field]['special_from_date'] = strtotime($product->getSpecialFromDate());
|
300 |
+
$customData[$field]['special_to_date'] = strtotime($product->getSpecialToDate());
|
301 |
|
302 |
+
$customData[$field]['default_original_formated'] = $customData[$field]['default_formated'];
|
|
|
|
|
|
|
303 |
|
304 |
+
$customData[$field]['default'] = $special_price;
|
305 |
+
$customData[$field]['default_formated'] = $product->getStore()->formatPrice($special_price, false);
|
306 |
+
}
|
|
|
307 |
|
308 |
+
if ($type == 'configurable' || $type == 'grouped' || $type == 'bundle')
|
309 |
{
|
310 |
+
$min = PHP_INT_MAX;
|
311 |
+
$max = 0;
|
312 |
|
313 |
+
if ($type == 'bundle')
|
314 |
+
{
|
315 |
+
$_priceModel = $product->getPriceModel();
|
316 |
|
317 |
+
list($min, $max) = $_priceModel->getTotalPrices($product, null, $with_tax, true);
|
318 |
+
}
|
319 |
+
|
320 |
+
if ($type == 'grouped' || $type == 'configurable')
|
321 |
{
|
322 |
+
if (count($sub_products) > 0)
|
323 |
{
|
324 |
+
foreach ($sub_products as $sub_product)
|
325 |
+
{
|
326 |
+
$price = (double) Mage::helper('tax')->getPrice($product, $sub_product->getFinalPrice(), $with_tax, null, null, null, $product->getStore(), null);
|
327 |
|
328 |
+
$min = min($min, $price);
|
329 |
+
$max = max($max, $price);
|
330 |
+
}
|
331 |
}
|
332 |
+
else
|
333 |
+
$min = $max; // avoid to have PHP_INT_MAX in case of no subproducts (Corner case of visibility and stock options)
|
334 |
}
|
|
|
|
|
|
|
335 |
|
336 |
+
if ($min != $max)
|
|
|
|
|
|
|
|
|
337 |
{
|
338 |
+
$dashed_format = $product->getStore()->formatPrice($min, false) . ' - ' . $product->getStore()->formatPrice($max, false);
|
339 |
+
$customData[$field]['default_formated'] = $dashed_format;
|
340 |
+
|
341 |
+
if ($customer_groups_enabled)
|
342 |
{
|
343 |
+
foreach ($groups as $group)
|
344 |
+
{
|
345 |
+
$group_id = (int)$group->getData('customer_group_id');
|
346 |
|
347 |
+
$customData[$field]['group_' . $group_id] = 0;
|
348 |
+
$customData[$field]['group_' . $group_id . '_formated'] = $dashed_format;
|
349 |
+
}
|
350 |
}
|
|
|
351 |
|
352 |
+
//// Do not keep special price that is already taken into account in min max
|
353 |
+
unset($customData['price']['special_from_date']);
|
354 |
+
unset($customData['price']['special_to_date']);
|
355 |
+
unset($customData['price']['default_original_formated']);
|
356 |
|
357 |
+
$customData[$field]['default'] = 0; // will be reset just after
|
358 |
+
}
|
359 |
|
360 |
+
if ($customData[$field]['default'] == 0)
|
361 |
+
{
|
362 |
+
$customData[$field]['default'] = $min;
|
363 |
|
364 |
+
if ($min === $max)
|
365 |
+
$customData[$field]['default_formated'] = $product->getStore()->formatPrice($min, false);
|
366 |
|
367 |
+
if ($customer_groups_enabled)
|
|
|
|
|
368 |
{
|
369 |
+
foreach ($groups as $group)
|
370 |
+
{
|
371 |
+
$group_id = (int)$group->getData('customer_group_id');
|
372 |
+
$customData[$field]['group_' . $group_id] = $min;
|
373 |
|
374 |
+
if ($min === $max)
|
375 |
+
$customData[$field]['group_' . $group_id . '_formated'] = $customData[$field]['default_formated'];
|
376 |
+
}
|
377 |
}
|
378 |
}
|
379 |
}
|
382 |
|
383 |
public function getObject(Mage_Catalog_Model_Product $product)
|
384 |
{
|
385 |
+
$type = $this->config->getMappedProductType($product->getTypeId());
|
386 |
$this->logger->start('CREATE RECORD '.$product->getId(). ' '.$this->logger->getStoreName($product->storeId));
|
387 |
+
$this->logger->log('Product type ('.$product->getTypeId().', mapped to: ' . $type . ')');
|
388 |
$defaultData = array();
|
389 |
|
390 |
$transport = new Varien_Object($defaultData);
|
417 |
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
|
418 |
->addAttributeToSelect('name')
|
419 |
->addAttributeToFilter('entity_id', $_categoryIds)
|
420 |
+
->addFieldToFilter('level', array('gt' => 1))
|
421 |
->addIsActiveFilter();
|
422 |
|
423 |
foreach ($categoryCollection as $category)
|
480 |
|
481 |
if (false === isset($defaultData['thumbnail_url']))
|
482 |
{
|
483 |
+
$thumb = Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(75, 75);
|
484 |
+
|
485 |
try
|
486 |
{
|
487 |
+
$customData['thumbnail_url'] = $thumb->toString();
|
488 |
$customData['thumbnail_url'] = str_replace(array('https://', 'http://'
|
489 |
), '//', $customData['thumbnail_url']);
|
490 |
}
|
491 |
+
catch (\Exception $e)
|
492 |
+
{
|
493 |
+
$this->logger->log($e->getMessage());
|
494 |
+
$this->logger->log($e->getTraceAsString());
|
495 |
+
|
496 |
+
$customData['thumbnail_url'] = str_replace(array('https://', 'http://'), '//', Mage::getDesign()->getSkinUrl($thumb->getPlaceholder()));
|
497 |
+
}
|
498 |
}
|
499 |
|
500 |
if (false === isset($defaultData['image_url']))
|
501 |
{
|
502 |
+
$image = Mage::helper('catalog/image')->init($product, $this->config->getImageType())->resize($this->config->getImageWidth(), $this->config->getImageHeight());
|
503 |
+
|
504 |
try
|
505 |
{
|
506 |
+
$customData['image_url'] = $image->toString();
|
507 |
$customData['image_url'] = str_replace(array('https://', 'http://'), '//', $customData['image_url']);
|
508 |
}
|
509 |
+
catch (\Exception $e)
|
510 |
+
{
|
511 |
+
$this->logger->log($e->getMessage());
|
512 |
+
$this->logger->log($e->getTraceAsString());
|
513 |
|
514 |
+
$customData['image_url'] = str_replace(array('https://', 'http://'), '//', Mage::getDesign()->getSkinUrl($image->getPlaceholder()));
|
515 |
+
}
|
516 |
|
517 |
if ($this->isAttributeEnabled($additionalAttributes, 'media_gallery'))
|
518 |
{
|
528 |
$sub_products = null;
|
529 |
$ids = null;
|
530 |
|
531 |
+
if ($type == 'configurable' || $type == 'grouped' || $type == 'bundle')
|
532 |
{
|
533 |
+
if ($type == 'bundle')
|
534 |
{
|
535 |
$ids = array();
|
536 |
|
540 |
$ids[] = $option->product_id;
|
541 |
}
|
542 |
|
543 |
+
if ($type == 'configurable' || $type == 'grouped')
|
544 |
$ids = $product->getTypeInstance(true)->getChildrenIds($product->getId());
|
545 |
|
546 |
if (count($ids))
|
587 |
if ($value === null)
|
588 |
{
|
589 |
/** Get values as array in children */
|
590 |
+
if ($type == 'configurable' || $type == 'grouped' || $type == 'bundle')
|
591 |
{
|
592 |
$values = array();
|
593 |
|
611 |
}
|
612 |
}
|
613 |
|
614 |
+
if (is_array($values) && count($values) > 0)
|
615 |
{
|
616 |
$customData[$attribute['attribute']] = array_values(array_unique($values));
|
617 |
}
|
639 |
|
640 |
$this->handlePrice($product, $sub_products, $customData);
|
641 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
642 |
$transport = new Varien_Object($customData);
|
643 |
Mage::dispatchEvent('algolia_subproducts_index', array('custom_data' => $transport, 'sub_products' => $sub_products));
|
644 |
$customData = $transport->getData();
|
645 |
|
646 |
$customData = array_merge($customData, $defaultData);
|
647 |
|
648 |
+
$customData['type_id'] = $type;
|
649 |
|
650 |
$this->castProductObject($customData);
|
651 |
|
app/code/community/Algolia/Algoliasearch/Helper/Image.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Algolia_Algoliasearch_Helper_Image extends Mage_Catalog_Helper_Image
|
4 |
+
{
|
5 |
+
/*
|
6 |
+
* Override to be able to catch the error
|
7 |
+
*/
|
8 |
+
public function toString()
|
9 |
+
{
|
10 |
+
$model = $this->_getModel();
|
11 |
+
|
12 |
+
if ($this->getImageFile())
|
13 |
+
$model->setBaseFile($this->getImageFile());
|
14 |
+
else
|
15 |
+
$model->setBaseFile($this->getProduct()->getData($model->getDestinationSubdir()));
|
16 |
+
|
17 |
+
if ($model->isCached())
|
18 |
+
return $model->getUrl();
|
19 |
+
|
20 |
+
|
21 |
+
if ($this->_scheduleRotate)
|
22 |
+
$model->rotate($this->getAngle());
|
23 |
+
|
24 |
+
if ($this->_scheduleResize)
|
25 |
+
$model->resize();
|
26 |
+
|
27 |
+
if ($this->getWatermark())
|
28 |
+
$model->setWatermark($this->getWatermark());
|
29 |
+
|
30 |
+
$url = $model->saveFile()->getUrl();
|
31 |
+
|
32 |
+
return $url;
|
33 |
+
}
|
34 |
+
}
|
app/code/community/Algolia/Algoliasearch/Model/Resource/Engine.php
CHANGED
@@ -86,19 +86,41 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
|
|
86 |
public function rebuildPages()
|
87 |
{
|
88 |
foreach (Mage::app()->getStores() as $store)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
$this->addToQueue('algoliasearch/observer', 'rebuildPageIndex', array('store_id' => $store->getId()), $this->config->getQueueMaxRetries());
|
|
|
90 |
}
|
91 |
|
92 |
public function rebuildAdditionalSections()
|
93 |
{
|
94 |
foreach (Mage::app()->getStores() as $store)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
$this->addToQueue('algoliasearch/observer', 'rebuildAdditionalSectionsIndex', array('store_id' => $store->getId()), $this->config->getQueueMaxRetries());
|
|
|
96 |
}
|
97 |
|
98 |
public function rebuildSuggestions()
|
99 |
{
|
100 |
foreach (Mage::app()->getStores() as $store)
|
101 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
$size = $this->suggestion_helper->getSuggestionCollectionQuery($store->getId())->getSize();
|
103 |
$by_page = $this->config->getNumberOfElementByPage();
|
104 |
$nb_page = ceil($size / $by_page);
|
@@ -120,6 +142,12 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
|
|
120 |
{
|
121 |
foreach (Mage::app()->getStores() as $store)
|
122 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
if ($store->getIsActive())
|
124 |
{
|
125 |
$this->_rebuildProductIndex($store->getId(), array());
|
@@ -135,6 +163,12 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
|
|
135 |
{
|
136 |
foreach (Mage::app()->getStores() as $store)
|
137 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
if ($store->getIsActive())
|
139 |
{
|
140 |
$this->addToQueue('algoliasearch/observer', 'rebuildCategoryIndex', array('store_id' => $store->getId(), 'category_ids' => array()), $this->config->getQueueMaxRetries());
|
86 |
public function rebuildPages()
|
87 |
{
|
88 |
foreach (Mage::app()->getStores() as $store)
|
89 |
+
{
|
90 |
+
if ($this->config->isEnabledBackEnd($store->getId()) === false)
|
91 |
+
{
|
92 |
+
$this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
|
93 |
+
continue;
|
94 |
+
}
|
95 |
+
|
96 |
$this->addToQueue('algoliasearch/observer', 'rebuildPageIndex', array('store_id' => $store->getId()), $this->config->getQueueMaxRetries());
|
97 |
+
}
|
98 |
}
|
99 |
|
100 |
public function rebuildAdditionalSections()
|
101 |
{
|
102 |
foreach (Mage::app()->getStores() as $store)
|
103 |
+
{
|
104 |
+
if ($this->config->isEnabledBackEnd($store->getId()) === false)
|
105 |
+
{
|
106 |
+
$this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
|
107 |
+
continue;
|
108 |
+
}
|
109 |
+
|
110 |
$this->addToQueue('algoliasearch/observer', 'rebuildAdditionalSectionsIndex', array('store_id' => $store->getId()), $this->config->getQueueMaxRetries());
|
111 |
+
}
|
112 |
}
|
113 |
|
114 |
public function rebuildSuggestions()
|
115 |
{
|
116 |
foreach (Mage::app()->getStores() as $store)
|
117 |
{
|
118 |
+
if ($this->config->isEnabledBackEnd($store->getId()) === false)
|
119 |
+
{
|
120 |
+
$this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
|
121 |
+
continue;
|
122 |
+
}
|
123 |
+
|
124 |
$size = $this->suggestion_helper->getSuggestionCollectionQuery($store->getId())->getSize();
|
125 |
$by_page = $this->config->getNumberOfElementByPage();
|
126 |
$nb_page = ceil($size / $by_page);
|
142 |
{
|
143 |
foreach (Mage::app()->getStores() as $store)
|
144 |
{
|
145 |
+
if ($this->config->isEnabledBackEnd($store->getId()) === false)
|
146 |
+
{
|
147 |
+
$this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
|
148 |
+
continue;
|
149 |
+
}
|
150 |
+
|
151 |
if ($store->getIsActive())
|
152 |
{
|
153 |
$this->_rebuildProductIndex($store->getId(), array());
|
163 |
{
|
164 |
foreach (Mage::app()->getStores() as $store)
|
165 |
{
|
166 |
+
if ($this->config->isEnabledBackEnd($store->getId()) === false)
|
167 |
+
{
|
168 |
+
$this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
|
169 |
+
continue;
|
170 |
+
}
|
171 |
+
|
172 |
if ($store->getIsActive())
|
173 |
{
|
174 |
$this->addToQueue('algoliasearch/observer', 'rebuildCategoryIndex', array('store_id' => $store->getId(), 'category_ids' => array()), $this->config->getQueueMaxRetries());
|
app/code/community/Algolia/Algoliasearch/Model/System/Imagetype.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Source model for select image type
|
4 |
+
*/
|
5 |
+
|
6 |
+
class Algolia_Algoliasearch_Model_System_Imagetype
|
7 |
+
{
|
8 |
+
public function toOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
array('value'=>'image', 'label' => Mage::helper('core')->__('Base Image')),
|
12 |
+
array('value'=>'small_image', 'label' => Mage::helper('core')->__('Small Image')),
|
13 |
+
array('value'=>'thumbnail', 'label' => Mage::helper('core')->__('Thumbnail')),
|
14 |
+
);
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Algolia/Algoliasearch/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Algolia_Algoliasearch>
|
5 |
-
<version>1.4.
|
6 |
</Algolia_Algoliasearch>
|
7 |
</modules>
|
8 |
<frontend>
|
@@ -30,6 +30,11 @@
|
|
30 |
<algoliasearch>
|
31 |
<class>Algolia_Algoliasearch_Helper</class>
|
32 |
</algoliasearch>
|
|
|
|
|
|
|
|
|
|
|
33 |
</helpers>
|
34 |
<blocks>
|
35 |
<algoliasearch>
|
@@ -175,11 +180,23 @@
|
|
175 |
<number_of_job_to_run>300</number_of_job_to_run>
|
176 |
<noprocess>0</noprocess>
|
177 |
</queue>
|
|
|
|
|
|
|
|
|
|
|
178 |
<advanced>
|
179 |
<partial_update>0</partial_update>
|
180 |
<make_seo_request>1</make_seo_request>
|
181 |
<remove_branding>0</remove_branding>
|
182 |
</advanced>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
</algoliasearch>
|
184 |
</default>
|
185 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Algolia_Algoliasearch>
|
5 |
+
<version>1.4.8</version>
|
6 |
</Algolia_Algoliasearch>
|
7 |
</modules>
|
8 |
<frontend>
|
30 |
<algoliasearch>
|
31 |
<class>Algolia_Algoliasearch_Helper</class>
|
32 |
</algoliasearch>
|
33 |
+
<catalog>
|
34 |
+
<rewrite>
|
35 |
+
<image>Algolia_Algoliasearch_Helper_Image</image>
|
36 |
+
</rewrite>
|
37 |
+
</catalog>
|
38 |
</helpers>
|
39 |
<blocks>
|
40 |
<algoliasearch>
|
180 |
<number_of_job_to_run>300</number_of_job_to_run>
|
181 |
<noprocess>0</noprocess>
|
182 |
</queue>
|
183 |
+
<image>
|
184 |
+
<width>265</width>
|
185 |
+
<height>265</height>
|
186 |
+
<type>image</type>
|
187 |
+
</image>
|
188 |
<advanced>
|
189 |
<partial_update>0</partial_update>
|
190 |
<make_seo_request>1</make_seo_request>
|
191 |
<remove_branding>0</remove_branding>
|
192 |
</advanced>
|
193 |
+
<product_map>
|
194 |
+
<!--
|
195 |
+
This is for custom product types. The node's name is the type of the custom product
|
196 |
+
and the value is the name of the Magento product type.
|
197 |
+
-->
|
198 |
+
<kit>grouped</kit>
|
199 |
+
</product_map>
|
200 |
</algoliasearch>
|
201 |
</default>
|
202 |
</config>
|
app/code/community/Algolia/Algoliasearch/etc/system.xml
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<algoliasearch translate="label" module="algoliasearch">
|
5 |
<label>
|
6 |
<![CDATA[
|
7 |
-
Algolia Search 1.4.
|
8 |
<style>
|
9 |
.algoliasearch-admin-menu span {
|
10 |
padding-left: 38px !important;
|
@@ -572,11 +572,52 @@
|
|
572 |
</noprocess>
|
573 |
</fields>
|
574 |
</queue>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
575 |
<advanced translate="label">
|
576 |
<label>Advanced Configuration</label>
|
577 |
<expanded>0</expanded>
|
578 |
<frontend_type>text</frontend_type>
|
579 |
-
<sort_order>
|
580 |
<show_in_default>1</show_in_default>
|
581 |
<show_in_website>1</show_in_website>
|
582 |
<show_in_store>1</show_in_store>
|
4 |
<algoliasearch translate="label" module="algoliasearch">
|
5 |
<label>
|
6 |
<![CDATA[
|
7 |
+
Algolia Search 1.4.8
|
8 |
<style>
|
9 |
.algoliasearch-admin-menu span {
|
10 |
padding-left: 38px !important;
|
572 |
</noprocess>
|
573 |
</fields>
|
574 |
</queue>
|
575 |
+
<image translate="label">
|
576 |
+
<label>Image Configuration</label>
|
577 |
+
<expanded>1</expanded>
|
578 |
+
<frontend_type>text</frontend_type>
|
579 |
+
<sort_order>80</sort_order>
|
580 |
+
<show_in_default>1</show_in_default>
|
581 |
+
<show_in_website>1</show_in_website>
|
582 |
+
<show_in_store>1</show_in_store>
|
583 |
+
<fields>
|
584 |
+
<width translate="label comment">
|
585 |
+
<label>Width</label>
|
586 |
+
<frontend_type>text</frontend_type>
|
587 |
+
<validate>validate-digits</validate>
|
588 |
+
<sort_order>10</sort_order>
|
589 |
+
<show_in_default>1</show_in_default>
|
590 |
+
<show_in_website>1</show_in_website>
|
591 |
+
<show_in_store>1</show_in_store>
|
592 |
+
</width>
|
593 |
+
<height translate="label comment">
|
594 |
+
<label>Height</label>
|
595 |
+
<frontend_type>text</frontend_type>
|
596 |
+
<validate>validate-digits</validate>
|
597 |
+
<sort_order>10</sort_order>
|
598 |
+
<show_in_default>1</show_in_default>
|
599 |
+
<show_in_website>1</show_in_website>
|
600 |
+
<show_in_store>1</show_in_store>
|
601 |
+
<comment><![CDATA[You can specify the size of the images used at the Search Results Page.<br />
|
602 |
+
If your images are already present in some size, eg. 265x265, Algolia's index job may not have to resize those, potentially saving time and resources.]]></comment>
|
603 |
+
</height>
|
604 |
+
<type translate="label comment">
|
605 |
+
<label>Type</label>
|
606 |
+
<frontend_type>select</frontend_type>
|
607 |
+
<source_model>algoliasearch/system_imagetype</source_model>
|
608 |
+
<sort_order>20</sort_order>
|
609 |
+
<show_in_default>1</show_in_default>
|
610 |
+
<show_in_website>1</show_in_website>
|
611 |
+
<show_in_store>1</show_in_store>
|
612 |
+
<comment>The image used at the Search Results Page.</comment>
|
613 |
+
</type>
|
614 |
+
</fields>
|
615 |
+
</image>
|
616 |
<advanced translate="label">
|
617 |
<label>Advanced Configuration</label>
|
618 |
<expanded>0</expanded>
|
619 |
<frontend_type>text</frontend_type>
|
620 |
+
<sort_order>90</sort_order>
|
621 |
<show_in_default>1</show_in_default>
|
622 |
<show_in_website>1</show_in_website>
|
623 |
<show_in_store>1</show_in_store>
|
app/design/frontend/base/default/template/algoliasearch/topsearch.phtml
CHANGED
@@ -1183,6 +1183,11 @@ $class = $isSearchPage ? 'search-page' : '';
|
|
1183 |
if (Array.isArray(hit.price))
|
1184 |
hit.price = hit.price[0];
|
1185 |
|
|
|
|
|
|
|
|
|
|
|
1186 |
}
|
1187 |
|
1188 |
if (indices[i] == 'categories')
|
@@ -1356,6 +1361,12 @@ $class = $isSearchPage ? 'search-page' : '';
|
|
1356 |
delete content.hits[i].price_with_tax;
|
1357 |
delete content.hits[i].price_with_tax_formated;
|
1358 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1359 |
}
|
1360 |
|
1361 |
/**
|
@@ -1682,8 +1693,21 @@ $class = $isSearchPage ? 'search-page' : '';
|
|
1682 |
getRefinementsFromUrl();
|
1683 |
}
|
1684 |
|
|
|
1685 |
if (supportsHistory) {
|
1686 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1687 |
} else {
|
1688 |
window.addEventListener("hashchange", getRefinementsFromUrl);
|
1689 |
}
|
1183 |
if (Array.isArray(hit.price))
|
1184 |
hit.price = hit.price[0];
|
1185 |
|
1186 |
+
if ('<?php echo $price_key; ?>' !== '.default' && hit['price']['<?php echo $price_key; ?>'.substr(1) + '_formated'] !== hit['price']['default_formated'])
|
1187 |
+
{
|
1188 |
+
hit['price']['<?php echo $price_key; ?>'.substr(1) + '_original_formated'] = hit['price']['default_formated'];
|
1189 |
+
}
|
1190 |
+
|
1191 |
}
|
1192 |
|
1193 |
if (indices[i] == 'categories')
|
1361 |
delete content.hits[i].price_with_tax;
|
1362 |
delete content.hits[i].price_with_tax_formated;
|
1363 |
}
|
1364 |
+
|
1365 |
+
if ('<?php echo $price_key; ?>' !== '.default' && content.hits[i]['price']['<?php echo $price_key; ?>'.substr(1) + '_formated'] !== content.hits[i]['price']['default_formated'])
|
1366 |
+
{
|
1367 |
+
content.hits[i]['price']['<?php echo $price_key; ?>'.substr(1) + '_original_formated'] = content.hits[i]['price']['default_formated'];
|
1368 |
+
}
|
1369 |
+
|
1370 |
}
|
1371 |
|
1372 |
/**
|
1693 |
getRefinementsFromUrl();
|
1694 |
}
|
1695 |
|
1696 |
+
|
1697 |
if (supportsHistory) {
|
1698 |
+
// FIX SAFARI ISSUE
|
1699 |
+
if (document.readyState !== 'complete') {
|
1700 |
+
// load event has not fired
|
1701 |
+
window.addEventListener('load', function() {
|
1702 |
+
setTimeout(function() {
|
1703 |
+
window.addEventListener("popstate", getRefinementsFromUrl);
|
1704 |
+
}, 0);
|
1705 |
+
}, false);
|
1706 |
+
}
|
1707 |
+
else {
|
1708 |
+
// load event has fired
|
1709 |
+
window.addEventListener("popstate", getRefinementsFromUrl);
|
1710 |
+
}
|
1711 |
} else {
|
1712 |
window.addEventListener("hashchange", getRefinementsFromUrl);
|
1713 |
}
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>algoliasearch</name>
|
4 |
-
<version>1.4.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://github.com/algolia/algoliasearch-magento/blob/master/LICENSE.txt">MIT</license>
|
7 |
<channel>community</channel>
|
@@ -11,18 +11,17 @@
|
|
11 |

|
12 |
This extension replaces Magento's FullText Search module and provide an as-you-type auto-completion menu in your searchbar.
|
13 |
</description>
|
14 |
-
<notes>- NEW:
|
15 |
-
- NEW:
|
16 |
-
-
|
17 |
-
- UPDATED:
|
18 |
-
- UPDATED:
|
19 |
-
- FIX:
|
20 |
-
- FIX: issue with
|
21 |
-
- FIX: corner case for price with visibility and stock options</notes>
|
22 |
<authors><author><name>Algolia Team</name><user>algolia</user><email>support@algolia.com</email></author></authors>
|
23 |
-
<date>2015-10-
|
24 |
-
<time>
|
25 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Algolia_Algoliasearch.xml" hash="17a1452f533423291332642969b41a53"/></dir></target><target name="magecommunity"><dir name="Algolia"><dir name="Algoliasearch"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Additionalsections.php" hash="696703aeb119749f661201d292bbf922"/><file name="Custompages.php" hash="f87a9cf7b5559717cd9d6570374dcda7"/><file name="Customrankingcategory.php" hash="6d9575c12dbaecf9054de1cf12736025"/><file name="Customrankingproduct.php" hash="6d1b145e37c4f22d5b56f5783ac47511"/><file name="Customsortorder.php" hash="786c8f8fca2e4b41b8732f5fe270491b"/><file name="Customsortordercategory.php" hash="9908ea7f463138d3047c51b98591db9c"/><file name="Customsortorderproduct.php" hash="ee62901a3911bb7784467e1ca5cd8e84"/><file name="Facets.php" hash="097998767edeee986958f421979ea141"/><file name="Select.php" hash="6e3cb4c1798775048bebbdc878e90aa9"/><file name="Sorts.php" hash="fede73c4ecbe39bf0344fbf6de46ed95"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Algoliahelper.php" hash="ff48a4929fffd913da57868457ace02f"/><file name="Config.php" hash="
|
26 |
<compatible/>
|
27 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
28 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>algoliasearch</name>
|
4 |
+
<version>1.4.8</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://github.com/algolia/algoliasearch-magento/blob/master/LICENSE.txt">MIT</license>
|
7 |
<channel>community</channel>
|
11 |

|
12 |
This extension replaces Magento's FullText Search module and provide an as-you-type auto-completion menu in your searchbar.
|
13 |
</description>
|
14 |
+
<notes>- NEW: allow to have custom product types
|
15 |
+
- NEW: make image generation size parameter customizable to be able to save ressources when already in cache
|
16 |
+
- UPDATED: remove root category when fetching product categories
|
17 |
+
- UPDATED: rewrite image class to be able to log the error when not being able to generate it
|
18 |
+
- UPDATED: Handle display price with AND without tax
|
19 |
+
- FIX: price issues
|
20 |
+
- FIX: Safari issue with instant search</notes>
|
|
|
21 |
<authors><author><name>Algolia Team</name><user>algolia</user><email>support@algolia.com</email></author></authors>
|
22 |
+
<date>2015-10-19</date>
|
23 |
+
<time>10:21:56</time>
|
24 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Algolia_Algoliasearch.xml" hash="17a1452f533423291332642969b41a53"/></dir></target><target name="magecommunity"><dir name="Algolia"><dir name="Algoliasearch"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Additionalsections.php" hash="696703aeb119749f661201d292bbf922"/><file name="Custompages.php" hash="f87a9cf7b5559717cd9d6570374dcda7"/><file name="Customrankingcategory.php" hash="6d9575c12dbaecf9054de1cf12736025"/><file name="Customrankingproduct.php" hash="6d1b145e37c4f22d5b56f5783ac47511"/><file name="Customsortorder.php" hash="786c8f8fca2e4b41b8732f5fe270491b"/><file name="Customsortordercategory.php" hash="9908ea7f463138d3047c51b98591db9c"/><file name="Customsortorderproduct.php" hash="ee62901a3911bb7784467e1ca5cd8e84"/><file name="Facets.php" hash="097998767edeee986958f421979ea141"/><file name="Select.php" hash="6e3cb4c1798775048bebbdc878e90aa9"/><file name="Sorts.php" hash="fede73c4ecbe39bf0344fbf6de46ed95"/></dir></dir></dir></dir></dir><dir name="Helper"><file name="Algoliahelper.php" hash="ff48a4929fffd913da57868457ace02f"/><file name="Config.php" hash="48a19659205b94a1fdc3a42315fa30ca"/><file name="Data.php" hash="c567e268fb312749e894ac628571ffb8"/><dir name="Entity"><file name="Additionalsectionshelper.php" hash="5d20d805b31b7dec4feb943c5e6a96ef"/><file name="Categoryhelper.php" hash="8a3caaa6a8e988d1ffd8c11486944535"/><file name="Helper.php" hash="85d9be2a624e882996cb27fc0ff38826"/><file name="Pagehelper.php" hash="7a0dcb237f6720d1637c48fc05a7d45e"/><file name="Producthelper.php" hash="6250a2b8776e56f0d3474ae35547b54c"/><file name="Suggestionhelper.php" hash="52f709b27a94c66aa9f7af8648dcb30a"/></dir><file name="Image.php" hash="e81357a72f4f87fb917c9a07d75f954d"/><file name="Logger.php" hash="fede0bd23b1beff2520d361293217834"/></dir><dir name="Model"><dir name="Indexer"><file name="Algolia.php" hash="e5ab21e69fb6dd8ea10a5e2ed2ae36c7"/><file name="Algoliaadditionalsections.php" hash="3113413441afccba3b8e79aa9fd8cdb1"/><file name="Algoliacategories.php" hash="fbeb6fde82dd44ecd1b098db7676152e"/><file name="Algoliapages.php" hash="26ea3afee58d07b721c5cd74b3d6c4e3"/><file name="Algoliasuggestions.php" hash="7020d40bae60469d0acc7138ee72a419"/></dir><file name="Observer.php" hash="7f6dc79b711e09d1e36465dc91d22191"/><file name="Queue.php" hash="4e0c7559dd15b4cbd75cf41ab90f5bdf"/><dir name="Resource"><file name="Engine.php" hash="99528be32e8020d2b477d9c7246e85cd"/><dir name="Fulltext"><file name="Collection.php" hash="849c1a8fd656150fb97d89346ac62c68"/></dir><file name="Fulltext.php" hash="e30d5d08ea1dce98248d3a8b5a4e8955"/></dir><dir name="System"><file name="Imagetype.php" hash="5fd4dbd98818a15b0253c5988a65a785"/><file name="Removewords.php" hash="69c9727a324b657f7cfdf7f5d06e3cbc"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="ea4176ed43885e531f90d1f5369f29ee"/><file name="config.xml" hash="0e08b76f8ca09d47652342d698bb4f95"/><file name="system.xml" hash="153368248bdc5eae851b096d683276f4"/></dir><dir name="sql"><dir name="algoliasearch_setup"><file name="mysql4-install-0.1.0.php" hash="fffd964f9c60be7909ec216260c37ba0"/><file name="mysql4-upgrade-0.1.0-1.4.7.php" hash="5224f8f1031a0659c64d393392a7f199"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="algoliasearch.xml" hash="f0df0b6ed09d186da4429577aefd346d"/></dir><dir name="template"><dir name="algoliasearch"><file name="topsearch.phtml" hash="4be9535ec3e26d8ad3578b2e2290d67c"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="algoliasearch"><file name="algolia-admin-menu.png" hash="9202a559c30a43d4d4bbc2f9ee774fd9"/><file name="algolia-logo.png" hash="190884b3e8652f3517754ae15bca31de"/><file name="algoliasearch.css" hash="1b85791da996184de93f54e54feca9c3"/><file name="bundle.css" hash="10df17cf0f50b56246a2ba017adcdae3"/><dir name="images"><file name="ui-bg_diagonals-thick_18_b81900_40x40.png" hash="62568c006bb1066f40fd5f9cfe4489be"/><file name="ui-bg_diagonals-thick_20_666666_40x40.png" hash="406541454ec466d93217826588335194"/><file name="ui-bg_flat_10_000000_40x100.png" hash="85243ed808c91ae60d33bda3a6bdee3c"/><file name="ui-bg_glass_100_f6f6f6_1x400.png" hash="f912ffca9b1919ab26c64cf1332c5322"/><file name="ui-bg_glass_100_fdf5ce_1x400.png" hash="a9b41e3f4db0fb9be1cd2c649deb253f"/><file name="ui-bg_glass_65_ffffff_1x400.png" hash="ff9e9b45e03f11808144324fd5350612"/><file name="ui-bg_gloss-wave_35_f6a828_500x100.png" hash="08ece8908c07b1c0d18b8db076ff50fc"/><file name="ui-bg_highlight-soft_100_eeeeee_1x100.png" hash="72fe4b0e1bbb83dfd6787989d3583fbe"/><file name="ui-bg_highlight-soft_75_ffe45c_1x100.png" hash="81262299ac7f591fd1763c1ccee0691f"/><file name="ui-icons_222222_256x240.png" hash="3a3c5468f484f07ac4a320d9e22acb8c"/><file name="ui-icons_228ef1_256x240.png" hash="92b29683b6a48eae7de7eb4b1cfa039c"/><file name="ui-icons_ef8c08_256x240.png" hash="f492970693640894fb54166c75dd2925"/><file name="ui-icons_ffd27a_256x240.png" hash="dda1b6f694b0d196aefc66a1d6d758f6"/><file name="ui-icons_ffffff_256x240.png" hash="41612b0f4a034424f8321c9f824a94da"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="algoliasearch"><file name="bundle.min.js" hash="50dc171cb2cbd89fda2a18a4b64e6e4c"/></dir></dir><dir name="lib"><dir name="AlgoliaSearch"><file name="AlgoliaException.php" hash="4acaa7c9142e19d1084295a3b8ba18e2"/><file name="Client.php" hash="11ad687a9868a9f574ae6a069800dd2c"/><file name="ClientContext.php" hash="77d2449636d263162460a7ccaea4e6b6"/><file name="Index.php" hash="5c1eacc54cd503bff296e9bbbd402895"/><file name="Version.php" hash="0c37eb6324361991364e0efd2696e56d"/><dir name="resources"><file name="ca-bundle.crt" hash="47961e7ef15667c93cd99be01b51f00a"/></dir></dir></dir></target></contents>
|
25 |
<compatible/>
|
26 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
27 |
</package>
|