2017-08-28 3 views
0

modx(回転バージョン2.5.7)の新機能と単純検索(simplesearch-1.9.2-pl) 日付ドロップダウンを追加する必要があります。テンプレート変数を型の日付として)modxプラグインでsimplesearchを余分に使用します。参考までに私の検索ページのスクリーンショットを添付しました。これを解決するために私を助けてください。 queryhookとの事前の検索を使用して日付ドロップダウン統合によるsimplesearch modx

search page image

+0

、私は https://forums.modx.com/thread/102739/advsearch-with-queryhook-example#dis-post-553462を達成 – afsar

答えて

0
https://forums.modx.com/thread/95128/advsearch-to-show-search-value-based-on-dropdown-box. 
After many painful debugging , got my code working. 
[b]My code[/b] , 

[[!AdvSearchForm? &tpl=`AdvanceSearchForm_tpl`]] 
</h1> 
<h2>Results</h2> 
<p>[[!AdvSearch? &parents=`12`&queryHook=`FilterCalenderSnippet` ]] 

[b]form tpl (AdvanceSearchForm_tpl) :--[/b] 
[code]<form id="[[+advsearch.asId]]_advsea-form" class="advsea-form" action="[[~[[+advsearch.landing]]]]" method="[[+advsearch.method]]"> 
    <fieldset> 
    <input type="hidden" name="id" value="[[+advsearch.landing]]" /> 
    <input type="hidden" name="asId" value="[[+advsearch.asId]]" /> 
    [[+advsearch.helpLink]]<input type="text" id="[[+advsearch.asId]]_advsea-search" name="[[+advsearch.searchIndex]]" value="[[+advsearch.searchValue]]" /> 
[[$SeminarCalendarDateChunk]]// give the dropdown of dates,you can put your form elements 
    [[+advsearch.liveSearch:isnot=`1`:then=`<input type="submit" id="[[+advsearch.asId]]_advsea-submit" name="sub" value="[[%advsearch.search? &namespace=`advsearch` &topic=`default`]]" />`:else`=``]] 
    </fieldset> 
</form> 
[[+advsearch.resultsWindow]] 


[b]Query Hook snippet(FilterCalenderSnippet)[/b] 
[ul] 
[li]My Date tv is EventDateTv[/li] 

[/ul] 

[code] 

<?php 
$andConditions = array(); 
// here i need to show events between one given input month. so I did some php to fetch first and last days of given month 
if (!empty($_REQUEST['calendar_date'])) { 
    $dateToTest = $_REQUEST['calendar_date'];// my form element name is calendar_date 
$lastday = date('Y-m-t',strtotime($dateToTest)); 
$andConditions['tv.EventDateTv:>='] = $dateToTest; 
$andConditions['tv.EventDateTv:<='] = $lastday ; 
} 

if (!empty($andConditions)) { 
    $qhDeclaration = array(
     'qhVersion' => '1.3', 
     'andConditions' => $andConditions 
    ); 
    $hook->setQueryHook($qhDeclaration); 
} 

return true; 
[/code]`enter code here` 
関連する問題