Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-advanced-search
Block
SearchData.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\AdvancedSearch\Block
;
7
8
use
Magento\Framework\View\Element\Template
;
9
use
Magento\Search\Model\QueryFactoryInterface
;
10
use
Magento\Search\Model\QueryInterface
;
11
use
Magento\AdvancedSearch\Model\SuggestedQueriesInterface
;
12
13
abstract
class
SearchData
extends
Template
implements
SearchDataInterface
14
{
18
private
$query;
19
23
protected
$title
;
24
28
private
$searchDataProvider;
29
33
protected
$_template
=
'Magento_AdvancedSearch::search_data.phtml'
;
34
42
public
function
__construct
(
43
Template
\
Context
$context,
44
SuggestedQueriesInterface
$searchDataProvider,
45
QueryFactoryInterface
$queryFactory,
46
$title
,
47
array
$data
= []
48
) {
49
$this->searchDataProvider = $searchDataProvider;
50
$this->query = $queryFactory->
get
();
51
$this->title =
$title
;
52
parent::__construct($context,
$data
);
53
}
54
58
public
function
getItems
()
59
{
60
return
$this->searchDataProvider->getItems($this->query);
61
}
62
66
public
function
isShowResultsCount
()
67
{
68
return
$this->searchDataProvider->isResultsCountEnabled();
69
}
70
74
public
function
getLink
($queryText)
75
{
76
return
$this->
getUrl
(
'*/*/'
) .
'?q='
. urlencode($queryText);
77
}
78
82
public
function
getTitle
()
83
{
84
return
__
($this->title);
85
}
86
}
Magento\Search\Model\QueryFactoryInterface
Definition:
QueryFactoryInterface.php:12
Magento\AdvancedSearch\Block\SearchData\__construct
__construct(Template\Context $context, SuggestedQueriesInterface $searchDataProvider, QueryFactoryInterface $queryFactory, $title, array $data=[])
Definition:
SearchData.php:42
Magento\Framework\View\Element\Template
Definition:
Context.php:6
Magento\AdvancedSearch\Block
Definition:
SuggestionsTest.php:6
Magento\AdvancedSearch\Block\SearchData\getTitle
getTitle()
Definition:
SearchData.php:82
Magento\AdvancedSearch\Block\SearchData\$title
$title
Definition:
SearchData.php:23
Magento\AdvancedSearch\Block\SearchData\isShowResultsCount
isShowResultsCount()
Definition:
SearchData.php:66
Magento\AdvancedSearch\Block\SearchData\getLink
getLink($queryText)
Definition:
SearchData.php:74
__
__()
Definition:
__.php:13
Magento\Search\Model\QueryInterface
Definition:
QueryInterface.php:13
Magento\AdvancedSearch\Block\SearchData\$_template
$_template
Definition:
SearchData.php:33
Magento\AdvancedSearch\Model\SuggestedQueriesInterface
Definition:
SuggestedQueriesInterface.php:14
Magento\Framework\View\Element\Template\Context
Definition:
Context.php:23
$data
$data
Definition:
attribute_set_with_image_attribute.php:16
Magento\Framework\View\Element\AbstractBlock\getUrl
getUrl($route='', $params=[])
Definition:
AbstractBlock.php:773
Magento\AdvancedSearch\Block\SearchDataInterface
Definition:
SearchDataInterface.php:12
Magento\AdvancedSearch\Block\SearchData\getItems
getItems()
Definition:
SearchData.php:58
Magento\Framework\View\Element\Template
Definition:
Template.php:32
Magento\Search\Model\QueryFactoryInterface\get
get()
Magento\AdvancedSearch\Block\SearchData
Definition:
SearchData.php:13