-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make single product visible by direct URL
- Loading branch information
Ilja Lapkovskis
committed
Jul 10, 2019
1 parent
1d5bea4
commit cffd426
Showing
3 changed files
with
46 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/Model/Resolver/Products/DataProvider/Product/CriteriaCheck.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
|
||
namespace ScandiPWA\CatalogGraphQl\Model\Resolver\Products\DataProvider\Product; | ||
|
||
|
||
use Magento\Framework\Api\SearchCriteriaInterface; | ||
|
||
class CriteriaCheck | ||
{ | ||
/** | ||
* @param SearchCriteriaInterface $searchCriteria | ||
* @return bool | ||
*/ | ||
static public function isSingleProductFilter(SearchCriteriaInterface$searchCriteria) | ||
{ | ||
$singleProduct = false; | ||
foreach ($searchCriteria->getFilterGroups() as $filterGroup) { | ||
$filters = $filterGroup->getFilters(); | ||
$type = $filters[0]->getConditionType(); | ||
$field = $filters[0]->getField(); | ||
if ($type === 'eq' && $field === 'url_key') { | ||
$singleProduct = true; | ||
break; | ||
} | ||
} | ||
|
||
return $singleProduct; | ||
} | ||
} |