Enable multiple forced concept uids
This commit is contained in:
@@ -89,8 +89,8 @@ class AjaxDateController extends ActionController
|
|||||||
|
|
||||||
public function initializeAction()
|
public function initializeAction()
|
||||||
{
|
{
|
||||||
$forcedConceptUid = (int) $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$this->processFilterSettingsArgument($forcedConceptUid);
|
$this->processFilterSettingsArgument($forcedConceptUids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,8 +111,8 @@ class AjaxDateController extends ActionController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if ($filterSettings === null) {
|
if ($filterSettings === null) {
|
||||||
$forcedConceptUid = (int) $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid, false);
|
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUids, false);
|
||||||
}
|
}
|
||||||
$altProductLink = null;
|
$altProductLink = null;
|
||||||
$altLabel = null;
|
$altLabel = null;
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ class AjaxFilterpanelController extends ActionController
|
|||||||
|
|
||||||
public function initializeAction()
|
public function initializeAction()
|
||||||
{
|
{
|
||||||
$forcedConceptUid = (int) $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$this->processFilterSettingsArgument($forcedConceptUid);
|
$this->processFilterSettingsArgument($forcedConceptUids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ class AjaxSearchController extends ActionController
|
|||||||
|
|
||||||
public function initializeAction()
|
public function initializeAction()
|
||||||
{
|
{
|
||||||
$forcedConceptUid = (int) $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$this->processFilterSettingsArgument($forcedConceptUid);
|
$this->processFilterSettingsArgument($forcedConceptUids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,11 +90,11 @@ class AjaxSearchController extends ActionController
|
|||||||
{
|
{
|
||||||
$dateSelected = false;
|
$dateSelected = false;
|
||||||
$organic = true;
|
$organic = true;
|
||||||
$forcedConceptUid = (int) $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']);
|
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']);
|
||||||
|
|
||||||
if ($filterSettings === null) {
|
if ($filterSettings === null) {
|
||||||
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid);
|
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUids);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($filterSettings->getDateFrom() !== null || $filterSettings->getDateTo() !== null) {
|
if ($filterSettings->getDateFrom() !== null || $filterSettings->getDateTo() !== null) {
|
||||||
@@ -104,7 +104,7 @@ class AjaxSearchController extends ActionController
|
|||||||
$searchResult = $this->searchResultService->getResult($filterSettings, $excludedConceptUids);
|
$searchResult = $this->searchResultService->getResult($filterSettings, $excludedConceptUids);
|
||||||
|
|
||||||
if ($searchResult->getTotal() === 0) {
|
if ($searchResult->getTotal() === 0) {
|
||||||
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid);
|
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUids);
|
||||||
$searchResult = $this->searchResultService->getResult($filterSettings, $excludedConceptUids);
|
$searchResult = $this->searchResultService->getResult($filterSettings, $excludedConceptUids);
|
||||||
$organic = false;
|
$organic = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ class AjaxSearchbarController extends ActionController
|
|||||||
|
|
||||||
public function initializeAction()
|
public function initializeAction()
|
||||||
{
|
{
|
||||||
$forcedConceptUid = $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$this->processSearchParamsArgument($forcedConceptUid);
|
$this->processSearchParamsArgument($forcedConceptUids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,8 +68,8 @@ class AjaxSearchbarController extends ActionController
|
|||||||
{
|
{
|
||||||
if ($searchParams === null) {
|
if ($searchParams === null) {
|
||||||
$searchParams = new SearchParams();
|
$searchParams = new SearchParams();
|
||||||
$forcedConceptUid = (int) $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid);
|
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUids);
|
||||||
} else {
|
} else {
|
||||||
$filterSettings = FilterSettings::fromSearchParams($searchParams);
|
$filterSettings = FilterSettings::fromSearchParams($searchParams);
|
||||||
}
|
}
|
||||||
@@ -86,8 +86,8 @@ class AjaxSearchbarController extends ActionController
|
|||||||
public function resetAction()
|
public function resetAction()
|
||||||
{
|
{
|
||||||
$searchParams = new SearchParams();
|
$searchParams = new SearchParams();
|
||||||
$forcedConceptUid = (int) $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid);
|
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUids);
|
||||||
$filterOptions = $this->filterService->getFilterOptions($filterSettings);
|
$filterOptions = $this->filterService->getFilterOptions($filterSettings);
|
||||||
return json_encode([
|
return json_encode([
|
||||||
'filterOptions' => $filterOptions,
|
'filterOptions' => $filterOptions,
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ class AjaxTableController extends ActionController
|
|||||||
|
|
||||||
public function initializeAction()
|
public function initializeAction()
|
||||||
{
|
{
|
||||||
$forcedConceptUid = (int) $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$this->processFilterSettingsArgument($forcedConceptUid);
|
$this->processFilterSettingsArgument($forcedConceptUids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,8 +100,8 @@ class AjaxTableController extends ActionController
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ($filterSettings === null) {
|
if ($filterSettings === null) {
|
||||||
$forcedConceptUid = (int) $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid, false);
|
$filterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUids, false);
|
||||||
}
|
}
|
||||||
if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
|
if ($reseller = $this->resellerDataService->getResellerForCurrentDomain()) {
|
||||||
$paCode = $reseller['paCode'];
|
$paCode = $reseller['paCode'];
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ class SearchController extends ActionController
|
|||||||
|
|
||||||
public function initializeAction()
|
public function initializeAction()
|
||||||
{
|
{
|
||||||
$forcedConceptUid = (int) $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$this->defaultFilterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUid);
|
$this->defaultFilterSettings = $this->filterService->getDefaultFilterSettings($forcedConceptUids);
|
||||||
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']);
|
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids']);
|
||||||
$this->defaultFilterOptions = $this->filterService->getFilterOptions($this->defaultFilterSettings, $excludedConceptUids);
|
$this->defaultFilterOptions = $this->filterService->getFilterOptions($this->defaultFilterSettings, $excludedConceptUids);
|
||||||
}
|
}
|
||||||
@@ -99,9 +99,9 @@ class SearchController extends ActionController
|
|||||||
|
|
||||||
public function initializeSearchresultAction()
|
public function initializeSearchresultAction()
|
||||||
{
|
{
|
||||||
$forcedConceptUid = $this->settings['forcedConceptUid'];
|
$forcedConceptUids = GeneralUtility::trimExplode(',', $this->settings['forcedConceptUids'], true);
|
||||||
$this->processSearchParamsArgument($forcedConceptUid);
|
$this->processSearchParamsArgument($forcedConceptUids);
|
||||||
$this->processFilterSettingsArgument($forcedConceptUid);
|
$this->processFilterSettingsArgument($forcedConceptUids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -151,10 +151,6 @@ class FilterSettings implements \JsonSerializable
|
|||||||
{
|
{
|
||||||
if ($dateFrom !== null) {
|
if ($dateFrom !== null) {
|
||||||
$this->setDateFrom($dateFrom);
|
$this->setDateFrom($dateFrom);
|
||||||
} else {
|
|
||||||
// Disabling the minimum date shouldn't be a problem since
|
|
||||||
// imported dates are never in the past
|
|
||||||
//$this->setDateFrom(new \DateTime('now'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($dateTo !== null) {
|
if ($dateTo !== null) {
|
||||||
@@ -181,8 +177,8 @@ class FilterSettings implements \JsonSerializable
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($searchParams->getConceptUid()) {
|
if ($searchParams->getConceptUids()) {
|
||||||
$filterSettings->setConceptUids([ $searchParams->getConceptUid() ]);
|
$filterSettings->setConceptUids($searchParams->getConceptUids());
|
||||||
}
|
}
|
||||||
$filterSettings->setPriceRange($searchParams->getPriceRange());
|
$filterSettings->setPriceRange($searchParams->getPriceRange());
|
||||||
$filterSettings->setPax($searchParams->getPax());
|
$filterSettings->setPax($searchParams->getPax());
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ class SearchParams implements \JsonSerializable
|
|||||||
protected $destinationType;
|
protected $destinationType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $conceptUid = 0;
|
protected $conceptUids = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
@@ -163,19 +163,19 @@ class SearchParams implements \JsonSerializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getConceptUid()
|
public function getConceptUids()
|
||||||
{
|
{
|
||||||
return $this->conceptUid;
|
return $this->conceptUids;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $conceptUid
|
* @param array $conceptUids
|
||||||
*/
|
*/
|
||||||
public function setConceptUid($conceptUid)
|
public function setConceptUids(array $conceptUids)
|
||||||
{
|
{
|
||||||
$this->conceptUid = $conceptUid;
|
$this->conceptUids = $conceptUids;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -235,7 +235,7 @@ class SearchParams implements \JsonSerializable
|
|||||||
'priceRange' => $this->getPriceRange(),
|
'priceRange' => $this->getPriceRange(),
|
||||||
'destinationUid' => $this->getDestinationUid(),
|
'destinationUid' => $this->getDestinationUid(),
|
||||||
'destinationType' => $this->getDestinationType(),
|
'destinationType' => $this->getDestinationType(),
|
||||||
'conceptUid' => $this->getConceptUid(),
|
'conceptUids' => $this->getConceptUids(),
|
||||||
'nights' => $this->getNights(),
|
'nights' => $this->getNights(),
|
||||||
'pax' => $this->getPax(),
|
'pax' => $this->getPax(),
|
||||||
'pageUid' => $this->getPageUid(),
|
'pageUid' => $this->getPageUid(),
|
||||||
@@ -244,4 +244,4 @@ class SearchParams implements \JsonSerializable
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,20 +58,20 @@ class FilterService implements SingletonInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $forcedConceptUid
|
* @param array $forcedConceptUids
|
||||||
* @param bool $respectBookableDaterange
|
* @param bool $respectBookableDaterange
|
||||||
*
|
*
|
||||||
* @return FilterSettings
|
* @return FilterSettings
|
||||||
*/
|
*/
|
||||||
public function getDefaultFilterSettings($forcedConceptUid = null, $respectBookableDaterange = true)
|
public function getDefaultFilterSettings(array $forcedConceptUids = [], $respectBookableDaterange = true)
|
||||||
{
|
{
|
||||||
[ $dateFrom, $dateTo ] = $this->constrainDateRange($this->getDateRange());
|
[ $dateFrom, $dateTo ] = $this->constrainDateRange($this->getDateRange());
|
||||||
if (!$respectBookableDaterange) {
|
if (!$respectBookableDaterange) {
|
||||||
$dateFrom = new \DateTime('now');
|
$dateFrom = new \DateTime('now');
|
||||||
}
|
}
|
||||||
$filterSettings = new FilterSettings($dateFrom, $dateTo);
|
$filterSettings = new FilterSettings($dateFrom, $dateTo);
|
||||||
if ($forcedConceptUid) {
|
if ($forcedConceptUids) {
|
||||||
$filterSettings->setConceptUids([ $forcedConceptUid ]);
|
$filterSettings->setConceptUids($forcedConceptUids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $filterSettings;
|
return $filterSettings;
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ trait RequestArgumentTypeConversionTrait
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts array to searchparams object
|
* Converts array to searchparams object
|
||||||
* @param null $forcedConceptUid
|
* @param array $forcedConceptUids
|
||||||
*/
|
*/
|
||||||
public function processSearchParamsArgument($forcedConceptUid = null)
|
public function processSearchParamsArgument(array $forcedConceptUids = [])
|
||||||
{
|
{
|
||||||
if ($this->request->hasArgument('searchParams')) {
|
if ($this->request->hasArgument('searchParams')) {
|
||||||
|
|
||||||
@@ -60,8 +60,8 @@ trait RequestArgumentTypeConversionTrait
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($forcedConceptUid) {
|
if ($forcedConceptUids) {
|
||||||
$searchParamsObject->setConceptUid($forcedConceptUid);
|
$searchParamsObject->setConceptUids($forcedConceptUids);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->request->setArgument('searchParams', $searchParamsObject);
|
$this->request->setArgument('searchParams', $searchParamsObject);
|
||||||
@@ -70,9 +70,9 @@ trait RequestArgumentTypeConversionTrait
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts urlencoded json or array to filtersettings object
|
* Converts urlencoded json or array to filtersettings object
|
||||||
* @param null $forcedConceptUid
|
* @param array $forcedConceptUids
|
||||||
*/
|
*/
|
||||||
public function processFilterSettingsArgument($forcedConceptUid = null)
|
public function processFilterSettingsArgument(array $forcedConceptUids = [])
|
||||||
{
|
{
|
||||||
if ($this->request->hasArgument('filterSettings')) {
|
if ($this->request->hasArgument('filterSettings')) {
|
||||||
|
|
||||||
@@ -111,9 +111,9 @@ trait RequestArgumentTypeConversionTrait
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($forcedConceptUid) {
|
if ($forcedConceptUids) {
|
||||||
$conceptUids = $filterSettingsObject->getConceptUids();
|
$conceptUids = $filterSettingsObject->getConceptUids();
|
||||||
$conceptUids[] = $forcedConceptUid;
|
array_push($conceptUids, ...$forcedConceptUids);
|
||||||
$filterSettingsObject->setConceptUids($conceptUids);
|
$filterSettingsObject->setConceptUids($conceptUids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ trait RequestArgumentTypeConversionTrait
|
|||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
static protected function convertType($value)
|
protected static function convertType($value)
|
||||||
{
|
{
|
||||||
if (\is_string($value) && (strtolower($value) === 'true' || strtolower($value) === 'false')) {
|
if (\is_string($value) && (strtolower($value) === 'true' || strtolower($value) === 'false')) {
|
||||||
return strtolower($value) === 'true';
|
return strtolower($value) === 'true';
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ plugin.tx_epproducts {
|
|||||||
defaultDetailPageUid =
|
defaultDetailPageUid =
|
||||||
# cat=plugin.tx_epproducts//a; type=string; label=Exclude products with concept UIDs from search result (CSV)
|
# cat=plugin.tx_epproducts//a; type=string; label=Exclude products with concept UIDs from search result (CSV)
|
||||||
excludedConceptUids =
|
excludedConceptUids =
|
||||||
# cat=plugin.tx_epproducts//a; type=string; label=Force concept UID in all search related parts
|
# cat=plugin.tx_epproducts//a; type=string; label=Force concept UID in all search related parts (CSV)
|
||||||
forcedConceptUid =
|
forcedConceptUids =
|
||||||
# cat=plugin.tx_epproducts//a; type=string; label=Don't show availability info for products with these concept UIDs
|
# cat=plugin.tx_epproducts//a; type=string; label=Don't show availability info for products with these concept UIDs
|
||||||
noInfoConceptUids =
|
noInfoConceptUids =
|
||||||
# cat=plugin.tx_epproducts//a; type=string; label=Room types for pricetables (CSV)
|
# cat=plugin.tx_epproducts//a; type=string; label=Room types for pricetables (CSV)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ plugin.tx_epproducts {
|
|||||||
defaultSearchPageUid = {$plugin.tx_epproducts.settings.defaultSearchPageUid}
|
defaultSearchPageUid = {$plugin.tx_epproducts.settings.defaultSearchPageUid}
|
||||||
defaultDetailPageUid = {$plugin.tx_epproducts.settings.defaultDetailPageUid}
|
defaultDetailPageUid = {$plugin.tx_epproducts.settings.defaultDetailPageUid}
|
||||||
excludedConceptUids = {$plugin.tx_epproducts.settings.excludedConceptUids}
|
excludedConceptUids = {$plugin.tx_epproducts.settings.excludedConceptUids}
|
||||||
forcedConceptUid = {$plugin.tx_epproducts.settings.forcedConceptUid}
|
forcedConceptUids = {$plugin.tx_epproducts.settings.forcedConceptUids}
|
||||||
noInfoConceptUids = {$plugin.tx_epproducts.settings.noInfoConceptUids}
|
noInfoConceptUids = {$plugin.tx_epproducts.settings.noInfoConceptUids}
|
||||||
priceTableRoomTypes = {$plugin.tx_epproducts.settings.priceTableRoomTypes}
|
priceTableRoomTypes = {$plugin.tx_epproducts.settings.priceTableRoomTypes}
|
||||||
searchLogIgnoreIps = {$plugin.tx_epproducts.settings.searchLogIgnoreIps}
|
searchLogIgnoreIps = {$plugin.tx_epproducts.settings.searchLogIgnoreIps}
|
||||||
|
|||||||
Reference in New Issue
Block a user