public/page_list_redis.php line 577

Open in your IDE?
  1. <?php
  2. use Klaravik\Buyer\Repository\FavoritesRepo;
  3. use Klaravik\Category\Cache\CategoryCache;
  4. use Klaravik\Enum\ReservePriceStatusEnum;
  5. use Klaravik\includes\Categories;
  6. use Klaravik\Product\ProductCardRenderer;
  7. use Klaravik\Page\PropUserData;
  8. use Klaravik\Product\Collection\ProductListCollection;
  9. use Klaravik\Product\Util\TimeLeftUtil;
  10. use Klaravik\Storefront\GraphQL\ProductObjectConverter;
  11. use Klaravik\Storefront\GraphQL\Products\PaginatedProductResponse;
  12. use Klaravik\Storefront\GraphQL\Repository\ProductCategoriesRepository;
  13. use Klaravik\Storefront\GraphQL\Repository\ProductSearchRepository;
  14. use Klaravik\Translate\Trans;
  15. use Symfony\Component\DependencyInjection\ContainerInterface;
  16. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  17. use Symfony\Component\HttpFoundation\Request;
  18. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  19. use Twig\Environment;
  20. use Twig\Error\LoaderError;
  21. use Twig\Error\RuntimeError;
  22. use Twig\Error\SyntaxError;
  23. /**
  24.  * Included from index.phtml
  25.  *
  26.  * @var CategoryCache $cachedCategories
  27.  * @var Categories $categoriesObject
  28.  * @var Object $manifestAssets
  29.  * @var mysqli $db
  30.  * @var ParameterBagInterface $parameters
  31.  * @var Request $request
  32.  * @var PropUserData $propUserData
  33.  *
  34.  * Comes from LegacyController
  35.  * @var Trans $trans
  36.  * @var UrlGeneratorInterface $urlGenerator
  37.  * @var ContainerInterface $container
  38.  * @var Environment $twig
  39.  */
  40. require_once __DIR__ '/includes/PageListPartials.php';
  41. require_once __DIR__ '/includes/Categories.php';
  42. $manifestAssets->add('bundle-pages-list');
  43. function getVendorChildrenId($db$vendorId)
  44. {
  45.     $vendors = array();
  46.     $vendorQuery "SELECT id FROM vendors
  47.             WHERE parent_id = " . (int) $vendorId "
  48.             AND deleted=0 AND active=1 AND banned=0
  49.             AND company IS NOT NULL";
  50.     $res mysqli_query($db$vendorQuery);
  51.     if (mysqli_num_rows($res) > 0) {
  52.         while ($vendor mysqli_fetch_object($res)) {
  53.             $vendors[] = (int) $vendor->id;
  54.             $vendors array_merge($vendorsgetVendorChildrenId($db$vendor->id));
  55.         }
  56.     }
  57.     return $vendors;
  58. }
  59. $showClosed false;
  60. $pageListPartials = new \Klaravik\includes\PageListPartials($urlGenerator$trans);
  61. // default to empty string to better handling.
  62. $_REQUEST['specialcat'] = isset($_REQUEST['specialcat']) ? $_REQUEST['specialcat'] : '';
  63. $sessionVarName "";
  64. if (isset($_REQUEST['specialcat']) && $_REQUEST["specialcat"] == "closed") {
  65.     $sessionVarName "CL_";
  66. }
  67. $_SESSION[$sessionVarName 'perpage'] = $setPerPage = isset($_SESSION[$sessionVarName 'perpage']) ? (int) $_SESSION[$sessionVarName 'perpage'] : 60;
  68. $availablePageSizes = array(306090120);
  69. if (isset($_REQUEST['setperpage']) && in_array((int) $_REQUEST['setperpage'], $availablePageSizestrue)) {
  70.     $setPerPage $_SESSION[$sessionVarName 'perpage'] = (int) $_REQUEST['setperpage'];
  71. }
  72. if (isset($_REQUEST["setsortflag"]) && is_numeric($_REQUEST["setsortflag"])) {
  73.     if ($_REQUEST["setsortflag"] > && $_REQUEST["setsortflag"] <= 8) {
  74.         if (!isset($_REQUEST['nocookie'])) {
  75.             $_SESSION[$sessionVarName "sortflag"] = $_REQUEST["setsortflag"];
  76.         } else {
  77.             $pageListPartials->setSortflag($_REQUEST['setsortflag']);
  78.         }
  79.     }
  80. }
  81. if (!isset($_SESSION[$sessionVarName "sortflag"])) {
  82.     $_SESSION[$sessionVarName "sortflag"] = 4;
  83. }
  84. if (!isset($_REQUEST["catid"]) && !isset($_REQUEST["specialcat"]) && !isset($_REQUEST["searchtext"])) {
  85.     $_REQUEST["specialcat"] = "all";
  86. }
  87. if (isset($_REQUEST['specialcat']) && $_REQUEST["specialcat"] != "closed" && $_SESSION[$sessionVarName "sortflag"] > 6) {
  88.     $_SESSION[$sessionVarName "sortflag"] = 4;
  89. }
  90. // Get a users favorite products and save an array
  91. $favoriteProductListCollection = new ProductListCollection([]);
  92. if (isset($_SESSION['register_id'])) {
  93.     $favoriteProductListCollection = (new FavoritesRepo())->getFavorites((int) $_SESSION['register_id']);
  94. }
  95. /** @var ProductSearchRepository $redisSearch */
  96. $redisSearch $container->get(ProductSearchRepository::class);
  97. /** @var ProductCategoriesRepository $productCategoriesRepository */
  98. $productCategoriesRepository $container->get(ProductCategoriesRepository::class);
  99. /** @var \Klaravik\Common\Collections\CountyCollection $countiesCollection */
  100. $countiesCollection = (new \Klaravik\Repository\CountyRepo())->getAll();
  101. $searchBuilder = new \Klaravik\Storefront\GraphQL\Products\SearchQueryBuilder();
  102. if (!empty($_REQUEST['searchtext'])) {
  103.     $searchBuilder->setText(trim(str_replace(["<"">""\""], ""$_REQUEST['searchtext'])));
  104. }
  105. if (isset($_REQUEST['commissions_id'])) {
  106.     $searchBuilder->setCommissions([mysqli_real_escape_string($db$_REQUEST['commissions_id'])]);
  107. } elseif (isset($_REQUEST['product_ids'])) {
  108.     $ids explode(','$_REQUEST['product_ids']);
  109.     if (count($ids) > 0) {
  110.         $searchBuilder->setIds($ids);
  111.     }
  112. } elseif (isset($_REQUEST['listVendors_id']) && $_REQUEST['listVendors_id'] > 0) {
  113.     $vendorIds[] = (int) $_REQUEST['listVendors_id'];
  114.     if (isset($_REQUEST['showChildren'])) {
  115.         $vendorIds array_merge($vendorIdsgetVendorChildrenId($db$_REQUEST['listVendors_id']));
  116.     }
  117.     $searchBuilder->setVendors($vendorIds);
  118. } else {
  119.     switch ($_REQUEST["specialcat"]) {
  120.         case "closed":
  121.             $showClosed 1;
  122.             $searchBuilder->setEnded(true)->setSold(true);
  123.             break;
  124.         case "bankruptcy":
  125.             $searchBuilder->setBankruptcy(true);
  126.             break;
  127.         case "promoted":
  128.             $searchBuilder->setCategories([$parameters->get('app.rest.category.id')]);
  129.             break;
  130.     }
  131. }
  132. $objectsPerPage $setPerPage;
  133. if (
  134.     isset($_REQUEST['listVendors_id'])
  135.     || (isset($_REQUEST['subcatpage']) && (int) $_REQUEST['subcatpage'] === 1)
  136. ) {
  137.     $objectsPerPage 1000;
  138. }
  139. $curpage = isset($_REQUEST['curpage']) ? (int) $_REQUEST['curpage'] : 1;
  140. $searchBuilder->setPageSize($objectsPerPage)->setPage($curpage);
  141. switch ($_SESSION[$sessionVarName "sortflag"]) {
  142.     case 1// Kortast tid kvar
  143.         $searchBuilder->sortBy()->byShortestTimeLeft();
  144.         break;
  145.     case 2// Senast inkommet
  146.         $searchBuilder->sortBy()->byLatest();
  147.         break;
  148.     case 3// Lägsta pris
  149.         $searchBuilder->sortBy()->byLowestPrice();
  150.         break;
  151.     case 4// Högsta pris
  152.         $searchBuilder->sortBy()->byHighestPrice();
  153.         break;
  154.     case 5// Minst bud
  155.         $searchBuilder->sortBy()->byLeastAmountOfBids();
  156.         break;
  157.     case 6// Flest bud
  158.         $searchBuilder->sortBy()->byHighestAmountOfBids();
  159.         break;
  160.     case 7// Senast avslutad
  161.         $searchBuilder->sortBy()->byRecentlyEnded();
  162.         break;
  163.     default:
  164.         $searchBuilder->sortBy()->byHighestPrice();
  165.         break;
  166. }
  167. $selectedCategoryId = (isset($_REQUEST['catid']) && (int) $_REQUEST['catid'] > 0) ? (int) $_REQUEST['catid'] : 0;
  168. if (isset($_REQUEST['subcatid']) && (int) $_REQUEST['subcatid'] > 0) {
  169.     $selectedCategoryId = (int) $_REQUEST['subcatid'];
  170. }
  171. if ($selectedCategoryId) {
  172.     $searchBuilder->setCategories([$selectedCategoryId]);
  173. }
  174. $requestSetCountyFlag $_REQUEST['setcountyflag'] ?? null;
  175. $countyFilter null;
  176. if ($requestSetCountyFlag) {
  177.     $countyFilter[] = $requestSetCountyFlag;
  178.     if (is_array($requestSetCountyFlag)) {
  179.         $countyFilter $requestSetCountyFlag;
  180.     }
  181.     $countyFilter $countiesCollection->filterCounties()->idsThatExist($countyFilter);
  182. }
  183. $requestSetMunicipality $_REQUEST['setmunicipality'] ?? null;
  184. $municipalityFilter null;
  185. if ($requestSetMunicipality) {
  186.     $municipalityFilter[] = $requestSetMunicipality;
  187.     if (is_array($requestSetMunicipality)) {
  188.         $municipalityFilter $requestSetMunicipality;
  189.     }
  190.     if (in_array('countyclose'$municipalityFilter)) {
  191.         $municipalityFilter = ['countyclose'];
  192.     } else {
  193.         $municipalityFilter $countiesCollection->filterMunicipalities()->idsThatExist($municipalityFilter);
  194.     }
  195. }
  196. $requestFilterReservePrice $_REQUEST['reserve'] ?? null;
  197. if ($requestFilterReservePrice && null !== $reserveFilterEnum ReservePriceStatusEnum::tryFrom($requestFilterReservePrice)) {
  198.     $pageListPartials->setReservePriceStatus($reserveFilterEnum);
  199.     $searchBuilder->setReservePriceStatus($reserveFilterEnum);
  200. }
  201. // If the user somehow have selected more than one county combined with more than one municipality, then reset municipalities.
  202. if ($countyFilter && count($countyFilter) > && $municipalityFilter && count($municipalityFilter) > 1) {
  203.     $municipalityFilter null;
  204. }
  205. if (
  206.     isset($_REQUEST['listVendors_id'])
  207.     || (isset($_REQUEST['subcatpage']) && (int) $_REQUEST['subcatpage'] === 1)
  208.     || (isset($_REQUEST['specialcat']) && in_array($_REQUEST['specialcat'], array('bankruptcy''closed')))
  209. ) {
  210.     $municipalityFilter null;
  211. }
  212. // Filter on county
  213. if (
  214.     $municipalityFilter &&
  215.     !array_intersect($municipalityFilter, ['all''countyclose']) &&
  216.     (!isset($_REQUEST["specialcat"]) || ($_REQUEST["specialcat"] === "all" || $_REQUEST['specialcat'] == ''))
  217. ) {
  218.     $searchBuilder->setMunicipalities($municipalityFilter);
  219. }
  220. // Filter on Län
  221. if ($countyFilter) {
  222.     $countyCloseIds = [];
  223.     // County close
  224.     if ($municipalityFilter && in_array('countyclose'$municipalityFilter) && count($countyFilter) === 1) {
  225.         $closeCountyQuery 'SELECT county_close FROM county_close WHERE county = ' . (int) $countyFilter[0];
  226.         $closeCountyStmt mysqli_query($db$closeCountyQuery);
  227.         if (!in_array('all'$countyFilter)) {
  228.             $countyCloseIds[] = (int) $countyFilter[0];
  229.         }
  230.         while ($closeCounties mysqli_fetch_object($closeCountyStmt)) {
  231.             if (in_array($closeCounties->county_close$countyCloseIds)) {
  232.                 continue;
  233.             }
  234.             $countyCloseIds[] = $closeCounties->county_close;
  235.         }
  236.     } else {
  237.         if (!in_array('all'$countyFilter) && ($_REQUEST["specialcat"] == "all" || $_REQUEST['specialcat'] == '')) {
  238.             $countyCloseIds $countyFilter;
  239.         }
  240.     }
  241.     if (count($countyCloseIds)) {
  242.         $searchBuilder->setCounties($countyCloseIds);
  243.     }
  244. }
  245. $sourceObjectsArray = [];
  246. try {
  247.     $searchProductSCategoriesResult $productCategoriesRepository->searchProductCategories($searchBuilder);
  248.     foreach ($searchProductSCategoriesResult->getItems() as $productCategoriesItem) {
  249.         $tmpCategories explode(','$productCategoriesItem['categories']);
  250.         $fakeProduct = new stdClass();
  251.         $fakeProduct->categories_id end($tmpCategories);
  252.         // For the auctions amount per category calculation to work.
  253.         for ($i 1$i <= $productCategoriesItem['items']; $i++) {
  254.             $sourceObjectsArray[] = $fakeProduct;
  255.         }
  256.     }
  257. } catch (\Klaravik\Storefront\GraphQL\Exception\GraphQLRepositoryException $e) {
  258. }
  259. try {
  260.     $searchResult $redisSearch->searchProductsList($searchBuilder);
  261. } catch (\Klaravik\Storefront\GraphQL\Exception\GraphQLRepositoryException $e) {
  262.     $searchResult = new PaginatedProductResponse(["data" => ["products" => ["pageCount" => 0"totalCount" => 0]]]);
  263. }
  264. $pages $searchResult->getPageCount();
  265. $activeCounties = array();
  266. $activeMunicipalities = array();
  267. $totalNbrMatchedObjects 0;
  268. /** @var \Klaravik\Model\County $countyItem */
  269. foreach ($countiesCollection->filterCounties()->orderByName() as $countyItem) {
  270.     $activeCounties[$countyItem->getId()] = $countyItem->getName();
  271.     if ($countyFilter && !in_array('all'$countyFilter) && !in_array($countyItem->getId(), $countyFilter)) {
  272.         continue;
  273.     }
  274.     /** @var \Klaravik\Model\County $municipalityItem */
  275.     foreach ($countiesCollection->filterMunicipalities($countyItem->getId()) as $municipalityItem) {
  276.         $activeMunicipalities[$municipalityItem->getId()] = [
  277.             'name' => $municipalityItem->getName(),
  278.             'county_id' => $countyItem->getId(),
  279.         ];
  280.     }
  281. }
  282. uasort($activeMunicipalities, function ($a$b) {
  283.     return strcmp($a["name"], $b["name"]);
  284. });
  285. $sortArray = array();
  286. $prodObjects = array();
  287. $pageUrl $urlGenerator->generate('app.legacy.auction.listing');
  288. if (!empty($_REQUEST['specialcat'])) {
  289.     switch ($_REQUEST['specialcat']) {
  290.         case 'closed':
  291.             $pageUrl $urlGenerator->generate('app.legacy.auction.listing.closed');
  292.             break;
  293.         case 'bankruptcy':
  294.             $pageUrl $urlGenerator->generate('app.legacy.auction.listing.bankruptcy');
  295.             break;
  296.         case 'promoted':
  297.             $pageUrl $urlGenerator->generate('app.legacy.auction.listing.promoted');
  298.             break;
  299.     }
  300. }
  301. // *******************************************************************************************
  302. print "<div class=\"page-container object-list-wrapper redis-search\">\n";
  303. $showSortbar false;
  304. $grid_cookie = (isset($_COOKIE['grid']) ? $_COOKIE['grid'] : 3);
  305. if (!isset($_REQUEST['listVendors_id']) && !isset($_REQUEST['subcatpage'])) {
  306.     if ($showClosed) {
  307.         $categoryCache = new \Klaravik\Category\Cache\ClosedCategoryCache();
  308.     } else {
  309.         $categoryCache = new \Klaravik\Category\Cache\ActiveCategoryCache();
  310.     }
  311.     $categoryCacheCollection $categoryCache->cachedCategories();
  312.     $pageListPartials->setUrl($pageUrl)
  313.         ->setPages($pages)
  314.         ->setPage($curpage)
  315.         ->setSessionVarName($sessionVarName)
  316.         ->setShowClosed($showClosed)
  317.         ->setActiveCounties($activeCounties)
  318.         ->setActiveMunicipalities($activeMunicipalities)
  319.         ->setTotalNbrMatchedObjects($totalNbrMatchedObjects)
  320.         ->setCategoryCache($categoryCache)
  321.         ->setListObjects($sourceObjectsArray);
  322.     $showSortbar true;
  323.     ?>
  324.     <div class="sortbar-filter-container-top">
  325.         <?php if ($selectedCategoryId || $showClosed || !empty($_REQUEST['searchtext'])): ?>
  326.             <div id="listNav" class="list-navigation">
  327.                 <div class="row">
  328.                     <div class="columns large-12">
  329.                         <div class="breadcrumbs-wrapper">
  330.                             <div class="left-blur"></div>
  331.                             <div id="breadcrumbs" class="breadcrumbs">
  332.                                 <?php $pageListPartials->breadcrumbs($selectedCategoryId); ?>
  333.                             </div>
  334.                             <div class="right-blur"></div>
  335.                         </div>
  336.                         <hr>
  337.                     </div>
  338.                 </div>
  339.             <?php elseif ($_REQUEST['specialcat'] !== 'bankruptcy'): ?>
  340.                 <div id="listNav" class="list-navigation">
  341.                     <div class="row">
  342.                         <div class="columns large-12">
  343.                             <div class="category-head-tags-wrapper">
  344.                                 <div class="left-blur"></div>
  345.                                 <div id="category-head-tags" class="category-head-tags">
  346.                                     <?php foreach ($categoryCacheCollection->getTopLevel()->toArray() as $cat):
  347.                                         $urlParams = ['caturlname' => $cat->getUrl()];
  348.                                         $pageListPartials->geoLocationUrlParams($urlParams);
  349.                                         $pageListPartials->filterUrlParams($urlParams);
  350.                                         $url $urlGenerator->generate('app.legacy.auction.listing.category'$urlParams);
  351.                                         ?>
  352.                                         <a class="category-head-tag" href="<?php echo $url?>" aria-label="<?php echo $cat->getName(); ?>">
  353.                                             <div class="circle-with-icon">
  354.                                                 <img src="/images/icons/icn-category-dark-<?php echo $cat->getIcon(); ?>.svg" alt="" aria-hidden="true"/>
  355.                                             </div>
  356.                                             <span><?php echo $cat->getEllipsedName(); ?></span>
  357.                                         </a>
  358.                                     <?php endforeach; ?>
  359.                                 </div>
  360.                                 <div class="right-blur"></div>
  361.                             </div>
  362.                         </div>
  363.                     </div>
  364.                 </div>
  365.             <?php endif; ?>
  366.             <?php if (!empty($_REQUEST["searchtext"]) || $showClosed || $selectedCategoryId 0): ?>
  367.                 <div class="row">
  368.                     <div class="columns large-12">
  369.                         <div class="category-tags-wrapper">
  370.                             <div class="left-blur"></div>
  371.                             <div id="catTags" class="category-tags">
  372.                                 <?php $pageListPartials->categoryButtons($selectedCategoryId); ?>
  373.                             </div>
  374.                             <div class="right-blur"></div>
  375.                         </div>
  376.                     </div>
  377.                 </div> <!-- row -->
  378.             <?php endif; ?>
  379.         </div>
  380.         <?php
  381. } else {
  382.     if (isset($_REQUEST['listVendors_id'])) {
  383.         $catHeadline $trans->get('ALIAS_PRODUCTLIST_VENDOR');
  384.         $catDescription $trans->get('ALIAS_PRODUCTLIST_VENDOR__DESCRIPTION');
  385.     }
  386.     if (isset($specialHeadline)) {
  387.         print "<div class='row collapse'><div class='large-12 columns'>";
  388.         print "<h1>" $specialHeadline "</h1>";
  389.     }
  390. }
  391. ?>
  392.     <div class="list-header">
  393.         <div class="row">
  394.             <?php
  395.             // *******************************************************************************************
  396.             if (!isset($catHeadline)) {
  397.                 $catHeadline '';
  398.             }
  399.             if ($selectedCategoryId 0) {
  400.                 $categoryModel $categoriesObject->getCategory($selectedCategoryId);
  401.                 $catHeadline $categoryModel->getHeadline();
  402.                 $catDescription $categoryModel->getDescription();
  403.             }
  404.             // Tweak 2013-02-08: Ingen filtrering på kategorier under avslutade auktioner
  405.             if ($showClosed) {
  406.                 $catHeadline $trans->get("ALIAS_PRODUCT_LIST_HEADLINE_CLOSED");
  407.                 $catDescription $trans->get("ALIAS_PRODUCT_LIST_DESCRIPTION_CLOSED");
  408.             }
  409.             if (isset($_REQUEST['specialcat']) && $_REQUEST["specialcat"] === "bankruptcy") {
  410.                 $catHeadline $trans->get("ALIAS_PRODUCT_LIST_HEADLINE_BANKRUPTCY") . ' <span class="auction-amount">(' $searchResult->getTotalCount() . ')</span>';
  411.                 $catDescription $trans->get("ALIAS_PRODUCT_LIST_DESCRIPTION_BANKRUPTCY");
  412.             }
  413.             if (isset($_REQUEST['specialcat']) && $_REQUEST["specialcat"] === "promoted") {
  414.                 $catHeadline $trans->get("ALIAS_PRODUCT_LIST_HEADLINE_STOCK");
  415.                 $catDescription $trans->get("ALIAS_PRODUCT_LIST_DESCRIPTION_STOCK");
  416.             }
  417.             if (!empty($_REQUEST['searchtext'])) {
  418.                 $appendCategory = !empty($categoryModel) ? 'i <span class="category-headline">' strtolower($categoryModel->getName()) : '';
  419.                 $catHeadline $trans->get('text_headline_page-list_heading_searched') . ' <span class="search-word">”' htmlentities($_REQUEST['searchtext']) . '”</span> ' $appendCategory '</span>';
  420.                 $catDescription '';
  421.             }
  422.             $headline false;
  423.             if (isset($catHeadline) && strlen($catHeadline) > 0) {
  424.                 $headline true;
  425.             }
  426.             $categoriesListClasses = array(
  427.                 'category-info',
  428.                 'large-6',
  429.                 'columns'
  430.             );
  431.             if ($showClosed) {
  432.                 $categoriesListClasses[] = 'show-closed-auctions';
  433.             }
  434.             if ($headline) {
  435.                 $categoriesListClasses[] = 'show-auctions';
  436.             } else {
  437.                 $categoriesListClasses[] = 'large-6 medium-10';
  438.             }
  439.             if ($headline) {
  440.                 if (isset($pageListPartials) && (empty($_REQUEST['specialcat']) || $showClosed) && $pageListPartials->totalNumberOfProducts((int) $selectedCategoryId)) {
  441.                     $catHeadline .= ' <span class="auction-amount">(' $pageListPartials->totalNumberOfProducts((int) $selectedCategoryId) . ')</span>';
  442.                 }
  443.                 if (!empty($_REQUEST['searchtext'])) {
  444.                     $catHeadline .= '<a href="' $urlGenerator->generate('app.legacy.index') . '" class="search-word-reset"><i class="ri-close-line"></i></a>';
  445.                 }
  446.                 print "<div class=\"" implode(' '$categoriesListClasses) . "\">";
  447.                 print "    <div class=\"category-info__wrapper\">";
  448.                 print "        <h1>" $catHeadline "</h1>";
  449.                 print "        <div class=\"catdescription\">\n";
  450.                 if (isset($catDescription) && strlen($catDescription) > 0) {
  451.                     print "<p>" $catDescription "</p>";
  452.                 }
  453.                 print "        </div>\n";
  454.                 print "    </div>\n";
  455.                 print "</div>";
  456.             } else {
  457.                 print "<div class=\"" implode(' '$categoriesListClasses) . "\">";
  458.                 print "    <div class=\"category-info__wrapper all-auctions\">";
  459.                 print "        <h1>" $trans->get('text_headline_page-list_heading_all-auctions') . ": <span>" $pageListPartials->totalNumberOfProducts() . "</span></h1>";
  460.                 print "    </div>\n";
  461.                 print "</div>";
  462.             }
  463.             if ($showClosed): ?>
  464.                 <div class="columns large-6">
  465.                     <div class='sell-with-us'>
  466.                         <h2><?php $trans->eGet('text_subheading_page-list_subheading_closed-auctions'); ?></h2>
  467.                         <p><?php $trans->eGet('text_bodytext_page-list_bodytext_all-auctions'); ?></p>
  468.                         <a
  469.                             href='<?php echo $urlGenerator->generate('app.legacy.pages.howtosell'); ?>'><?php $trans->eGet('link_button_page-list_link_all-auctions'); ?></a>
  470.                     </div>
  471.                 </div>
  472.             <?php endif; ?>
  473.         </div>
  474.         <?php
  475.         if ($showSortbar):
  476.             ?>
  477.             <div class="row">
  478.                 <div class="columns">
  479.                     <div class="filter-wrapper">
  480.                         <?php if (!$showClosed && $_REQUEST['specialcat'] !== 'bankruptcy'): ?>
  481.                             <div class="filter-col redis-search__location">
  482.                                 <div class="location-filter redis-filter">
  483.                                     <?php
  484.                                     $countiesArr = [];
  485.                                     foreach ($countiesCollection->filterCounties()->orderByName() as $countyItem) {
  486.                                         // The leading 0 is to force PHP to preserve the key as the type string
  487.                                         $countiesArr['0' $countyItem->getId()] = $countyItem->getName();
  488.                                     }
  489.                                     $municipalityArr = [];
  490.                                     foreach ($countiesCollection->filterMunicipalities()->orderByName() as $municipalityItem) {
  491.                                         $municipalityArr['0' $municipalityItem->getParentId()]['0' $municipalityItem->getId()] = $municipalityItem->getName();
  492.                                     }
  493.                                     ?>
  494.                                     <script>
  495.                                         const currentCounty = <?php echo (!empty($setCountyFlagData) ? json_encode($setCountyFlagData) : "false"); ?>;
  496.                                         const currentMunicipality = <?php echo (!empty($setMunicipalityData) ? json_encode($setMunicipalityData) : "false"); ?>;
  497.                                         const reservePriceStatus = <?php echo (!empty($requestFilterReservePrice) ? json_encode($requestFilterReservePrice) : "false"); ?>;
  498.                                         const countiesList = <?php echo json_encode($countiesArrJSON_UNESCAPED_UNICODE); ?>;
  499.                                         const municipalityList = <?php echo json_encode($municipalityArrJSON_UNESCAPED_UNICODE); ?>;
  500.                                         const postLabelTrans = " <?php $trans->eGet('text_label_page-list-partials_including-bordering-counties'); ?>";
  501.                                         const reserveDropdownOptions = {
  502.                                             '': '<?php $trans->eGet('text_label_page-list-partials_reserve_all'); ?>',
  503.                                             none: '<?php $trans->eGet('text_label_page-list-partials_no_reserve'); ?>',
  504.                                             reached: '<?php $trans->eGet('text_label_page-list-partials_reserve_reached'); ?>',
  505.                                             notreached: '<?php $trans->eGet('text_label_page-list-partials_reserve_not_reached'); ?>'
  506.                                         };
  507.                                     </script>
  508.                                     <?php
  509.                                     echo '<form id="locationSearchForm" action="' $pageListPartials->getFormUrl() . '" method="GET">';
  510.                                     echo $pageListPartials->renderCountyRedis();
  511.                                     echo $pageListPartials->renderMunicipalityRedis();
  512.                                     if (
  513.                                         $selectedCategoryId ||
  514.                                         !empty($_REQUEST['searchtext']) ||
  515.                                         ($countyFilter && !in_array('all'$countyFilter)) ||
  516.                                         ($municipalityFilter && !in_array('all'$municipalityFilter))
  517.                                     ):
  518.                                         ?>
  519.                                         <button data-k-modal-trigger="saved-search-modal" type="button"
  520.                                             class="saved-search-button saved-search-button-desktop button--large button--rounded button--text">
  521.                                             <svg width="14" height="14" viewBox="0 0 16 16" fill="none"
  522.                                                 xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet">
  523.                                                 <g clip-path="url(#clip0_11116_9170)">
  524.                                                     <path
  525.                                                         d="M2.66667 1.33331H13.3333C13.5101 1.33331 13.6797 1.40355 13.8047 1.52858C13.9298 1.6536 14 1.82317 14 1.99998V14.8506C14.0001 14.9063 13.9862 14.961 13.9597 15.0099C13.9332 15.0588 13.8948 15.1003 13.8482 15.1306C13.8015 15.1609 13.748 15.179 13.6926 15.1833C13.6371 15.1876 13.5814 15.178 13.5307 15.1553L8 12.6866L2.46933 15.1546C2.4186 15.1773 2.36301 15.1869 2.30761 15.1827C2.25221 15.1784 2.19876 15.1603 2.15212 15.1301C2.10548 15.0999 2.06713 15.0585 2.04057 15.0097C2.014 14.9609 2.00005 14.9062 2 14.8506V1.99998C2 1.82317 2.07024 1.6536 2.19526 1.52858C2.32029 1.40355 2.48986 1.33331 2.66667 1.33331ZM12.6667 13.31V2.66665H3.33333V13.31L8 11.2273L12.6667 13.31Z"
  526.                                                         fill="#008540" />
  527.                                                     <path
  528.                                                         d="M6.59318 5C6.1822 5 5.77002 5.15179 5.4619 5.45268C4.84566 6.05446 4.84641 7.00917 5.4619 7.61122C5.4619 7.61122 7.9387 10 7.99978 10C8.06087 10 9.74506 8.3873 10.5378 7.61337C11.1541 7.01159 11.1541 6.05648 10.5378 5.45484C9.92158 4.85306 8.89391 4.85306 8.27766 5.45484L8.00113 5.72445L7.72236 5.45282C7.41408 5.15193 7.00415 5 6.59318 5Z"
  529.                                                         fill="#008540" />
  530.                                                 </g>
  531.                                                 <defs>
  532.                                                     <clipPath id="clip0_11116_9170">
  533.                                                         <rect width="16" height="16" fill="white" />
  534.                                                     </clipPath>
  535.                                                 </defs>
  536.                                             </svg>
  537.                                             <?php $trans->eGet("text_label_saved-search_trigger-button"?>
  538.                                         </button>
  539.                                     <?php endif;
  540.                                     print '</form>';
  541.                                 print '</div>'// End location filter
  542.                             print '</div>'// End filter-col
  543.                             print '<div class="filter-col">';
  544.                                 print '<form id="reservePriceForm" action="' $pageListPartials->getFormUrl() . '" method="GET">';
  545.                                     print $pageListPartials->renderReservePrice();
  546.                                 print '</form>';
  547.                             print '</div>'// end filter-col
  548.                             endif;
  549.                             print '<div class="filter-col">';
  550.                                     print '<div class="saved-search-wrapper hide-for-large-up">';
  551.                                         if (
  552.                                             $selectedCategoryId ||
  553.                                             !empty($_REQUEST['searchtext']) ||
  554.                                             ($countyFilter && !in_array('all'$countyFilter)) ||
  555.                                             ($municipalityFilter && !in_array('all'$municipalityFilter))
  556.                                         ):
  557.                                             print "<button data-k-modal-trigger=\"saved-search-modal\" class=\"saved-search-button saved-search-button-mobile button--medium button--rounded button--text show-for-medium-down\"><svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" preserveAspectRatio=\"xMidYMid meet\"><g clip-path=\"url(#clip0_11116_9170)\"><path d=\"M2.66667 1.33331H13.3333C13.5101 1.33331 13.6797 1.40355 13.8047 1.52858C13.9298 1.6536 14 1.82317 14 1.99998V14.8506C14.0001 14.9063 13.9862 14.961 13.9597 15.0099C13.9332 15.0588 13.8948 15.1003 13.8482 15.1306C13.8015 15.1609 13.748 15.179 13.6926 15.1833C13.6371 15.1876 13.5814 15.178 13.5307 15.1553L8 12.6866L2.46933 15.1546C2.4186 15.1773 2.36301 15.1869 2.30761 15.1827C2.25221 15.1784 2.19876 15.1603 2.15212 15.1301C2.10548 15.0999 2.06713 15.0585 2.04057 15.0097C2.014 14.9609 2.00005 14.9062 2 14.8506V1.99998C2 1.82317 2.07024 1.6536 2.19526 1.52858C2.32029 1.40355 2.48986 1.33331 2.66667 1.33331ZM12.6667 13.31V2.66665H3.33333V13.31L8 11.2273L12.6667 13.31Z\" fill=\"#008540\"/><path d=\"M6.59318 5C6.1822 5 5.77002 5.15179 5.4619 5.45268C4.84566 6.05446 4.84641 7.00917 5.4619 7.61122C5.4619 7.61122 7.9387 10 7.99978 10C8.06087 10 9.74506 8.3873 10.5378 7.61337C11.1541 7.01159 11.1541 6.05648 10.5378 5.45484C9.92158 4.85306 8.89391 4.85306 8.27766 5.45484L8.00113 5.72445L7.72236 5.45282C7.41408 5.15193 7.00415 5 6.59318 5Z\" fill=\"#008540\"/></g><defs><clipPath id=\"clip0_11116_9170\"><rect width=\"16\" height=\"16\" fill=\"white\"/></clipPath></defs></svg>" $trans->get("text_label_saved-search_trigger-button") . "</button>";
  558.                                         endif;
  559.                                     print '</div>'// End grid-picker-wrapper
  560.                                     print '<div class="secondary-sortbar-wrapper">';
  561.                                         print '<div class="secondary-sortbar">';
  562.                                             print $pageListPartials->renderPerPage();
  563.                                             print $pageListPartials->renderSortOrder();
  564.                                         print '</div>';
  565.                                     print '</div>';
  566.                                     print '</div>'// end filter-col
  567.                                     ?>
  568.                                 </div> <!-- end filter-wrapper -->
  569.                         </div> <!-- end columns -->
  570.                     </div> <!-- end row -->
  571.         <?php endif; ?>
  572.     </div> <!-- list-header -->
  573. </div> <!-- sortbar-filter-conatainer -->
  574. <?php
  575. $productIds = array();
  576. if ($searchResult->getTotalCount()) {
  577.     print "  <div class=\"row\">\n";
  578.     print "  <div id=\"listing_wrapper\" class=\"listing_wrapper\">\n";
  579.     print "        <div class=\"redis-product-grid\">\n";
  580.     $currentDateTime = new DateTime();
  581.     $productCardRenderer = new ProductCardRenderer($twig$propUserData$parameters);
  582.     $productObjectConverter = new ProductObjectConverter();
  583.     $timeLeftUtil $container->get(TimeLeftUtil::class);
  584.     foreach ($searchResult->getItems() as $object) {
  585.         $productIds[] = $object['id'];
  586.         $prodObjects[] = [
  587.             'id' => (int) $object['id'],
  588.             'timeLeft' => $timeLeftUtil->timeLeft(new DateTime($object['endDate'])),
  589.             'auctionEnd' => strtotime($object['endDate'])
  590.         ];
  591.         try {
  592.             echo $productCardRenderer->render(
  593.                 $productObjectConverter->toProductList($object$favoriteProductListCollection),
  594.                 false,
  595.                 true
  596.             );
  597.         } catch (LoaderError RuntimeError SyntaxError $e) {}
  598.     }
  599.     print "        <!-- end redis-product-grid --></div>";
  600.     if ((!isset($_REQUEST['specialcat']) || (isset($_REQUEST['specialcat']) && ($_REQUEST['specialcat'] == 'all' || $_REQUEST['specialcat'] == ''))) && !isset($_REQUEST['curpage']) && (isset($_REQUEST['catid']) && (int) $_REQUEST['catid'] < 1)) {
  601.         print "<a href=/corona-information.html class=\"coronaBar\">";
  602.         print $trans->get('text_url_page-list_covid-information');
  603.         print "  &nbsp;<img src='/images/arrow-right.svg?v=1' alt='" $trans->get('text_altimg_page-list_arrow') . "'>";
  604.         print "</a>";
  605.     }
  606.     print "  <!-- end #listing_wrapper --></div>\n";
  607.     print "  <!-- end row --></div>\n";
  608.     $js_searchtext '';
  609.     if (isset($_REQUEST['searchtext'])) {
  610.         $js_searchtext str_replace(array("'""\r\n""\r""\n"), ""$_REQUEST["searchtext"]);
  611.     }
  612.     $ajaxtimeout 45000;
  613.     if (isset($_REQUEST['specialcat']) && $_REQUEST["specialcat"] == "closed") {
  614.         $ajaxtimeout 3600000;
  615.     }
  616. ?>
  617. <?php
  618. }
  619. if ($searchResult->getTotalCount() === 0) {
  620.     ?>
  621.     <div class="row">
  622.         <div class="columns">
  623.             <div class="no-search-results-container">
  624.                 <div class="lottie-search-container">
  625.                     <div id="lottie-no-search" class="lottie-no-search"
  626.                         data-src="/images/lottie-animations/lottie-search-real.json"></div>
  627.                 </div>
  628.                 <p>
  629.                     <?php
  630.                     print $trans->get("ALIAS_PRODUCT_LIST_NOOBJECTS");
  631.                     print "<span>" $trans->get("ALIAS_PRODUCT_LIST_NOOBJECTS__DESCRIPTION") . "</span>";
  632.                     ?>
  633.                 </p>
  634.             </div>
  635.         </div>
  636.     </div>
  637.     <?php
  638. }
  639. if (
  640.     $selectedCategoryId ||
  641.     !empty($_REQUEST['searchtext']) ||
  642.     ($countyFilter && !in_array('all'$countyFilter)) ||
  643.     ($municipalityFilter && !in_array('all'$municipalityFilter))
  644. ):
  645.     print "<div class=\"saved-search-button-bottom-container\"><button data-k-modal-trigger=\"saved-search-modal\" class=\"saved-search-button saved-search-button-bottom button--medium button--rounded button--text \"><svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" preserveAspectRatio=\"xMidYMid meet\"><g clip-path=\"url(#clip0_11116_9170)\"><path d=\"M2.66667 1.33331H13.3333C13.5101 1.33331 13.6797 1.40355 13.8047 1.52858C13.9298 1.6536 14 1.82317 14 1.99998V14.8506C14.0001 14.9063 13.9862 14.961 13.9597 15.0099C13.9332 15.0588 13.8948 15.1003 13.8482 15.1306C13.8015 15.1609 13.748 15.179 13.6926 15.1833C13.6371 15.1876 13.5814 15.178 13.5307 15.1553L8 12.6866L2.46933 15.1546C2.4186 15.1773 2.36301 15.1869 2.30761 15.1827C2.25221 15.1784 2.19876 15.1603 2.15212 15.1301C2.10548 15.0999 2.06713 15.0585 2.04057 15.0097C2.014 14.9609 2.00005 14.9062 2 14.8506V1.99998C2 1.82317 2.07024 1.6536 2.19526 1.52858C2.32029 1.40355 2.48986 1.33331 2.66667 1.33331ZM12.6667 13.31V2.66665H3.33333V13.31L8 11.2273L12.6667 13.31Z\" fill=\"#008540\"/><path d=\"M6.59318 5C6.1822 5 5.77002 5.15179 5.4619 5.45268C4.84566 6.05446 4.84641 7.00917 5.4619 7.61122C5.4619 7.61122 7.9387 10 7.99978 10C8.06087 10 9.74506 8.3873 10.5378 7.61337C11.1541 7.01159 11.1541 6.05648 10.5378 5.45484C9.92158 4.85306 8.89391 4.85306 8.27766 5.45484L8.00113 5.72445L7.72236 5.45282C7.41408 5.15193 7.00415 5 6.59318 5Z\" fill=\"#008540\"/></g><defs><clipPath id=\"clip0_11116_9170\"><rect width=\"16\" height=\"16\" fill=\"white\"/></clipPath></defs></svg>" $trans->get("text_label_saved-search_trigger-button") . "</button>";
  646. endif;
  647. print "</div>\n";
  648. print "<!-- end .page-container --></div>\n";
  649. print "<!-- end #topbar_full --></div>";
  650. ?>
  651. <?php if ($selectedCategoryId 1): ?>
  652.     <div id="topbar-app">
  653.         <div class="topbar-app__wrapper">
  654.             <p class="topbar-app__text"><?php $trans->eGet("text_topbar_download-app_description"?></p>
  655.             <a href="/app/download">
  656.                 <button
  657.                     class="topbar-app__download button--small button--highlight"><?php $trans->eGet("text_topbar_download-app_button"?></button>
  658.             </a>
  659.         </div>
  660.         <p href="#" id="topbar-app__close" class="topbar-app__close-icon"><i class="ri-close-line"></i></p>
  661.     </div>
  662. <?php endif;
  663. if ($showSortbar):
  664.     ?>
  665.     <div class="pagination-wrapper">
  666.         <div class="pagination bottom-pagination">
  667.             <?php print $pageListPartials->renderPaging(); ?>
  668.         </div>
  669.     </div>
  670.     <?php
  671. endif;
  672. // *******************************************************************************************
  673. // Trustpilot-showcase
  674. if ($_REQUEST['specialcat'] === '' || $_REQUEST['specialcat'] === 'all') {
  675.     echo $container->get('twig')->render('public/trustpilot/trustpilot_slider.html.twig');
  676. } else {
  677.     echo $container->get('twig')->render('public/trustpilot/trustpilot_small.html.twig');
  678. }
  679. // *******************************************************************************************
  680. if (isset($_SESSION['register_id'])) {
  681.     ?>
  682.     <k-modal id="saved-search-modal" class="saved-search-modal" data-position="center">
  683.         <i slot="close-icon" class="ri-close-fill"></i>
  684.         <div slot="header" class="saved-search-modal__header">
  685.             <span class="saved-search-modal__header-img"></span>
  686.         </div>
  687.         <div slot="body" class="saved-search-modal__body">
  688.             <h1 class="saved-search-modal__heading"><?php $trans->eGet("text_heading_saved-search-modal_save-search"?>
  689.             </h1>
  690.             <p class="saved-search-modal__subheading"><?php $trans->eGet("text_bodytext_saved-search-modal_save-search"?>
  691.             </p>
  692.             <form id="save-search-form" class="saved-search-modal__form validate-form">
  693.                 <div class="form-field-1">
  694.                     <input type="text" id="saveSearchTitle" class="form-field-1__input-field validate-field textInput"
  695.                         value=" " />
  696.                     <label for="form-field-1" class="form-field-1__label">
  697.                         <?php $trans->eGet("text_label_saved-search-modal_save-search-input"?>
  698.                     </label>
  699.                     <span class="form-clear-field"></span>
  700.                 </div>
  701.                 <span class="saved-search-modal__info-text saved-search-modal__filters-description"></span>
  702.                 <div>
  703.                     <k-switch-component checked label="<?php $trans->eGet("text_label_saved-search-modal_mail-switch"?>"
  704.                         id="mail-switch"></k-switch-component>
  705.                 </div>
  706.                 <span
  707.                     class="saved-search-modal__info-text"><?php $trans->eGet("text_label_saved-search-modal_mail-disclaimer"?></span>
  708.                 <button class="button--large button--primary button--rounded button--grid">
  709.                     <?php $trans->eGet("text_label_saved-search_trigger-button"?>
  710.                 </button>
  711.             </form>
  712.         </div>
  713.         <div slot="footer" class="saved-search-modal__footer"></div>
  714.     </k-modal>
  715. <?php } else { ?>
  716.     <k-modal id="saved-search-modal" data-position="center">
  717.         <i slot="close-icon" class="ri-close-fill"></i>
  718.         <div slot="header" class="saved-search-modal__header">
  719.             <span class="saved-search-modal__header-img"></span>
  720.         </div>
  721.         <div slot="body" class="saved-search-modal__body">
  722.             <h1 class="saved-search-modal__heading"><?php $trans->eGet("text_heading_saved-search-modal_save-search"?>
  723.             </h1>
  724.             <p class="saved-search-modal__subheading"><?php $trans->eGet("text_bodytext_saved-search-modal_login"?></p>
  725.         </div>
  726.         <div slot="footer" class="saved-search-modal__footer saved-search-modal__footer-btns">
  727.             <a href="<?php echo ($urlGenerator->generate('app.legacy.pages.login', ['continue' => $request->getRequestUri()])) ?>"
  728.                 class="button--large button--primary button--rounded">
  729.                 <i class="ri-user-fill"></i><?php $trans->eGet("text_label_saved-search-modal_login"?>
  730.             </a>
  731.             <a href="<?php echo ($urlGenerator->generate('app.legacy.pages.register')) ?>"
  732.                 class="button--large button--rounded button--secondary">
  733.                 <i class="ri-user-add-line"></i><?php $trans->eGet("text_label_saved-search-modal_create-account"?>
  734.             </a>
  735.         </div>
  736.     </k-modal>
  737.     <k-modal id="saved-object-modal" data-position="center">
  738.         <i slot="close-icon" class="ri-close-fill"></i>
  739.         <div slot="header" class="saved-object-modal__header">
  740.             <span class="saved-object-modal__header-img"></span>
  741.         </div>
  742.         <div slot="body" class="saved-object-modal__body">
  743.             <h1 class="saved-object-modal__heading"><?php $trans->eGet("text_heading_saved-object-modal_save-object"?>
  744.             </h1>
  745.             <p class="saved-object-modal__subheading"><?php $trans->eGet("text_bodytext_saved-object-modal_login"?></p>
  746.         </div>
  747.         <div slot="footer" class="saved-search-modal__footer saved-object-modal__footer-btns">
  748.             <a href="<?php echo ($urlGenerator->generate('app.legacy.pages.login', ['continue' => $request->getRequestUri()])) ?>"
  749.                 class="button--large button--primary button--rounded" saved-object-cta="login">
  750.                 <i class="ri-user-fill"></i><?php $trans->eGet("text_label_saved-object-modal_login"?>
  751.             </a>
  752.             <a href="<?php echo ($urlGenerator->generate('app.legacy.pages.register')) ?>"
  753.                 class="button--large button--rounded button--secondary" saved-object-cta="create-account">
  754.                 <i class="ri-user-add-line"></i><?php $trans->eGet("text_label_saved-object-modal_create-account"?>
  755.             </a>
  756.         </div>
  757.     </k-modal>
  758.     <?php
  759. }
  760.     ?>
  761.     <script>
  762.         const prodObjects = <?php echo json_encode($prodObjects?>;
  763.         const watchProdIds = [<?php echo implode(","$productIds); ?>];
  764.         const notifierUrl = "<?php echo $parameters->get('app.notifier.url'); ?>";
  765.         const ajaxTimeout = <?php echo isset($ajaxtimeout) ? $ajaxtimeout "false"?>;
  766.     </script>
  767.     <?php
  768. $manifestAssets->add('bundle-pages-redisSearchFilter');