Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
Merge branch 'v4.2.1'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/app/code/community/FACTFinder/Core/etc/config.xml
  • Loading branch information
mbraeuner committed Mar 20, 2019
2 parents 609f4a9 + 4188dc5 commit 53ecb8e
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/app/code/community/FACTFinder/Core/Model/Export/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/code/community/FACTFinder/Core/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<config>
<modules>
<FACTFinder_Core>
<version>4.2.0.1</version>
<version>4.2.2</version>
</FACTFinder_Core>
</modules>
<global>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -139,7 +139,7 @@ protected function _assembleSuggestResult()
}
}

$resultArray = array();
$resultArray = array('suggestions' => array());
if ($mergedSuggestResults) {
foreach ($mergedSuggestResults as $resultQuery) {
/** @var $resultQuery FACTFinder\Data\SuggestQuery */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,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,
Expand Down
8 changes: 5 additions & 3 deletions src/js/factfinder/suggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -248,7 +248,7 @@ var FactFinderSuggest = Class.create(Varien.searchForm, {
},

loadDataCallback: function (data) {
if (data.suggestions) {
if (typeof data.suggestions !== 'undefined') {
data = data.suggestions;
}

Expand Down Expand Up @@ -295,7 +295,9 @@ var FactFinderSuggest = Class.create(Varien.searchForm, {
temp += '<span class="thumbnail"><img src="' + item.image + '" title="' + item.name + '" /></span>';
}

temp += item.name.replace(new RegExp("("+this.field.value+")","ig"), '<strong>$1</strong>');
var searchString = this.field.value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");

temp += item.name.replace(new RegExp("(" + searchString + ")", "ig"), '<strong>$1</strong>');

if (item.attributes.parentCategory) {
temp += ' (' + decodeURIComponent(item.attributes.parentCategory) + ')';
Expand Down

0 comments on commit 53ecb8e

Please sign in to comment.