Skip to content

Commit f456af5

Browse files
author
Fanny DECLERCK
authored
Merge pull request #98 from Smile-SA/fix-issue-93
move autocompletion to ElasticSuiteRetailer module
2 parents a958113 + 4eeeae1 commit f456af5

File tree

7 files changed

+16
-370
lines changed

7 files changed

+16
-370
lines changed

Controller/Ajax/Suggest.php

Lines changed: 0 additions & 69 deletions
This file was deleted.

Helper/Data.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,4 @@ public function getRetailerUrl(RetailerInterface $retailer)
6767
{
6868
return $this->urlModel->getUrl($retailer);
6969
}
70-
71-
/**
72-
* Retrieve suggest url
73-
*
74-
* @return string
75-
*/
76-
public function getSuggestUrl()
77-
{
78-
return $this->_getUrl(
79-
'storelocator/ajax/suggest',
80-
['_secure' => $this->_getRequest()->isSecure()]
81-
);
82-
}
8370
}

Model/Autocomplete/DataProvider.php

Lines changed: 0 additions & 157 deletions
This file was deleted.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@ The module requires :
2929
3030
Maximum number of visible stores : Above this limit, the list of stores will be not display
3131

32+
### Add autocompletion
33+
34+
To add autocompletion you need to add this module :
35+
36+
[RetailerSearch](https://github.com/Smile-SA/magento2-module-retailer-elasticsuite-search)
37+
/!\ be careful with dependencies

view/frontend/templates/chooser.phtml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717

1818
<?php
1919
/** @var \Smile\StoreLocator\Block\StoreChooser $block */
20-
$dataScope = $block->getDataScope();
21-
22-
/** @var $helper \Magento\Search\Helper\Data */
23-
$helper = $this->helper(\Smile\StoreLocator\Helper\Data::class);
2420
?>
2521

2622
<?php $dataScope = $block->getDataScope(); ?>
@@ -57,7 +53,7 @@ $helper = $this->helper(\Smile\StoreLocator\Helper\Data::class);
5753
</div>
5854
</div>
5955
</div>
60-
<form id="search_store_mini_form" action="<?php echo $block->getStoreLocatorHomeUrl() ?>" data-bind="submit: onSubmit">
56+
<form action="<?php echo $block->getStoreLocatorHomeUrl() ?>" data-bind="submit: onSubmit">
6157
<div class="store-search">
6258
<div class="geolocalize-container" data-bind="scope: requestChild('geocoder')">
6359
<div class="primary" data-bind="afterRender: initGeocoder">
@@ -68,13 +64,7 @@ $helper = $this->helper(\Smile\StoreLocator\Helper\Data::class);
6864
</div>
6965
<div class="store-search-form">
7066
<div class="field">
71-
<input id="search_store"
72-
data-bind="value: fulltextSearch, event: {keydown: onKeydown}"
73-
type="text"
74-
name="query"
75-
placeholder="<?php echo $block->escapeHtml(__('City, Zipcode, Department, ...'));?>"
76-
autocomplete="off"/>
77-
<input type="hidden" id="suggest_url" value="<?= $block->escapeUrl($helper->getSuggestUrl())?>" />
67+
<input data-bind="{ value: fulltextSearch }" type="text" name="query" placeholder="<?php echo $block->escapeHtml(__('City, Zipcode, Department, ...'));?>"/>
7868
</div>
7969
<div class="actions">
8070
<div class="primary">
@@ -84,11 +74,10 @@ $helper = $this->helper(\Smile\StoreLocator\Helper\Data::class);
8474
</div>
8575
</div>
8676
</form>
87-
<div id="search_store_autocomplete" class="search-autocomplete search-store-autocomplete"></div>
8877
</div>
8978
</div>
9079
</div>
9180

9281
<script type="text/x-magento-init">
93-
{"*" : {"Magento_Ui/js/core/app": <?php echo /* @noEscape */ $block->getJsLayout(); ?>} }
82+
{ "*" : { "Magento_Ui/js/core/app": <?php echo /* @noEscape */ $block->getJsLayout(); ?> } }
9483
</script>

view/frontend/web/css/source/_module.less

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,15 +1519,6 @@ a.geolocalize:before {
15191519
}
15201520
}
15211521

1522-
.search-store-autocomplete {
1523-
padding-left: 11px;
1524-
width: 209px !important;
1525-
margin-top: -9px !important;
1526-
.store-url-link{
1527-
color: #333333;
1528-
}
1529-
}
1530-
15311522
.map-search-autocomplete {
15321523
.ui-helper-hidden-accessible {
15331524
display: none !important;

0 commit comments

Comments
 (0)