Skip to content

Commit

Permalink
Merge pull request #98 from Smile-SA/fix-issue-93
Browse files Browse the repository at this point in the history
move autocompletion to ElasticSuiteRetailer module
  • Loading branch information
Fanny DECLERCK authored Mar 27, 2020
2 parents a958113 + 4eeeae1 commit f456af5
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 370 deletions.
69 changes: 0 additions & 69 deletions Controller/Ajax/Suggest.php

This file was deleted.

13 changes: 0 additions & 13 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,4 @@ public function getRetailerUrl(RetailerInterface $retailer)
{
return $this->urlModel->getUrl($retailer);
}

/**
* Retrieve suggest url
*
* @return string
*/
public function getSuggestUrl()
{
return $this->_getUrl(
'storelocator/ajax/suggest',
['_secure' => $this->_getRequest()->isSecure()]
);
}
}
157 changes: 0 additions & 157 deletions Model/Autocomplete/DataProvider.php

This file was deleted.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ The module requires :
Maximum number of visible stores : Above this limit, the list of stores will be not display

### Add autocompletion

To add autocompletion you need to add this module :

[RetailerSearch](https://github.com/Smile-SA/magento2-module-retailer-elasticsuite-search)
/!\ be careful with dependencies
17 changes: 3 additions & 14 deletions view/frontend/templates/chooser.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

<?php
/** @var \Smile\StoreLocator\Block\StoreChooser $block */
$dataScope = $block->getDataScope();

/** @var $helper \Magento\Search\Helper\Data */
$helper = $this->helper(\Smile\StoreLocator\Helper\Data::class);
?>

<?php $dataScope = $block->getDataScope(); ?>
Expand Down Expand Up @@ -57,7 +53,7 @@ $helper = $this->helper(\Smile\StoreLocator\Helper\Data::class);
</div>
</div>
</div>
<form id="search_store_mini_form" action="<?php echo $block->getStoreLocatorHomeUrl() ?>" data-bind="submit: onSubmit">
<form action="<?php echo $block->getStoreLocatorHomeUrl() ?>" data-bind="submit: onSubmit">
<div class="store-search">
<div class="geolocalize-container" data-bind="scope: requestChild('geocoder')">
<div class="primary" data-bind="afterRender: initGeocoder">
Expand All @@ -68,13 +64,7 @@ $helper = $this->helper(\Smile\StoreLocator\Helper\Data::class);
</div>
<div class="store-search-form">
<div class="field">
<input id="search_store"
data-bind="value: fulltextSearch, event: {keydown: onKeydown}"
type="text"
name="query"
placeholder="<?php echo $block->escapeHtml(__('City, Zipcode, Department, ...'));?>"
autocomplete="off"/>
<input type="hidden" id="suggest_url" value="<?= $block->escapeUrl($helper->getSuggestUrl())?>" />
<input data-bind="{ value: fulltextSearch }" type="text" name="query" placeholder="<?php echo $block->escapeHtml(__('City, Zipcode, Department, ...'));?>"/>
</div>
<div class="actions">
<div class="primary">
Expand All @@ -84,11 +74,10 @@ $helper = $this->helper(\Smile\StoreLocator\Helper\Data::class);
</div>
</div>
</form>
<div id="search_store_autocomplete" class="search-autocomplete search-store-autocomplete"></div>
</div>
</div>
</div>

<script type="text/x-magento-init">
{"*" : {"Magento_Ui/js/core/app": <?php echo /* @noEscape */ $block->getJsLayout(); ?>} }
{ "*" : { "Magento_Ui/js/core/app": <?php echo /* @noEscape */ $block->getJsLayout(); ?> } }
</script>
9 changes: 0 additions & 9 deletions view/frontend/web/css/source/_module.less
Original file line number Diff line number Diff line change
Expand Up @@ -1519,15 +1519,6 @@ a.geolocalize:before {
}
}

.search-store-autocomplete {
padding-left: 11px;
width: 209px !important;
margin-top: -9px !important;
.store-url-link{
color: #333333;
}
}

.map-search-autocomplete {
.ui-helper-hidden-accessible {
display: none !important;
Expand Down
Loading

0 comments on commit f456af5

Please sign in to comment.