From 5248708e22d27ee136fdad7ad7ed621a69648979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Macro=20Br=C3=A4uner?= Date: Wed, 11 Apr 2018 13:40:01 +0200 Subject: [PATCH 1/7] escape regex special chars in search term --- .../community/FACTFinder/Suggest/Model/Handler/Suggest.php | 4 ++-- src/js/factfinder/suggest.js | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/code/community/FACTFinder/Suggest/Model/Handler/Suggest.php b/src/app/code/community/FACTFinder/Suggest/Model/Handler/Suggest.php index 96ae4cc5..7045a894 100644 --- a/src/app/code/community/FACTFinder/Suggest/Model/Handler/Suggest.php +++ b/src/app/code/community/FACTFinder/Suggest/Model/Handler/Suggest.php @@ -128,7 +128,7 @@ protected function _assembleSuggestResult() if ($suggestResult != null){ $mergedSuggestResults = $suggestResult; } - + foreach ($this->_secondaryChannels AS $channel) { $params = array('channel' => $channel); $this->_getFacade()->configureSuggestAdapter($params, $channel); @@ -139,7 +139,7 @@ protected function _assembleSuggestResult() } } - $resultArray = array(); + $resultArray = array('suggestions' => array()); if ($mergedSuggestResults) { foreach ($mergedSuggestResults as $resultQuery) { /** @var $resultQuery FACTFinder\Data\SuggestQuery */ diff --git a/src/js/factfinder/suggest.js b/src/js/factfinder/suggest.js index a6881b7f..d0184995 100644 --- a/src/js/factfinder/suggest.js +++ b/src/js/factfinder/suggest.js @@ -248,7 +248,7 @@ var FactFinderSuggest = Class.create(Varien.searchForm, { }, loadDataCallback: function (data) { - if (data.suggestions) { + if (typeof data.suggestions !== 'undefined') { data = data.suggestions; } @@ -295,7 +295,9 @@ var FactFinderSuggest = Class.create(Varien.searchForm, { temp += ''; } - temp += item.name.replace(new RegExp("("+this.field.value+")","ig"), '$1'); + var searchString = this.field.value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); + + temp += item.name.replace(new RegExp("(" + searchString + ")", "ig"), '$1'); if (item.attributes.parentCategory) { temp += ' (' + decodeURIComponent(item.attributes.parentCategory) + ')'; From 7ae7611e91a9b53b893b76c64dbb460ef3d09499 Mon Sep 17 00:00:00 2001 From: MarcoB Date: Thu, 8 Nov 2018 15:03:12 +0100 Subject: [PATCH 2/7] fix product url --- .../FACTFinder/Core/Model/Export/Type/Product.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/code/community/FACTFinder/Core/Model/Export/Type/Product.php b/src/app/code/community/FACTFinder/Core/Model/Export/Type/Product.php index 777ba269..a12fc9ce 100644 --- a/src/app/code/community/FACTFinder/Core/Model/Export/Type/Product.php +++ b/src/app/code/community/FACTFinder/Core/Model/Export/Type/Product.php @@ -270,6 +270,9 @@ protected function _getFile($storeId) public function doExport($storeId = null) { $this->_resetInternalState(); + if(!is_null($storeId)) { + Mage::app()->setCurrentStore($storeId); + } $idFieldName = Mage::helper('factfinder/search')->getIdFieldName(); @@ -470,14 +473,15 @@ protected function getHelper() */ protected function getProductUrl($productId, $storeId) { - $product = Mage::getModel('catalog/product') + $productUrl = Mage::getModel('catalog/product') ->getCollection() ->addAttributeToFilter('entity_id', $productId) ->setStoreId($storeId) ->setPage(1, 1) - ->getFirstItem(); + ->addUrlRewrite() + ->getFirstItem() + ->getProductUrl(false); - $productUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . $product->getRequestPath(); return $productUrl; } From 276236c99452f97ea234348984da6fcf50c4effe Mon Sep 17 00:00:00 2001 From: MarcoB Date: Fri, 9 Nov 2018 18:31:45 +0100 Subject: [PATCH 3/7] [issue-277] fix empty sorting in toolbar --- .../Block/Catalog/Product/List/Toolbar.php | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/app/code/community/FACTFinder/Core/Block/Catalog/Product/List/Toolbar.php b/src/app/code/community/FACTFinder/Core/Block/Catalog/Product/List/Toolbar.php index 4382f162..36ee740a 100644 --- a/src/app/code/community/FACTFinder/Core/Block/Catalog/Product/List/Toolbar.php +++ b/src/app/code/community/FACTFinder/Core/Block/Catalog/Product/List/Toolbar.php @@ -363,17 +363,25 @@ protected function initSortings($sortingId) $sortings = $this->_handler->getSorting(); - // relevance default and has no directions - if ($sortingId == $this->_orderField) { - $sorting = $sortings[0]; - $this->_sortings[$sortingId] = $sorting->getUrl(); - } elseif (!isset($this->_sortings[$sortingId])) { - /** @var \FACTFinder\Data\Item $sorting */ - foreach ($sortings as $sorting) { - $url = $sorting->getUrl(); - if (strpos($url, $sortingId) !== false) { - $this->_sortings[$sortingId] = $sorting->getUrl(); - break; + + if ($sortings instanceof \FACTFinder\Data\Sorting) { + // relevance default and has no directions + if ($sortingId == $this->_orderField) { + $sortings->rewind(); + if ($sortings->count() > 0) { + $sorting = $sortings->current(); + if ($sorting instanceof \FACTFinder\Data\Item) { + $this->_sortings[$sortingId] = $sorting->getUrl(); + } + } elseif (!isset($this->_sortings[$sortingId])) { + /** @var \FACTFinder\Data\Item $sorting */ + foreach ($sortings as $sorting) { + $url = $sorting->getUrl(); + if (strpos($url, $sortingId) !== false) { + $this->_sortings[$sortingId] = $sorting->getUrl(); + break; + } + } } } } From 2294a953d3f072120336ce3b449e8fb0f5cc4a74 Mon Sep 17 00:00:00 2001 From: MarcoB Date: Mon, 7 Jan 2019 15:01:30 +0100 Subject: [PATCH 4/7] add auto loader to export observer for cron task --- .../FACTFinder/Core/Model/Export/Observer.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/app/code/community/FACTFinder/Core/Model/Export/Observer.php b/src/app/code/community/FACTFinder/Core/Model/Export/Observer.php index 225f7af3..9f3fa401 100644 --- a/src/app/code/community/FACTFinder/Core/Model/Export/Observer.php +++ b/src/app/code/community/FACTFinder/Core/Model/Export/Observer.php @@ -12,6 +12,21 @@ class FACTFinder_Core_Model_Export_Observer { + public function __construct() + { + $this->_initFFAutoloader(); + } + + /** + * Init fact-finder lib autoloader + * + * @return void + */ + protected function _initFFAutoloader() + { + $autoloaderClass = new FACTFinder_Core_Model_Autoloader(); + $autoloaderClass->addAutoloader(new Varien_Event_Observer()); + } /** * @param Varien_Object $observer From 560d441ff2ef83d9039250501086d51b146c621c Mon Sep 17 00:00:00 2001 From: MarcoB Date: Mon, 7 Jan 2019 16:14:20 +0100 Subject: [PATCH 5/7] raise version 4.2.1 --- src/app/code/community/FACTFinder/Core/etc/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/code/community/FACTFinder/Core/etc/config.xml b/src/app/code/community/FACTFinder/Core/etc/config.xml index cb63f6ee..d62aff96 100644 --- a/src/app/code/community/FACTFinder/Core/etc/config.xml +++ b/src/app/code/community/FACTFinder/Core/etc/config.xml @@ -15,7 +15,7 @@ - 4.2.0 + 4.2.1 From cb97afcbbd7466329d5796fa2d6fbd8ce1f8b215 Mon Sep 17 00:00:00 2001 From: MarcoB Date: Mon, 7 Jan 2019 16:18:32 +0100 Subject: [PATCH 6/7] fix update of suggest options --- src/js/factfinder/suggest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/factfinder/suggest.js b/src/js/factfinder/suggest.js index d0184995..9646ff82 100644 --- a/src/js/factfinder/suggest.js +++ b/src/js/factfinder/suggest.js @@ -144,7 +144,7 @@ var FactFinderAutocompleter = Class.create(Ajax.Autocompleter, { }, updateChoices: function(choices) { - if(!this.changed && this.hasFocus) { + if(this.hasFocus) { this.update.innerHTML = choices; Element.cleanWhitespace(this.update); Element.cleanWhitespace(this.update.down()); From c7ecaa348ddb62e9a72b2cdcd344210a3d6634c0 Mon Sep 17 00:00:00 2001 From: MarcoB Date: Mon, 7 Jan 2019 16:33:40 +0100 Subject: [PATCH 7/7] issue FFSD-78, fix cart tracking by entity_id of product --- src/app/code/community/FACTFinder/Tracking/Model/Observer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/code/community/FACTFinder/Tracking/Model/Observer.php b/src/app/code/community/FACTFinder/Tracking/Model/Observer.php index 188d587b..ecea5218 100644 --- a/src/app/code/community/FACTFinder/Tracking/Model/Observer.php +++ b/src/app/code/community/FACTFinder/Tracking/Model/Observer.php @@ -94,7 +94,7 @@ public function addToCartTracking($observer) /** @var $tracking FACTFinder_Tracking_Model_Handler_Tracking */ $tracking = Mage::getModel('factfinder_tracking/handler_tracking'); $tracking->trackCart( - $quoteItem->getData($trackingIdFieldName), + $product->getData($trackingIdFieldName), $product->getData($masterIdFieldName), $product->getName(), null,