public/page_product.phtml line 710

Open in your IDE?
  1. <?php
  2. require_once __DIR__ '/includes/auctionfee.php';
  3. require_once __DIR__ '/includes/Categories.php';
  4. require_once __DIR__ '/includes/ProductFieldsTableRender.php';
  5. /**
  6.  * $products_id is defined in index.phtml
  7.  * @var mysqli $db   defined in require.phtml, included thru index.phtml
  8.  *
  9.  * @var Trans $trans
  10.  * @var UrlGeneratorInterface $urlGenerator
  11.  * @var \Symfony\Component\DependencyInjection\ContainerInterface $container
  12.  * @var ContainerBagInterface $parameters
  13.  * @var \Klaravik\Assets\ManifestAssets $manifestAssets
  14.  */
  15. use Klaravik\Enum\ProductFieldsEnum;
  16. use Klaravik\Exception\MissingResultException;
  17. use Klaravik\Images\ProductImage;
  18. use Klaravik\Images\ProductImagesViewCollection;
  19. use Klaravik\includes\ProductFieldsTableRender;
  20. use Klaravik\includes\Categories;
  21. use Klaravik\Breadcrumb\Breadcrumb;
  22. use Klaravik\Model\ExtraVehicle;
  23. use Klaravik\Model\VendorType;
  24. use Klaravik\Product\BasicData\RenderBasicProductData;
  25. use Klaravik\Product\Condition\RenderConditionData;
  26. use Klaravik\Product\Equipment\RenderEquipmentData;
  27. use Klaravik\Product\Util\TimeLeftUtil;
  28. use Klaravik\Repository\ProductDescriptionRepo;
  29. use Klaravik\Repository\ProductsRegisterRefRepo;
  30. use Klaravik\Repository\VendorTypeRepo;
  31. use Klaravik\Translate\Trans;
  32. use Klaravik\Product\ExtraVehicle\RenderExtraVehicleData;
  33. use Klaravik\Repository\ExtraVehicleRepo;
  34. use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
  35. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  36. use Klaravik\Repository\UserRepo;
  37. use Klaravik\Repository\ProductFlagRepo;
  38. use Klaravik\Exception\RepositoryException;
  39. use Klaravik\Repository\RegisterRepository;
  40. $categoriesObject = new Categories($trans$urlGenerator);
  41. $productFieldsRender null;
  42. /**
  43.  * Returns a valid url for getting back to vendor view
  44.  *
  45.  * @param UrlGeneratorInterface $urlGenerator
  46.  * @return string
  47.  */
  48. function getReturnUrl(UrlGeneratorInterface $urlGenerator): string {
  49.     if (isset($_GET['vendorTab'])) {
  50.         $params = ['vendortab' => $_GET['vendorTab']];
  51.         if (isset($_GET['productspage'])) {
  52.             $params['productspage'] = $_GET['productspage'];
  53.         }
  54.         return $urlGenerator->generate('app.legacy.pages.vendor.subpage'$params);
  55.     }
  56.     return '';
  57. }
  58. /**
  59.  * @return bool
  60.  */
  61. function isKam(): bool
  62. {
  63.     $userIsKam FALSE;
  64.     if (isset($_SESSION['users_id'])) {
  65.         try {
  66.             $userIsKam = (new UserRepo())->userIsKam($_SESSION['users_id'])->getId() === $_SESSION['users_id'];
  67.         } catch (RepositoryException MissingResultException $e) {}
  68.     }
  69.     return $userIsKam;
  70. }
  71. /**
  72.  * Check if a product needs to be reviewed by KAM
  73.  *
  74.  * @throws RepositoryException
  75.  */
  76. function mustBeReviewed(int $products_id): int
  77. {
  78.     return (new ProductFlagRepo())->getByProductId($products_id)->getMustBeReviewed();
  79. }
  80. function buildProductQuery($db$useTable$products_id$language) {
  81.     $query  "SELECT p.*, pd.name AS name, pd.description AS description, pd.county_id, pd.fabrikat AS fabrikat, pd.model AS model, pd.enteredByKam, ";
  82.     $query .= "pd.includesForewordInDescription as includesForewordInDescription, pd.previewHash, pd.extraVehicleDescription, pd.extraDescription, pd.descriptionPreamble, ";
  83.     $query .= "CASE WHEN (p.auctionend < NOW() AND p.paymentbasis_id > 0) THEN 1 ELSE 0 END AS isSold, ";
  84.     $query .= "pd.filelinkname AS filelinkname, pd.urlname AS urlname, p.price AS price, p.resprice AS resprice, p.canceled AS canceled, ";
  85.     $query .= "DATE_FORMAT(p.auctionstart, '%Y-%m-%d') AS astartdate, DATE_FORMAT(p.auctionstart, '%H:%i') AS astartkl, ";
  86.     $query .= "DATE_FORMAT(p.auctionend, '%Y-%m-%d') AS aenddate, DATE_FORMAT(p.auctionend, '%H:%i') AS aendkl, ";
  87.     $query .= "DATE_FORMAT(p.auctionstart, '%Y%m%d%H%i%s') AS fullstart, DATE_FORMAT(p.auctionend, '%Y%m%d%H%i%s') AS fullend, ";
  88.     $query .= "DATE_FORMAT(p.auctionend, '%Y-%m-%d %H:%i:%s') AS ddend, ";
  89.     $query .= "DATE_FORMAT(p.auctionend, '%H:%i') AS kl, ";
  90.     $query .= "DATE_FORMAT(p.auctionend, '%Y') AS oyear, DATE_FORMAT(p.auctionend, '%m') AS omonth, DATE_FORMAT(p.auctionend, '%d') AS oday ";
  91.     $query .= "FROM ".$useTable." p, products_description pd ";
  92.     $query .= "WHERE p.id='".mysqli_real_escape_string($db$products_id)."' ";
  93.     //$query .= "AND p.online=1 AND p.commissions_id!=0 ";
  94.     $query .= "AND pd.products_id=p.id AND pd.language_id='".$language."'";
  95.     //print $query."<br />";
  96.     return $query;
  97. }
  98. /**
  99.  * @param mysqli $db
  100.  * @param int $products_id
  101.  * @return string
  102.  */
  103. function recentProductChanges(mysqli $dbint $products_id) {
  104.     $rpcRes mysqli_query($db"SELECT * FROM recentProductChanges WHERE `products_id` = " $products_id);
  105.     if (mysqli_num_rows($rpcRes)) {
  106.         $rpcObj mysqli_fetch_object($rpcRes);
  107.         if (!empty($rpcObj->changes)) {
  108.             return $rpcObj->changes;
  109.         }
  110.     }
  111.     return '';
  112. }
  113. /**
  114.  * @param mysqli $db
  115.  * @param int $products_id
  116.  * @return array
  117.  */
  118. function getHighlightedFieldsAndValues(mysqli $dbint $products_id): array
  119. {
  120.     $highlightedFieldsArray = [];
  121.     $hfRes mysqli_query($db"SELECT pV.value, pF.value AS productFieldName FROM productvalues pV
  122.                                         LEFT JOIN productfields pF on pF.id = pV.productfields_id
  123.                                         WHERE pF.highlight = 1 AND `products_id` = " $products_id);
  124.     if (mysqli_num_rows($hfRes)) {
  125.         $values mysqli_fetch_all($hfResMYSQLI_ASSOC);
  126.         foreach($values as $value) {
  127.             $highlightedFieldsArray[$value['productFieldName']] = $value['value'];
  128.         }
  129.     }
  130.     return $highlightedFieldsArray;
  131. }
  132. if(isset($products_id) && is_numeric($products_id)){
  133.   $counties getAllCounties($db);
  134.   $shortDescription = (new ProductDescriptionRepo())->getByProductsId($products_id)->getShortDescription() ?: null;
  135.   $useTable 'products';
  136.   $query buildProductQuery($db$useTable$products_idLANGUAGE_ID);
  137.   $result mysqli_query($db$query);
  138.   if (mysqli_num_rows($result) == 0) {
  139.     $useTable 'products_archive';
  140.     $query buildProductQuery($db$useTable$products_idLANGUAGE_ID);
  141.     $result mysqli_query($db$query);
  142.   }
  143.   if(mysqli_num_rows($result)){
  144.     $obj mysqli_fetch_object($result);
  145.     $productFieldsRender = new ProductFieldsTableRender($db$obj);
  146.     // If copiedFrom_id and leasing_company_id and 'manuel försäljning' is isset/true then read bids from the original product.
  147.     $getBidBoxFromCopy false;
  148.     if ($obj->leasing_company_id && $obj->copiedFrom_id && $obj->annulment_reasons_id 100) {
  149.         $getBidBoxFromCopy getBidHistoryFromCopy($db$obj->id$obj->copiedFrom_id);
  150.     }
  151.     $county getNodei($db"county",$obj->county_id);
  152.     $countyParent getNodei($db'county',$county->parent_id);
  153.     $images = array();
  154.     try {
  155.         $images = new ProductImagesViewCollection($db$obj->id);
  156.     } catch (Exception $exception) {
  157.     }
  158.     $previewAvailable false;
  159.     if(
  160.         ((new DateTime() < new DateTime($obj->auctionstart)) || !$obj->online)
  161.     ) {
  162.         if (array_key_exists('preview'$_REQUEST)) {
  163.             $previewAvailable = ($_REQUEST['preview'] === $obj->previewHash);
  164.         } elseif (
  165.             (isset($_SESSION['users_id']) && array_key_exists($obj->vendors_id$_SESSION['vendorAccess']))
  166.             || (array_key_exists('is_admin'$_SESSION) && $_SESSION['is_admin'])
  167.         ) {
  168.             $previewAvailable true;
  169.         }
  170.     }
  171.     if (
  172.             ((int)$obj->online === 1
  173.             && (int)$obj->commissions_id !== 0
  174.             && (int)$obj->fullstart &&
  175.             date("YmdHis") >= $obj->fullstart)
  176.             || (isset($_SESSION['users_id']) && array_key_exists($obj->vendors_id$_SESSION['vendorAccess']))
  177.             || (array_key_exists('is_admin'$_SESSION) && $_SESSION['is_admin'])
  178.             || $previewAvailable
  179.     ){
  180.       mysqli_query($db"UPDATE products SET viewcounter=(viewcounter + 1) WHERE id='".mysqli_real_escape_string($db$obj->id)."'");
  181.       $secleft 0;
  182.       $timeleft $trans->get('text_label_page-product_not-started');
  183.       if($obj->ddend date("Y-m-d H:i:s")) {
  184.           $secleft strtotime($obj->ddend) - strtotime(date("Y-m-d H:i:s"));
  185.           $timeleft $container->get(TimeLeftUtil::class)->withoutIcon()->timeLeft(new \DateTime($obj->ddend));
  186.       } elseif ($obj->ddend date("Y-m-d H:i:s")) {
  187.           $timeleft $trans->get('text_label_ajax-product-json_time-left-completed');
  188.       }
  189.       if($obj->canceled) {
  190.           $secleft 0;
  191.           $timeleft $trans->get('text_label_page-product_cancelled');
  192.       }
  193.         $nbrBids 0;
  194.         $highBid 0;
  195.         $highestBidder null;
  196.         $lastBid = new stdClass();
  197.         $lastBid->bid = -1;
  198.         $mbidSql  "SELECT *, DATE_FORMAT(entered, '%Y') AS year, DATE_FORMAT(entered, '%m') AS month, DATE_FORMAT(entered, '%d') AS day, DATE_FORMAT(entered, '%H:%i') AS kl FROM bids ";
  199.         $mbidSqlId $obj->id;
  200.         if($getBidBoxFromCopy) {
  201.             $mbidSqlId $obj->copiedFrom_id;
  202.         }
  203.         $mbidSql .= "WHERE products_id= " . (int) $mbidSqlId " ORDER BY bid DESC, id DESC";
  204.       $mbidRes mysqli_query($db$mbidSql);
  205.       $nbrBids mysqli_num_rows($mbidRes);
  206.       if($nbrBids){
  207.         $i 1;
  208.         while($mbid mysqli_fetch_object($mbidRes)){
  209.           if($i == 1){
  210.             $highestBidder $mbid->register_id;
  211.             $lastBid $mbid;
  212.             $highBid $mbid->bid;
  213.           }
  214.           $i++;
  215.         }
  216.       }
  217.       $bidinc 0;
  218.       $bssql "SELECT * FROM biddingsteps ORDER BY level DESC";
  219.       $bsres mysqli_query($db$bssql);
  220.       while($bs mysqli_fetch_object($bsres)){
  221.         if($lastBid->bid <= $bs->level){
  222.           $bidinc $bs->step;
  223.         }
  224.       }
  225.       if($nbrBids 0$bidtext $trans->get('text_label_page-product_min-bid-increased');
  226.       else $bidtext $trans->get('text_label_page-product_min-bid');
  227.       $minimumBid = ($highBid $bidinc);
  228.       if($highBid == 0$minimumBid $obj->price;
  229.       if ($minimumBid == 0$minimumBid $bidinc;
  230.       $vendor getNodei($db"vendors"$obj->vendors_id);
  231.       if($vendor->isAnon){
  232.         $vendorName $trans->get('text_label_page-product_anonymous');
  233.         if($vendor->companytype){
  234.           $vendortype getNodei($db"vendortypes"$vendor->companytype);
  235.           if($vendortype->typename != ""){
  236.             $vendorName $vendortype->typename;
  237.           }
  238.         }
  239.       }
  240.       else {
  241.         $vendorName $vendor->company;
  242.       }
  243.       $vendorType = new VendorType();
  244.       try {
  245.          $vendorType = (new VendorTypeRepo())->getById($vendor->companytype);
  246.       } catch (MissingResultException|RepositoryException $e) {
  247.       }
  248.     $bids = array();
  249.     $mbidSqlId $obj->id;
  250.     if($getBidBoxFromCopy) {
  251.         $mbidSqlId $obj->copiedFrom_id;
  252.     }
  253.     $bidsSql "SELECT id, register_id, bid, ip, entered, DATE_FORMAT(entered, '%m') AS bmonth,
  254.        DATE_FORMAT(entered, '%d') AS bday, DATE_FORMAT(entered, '%H:%i') AS kl
  255.     FROM bids
  256.     WHERE products_id={$mbidSqlId}
  257.     ORDER BY bid DESC, id DESC";
  258.     $bidders getBidderNumbers($db$products_id);
  259.     $leaderBidderNumber array_key_exists($highestBidder$bidders) ? $bidders[$highestBidder] : 0;
  260.     $bidsResult mysqli_query($db$bidsSql);
  261.     if (mysqli_num_rows($bidsResult) > 0) {
  262.         while ($bid mysqli_fetch_object($bidsResult)) {
  263.             // SPECIAL: Pga krockande maxbud kan visa bud vara sparade som xxx99 men ska visas som jämnt 100-tal
  264.             if ($bid->bid 10) {
  265.                 $bid->bid += 1;
  266.             }
  267.             $isAutoBid false;
  268.             if ($bid->ip === "Budhöjaren") {
  269.                 $isAutoBid true;
  270.             }
  271.             $negotiation false;
  272.             if ($bid->ip === "Förhandling") {
  273.                 $negotiation true;
  274.             }
  275.             $bidderNumber array_key_exists($bid->register_id$bidders) ? $bidders[$bid->register_id] : 0;
  276.             $userIsBidder false;
  277.             if (array_key_exists('register_id'$_SESSION) &&
  278.                 (int)$_SESSION['register_id'] === (int)$bid->register_id) {
  279.                 $userIsBidder true;
  280.             }
  281.             $bidData = array(
  282.                 'id' => $bid->id,
  283.                 'bidTime' => $trans->get(
  284.                         'text_label_page-product_date-time_day-short-month-time',
  285.                         ['dateTime' => new DateTime($bid->entered)]
  286.                 ),
  287.                 'bidTimeUnix' => (new DateTime($bid->entered))->getTimestamp(),
  288.                 'userIsBidder' => $userIsBidder,
  289.                 'user' => $bidderNumber,
  290.                 'bidSum' => (int)$bid->bid,
  291.                 'autoBid' => $isAutoBid,
  292.                 'negotiation' => $negotiation,
  293.             );
  294.             if (array_key_exists('is_admin'$_SESSION) && (bool)$_SESSION['is_admin']) {
  295.                 $bidData['userId'] = (int)$bid->register_id;
  296.             }
  297.             $bids[] = $bidData;
  298.         }
  299.     }
  300.     ?>
  301.          <div class="row">
  302.                 <div class="columns large-12">
  303.                     <div class="product-page-breadcrumbs">
  304.                         <div class="left-blur"></div>
  305.                         <div id="breadcrumbs" class="breadcrumbs">
  306.                             <?php
  307.                             $breadcrumb = new Breadcrumb($trans$urlGenerator);
  308.                             $breadcrumbs $breadcrumb->activeAuctionBreadcrumbs($obj->categories_id);
  309.                             $httpRefer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
  310.                             $urlParams = [];
  311.                             $closedAuction false;
  312.                             if (strpos($httpRefer'bankruptcy') !== false) {
  313.                                 echo '<a href="'.$urlGenerator->generate('app.legacy.auction.listing.bankruptcy').'">'.
  314.                                     $trans->get('text_label_page-product_bankruptcy_auctions') .'</a>';
  315.                                 $breadcrumbs = array();
  316.                             }
  317.                             if($obj->fullend && date("YmdHis") > $obj->fullend){
  318.                                 $closedAuction true;
  319.                                 $breadcrumbs $breadcrumb->closedAuctionBreadcrumbs($obj->categories_id);
  320.                             }
  321.                             if (strpos($httpRefer'searchtext')) {
  322.                                 $breadcrumbs $breadcrumb->getBreadcrumbs($obj->categories_id, array(
  323.                                     array(
  324.                                         'url'  => '',
  325.                                         'name' => $trans->get('text_label_page-product_all-search-result'),
  326.                                     )
  327.                                 ));
  328.                                 preg_match('/searchtext=([a-zA-Z\d%+]+)&?/'$httpRefer$matches);
  329.                                 if (count($matches)) {
  330.                                     $urlParams array_merge($urlParams, ['searchtext' => $matches[1], 'dosearch' => '']);
  331.                                 }
  332.                             }
  333.                             $parseUrl parse_url($httpRefer);
  334.                             if (isset($parseUrl['query'])) {
  335.                                 parse_str($parseUrl['query'], $querys);
  336.                                 if (isset($querys['setcountyflag'])) {
  337.                                     $urlParams['setcountyflag'] = $querys['setcountyflag'];
  338.                                 }
  339.                                 if (isset($querys['setmunicipality'])) {
  340.                                     $urlParams['setmunicipality'] = $querys['setmunicipality'];
  341.                                 }
  342.                             }
  343.                             foreach($breadcrumbs as $index => $breadcrumbArray) {
  344.                                 $breadcrumbUrlParams $urlParams;
  345.                                 $routeName $closedAuction 'app.legacy.auction.listing.closed' 'app.legacy.auction.listing';
  346.                                 if (!empty($breadcrumbArray['url'])) {
  347.                                     $routeName $closedAuction 'app.legacy.auction.listing.closed.category' 'app.legacy.auction.listing.category';
  348.                                     $breadcrumbUrlParams['caturlname'] = $breadcrumbArray['url'];
  349.                                 }
  350.                                 echo '<a href="'.$urlGenerator->generate($routeName$breadcrumbUrlParams).'">'.$breadcrumbArray['name'].'</a>';
  351.                             }
  352.                             echo '<span>'$trans->get('text_label_page-product_object', ['object_id' => $obj->id]) .'</span>';
  353.                             ?>
  354.                         </div>
  355.                         <div class="right-blur"></div>
  356.                         <hr>
  357.                     </div>
  358.                 </div>
  359.             </div>
  360.         <?php
  361.         if ($previewAvailable) {
  362.             $respricePrice $trans->get('info_label_page-product_reserved-price', ['resprice' => (int)$obj->resprice]);
  363.         }
  364.         $regObj null;
  365.         $registerAllowedToBid false;
  366.         $canBidBankId true;
  367.         if (isset($_SESSION['register_id'])) {
  368.             $regObj getNodei($db"register"$_SESSION['register_id']);
  369.         }
  370.         $reservPriceReached = ($nbrBids && $lastBid->bid >= $obj->resprice && $obj->resprice 0) || (int)$obj->resprice === 0;
  371.         $reservationPriceAlias $trans->get("ALIAS_RESERVATIONPRICE_INFO");
  372.         $aendtime '';
  373.         if ((int)$obj->omonth) {
  374.             $aendtime $trans->get(
  375.                 'text_label_page-product_date-time_day-short-month-time',
  376.                 ['dateTime' => new DateTime($obj->auctionend)]
  377.             );
  378.             // Add year to the endTime if the year is not the current year.
  379.             if (date("Y",strtotime($obj->ddend)) != date("Y")) {
  380.                 $aendtime $trans->get(
  381.                     'text_label_page-product_date-time_day-short-month-year-time',
  382.                     ['dateTime' => new DateTime($obj->auctionend)]
  383.                 );
  384.             }
  385.         }
  386.         if ($regObj) {
  387.             // Precaution because we don't know how these are saved as.
  388.             $private $vendor->clientnbr && str_contains(strtolower($vendor->clientnbr), 'privat');
  389.             $vendorClientNBR trim(preg_replace('/\D/'''$vendor->clientnbr));
  390.             $registerClientNBR trim(preg_replace('/\D/'''$regObj->clientnbr));
  391.             $allowedClientType 'allowedBidder' $regObj->clienttype;
  392.             $deniedBidderAlias 'ALIAS_DENIEDBIDDER_' $regObj->clienttype;
  393.             $deniedBidderHeaderAlias 'ALIAS_DENIEDBIDDER_HEADER_' $regObj->clienttype;
  394.             if ((int)$obj->{$allowedClientType} === && ($vendorClientNBR !== $registerClientNBR || ($private && $parameters->get("app.instance") === 'dk'))) {
  395.                 $registerAllowedToBid true;
  396.             }
  397.         }
  398.         if (
  399.             $parameters->get('app.bankid.enable') &&
  400.             $parameters->get('app.bankid.force') &&
  401.             isset($_SESSION['register_id']) &&
  402.             isset($_SESSION['bankIDActive']) &&
  403.             !$_SESSION['bankIDActive'] &&
  404.             !$_SESSION['exceptRequiredAuthentication']
  405.         ) {
  406.             $canBidBankId false;
  407.         }
  408.         if ($registerAllowedToBid && !isset($_SESSION['late_payments']) && !isset($_SESSION['user_banned'])) {
  409.           unset($umb);
  410.           $umbSql "SELECT * FROM maxbids WHERE products_id='" mysqli_real_escape_string($db$obj->id) . "' ";
  411.           $umbSql .= "AND register_id='" mysqli_real_escape_string($db$_SESSION["register_id"]) . "' AND reached='N'";
  412.           $umbRes mysqli_query($db$umbSql);
  413.           if (mysqli_num_rows($umbRes)) {
  414.               $umb mysqli_fetch_object($umbRes);
  415.           }
  416.         }
  417.         $bidBoxData = array(
  418.             'bid' => (int)$highBid,
  419.         );
  420.         $status 'online';
  421.         if (new DateTime($obj->ddend) < new DateTime()) {
  422.             $status 'ended';
  423.         }
  424.         if ((int) $obj->canceled) {
  425.             $status 'canceled';
  426.         }
  427.         $closeBoxData = array(
  428.             'timeLeft' => $timeleft,
  429.             'auctionEndTime' => $aendtime,
  430.             'auctionEndTimeUnix' => strtotime($obj->fullend),
  431.             'printData' => array(
  432.                 'imgSrc' => $parameters->get('app.image.path') . '/icon-calender.svg',
  433.             ),
  434.             'status' => $status,
  435.         );
  436.         $biddingBox = array(
  437.             'bidder' => $leaderBidderNumber,
  438.             'noBids' => count($bids),
  439.             'bids' => $bids,
  440.         );
  441.         $userData = array(
  442.             'type' => (array_key_exists("register_clientType"$_SESSION) ? $_SESSION["register_clientType"] : ""),
  443.             'isLoggedIn' => array_key_exists('register_id'$_SESSION),
  444.             'incVat' => false,
  445.             'canBid' => (
  446.                 (
  447.                     $registerAllowedToBid
  448.                     && !isset($_SESSION['late_payments'])
  449.                     && !isset($_SESSION['user_banned'])
  450.                     && $obj->canceled === 0
  451.                 )
  452.                 && (
  453.                     $regObj->clienttype == "SF"
  454.                     || $regObj->clienttype == "SP"
  455.                     || (
  456.                         (
  457.                             $regObj->clienttype == "UF" || $regObj->clienttype == "UP"
  458.                         )
  459.                         && $regObj->vatValidated == 1
  460.                     )
  461.                 )
  462.                 && date("YmdHis") >= $obj->fullstart
  463.                 && $obj->fullstart !== 0
  464.                 && $obj->online === 1
  465.             ),
  466.             'canBidBankid' => $canBidBankId,
  467.             'bankIdEnable' => $parameters->get('app.bankid.enable'),
  468.             'umb' => (isset($umb) ? number_format($umb->bid0',''') : false),
  469.             'inPreviewMode' => $previewAvailable,
  470.             'vatable' => (is_object($regObj) ? (int)$regObj->vatable:0),
  471.         );
  472.         $isFav false;
  473.         if (isset($_SESSION['register_id']) && !($obj->fullend && date("YmdHis") > $obj->fullend) ):
  474.             try {
  475.                 $isFav = (new ProductsRegisterRefRepo())
  476.                     ->registerHasProductAsFavorite($obj->id$_SESSION['register_id']);
  477.             } catch (RepositoryException $e) {}
  478.         endif;
  479.             $productData = array(
  480.                 'id' => $obj->id,
  481.                 'isFav' => $isFav,
  482.                 'previewHash' => isset($_REQUEST['preview']) ? htmlspecialchars($_REQUEST['preview'], ENT_QUOTES) : '',
  483.                 'closed' => ($obj->fullend && date("YmdHis") > $obj->fullend true ''),
  484.                 'vat' => ($obj->momsavdrag == ? (int)$obj->moms 0),
  485.                 'vmb' => (int)$obj->vmb,
  486.                 "nextBid" => (int)$minimumBid,
  487.                 'momsavdrag' => (int)$obj->momsavdrag,
  488.                 'bidStep' => (int)$bidinc,
  489.                 'auctionFee' => (int)auctionFee($db, (int)$products_id),
  490.                 'bidBox' => $bidBoxData,
  491.                 'reservePriceReached' => $reservPriceReached,
  492.                 'closeBox' => $closeBoxData,
  493.                 'biddingBox' => $biddingBox,
  494.                 'user' => $userData,
  495.                 'region' => (isset($_SESSION['register_country_region']) ? (int)$_SESSION['register_country_region'] : ""),
  496.                 'vatValidated' => (isset($_SESSION['vatValidated']) ? (int)$_SESSION['vatValidated'] : ""),
  497.                 'url' => $urlGenerator->generate('app.legacy.auction.object', ['produrlname' => $obj->urlname]),
  498.                 'bidInfoManual' => $trans->get('ALIAS_PRODUCT_BID_INFO_MANUAL'),
  499.                 'bidButtonManual' => $trans->get('ALIAS_PRODUCT_BID_BUTTON_MANUAL'),
  500.                 'bidButtonAuto' => $trans->get("ALIAS_PRODUCT_BID_BUTTON_AUTO"),
  501.                 'bidInfoAuto' => $trans->get('ALIAS_PRODUCT_BID_INFO_AUTO'),
  502.                 'urlRegister' => $urlGenerator->generate('app.legacy.pages.register'),
  503.                 'urlLoginBuyer' => $urlGenerator->generate('app.legacy.pages.login', ['continue' => $urlGenerator->generate('app.legacy.auction.object', ['produrlname' => $obj->urlname])]),
  504.                 'zendeskChat' => ZENDESKCHAT,
  505.                 'switchAccount' => !$multiUserCollection->empty(),
  506.             );
  507.         $showFinance true;
  508.         $yearModelExists false;
  509.         $serialNumberExists false;
  510.         $displayFinancing false;
  511.         $resYear mysqli_query($db"SELECT `pv`.`value`, `pf`.`mascusDbname`, `pf`.`infocarElement` FROM `productvalues` `pv`
  512.                 LEFT JOIN `productfields` `pf` ON `pf`.`id` = `pv`.`productfields_id`
  513.                 LEFT JOIN `products` `p` ON `p`.`id` = `pv`.`products_id`
  514.                 LEFT JOIN `categories` `c` ON `c`.`id` = `pf`.`categories_id` AND `p`.`categories_id` = `c`.`id`
  515.                 WHERE `p`.`id` = ".(int)$obj->id." AND p.moms=25 AND p.momsavdrag=1 AND p.vmb=0 AND `pf`.`online` = 1 AND `pf`.`parent_id` = 0
  516.                 AND (`pf`.`mascusDbname` = 'yearofmanufacture' or `pf`.`infocarElement` = 'generationSold' or `pf`.`infocarElement` = 'generationDesign' or `pf`.`infocarElement` = 'vinCode' or `pf`.`mascusDbname` = 'manufacturenumber')");
  517.         while($rowYear mysqli_fetch_object($resYear)) {
  518.             if ($rowYear->mascusDbname === 'manufacturenumber' || $rowYear->infocarElement === 'vinCode') {
  519.                 if (strlen($rowYear->value) > 0) {
  520.                     $serialNumberExists true;
  521.                 }
  522.             } else {
  523.                 if (strlen((int)$rowYear->value) == 4) {
  524.                     if ((int)date("Y")-((int)$rowYear->value) <= SGFINANCE_YEARLIMIT) {
  525.                         $yearModelExists true;
  526.                     }
  527.                 }
  528.             }
  529.         }
  530.         $displayFinancingForUser true;
  531.         if ($obj->fullend && date("YmdHis") > $obj->fullend) {
  532.             $displayFinancingForUser false;
  533.             $bidRes mysqli_query($db"SELECT register_id FROM bids WHERE products_id=".(int)$obj->id." AND bid >= ".$obj->resprice." ORDER BY bid DESC, id DESC LIMIT 1");
  534.             if (mysqli_num_rows($bidRes)) {
  535.                 $bidObj mysqli_fetch_object($bidRes);
  536.                 if (isset($_SESSION['register_id']) && (int)$_SESSION["register_id"] === (int)$bidObj->register_id) {
  537.                     $displayFinancingForUser true;
  538.                 }
  539.             }
  540.         }
  541.         if (
  542.                 (int)$obj->allowedBidderSF === && $yearModelExists && $serialNumberExists &&
  543.                 ((int)$obj->market_value >= SGFINANCE_MARKET_VALUE_MINIMUM && (int)$obj->showSgDespiteLowMarketValue === || (int)$obj->showSgDespiteLowMarketValue === 1)
  544.                 && $displayFinancingForUser
  545.         ) {
  546.             $displayFinancing true;
  547.         }
  548.         if (USE_SG_FINANCING == false) {
  549.             $displayFinancing false;
  550.         }
  551.         // Only show SG Finance for BO users when SGFINANCE_AUTH_ACCESS is set to true.
  552.         // Note that nothing will be shown if USE_SG_FINANCING is set to false.
  553.         if (SGFINANCE_AUTH_ACCESS && !array_key_exists('is_admin'$_SESSION)) {
  554.             $displayFinancing false;
  555.         }
  556.         if (!$showFinance) {
  557.             $displayFinancing false;
  558.         }
  559.         // don't show financing for banned users
  560.         if (isset($_SESSION['user_banned'])) {
  561.             $displayFinancing false;
  562.         }
  563.         $youtube null;
  564.         $youtubeThumb null;
  565.         if (empty($obj->youtubelink)) {
  566.             $youtubeQuery "SELECT id FROM products_youtube WHERE products_id=".(int)$obj->id;
  567.             $youtubeResult $db->query($youtubeQuery);
  568.             if (false !== $youtubeResult && !== $youtubeResult->num_rows) {
  569.                 $youtubeObject $youtubeResult->fetch_object();
  570.                 $filename '/products_youtube_video' $youtubeObject->id '.mp4';
  571.                 if (is_file($parameters->get('youtube.path') . $filename)) {
  572.                     $youtube $parameters->get('youtube.url') . $filename;
  573.                     $thumbFile '/products_youtube' $youtubeObject->id '.jpg';
  574.                     if (is_file($parameters->get('youtube.path') . $thumbFile)) {
  575.                         $youtubeThumb $parameters->get('youtube.url') . $thumbFile;
  576.                     }
  577.                 }
  578.             }
  579.         }
  580.         // TODO: This should be delivered to the view as a simple variable
  581.         $conditions 0;
  582.         if($obj->includesForewordInDescription == 1) {
  583.             // Check if there are used productfields with tabtype = 2 (conditions category)
  584.             $pfSql  "SELECT * FROM productfields WHERE categories_id='".mysqli_real_escape_string($db$obj->categories_id)."' AND tabtype='2' ";
  585.             $pfSql .= "AND online>0 AND parent_id=0 AND hideOnObjectPage=0 ORDER BY sortorder";
  586.             $pfRes mysqli_query($db$pfSql);
  587.             if(mysqli_num_rows($pfRes)){
  588.                 while($pf mysqli_fetch_object($pfRes)){
  589.                     unset($pv);
  590.                     $pvSql "SELECT * FROM productvalues WHERE productfields_id='".mysqli_real_escape_string($db$pf->id)."' AND products_id='".mysqli_real_escape_string($db$obj->id)."' ";
  591.                     $pvRes mysqli_query($db$pvSql);
  592.                     if(mysqli_num_rows($pvRes)){
  593.                         $pv mysqli_fetch_object($pvRes);
  594.                         if ((int)$pv->refid !== 0) {
  595.                             $pfoRes mysqli_query($db"SELECT placeholder FROM productfields WHERE id=" . (int)$pv->refid);
  596.                             if (mysqli_num_rows($pfoRes)) {
  597.                                 $pfo mysqli_fetch_object($pfoRes);
  598.                                 if (!(int)$pfo->placeholder) {
  599.                                     if ($pv->value !== "" && $pv->value != $trans->get('text_label_page-product_select-grading')) {
  600.                                         $conditions++;
  601.                                     }
  602.                                 }
  603.                             }
  604.                         } elseif ($pv->value !== "") {
  605.                             $conditions++;
  606.                         }
  607.                     }
  608.                 }
  609.             }
  610.         }
  611.         $hasNotice false;
  612.         if($obj->fullend && date("YmdHis") > $obj->fullend) {
  613.             $hasNotice true;
  614.         }
  615.         $externalLink false;
  616.         if (!empty($obj->filelink)) {
  617.             $externalLink = [
  618.                 'filename' => !empty($obj->filelinkname) ? $obj->filelinkname $trans->get("ALIAS_FILELINK_SHOW"),
  619.                 'filelink' => checkUrl($obj->filelink)
  620.             ];
  621.         }
  622.         $renderEquipmentData = new RenderEquipmentData();
  623.         $equipmentData $renderEquipmentData->renderHtml($obj->id$obj->categories_id);
  624.         $renderProductBasicData = new RenderBasicProductData($trans$obj);
  625.         $basicProductData $renderProductBasicData->renderHtml($obj->id$obj->categories_id);
  626.         $hasFiles $externalLink || canShowTab($trans$db$obj->id3);
  627.         $hasEquipment = !empty($equipmentData);
  628.         $renderConditionData = new RenderConditionData($trans);
  629.         $hasCondition = !empty($renderConditionData->renderHtml($obj->id$obj->categories_id));
  630.         $menuItems = [];
  631.         $menuItems['slider'] = true// an object always needs media, try so sell stuff without images?
  632.         $menuItems['desc'] = true// an object always needs a description
  633.         $menuItems['condition'] = $hasCondition;
  634.         $menuItems['equipment'] = $hasEquipment;
  635.         $menuItems['geolocation'] = true// should always be able to find where the object is located
  636.         $menuItems['files'] = $hasFiles;
  637.         $vendorType = new VendorType();
  638.         try {
  639.             $vendorType = (new VendorTypeRepo())->getById($vendor->companytype);
  640.         } catch (MissingResultException|RepositoryException $e) {
  641.         }
  642.         $departmentIsObest = (
  643.             isset($_SESSION["vendorAccess"][$obj->vendors_id])
  644.             && isset($_SESSION["users_id"])
  645.             && $vendorType->getDepartment() === 'Obest'
  646.             && (int)$obj->fullend === 0
  647.         );
  648.         $showVendorInfoIds $previewAvailable && $departmentIsObest;
  649.       ?>
  650.             <div class="product-grid">
  651.                 <div class="product-grid__aside">
  652.                     <?php
  653.                         if ($showVendorInfoIds):
  654.                     ?>
  655.                         <div class="vendor-info vendor-info--hide-desktop">
  656.                             <div class="vendor-info__content">
  657.                         <?php
  658.                             $vendorIsTypeSeven = (
  659.                                 isset($_SESSION["vendorAccess"][$obj->vendors_id])
  660.                                 && isset($_SESSION["users_id"])
  661.                                 && ($vendorType->getDepartment() === 'Obest' && $vendorType->getBankruptcy() === 0)
  662.                                 && (int)$obj->fullend === 0
  663.                             );
  664.                             // Info area - Intern-id and reserved price, Vendor.
  665.                             if ($previewAvailable && $vendorIsTypeSeven) { ?>
  666.                                 <div class="vendor-info">
  667.                                     <div class="vendor-info__content">
  668.                                     <?php
  669.                                     // Info area - Intern-id and reserved price, Vendor.
  670.                                     if ($showVendorInfoIds): ?>
  671.                                         <div>
  672.                                             <div class="item">
  673.                                                 <span><?php $trans->eGet('text_label_page-product_internal-id'); ?></span>
  674.                                                 <?php print $obj->artno ?>
  675.                                             </div>
  676.                                             <div class="item">
  677.                                                 <span><?php $trans->eGet('info_label_page-product_rek-res-price'); ?></span>
  678.                                                 <?php print $respricePrice?>
  679.                                             </div>
  680.                                         </div>
  681.                                     <?php endif; ?>
  682.                                     </div>
  683.                                 </div>
  684.                             <?php ?>
  685.                             </div>
  686.                         </div>
  687.                         <?php endif;
  688.                     // AUCTION ENDED
  689.                     if ($obj->fullend && date("YmdHis") > $obj->fullend) {
  690.                     ?>
  691.                             <div class='product-grid__notice'>
  692.                                 <div class="product-grid__ended">
  693.                                     <video height='49' width='49' loop="" muted="" autoplay="" playsinline="">
  694.                                         <source src='/assets/videos/klubbad-150x150.mp4' type='video/mp4'>
  695.                                     </video>
  696.                                     <div class="product-grid__ended-text">
  697.                                         <h5><?php $trans->eGet('ALIAS_PRODUCT_CLOSED_HEADER'); ?></h5>
  698.                                         <?php print nl2br($trans->get('ALIAS_PRODUCT_CLOSED_HEADER__DESCRIPTION')); ?>
  699.                                     </div>
  700.                                 </div>
  701.                             </div>
  702.                         <?php
  703.                     }
  704.                     ?>
  705.                     <!-- Object Id -->
  706.                     <div class="product-grid__object-id">
  707.                         <span class='product-grid__object-id-label'>
  708.                             <?php $trans->eGet('text_label_page-product_object-id');?>
  709.                         </span>
  710.                         <?php if(isset($_SESSION['is_admin']) ) { ?>
  711.                             <span id='object-id-copy' class="tag">
  712.                                 <?php print $obj->id?>
  713.                             </span>
  714.                             <span class='id-copied'>
  715.                                 <?php $trans->eGet('info_label_page-product_copied-clipboard');?>
  716.                             </span>
  717.                         <?php } else { ?>
  718.                             <span class="tag">
  719.                                 <?php print $obj->id?>
  720.                             </span>
  721.                         <?php ?>
  722.                     </div>
  723.                     <!-- Object Title Aside -->
  724.                     <h1 class="product-grid__aside-title"><?php echo $obj->name?></h1>
  725.                     <div class="product-grid__company">
  726.                         <!-- Object Municipaity -->
  727.                         <div class="product-grid__municipality">
  728.                             <i class="ri-map-pin-fill"></i> <a href="#nav-freight" data-scroll-smoothly><?php echo $county->name .", "$countyParent->name;?></a>
  729.                         </div>
  730.                         <!-- Object Seller Type -->
  731.                         <span class='product-grid__company-type'>
  732.                             <i class="ri-user-fill"></i> <span><?php echo $vendorName;?> </span>
  733.                         </span>
  734.                     </div>
  735.                     <div class="product-grid__interactions">
  736.                         <div class="share-menu">
  737.                             <button class="button--icon-cta" data-share-menu__trigger>
  738.                                 <i class="ri-share-fill"></i>
  739.                             </button>
  740.                             <div>
  741.                                 <a class="share-menu__item share-menu__item--facebook" target="_blank">
  742.                                     <div class="button--icon-cta">
  743.                                         <i class="ri-facebook-circle-fill"></i>
  744.                                     </div>
  745.                                 </a>
  746.                                 <a class="share-menu__item share-menu__item--linkedin" target="_blank">
  747.                                     <div class="button--icon-cta">
  748.                                         <i class="ri-linkedin-box-fill"></i>
  749.                                     </div>
  750.                                 </a>
  751.                                 <a class="share-menu__item share-menu__item--email">
  752.                                     <div class="button--icon-cta">
  753.                                         <i class="ri-mail-fill"></i>
  754.                                     </div>
  755.                                 </a>
  756.                                 <a class="share-menu__item share-menu__item--sms">
  757.                                     <div class="button--icon-cta">
  758.                                         <i class="ri-chat-3-fill"></i>
  759.                                     </div>
  760.                                 </a>
  761.                                 <a class="share-menu__item share-menu__item--copy">
  762.                                     <div class="button--icon-cta">
  763.                                         <i class="ri-link"></i>
  764.                                     </div>
  765.                                 </a>
  766.                                 <div class="share-menu__overlay"></div>
  767.                             </div>
  768.                         </div>
  769.                         <?php
  770.                         if (!($obj->fullend && date("YmdHis") > $obj->fullend) ): ?>
  771.                             <button class="button--icon-cta product-grid__button-save"
  772.                                 <?php print isset($_SESSION['register_id']) ? '' ' data-no-session ' ?>
  773.                                 data-object-marked="<?php print $isFav '1' '0'?>"
  774.                                 data-object-id="<?php print $obj->id?>"
  775.                                 data-object-name="<?php print htmlspecialchars($obj->name); ?>"
  776.                             >
  777.                                 <span></span>
  778.                             </button>
  779.                         <?php endif; ?>
  780.                     </div>
  781.                     <?php $sideNavItems = [];
  782.                     if ($menuItems['slider']) {
  783.                         $sideNavItems[] = [
  784.                             'href' => '#nav-slider',
  785.                             'icon' => 'image-fill',
  786.                             'label' => $trans->get('text_label_page-product_side-nav_slider')
  787.                         ];
  788.                     }
  789.                     if ($menuItems['desc']) {
  790.                         $sideNavItems[] = [
  791.                             'href' => '#nav-desc',
  792.                             'icon' => 'search-eye-line',
  793.                             'label' => $trans->get('text_label_page-product_side-nav_desc')
  794.                         ];
  795.                     }
  796.                     if ($menuItems['equipment']) {
  797.                         $sideNavItems[] = [
  798.                             'href' => '#nav-base',
  799.                             'icon' => 'play-list-add-line',
  800.                             'label' => $trans->get('text_label_page-product_side-nav_equipment')
  801.                         ];
  802.                     }
  803.                     if ($menuItems['condition']) {
  804.                         $sideNavItems[] = [
  805.                             'href' => '#nav-condition',
  806.                             'icon' => 'calendar-check-fill"',
  807.                             'label' => $trans->get('text_label_page-product_side-nav_condition')
  808.                         ];
  809.                     }
  810.                     if ($menuItems['files']) {
  811.                         $sideNavItems[] = [
  812.                             'href' => '#nav-files',
  813.                             'icon' => 'file-copy-2-fill',
  814.                             'label' => $trans->get('text_label_page-product_side-nav_files')
  815.                         ];
  816.                     }
  817.                     if ($menuItems['geolocation']) {
  818.                         $sideNavItems[] = [
  819.                             'href' => '#nav-freight',
  820.                             'icon' => 'map-pin-fill',
  821.                             'label' => $trans->get('text_label_page-product_side-nav_geolocation')
  822.                         ];
  823.                     }
  824.                    ?>
  825.                     <div class="product-grid__aside-side-nav">
  826.                         <ul class="page-nav" data-nav>
  827.                             <?php foreach ($sideNavItems as &$item):?>
  828.                                 <li class="page-nav__item">
  829.                                     <a class="page-nav__link" href="<?php print($item['href']); ?>" data-scroll-smoothly><i class="ri-<?php print($item['icon']); ?>"></i> <?php print($item['label']); ?></a>
  830.                                 </li>
  831.                             <?php endforeach ?>
  832.                         </ul>
  833.                     </div>
  834.                 </div> <!-- end product-grid__aside -->
  835.                 <div class="print-content product-grid__slider--print">
  836.                     <div class="print-header">
  837.                         <img src="<?php print $parameters->get('app.image.path') . '/klaravik-print-logo.svg'?>" class="klaravik-print">
  838.                         <div class="print-content-date-time">
  839.                             <p class="print-content-date-time__label">
  840.                                 <?php $trans->eGet('text_label_page-product_printed'); ?>
  841.                             </p>
  842.                             <p id="print-date-time">
  843.                                 <?php print date('Y-m-d'time());?> <span><?php print date('h:i'time());?></span>
  844.                             </p>
  845.                         </div>
  846.                     </div>
  847.                     <?php if ($showVendorInfoIds): ?>
  848.                         <div class="vendor-info">
  849.                             <div class="vendor-info__content">
  850.                                 <?php
  851.                                 // Info area - Intern-id and reserved price, Vendor.
  852.                                 if ($showVendorInfoIds): ?>
  853.                                     <div>
  854.                                         <div class="item">
  855.                                             <span><?php $trans->eGet('text_label_page-product_internal-id'); ?></span>
  856.                                             <?php print $obj->artno ?>
  857.                                         </div>
  858.                                         <div class="item">
  859.                                             <span><?php $trans->eGet('info_label_page-product_rek-res-price'); ?></span>
  860.                                             <?php print $respricePrice?>
  861.                                         </div>
  862.                                     </div>
  863.                                 <?php endif; ?>
  864.                             </div>
  865.                         </div>
  866.                     <?php endif;?>
  867.                     <?php
  868.                     $printImageUrl '/images/image-missing-large.png';
  869.                     /** @var ProductImage|bool $printImage */
  870.                     $printImage $images->first();
  871.                     if (false !== $printImage) {
  872.                         $printImageUrl $printImage->getImageUrl('large');
  873.                     }
  874.                     ?>
  875.                     <img src="<?php print $printImageUrl;?>" alt="<?php print $obj->name;?>"/>
  876.                 </div>
  877.                 <div id="nav-slider" class="product-grid__slider">
  878.                     <div class="carousel-wrapper">
  879.                         <div class="carousel__toolbar-wrapper">
  880.                             <div class="carousel__counter">
  881.                                 <span class="carousel__index">1</span>
  882.                                 <span class="carousel__separator"><?php $trans->eGet('text_label_page-product_slider_count-separator'); ?></span>
  883.                                 <span class="carousel__count"></span>
  884.                             </div>
  885.                         </div>
  886.                         <div id="lightbox" class="carousel f-carousel">
  887.                         <?php
  888.                         foreach ($images as $index => $image) {
  889.                             if ( $index === 1) {
  890.                                 if ($obj->youtubelink) {
  891.                                     //TODO: make a fallback solution to check if maxresdefault exists otherwise change to hqdefault.jpg
  892.                                     $fancyBoxLink $obj->youtubelink;
  893.                                     $videoElement '
  894.                                         <img
  895.                                             class="hidden"
  896.                                             loading="lazy"
  897.                                             src="https://img.youtube.com/vi/' youtubeIdFromLink($fancyBoxLink) . '/maxresdefault.jpg"
  898.                                             alt=""
  899.                                         />
  900.                                     ';
  901.                                 } elseif (null !== $youtube) {
  902.                                     $fancyBoxLink $youtube;
  903.                                     $videoElement '
  904.                                         <video>
  905.                                             <source src="'.$youtube.'#t=0.001" type="video/mp4">
  906.                                             '.$trans->get("info_label_page-product_browser-support").'
  907.                                         </video>
  908.                                     ';
  909.                                     if (null !== $youtubeThumb) {
  910.                                         $videoElement '
  911.                                     <img
  912.                                         class="hidden"
  913.                                         loading="lazy"
  914.                                         src="' $youtubeThumb '"
  915.                                         alt=""
  916.                                     />
  917.                                 ';
  918.                                     }
  919.                                 }
  920.                                 if (!empty($fancyBoxLink)) { ?>
  921.                                     <div class="carousel__slide carousel__slide--youtube f-carousel__slide">
  922.                                         <a data-fancybox="object_gallery" href='<?php print $fancyBoxLink?>' class="item youtube">
  923.                                             <div class="digitalViewingBox--slider">
  924.                                                 <div class="title-box">
  925.                                                     <div class="title-box__icon"></div>
  926.                                                     <div class="title-box__text"><?php $trans->eGet('text_label_page-product_digital-viewing-caption'); ?></div>
  927.                                                 </div>
  928.                                             </div>
  929.                                             <?php print $videoElement?>
  930.                                             <span class="carousel__slide__video-btn"><i class="ri-play-fill"></i></span>
  931.                                         </a>
  932.                                     </div>
  933.                                     <?php
  934.                                 }
  935.                             }
  936.                             if ($image->getHasVideo()) { ?>
  937.                                 <div class="carousel__slide f-carousel__slide">
  938.                                     <a
  939.                                             data-fancybox="object_gallery"
  940.                                             data-thumb="<?php echo $image->getImageUrl('large'); ?>"
  941.                                             data-src="<?php echo $image->getVideoUrl(); ?>"
  942.                                     >
  943.                                         <video>
  944.                                             <source src="<?php echo $image->getVideoUrl(); ?>" type="video/mp4">
  945.                                             Your browser does not support HTML5 video.
  946.                                         </video>
  947.                                         <span class="carousel__slide__video-btn"><i class="ri-play-fill"></i></span>
  948.                                     </a>
  949.                                 </div>
  950.                                 <?php
  951.                             } else { ?>
  952.                                 <div class="carousel__slide f-carousel__slide">
  953.                                     <a data-fancybox="object_gallery" href="<?php echo $image->getImageUrl('large'); ?>">
  954.                                         <img
  955.                                                 class="carousel-cell-image hidden"
  956.                                                 loading="lazy"
  957.                                                 src="<?php echo $image->getImageUrl('large'); ?>"
  958.                                                 alt="<?php echo $obj->name?>"
  959.                                         >
  960.                                     </a>
  961.                                 </div>
  962.                                 <?php
  963.                             }
  964.                         }
  965.                         ?>
  966.                             <div class="carousel__button-wrapper">
  967.                                 <a class="button button--medium button--ghost button--icon button--icon-image-fill" data-fancybox-trigger="object_gallery" data-fancybox-index="0">
  968.                                     <?php $trans->eGet('text_button_page-product_slider_all-media'); ?>
  969.                                 </a>
  970.                             </div>
  971.                         </div>
  972.                     </div>
  973.                 </div> <!-- nav-slider end -->
  974.                 <div class="product-grid__bidding-info">
  975.                     <?php
  976.                     if ((int)$obj->special_terms_uf == 1) {
  977.                         $aliasName = isset($_SESSION['register_id']) && ($regObj->clienttype == "UP" || $regObj->clienttype == "UF") ?
  978.                             'ALIAS_PRODUCT_TAB_SPECIAL_TERM_UP' :
  979.                             'ALIAS_PRODUCT_TAB_SPECIAL_TERM';
  980.                         ?>
  981.                             <div class="bid-box-container">
  982.                                 <div id="bidbox" class="bid-box">
  983.                                     <div class="row">
  984.                                         <div class="large-12 medium-12 small-12 columns">
  985.                                             <div class="descriptionBox specialTerms">
  986.                                                 <h4><?php $trans->eGet($aliasName); ?></h4>
  987.                                                 <div class="object_desc">
  988.                                                     <p><?php print nl2br($trans->get($aliasName '__DESCRIPTION')); ?><p>
  989.                                                 </div>
  990.                                             </div>
  991.                                         </div>
  992.                                     </div>
  993.                                 </div>
  994.                             </div>
  995.                         <?php
  996.                     }
  997.                     ?>
  998.                     <!-- Vue instance, bidding component -->
  999.                     <div id="page-product__sidebar"
  1000.                             data-id="<?php echo $obj->id?>"
  1001.                             data-notifier-url="<?php echo NOTIFIER_URL?>"
  1002.                             data-preview-hash="<?php echo (isset($_REQUEST['preview']) ? htmlspecialchars($_REQUEST['preview'], ENT_QUOTES) : '' ); ?>"
  1003.                             data-closed="<?php echo ($obj->fullend && date("YmdHis") > $obj->fullend 'true' ''); ?>">
  1004.                         <close-box :product-data='<?php echo json_encode($productData); ?>'></close-box>
  1005.                         <bid-box :product-data='<?php echo json_encode($productData); ?>'>
  1006.                             <?php if ($hasNotice): ?>
  1007.                                 <div class='closed-auction-seller'>
  1008.                                     <h3><?php $trans->eGet('text_label_page-product_closed-auction-seller-caption'); ?></h3>
  1009.                                     <p><?php $trans->eGet('text_label_page-product_closed-auction-seller-text'); ?></p>
  1010.                                     <a class="button--rounded button--highlight button--small button--icon-right button--icon-right--arrow-right" href="<?php echo $urlGenerator->generate('app.legacy.pages.howtosell'); ?>">
  1011.                                     <?php $trans->eGet('link_button_page-product_closed-auction-seller-link'); ?>
  1012.                                         <i class="ri-arrow-right-line"></i>
  1013.                                     </a>
  1014.                                 </div>
  1015.                             <?php endif; ?>
  1016.                         </bid-box>
  1017.                         <bid-form :product-data='<?php echo json_encode($productData); ?>'></bid-form>
  1018.                         <bid-payment-info :product-data='<?php echo json_encode($productData); ?>'>
  1019.                             <?php
  1020.                             if (!$productData['closed']) {
  1021.                                 if ($regObj) {
  1022.                                     if ((int)$obj->{$allowedClientType} === 0) {
  1023.                                         printf('<div class="prohibited-bid"><div class="prohibited-bid__header"><i class="ri-information-fill prohibited-bid__icon"></i><span>%s</span></div><div class="prohibited-bid__body">%s</div></div>'$trans->get($deniedBidderHeaderAlias), $trans->get($deniedBidderAlias));
  1024.                                     } elseif ($vendorClientNBR === $registerClientNBR) {
  1025.                                         if (!$private && $parameters->get("app.instance") === 'dk') {
  1026.                                             printf('<div class="prohibited-bid">%s</div>'$trans->get('ALIAS_BIDDER_SAME_ORGNUMBER_AS_SELLER'));
  1027.                                         }
  1028.                                     }
  1029.                                     if (($regObj->clienttype == "UF" || $regObj->clienttype == "UP") && ($regObj->vatValidated == 0)) { ?>
  1030.                                         <div class="prohibited-bid">
  1031.                                             <div class="prohibited-bid__header">
  1032.                                                 <i class="ri-information-fill prohibited-bid__icon"></i>
  1033.                                                 <?php echo $trans->get("ALIAS_UP_NOVATVALIDATED_CANT_BID__HEADER"); ?>
  1034.                                             </div>
  1035.                                             <div class="prohibited-bid__body">
  1036.                                                 <?php echo $trans->get("ALIAS_UP_NOVATVALIDATED_CANT_BID__DESCRIPTION"); ?>
  1037.                                             </div>
  1038.                                             <div class="prohibited-bid__footer">
  1039.                                                 <span class="prohibited-bid__footer__item">
  1040.                                                     <i class="prohibited-bid__icon ri-phone-fill"></i><a href="tel:<?php $trans->eGet('phone_customer-service_formatted'); ?>"><?php $trans->eGet("phone_customer-service_formatted"); ?></a>
  1041.                                                 </span>
  1042.                                                 <span class="prohibited-bid__footer__item">
  1043.                                                     <i class="prohibited-bid__icon ri-mail-fill"></i><a href="mailto:<?php $trans->eGet("email_customer-service"); ?>"><?php $trans->eGet("email_customer-service"); ?></a>
  1044.                                                 </span>
  1045.                                             </div>
  1046.                                         </div>
  1047.                                         <?php
  1048.                                     }
  1049.                                 }
  1050.                                 $buyerBlocked false;
  1051.                                 if(!isset($_SESSION["register_id"]) || !is_numeric($_SESSION["register_id"]) || isset($_SESSION["late_payments"]) || isset($_SESSION["user_banned"])) {
  1052.                                     $buyerBlocked true;
  1053.                                     if (isset($_SESSION["user_banned"]) || isset($_SESSION['late_payments'])) {
  1054.                                         $showFinance false;
  1055.                                         print "          <div class=\"prohibited-bid prohibited-bid--banned-cant-bid\">";
  1056.                                         print "            <div class=\"prohibited-bid__header\">";
  1057.                                         print "                <i class=\"ri-information-fill prohibited-bid__icon\"></i>";
  1058.                                         print "                <span>".$trans->get('ALIAS_USER_BANNED_CANT_BID_HEADER')."</span>";
  1059.                                         print "            </div>\n";
  1060.                                         print "            <div class=\"prohibited-bid__body\">".$trans->get("ALIAS_USER_BANNED_CANT_BID")."</div>";
  1061.                                         print "            <div class=\"prohibited-bid__footer\">";
  1062.                                         print "                <span class=\"prohibited-bid__footer__item\">";
  1063.                                         print "                    <i class=\"prohibited-bid__icon ri-phone-fill\"></i><a href=\"tel:".$trans->get('phone_customer-service_formatted')."\">".$trans->get("phone_customer-service_formatted")."</a>";
  1064.                                         print "                </span>\n";
  1065.                                         print "                <span class=\"prohibited-bid__footer__item\">";
  1066.                                         print "                    <i class=\"prohibited-bid__icon ri-mail-fill\"></i><a href=\"mailto:".$trans->get("email_customer-service")."\">".$trans->get("email_customer-service")."</a>";
  1067.                                         print "                </span>\n";
  1068.                                         print "            </div>\n";
  1069.                                         print "          </div>\n";
  1070.                                     }
  1071.                                 }
  1072.                             }
  1073.                             ?>
  1074.                         </bid-payment-info>
  1075.                         <bidding-box :product-data='<?php echo json_encode($productData); ?>'></bidding-box>
  1076.                     </div> <!-- page-product__sidebar end, End of Vue instance, bidding component -->
  1077.                         <div class="product-info-section">
  1078.                             <div class="quick-information">
  1079.                                 <div class="head-wrapper">
  1080.                                     <div class="icon freight-icon">
  1081.                                         <i class="ri-truck-line"></i>
  1082.                                     </div>
  1083.                                     <div class="title">
  1084.                                         <?php $trans->eGet('text_caption_page-product_shipping')?>
  1085.                                     </div>
  1086.                                     <div class="arrow">
  1087.                                         <i class="ri-arrow-down-s-line"></i>
  1088.                                     </div>
  1089.                                 </div>
  1090.                                 <div class="content-wrapper">
  1091.                                     <div class="content">
  1092.                                         <?php if ($vendor->freightinfo != "") {
  1093.                                             $freightString nl2br(strip_tags($vendor->freightinfo));
  1094.                                         } else {
  1095.                                             $freightString $trans->get(
  1096.                                                     'text_placeholder_page-product_map-and-freight_content',
  1097.                                                     [
  1098.                                                             'freightLink' => $urlGenerator->generate(
  1099.                                                                     'app.legacy.pages.text',
  1100.                                                                     ['urlname' => 'fraktforfragan'],
  1101.                                                                 UrlGeneratorInterface::ABSOLUTE_URL
  1102.                                                             )
  1103.                                                     ]
  1104.                                             );
  1105.                                         }?>
  1106.                                         <p><?php print $freightString?></p>
  1107.                                     </div>
  1108.                                 </div>
  1109.                             </div>
  1110.                         </div> <!-- product-info-section end -->
  1111.                     <?php
  1112.                     $loadingHelp $basicProductData['loadingHelpText'];
  1113.                     switch ($basicProductData['loadingHelp']) {
  1114.                         case ProductFieldsEnum::LOADINGHELP_YES()->label:
  1115.                             $loadingHelpIcon 'ri-checkbox-circle-fill';
  1116.                             $loadingHelpClass '';
  1117.                             break;
  1118.                         case ProductFieldsEnum::LOADINGHELP_MAYBE()->label:
  1119.                             $loadingHelpIcon 'ri-checkbox-circle-fill';
  1120.                             $loadingHelpClass 'orange';
  1121.                             break;
  1122.                         case ProductFieldsEnum::LOADINGHELP_NO()->label:
  1123.                             $loadingHelpIcon 'ri-close-circle-fill';
  1124.                             $loadingHelpClass 'red';
  1125.                             break;
  1126.                         default: // Fallback if no loadinghelp is found
  1127.                             $loadingHelp false;
  1128.                     }
  1129.                     if ($loadingHelp):?>
  1130.                     <div class="quick-information">
  1131.                         <div class="head-wrapper no-hover">
  1132.                             <div class="icon <?php echo $loadingHelpClass ?>">
  1133.                                 <i class="<?php echo $loadingHelpIcon ?>"></i>
  1134.                             </div>
  1135.                             <div class="title">
  1136.                                 <?php echo $loadingHelp ?>
  1137.                             </div>
  1138.                         </div>
  1139.                     </div> <!-- quick-information end -->
  1140.                     <?php endif; ?>
  1141.                     <div class="quick-information">
  1142.                         <div class="head-wrapper">
  1143.                             <div class="icon">
  1144.                                 <i class="ri-shield-check-fill"></i>
  1145.                             </div>
  1146.                             <div class="title">
  1147.                                 <?php $trans->eGet('text_label_page-product_secure-payments-expander'?>
  1148.                             </div>
  1149.                             <div class="arrow">
  1150.                                 <i class="ri-arrow-down-s-line"></i>
  1151.                             </div>
  1152.                         </div>
  1153.                         <div class="content-wrapper">
  1154.                             <div class="content">
  1155.                                 <?php $trans->eGet('text_body-text_page-product_secure-payments-expander'?>
  1156.                             </div>
  1157.                             <div class="content-icons-row">
  1158.                                 <div class="payex-icon">
  1159.                                     <img alt="payex-logo" src="/images/payex-logo.png" />
  1160.                                 </div>
  1161.                                 <?php if($parameters->get("app.instance") === 'se'): ?>
  1162.                                 <div class="swish-icon">
  1163.                                     <img alt="swish-logo" src="/images/swish/swish-logo.svg"/>
  1164.                                 </div>
  1165.                                 <?php endif;?>
  1166.                             </div>
  1167.                         </div>
  1168.                     </div> <!-- quick-information end -->
  1169.                     <?php
  1170.                     $displayDnb = !isset($_SESSION['user_banned']) && $categoriesObject->getCategory($obj->categories_id)->getAllowPrivateLoan() &&
  1171.                                     (
  1172.                                         !isset($_SESSION["register_id"])
  1173.                                         || ((bool)$obj->allowedBidderSP && isset($regObj) && $regObj->clienttype === 'SP')
  1174.                                         || ((bool)$obj->allowedBidderSF && isset($regObj) && $regObj->clienttype === 'SF' && !$displayFinancing)
  1175.                                     );
  1176.                     ?>
  1177.                     <?php
  1178.                         if (!$displayDnb && !$displayFinancing && $parameters->get('financing.offer.assistance')) :
  1179.                     ?>
  1180.                     <div class="quick-information">
  1181.                         <div class="head-wrapper">
  1182.                             <div class="icon financing-fallback">
  1183.                             </div>
  1184.                             <div class="title">
  1185.                                 <?php $trans->eGet('text_label_page-product_financing-expander-fallback'); ?>
  1186.                             </div>
  1187.                             <div class="arrow">
  1188.                                 <i class="ri-arrow-down-s-line"></i>
  1189.                             </div>
  1190.                         </div>
  1191.                         <div class="content-wrapper">
  1192.                             <div class="content">
  1193.                                 <?php $trans->eGet('text_content_page-product_financing-expander-fallback'); ?>
  1194.                             </div>
  1195.                         </div>
  1196.                     </div>  <!-- quick-information end -->
  1197.                     <?php
  1198.                         endif;
  1199.                     if ($displayDnb)
  1200.                     // DNB FINANCING
  1201.                     // Show private loan for all non-logged in users, users who are Swedish non-companies and Swedish company-users where the nordeaFinanceProductForm is NOT shown.
  1202.                      ?>
  1203.                         <a class="dnb-button-link" target="_blank" href="https://dnbprivatlan.se/klaravik/" rel="nofollow noopener">
  1204.                             <div class="dnb-button">
  1205.                                 <div class="dnb-button__text">
  1206.                                     <?php $trans->eGet('text_label_page-product_dnb-apply-loan'); ?>
  1207.                                     <span class="dnb-button__img-wrapper"><div class="dnb-logo"></div></span>
  1208.                                 </div>
  1209.                             </div>
  1210.                         </a>
  1211.                     <?php
  1212.                     }
  1213.                     // Financing Nordea
  1214.                     $monthSteps = array();
  1215.                     $defaultStep 0;
  1216.                     $resFinancing mysqli_query($db"SELECT sgf.* FROM categories AS c LEFT JOIN sgAssetRequirement AS sga ON sga.subAssetGroupId = c.sgSubAssetGroupId LEFT JOIN sgFactors sgf ON sgf.termId = sga.termId WHERE c.sgSubAssetGroupId<>0 AND c.id=".(int)$obj->categories_id);
  1217.                     if ($displayFinancing && mysqli_num_rows($resFinancing) > 0) {
  1218.                         $financing = array();
  1219.                         while($rowFinancing mysqli_fetch_object($resFinancing)) {
  1220.                             if (count($financing) == 0) {
  1221.                                 $defaultStep $rowFinancing->months;
  1222.                                 $minAmount $rowFinancing->minAmount;
  1223.                                 $maxAmount $rowFinancing->maxAmount;
  1224.                                 $minmonths $rowFinancing->months;
  1225.                                 $maxmonths $rowFinancing->months;
  1226.                             }
  1227.                             $financing[] = array(
  1228.                             'minAmount' => $rowFinancing->minAmount,
  1229.                             'maxAmount' => $rowFinancing->maxAmount,
  1230.                             'months' => $rowFinancing->months,
  1231.                             'factor' => $rowFinancing->factor
  1232.                             );
  1233.                             $monthSteps[] = $rowFinancing->months;
  1234.                             if ($rowFinancing->months $defaultStep) { $defaultStep $rowFinancing->months; }
  1235.                             if ($rowFinancing->minAmount $minAmount) { $minAmount $rowFinancing->minAmount; }
  1236.                             if ($rowFinancing->maxAmount $maxAmount) { $maxAmount $rowFinancing->minAmount; }
  1237.                             if ($rowFinancing->months $minmonths) { $minmonths $rowFinancing->months; }
  1238.                             if ($rowFinancing->months $maxmonths) { $maxmonths $rowFinancing->months; }
  1239.                         }
  1240.                         if (in_array(60,$monthSteps)) {
  1241.                             $defaultStep 60;
  1242.                         } else if (in_array(48,$monthSteps)) {
  1243.                             $defaultStep 48;
  1244.                         } else if (in_array(36,$monthSteps)) {
  1245.                             $defaultStep 36;
  1246.                         }
  1247.                         if ($maxAmount >= 3000000) {
  1248.                             $maxAmount 3000000;
  1249.                         }
  1250.                         $curBid 0;
  1251.                         if (isset($highBid)) {
  1252.                             $curBid = (round($highBid/1000)*1000);
  1253.                             if ($highBid >= 3000000) {
  1254.                                 $maxAmount 5000000;
  1255.                             }
  1256.                         }
  1257.                         // If curBid is still zero, then set it to the bidstep.
  1258.                         if ((int)$curBid === 0) {
  1259.                             $curBid $bidinc;
  1260.                         }
  1261.                         require_once __DIR__ '/includes/nordeaFinanceProductForm.php';
  1262.                         if ($highBid 5000000) {
  1263.                             renderNordeaFinanceProductFormBidOverLimit($trans);
  1264.                         } else {
  1265.                             /** @var \Klaravik\Financing\Nordea\Calculate $calculateFinancing */
  1266.                             $calculateFinancing $container->get(\Klaravik\Financing\Nordea\Calculate::class);
  1267.                             $disablePriceAdjustment false;
  1268.                             if ($obj->fullend && date("YmdHis") > $obj->fullend) {
  1269.                                 $disablePriceAdjustment true;
  1270.                             }
  1271.                             renderNordeaFinanceProductForm($trans$urlGenerator$db$obj5000000$curBid$minmonths$maxmonths$defaultStep$financing$calculateFinancing$disablePriceAdjustment);
  1272.                         }
  1273.                     }
  1274.                 ?>
  1275.                 </div> <!-- bidding-info end -->
  1276.                 <div class="product-grid__content">
  1277.                     <div class="product-grid__content-title-box">
  1278.                         <h1><?php echo $obj->name?></h1>
  1279.                         <div class="share-menu">
  1280.                             <button class="button--icon-cta" data-share-menu__trigger>
  1281.                                 <i class="ri-share-fill"></i>
  1282.                             </button>
  1283.                             <div>
  1284.                                 <!-- facebook -->
  1285.                                 <a class="share-menu__item share-menu__item--facebook" target="_blank">
  1286.                                     <div class="button--icon-cta">
  1287.                                         <i class="ri-facebook-circle-fill"></i>
  1288.                                     </div>
  1289.                                 </a>
  1290.                                 <!-- linkedin -->
  1291.                                 <a class="share-menu__item share-menu__item--linkedin" target="_blank">
  1292.                                     <div class="button--icon-cta">
  1293.                                         <i class="ri-linkedin-box-fill"></i>
  1294.                                     </div>
  1295.                                 </a>
  1296.                                 <a class="share-menu__item share-menu__item--email">
  1297.                                     <div class="button--icon-cta">
  1298.                                         <i class="ri-mail-fill"></i>
  1299.                                     </div>
  1300.                                 </a>
  1301.                                 <a class="share-menu__item share-menu__item--sms">
  1302.                                     <div class="button--icon-cta">
  1303.                                         <i class="ri-chat-3-fill"></i>
  1304.                                     </div>
  1305.                                 </a>
  1306.                                 <a class="share-menu__item share-menu__item--copy">
  1307.                                     <div class="button--icon-cta">
  1308.                                         <i class="ri-link"></i>
  1309.                                     </div>
  1310.                                 </a>
  1311.                                 <div class="share-menu__overlay"></div>
  1312.                             </div>
  1313.                         </div>
  1314.                         <?php if (!($obj->fullend && date("YmdHis") > $obj->fullend) ): ?>
  1315.                             <button class="button--icon-cta product-grid__button-save"
  1316.                                 <?php print isset($_SESSION['register_id']) ? '' ' data-no-session ' ?>
  1317.                                 data-object-marked="<?php print $isFav 0 ?>"
  1318.                                 data-object-id="<?php print $obj->id?>"
  1319.                                 data-object-name="<?php print htmlspecialchars($obj->name);?>"
  1320.                             >
  1321.                                 <span></span>
  1322.                             </button>
  1323.                         <?php endif; ?>
  1324.                     </div>
  1325.                     <?php if ($showVendorInfoIds): ?>
  1326.                         <div class="vendor-info vendor-info--hide-mobile">
  1327.                             <div class="vendor-info__content">
  1328.                             <?php
  1329.                             // Info area - Intern-id and reserved price, Vendor.
  1330.                             if ($showVendorInfoIds): ?>
  1331.                                 <div>
  1332.                                     <div class="item">
  1333.                                         <span><?php $trans->eGet('text_label_page-product_internal-id'); ?></span>
  1334.                                         <?php print $obj->artno ?>
  1335.                                     </div>
  1336.                                     <div class="item">
  1337.                                         <span><?php $trans->eGet('info_label_page-product_rek-res-price'); ?></span>
  1338.                                         <?php print $respricePrice?>
  1339.                                     </div>
  1340.                                 </div>
  1341.                             <?php endif; ?>
  1342.                             </div>
  1343.                         </div>
  1344.                     <?php endif;?>
  1345.                     <?php
  1346.                         $recentChanges recentProductChanges($db$products_id);
  1347.                         if (!empty($recentChanges)):
  1348.                     ?>
  1349.                     <div class="product-grid__new-information">
  1350.                         <?php print nl2br(recentProductChanges($db$products_id)); ?>
  1351.                     </div>
  1352.                     <?php endif; ?>
  1353.                     <?php
  1354.                     if ($vendorType->getDepartment() === 'Obest' && $vendorType->getBankruptcy() === 1) { ?>
  1355.                     <div class="alert-box--department-information">
  1356.                         <div class="alert-box__department-title"></div>
  1357.                             <p class="alert-box__content"><?php print nl2br($trans->get('ALIAS_PRODUCT_BANKRUPT_TEXT__DESCRIPTION'));?></p>
  1358.                     </div>
  1359.                 <?php
  1360.                     }?>
  1361.                      <!--- DESCRIPTION -->
  1362.                      <div class="product-grid__description">
  1363.                         <?php $extraDesc = !empty($obj->extraDescription) ? nl2br($obj->extraDescription) : null?>
  1364.                         <div id="nav-desc">
  1365.                         <?php $descPreamble = !empty($obj->descriptionPreamble) ? nl2br($obj->descriptionPreamble) : null?>
  1366.                         <?php if ($obj->description != "" || $vendor->foreword != ""): ?>
  1367.                             <div class="object_desc product-grid__description-overview">
  1368.                                 <div class="object-information__header">
  1369.                                     <span class="object-information__header-icon"><i class="ri-search-eye-line"></i></span>
  1370.                                     <span class="object-information__header-text"><?php $trans->eGet('text_label_page-product_description-title');?></span>
  1371.                                 </div>
  1372.                                 <?php print $obj->includesForewordInDescription == && $vendor->foreword != "" nl2br($vendor->foreword) . '<br>' ''?>
  1373.                                 <?php
  1374.                                     if (!empty($descPreamble)) print '<p class="product-grid__description-preamble">' $descPreamble '</p>';
  1375.                                     if ($obj->includesForewordInDescription == 0) { print '<p class="product-grid__description-extra">' nl2br($obj->description) . '</p>'; }
  1376.                                     print $basicProductData['htmlOutput'];
  1377.                                 ?>
  1378.                             </div>
  1379.                         <?php endif; ?>
  1380.                         <?php
  1381.                         print "<div class='extra-vehicle'>";
  1382.                             try {
  1383.                                 $extraVehicleModel = (new ExtraVehicleRepo())->getByProductId($obj->id);
  1384.                                 $renderExtraVehicleData = new RenderExtraVehicleData($trans);
  1385.                                 echo $renderExtraVehicleData->renderHtml($extraVehicleModel);
  1386.                             } catch (MissingResultException $e) {
  1387.                                 $extraVehicleModel = new ExtraVehicle();
  1388.                             }
  1389.                         print "</div>";
  1390.                             $extraDesc = !empty($obj->extraDescription) ? $obj->extraDescription null;
  1391.                             if (!empty($extraVehicleModel->getOtherInformation())) {
  1392.                                 $extraDesc .= PHP_EOL PHP_EOL $extraVehicleModel->getOtherInformation();
  1393.                             }
  1394.                         ?>
  1395.                         <?php if (!empty($extraDesc)): ?>
  1396.                         <div class="object-information__header object-information__header--small object-information__header--mock"></div>
  1397.                         <p class="product-grid__description-extra"><?php print nl2br(trim($extraDesc))?></p>
  1398.                         <?php endif; ?>
  1399.                         </div>
  1400.                         <?php
  1401.                         if ($hasEquipment): ?>
  1402.                             <div class="object-information__equipment object-equipment" id="nav-base">
  1403.                                 <div class="object-information__header">
  1404.                                     <span class="object-information__header-icon"><i class="ri-menu-add-line"></i></span>
  1405.                                     <span class="object-information__header-text"><?php $trans->eGet('text_label_page-product_equipment-title');?></span>
  1406.                                 </div>
  1407.                                     <div class="object-equipment__content">
  1408.                                         <?php print $equipmentData?>
  1409.                                 </div>
  1410.                             </div>
  1411.                         <?php endif; ?>
  1412.                     </div>
  1413.                     <?php
  1414.                     //  CONDITION
  1415.                     if(canShowTab($trans$db$obj->id2)) {
  1416.                     ?>
  1417.                     <div id="nav-condition" class="product-grid__condition product-condition product-info-section">
  1418.                         <div class="object-information__header">
  1419.                             <span class="object-information__header-icon"><i class="ri-calendar-check-fill"></i></span>
  1420.                             <span class="object-information__header-text"><?php $trans->eGet('text_label_page-product_condition-caption');?></span>
  1421.                         </div>
  1422.                         <?php
  1423.                             try {
  1424.                                 $renderRenderConditionData = new RenderConditionData($trans);
  1425.                                 print $renderRenderConditionData->renderHtml($obj->id$obj->categories_id);
  1426.                             } catch (RepositoryException $e) {}
  1427.                         ?>
  1428.                     </div> <!-- nav-condition end div-->
  1429.                     <?php
  1430.                     }
  1431.                     // DIGITAL SHOWCASE
  1432.                     if ($obj->youtubelink) {
  1433.                         $fancyBoxLink $obj->youtubelink;
  1434.                         $videoElement '
  1435.                              <img
  1436.                                     class="digital-viewing-box__video"
  1437.                                     loading="lazy"
  1438.                                     src="https://img.youtube.com/vi/' youtubeIdFromLink($fancyBoxLink) . '/maxresdefault.jpg"
  1439.                                     alt=""
  1440.                             >
  1441.                         ';
  1442.                     }
  1443.                     elseif (null !== $youtube) {
  1444.                         $fancyBoxLink $youtube;
  1445.                         $videoElement '
  1446.                              <video>
  1447.                                 <source src="' $fancyBoxLink '#t=0.001" type="video/mp4">
  1448.                                 ' $trans->get('info_label_page-product_browser-support') . '
  1449.                             </video>
  1450.                         ';
  1451.                     }
  1452.                     if (!empty($fancyBoxLink)) { ?>
  1453.                         <div class="digital-viewing-box" id="digitalViewing-youtube">
  1454.                             <div class="digital-viewing-box__title-and-text">
  1455.                                 <div class="digital-viewing-box__title">
  1456.                                     <div class="digital-viewing-box__title__icon"></div>
  1457.                                     <div class="digital-viewing-box__title__text">
  1458.                                         <?php $trans->eGet('text_label_page-product_digital-viewing-caption'); ?>
  1459.                                     </div>
  1460.                                 </div>
  1461.                                 <span class="digital-viewing-box__preamble">
  1462.                                     <?php $trans->eGet('text_label_page-product_digital-viewing-tour-caption'); ?>
  1463.                                 </span>
  1464.                             </div>
  1465.                             <div class="digital-viewing-box__video-and-arrow">
  1466.                                 <a
  1467.                                     data-fancybox-trigger="object_gallery"
  1468.                                     data-fancybox-index="1"
  1469.                                     href='<?php print $fancyBoxLink?>'
  1470.                                     class="digital-viewing-box__video-holder"
  1471.                                 >
  1472.                                     <?php print $videoElement ?>
  1473.                                     <span class="digital-viewing-box__video-play-btn">
  1474.                                         <i class="ri-play-fill"></i>
  1475.                                     </span>
  1476.                                 </a>
  1477.                                 <div class="digital-viewing-box__arrow-holder">
  1478.                                     <img class="digital-viewing-box__arrow" src="/images/arrow-illustr-below.png">
  1479.                                 </div>
  1480.                             </div>
  1481.                         </div>
  1482.                         <?php
  1483.                     }
  1484.                     //  IMPORTANT INFORMATION
  1485.                      // Temp hack, 419 ska inte med in i item page
  1486.         if(canShowTab($trans$db$obj->id5) && !in_array($obj->categories_id, [375419], true)) {
  1487.                         // KAM
  1488.                         $aliasName 'ALIAS_PRODUCT_TAB_OTHER_TEXT__DESCRIPTION';
  1489.                         if ((int)$obj->enteredByKam === 0) {
  1490.                             // Ej KAM
  1491.                             $aliasName 'ALIAS_PRODUCT_TAB_OTHER_TEXT__DESCRIPTION_NON-KAM';
  1492.                         }
  1493.                         if ($vendorType->getDepartment() === 'Obest' && $vendorType->getBankruptcy() === 1) {
  1494.                             // Konkurs
  1495.                             $aliasName 'ALIAS_PRODUCT_TAB_OTHER_TEXT_BANKRUPTCY__DESCRIPTION';
  1496.                         }
  1497.                         $aliasDescription $trans->get($aliasName);
  1498.                         ?>
  1499.                         <div class="object-information__important">
  1500.                             <div class='alert-box alert-box--regular'>
  1501.                                 <span class='alert-box__title'><i class="ri-error-warning-line"></i><?php $trans->eGet('text_caption_page-product_important-information')?></span>
  1502.                                 <p class='alert-box__content'>
  1503.                                     <?php print $aliasDescription !== '' nl2br($aliasDescription) : ''?>
  1504.                                 </p>
  1505.                             </div>
  1506.                         </div>
  1507.                      <?php ?>
  1508.                     <!-- NORWAY IMPORT INFORMATION -->
  1509.                     <?php
  1510.                     $categoryModel $categoriesObject->getClosestPublicCategory($obj->categories_id);
  1511.                     if (
  1512.                             $regObj &&
  1513.                             in_array($regObj->clienttype, ['UP''UF']) &&
  1514.                             $categoryModel->getForeignBuyerAuctionText() &&
  1515.                             $categoryModel->getForeignBuyerAuctionHeadline()
  1516.                     ) {
  1517.                         $countryResult $db->query("SELECT id FROM countries WHERE iso2='NO'");
  1518.                         if ($countryResult->num_rows && $countryResult->fetch_object()->id === $regObj->country_id) {?>
  1519.                             <div class='alert-box alert-box--message'>
  1520.                                 <p class='alert-box__title'><?php print $categoryModel->getForeignBuyerAuctionHeadline(); ?></p>
  1521.                                 <p class='alert-box__content'><?php print $categoryModel->getForeignBuyerAuctionText(); ?></p>
  1522.                             </div>
  1523.                         <?php }
  1524.                     }?>
  1525.                     <?php if ($hasFiles): ?>
  1526.                         <div id="nav-files" class="product-grid__documents grid-segment">
  1527.                             <div class="object-information__header">
  1528.                                 <span class="object-information__header-icon"><i class="ri-file-copy-2-fill"></i></span>
  1529.                                 <span class="object-information__header-text"><?php $trans->eGet('text_caption_page-product_section_document');?></span>
  1530.                             </div>
  1531.                             <?php
  1532.                                 showFilebank($urlGenerator$trans$db$obj->id$externalLink);
  1533.                             ?>
  1534.                         </div>
  1535.                     <?php endif; ?>
  1536.                     <?php
  1537.                     // Anthesis calculation on LCA Value
  1538.                     /** @var \Klaravik\Anthesis\CarbonDioxideEmissions $carbonDioxideEmission */
  1539.                     $carbonDioxideEmission $container->get(\Klaravik\Anthesis\CarbonDioxideEmissions::class);
  1540.                     try {
  1541.                         $carbonDioxideEmissionValue $carbonDioxideEmission->getEmissionByProductsIdAndLcaValue(
  1542.                                 $obj->id$categoriesObject->getCategory($obj->categories_id)->getLcaValue()
  1543.                         );
  1544.                     } catch (\Klaravik\Anthesis\Exception\CarbonDioxidEmissionException $e) {}
  1545.                     ?>
  1546.                     <?php if (isset($carbonDioxideEmissionValue)): ?>
  1547.                         <div class="product__esg" data-object-id="<?php print $obj->id?>">
  1548.                             <div class="product__esg-calculation">
  1549.                                 <div id="lottie-esg" class="product__esg-lottie" data-src="/images/lottie-animations/lottie-esg.json"></div>
  1550.                                 <p class="product__esg-value">
  1551.                                     <?php $trans->eGet('text_label_page-product_esg-kg', ['weight' => $carbonDioxideEmissionValue]); ?>
  1552.                                 </p>
  1553.                             </div>
  1554.                             <a id="esgOpenModal" class="product__esg-how">
  1555.                                 <?php $trans->eGet('text_label_page-product_esg-modal-cta'); ?>
  1556.                             </a>
  1557.                             <p class="product__esg-text"><?php $trans->eGet('text_label_page-product_esg-caption'); ?></p>
  1558.                             <p class="product__esg-text-comparison">
  1559.                                 <?php $trans->eGet('text_label_page-product_esg-comparison'); ?>
  1560.                             </p>
  1561.                             <k-modal id="esg-modal">
  1562.                                 <div slot="header">
  1563.                                     <h3 class="bidding-modal__header">
  1564.                                         <span class="bidding-modal__header__icon"><img src="/images/icons/icn-exclamation-green.svg" alt=""></span>
  1565.                                     </h3>
  1566.                                 </div>
  1567.                                 <div slot="body" class="product__esg-text">
  1568.                                     <p><?php $trans->eGet('text_label_page-product_esg-modal-caption'); ?></p>
  1569.                                     <p class="product__esg-text-comparison">
  1570.                                         <?php $trans->eGet('text_label_page-product_esg-modal-source'); ?>
  1571.                                     </p>
  1572.                                     <a href="/assets/pdf/Anthesis-Koldioxid-och-resurskalkylator-Metodik.pdf" id="esgReadMore" target="_blank" class="button--medium button--primary button--outlined">
  1573.                                         <i class="ri-file-text-line"></i><?php $trans->eGet('text_label_page-product_esg-modal-method'); ?>
  1574.                                     </a>
  1575.                                 </div>
  1576.                                 <div slot="footer" class="product__esg-modal-footer">
  1577.                                     <a id="esg-modal__close" class="k-modal__close-button button--medium button--negate button--v-text">
  1578.                                         <?php $trans->eGet('text_label_page-product_esg-modal-close'); ?>
  1579.                                     </a>
  1580.                                 </div>
  1581.                             </k-modal>
  1582.                         </div>
  1583.                     <?php endif; ?>
  1584.                 </div> <!-- product-grid__content end -->
  1585.                 <div id="nav-freight" class="object-position-and-freight">
  1586.                     <div class="object-position-and-freight__inner">
  1587.                         <div class="object-position">
  1588.                             <div class="object-information__header">
  1589.                                 <span class="object-information__header-icon"><i class="ri-map-pin-fill"></i></span>
  1590.                                 <span class="object-information__header-text"><?php $trans->eGet("text_headline_page-product_map-and-freight"); ?></span>
  1591.                             </div>
  1592.                             <div class="object-position__information">
  1593.                                 <span  class="object-position__municipallity"><?php echo $county->name .", "$countyParent->name;?>.</span>
  1594.                                 <?php $trans->eGet('text_preamble_page-product_map-and-freight'); ?>
  1595.                             </div>
  1596.                             <div id="page-product__county-map">
  1597.                                 <county-map country="<?php echo $parameters->get('app.instance'); ?>" :county=<?php echo (int)$county->code?>></county-map>
  1598.                             </div>
  1599.                         </div>
  1600.                         <div class="object-freight">
  1601.                             <div class="object-information__header object-information__header--sub">
  1602.                                 <span class="object-information__header-icon"><i class="ri-truck-line"></i></span>
  1603.                                 <span class="object-information__header-text"><?php $trans->eGet('text_subheadline_page-product_map-and-freight'?></span>
  1604.                             </div>
  1605.                             <div class="object-freight__content">
  1606.                                 <?php if ($vendor->freightinfo != "") {
  1607.                                     $freightString nl2br(strip_tags($vendor->freightinfo));
  1608.                                 } else {
  1609.                                     $freightString $trans->get('text_placeholder_page-product_map-and-freight_content', [
  1610.                                         'freightLink' => $urlGenerator->generate(
  1611.                                             'app.legacy.pages.text',
  1612.                                             ['urlname' => 'fraktforfragan'],
  1613.                                             UrlGeneratorInterface::ABSOLUTE_URL
  1614.                                         )
  1615.                                     ]);
  1616.                                 }?>
  1617.                                 <p><?php print $freightString?></p>
  1618.                             </div>
  1619.                         </div>
  1620.                     </div>
  1621.                 </div> <!-- nav-freight end -->
  1622.                 <div class="map-background"></div>
  1623.                 <div class="bidding-info-background"></div>
  1624.                 <div class="product-footer-row">
  1625.                     <div class="faq-cta">
  1626.                         <div class="faq">
  1627.                             <div class="article-select__faq-section">
  1628.                                 <h2><?php $trans->eGet('text_caption_page-product_faq'?></h2>
  1629.                                 <div class="faq-item">
  1630.                                     <p
  1631.                                       class="faq-item-q"
  1632.                                       data-article-link-id="faq1-1"
  1633.                                       data-article-group-id="faq"
  1634.                                       data-selected-class="faq-item-q--selected"
  1635.                                     >
  1636.                                         <?php $trans->eGet('text_label_page-product_vat-question'?>
  1637.                                     </p>
  1638.                                     <p
  1639.                                       class="faq-item-a"
  1640.                                       data-article-id="faq1-1"
  1641.                                     >
  1642.                                         <?php $trans->eGet('text_label_page-product_vat-answer'?>
  1643.                                     </p>
  1644.                                     <p
  1645.                                       class="faq-item-q"
  1646.                                       data-article-link-id="faq1-2"
  1647.                                       data-article-group-id="faq"
  1648.                                       data-selected-class="faq-item-q--selected"
  1649.                                     >
  1650.                                         <?php $trans->eGet('text_label_page-product_res-price-question'?></p>
  1651.                                     <p
  1652.                                       class="faq-item-a"
  1653.                                       data-article-id="faq1-2"
  1654.                                     >
  1655.                                         <?php $trans->eGet('text_label_page-product_res-price-answer'?>
  1656.                                     </p>
  1657.                                     <p
  1658.                                       class="faq-item-q"
  1659.                                       data-article-link-id="faq1-3"
  1660.                                       data-article-group-id="faq"
  1661.                                       data-selected-class="faq-item-q--selected"
  1662.                                     >
  1663.                                         <?php $trans->eGet('text_label_page-product_buying-question'?></p>
  1664.                                     <div class="faq-item-a" data-article-id="faq1-3">
  1665.                                         <p><?php $trans->eGet('text_label_page-product_buying-answer'?></p>
  1666.                                         <?php if ('se' === $parameters->get('app.instance')): ?>
  1667.                                         <div class="faq-video">
  1668.                                             <iframe
  1669.                                                 src="https://www.youtube.com/embed/CUjII3ljg-U"
  1670.                                                 allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
  1671.                                                 allowfullscreen=""
  1672.                                                 width="560"
  1673.                                                 height="315"
  1674.                                                 frameborder="0">
  1675.                                             </iframe>
  1676.                                         </div>
  1677.                                         <?php endif; ?>
  1678.                                     </div>
  1679.                                     <p
  1680.                                       class="faq-item-q"
  1681.                                       data-article-link-id="faq1-4"
  1682.                                       data-article-group-id="faq"
  1683.                                       data-selected-class="faq-item-q--selected"
  1684.                                     >
  1685.                                         <?php $trans->eGet('text_label_page-product_auction-question'?>
  1686.                                     </p>
  1687.                                     <p
  1688.                                       class="faq-item-a"
  1689.                                       data-article-id="faq1-4"
  1690.                                     >
  1691.                                         <?php $trans->eGet('text_label_page-product_auction-answer'?>
  1692.                                         <a href="<?php echo $urlGenerator->generate('app.legacy.pages.contact'?>" target="_blank">
  1693.                                             <?php $trans->eGet('link_button_page-product_customer-service'?>
  1694.                                         </a>
  1695.                                     </p>
  1696.                                     <p
  1697.                                       class="faq-item-q"
  1698.                                       data-article-link-id="faq1-5"
  1699.                                       data-article-group-id="faq"
  1700.                                       data-selected-class="faq-item-q--selected"
  1701.                                     >
  1702.                                         <?php $trans->eGet('text_label_page-product_something-wrong-question'?>
  1703.                                     </p>
  1704.                                     <p
  1705.                                       class="faq-item-a"
  1706.                                       data-article-id="faq1-5"
  1707.                                     >
  1708.                                         <?php $trans->eGet('text_label_page-product_something-wrong-answer'?>
  1709.                                     </p>
  1710.                                 </div>
  1711.                                 <div class="how-to-buy-link">
  1712.                                     <a href="<?php echo $urlGenerator->generate('app.legacy.pages.howtobuy'?>">
  1713.                                         <?php $trans->eGet('text_link_page-product_faq-kpk'); ?>
  1714.                                     </a>
  1715.                                     <i class="ri-arrow-right-line"></i>
  1716.                                 </div>
  1717.                             </div>
  1718.                         </div> <!-- faq  end-->
  1719.                         <div class="cta">
  1720.                             <div class="cta-header">
  1721.                                 <div class="cta-header__pre"><?php $trans->eGet('text_label_page-product_cta-header-pre'); ?></div>
  1722.                                 <div class="cta-header__main"><?php $trans->eGet('text_label_page-product_cta-header-main'); ?></div>
  1723.                             </div>
  1724.                             <div class="cta-content">
  1725.                                 <?php $trans->eGet('text_label_page-product_cta-content'); ?>
  1726.                             </div>
  1727.                             <div class="cta-content__link">
  1728.                                 <a href="<?php echo $urlGenerator->generate('app.legacy.pages.howtosell'?>" class="button button--rounded button--large button--highlight">
  1729.                                     <?php $trans->eGet('text_button_page-product_spk-cta-link'); ?><i class="ri-arrow-right-line"></i>
  1730.                                 </a>
  1731.                             </div>
  1732.                         </div> <!-- cta end-->
  1733.                     </div> <!-- END FAQ-CTA -->
  1734.                 </div> <!-- END product-footer-row -->
  1735.             <?php
  1736.             print "<div class='similar-objects-row'>";
  1737.             // -- OTHER OBJECTS SLIDER
  1738.             if($vendor->hideOtherProductsSlider != 1) {
  1739.                 $query  "SELECT p.id, p.price, p.focus, p.categories_id, p.resprice, p.showtype,  p.artno, pd.name, pd.county_id, pd.fabrikat, pd.model, pd.urlname, pd.description, pd.short_description, ";
  1740.                 $query .= "DATE_FORMAT(p.auctionend, '%Y%m%d%H%i%s') AS fullend, ";
  1741.                 $query .= "DATE_FORMAT(p.auctionstart, '%Y%m%d%H%i%s') AS objstart, ";
  1742.                 $query .= "CASE WHEN (p.auctionend < NOW() AND p.paymentbasis_id > 0) THEN 1 ELSE 0 END AS isSold ";
  1743.                 $query .= ", p.auctionend as ddend ";
  1744.                 $query .= "FROM products p";
  1745.                 $query .= " LEFT JOIN products_description pd ON pd.products_id=p.id AND pd.language_id=".LANGUAGE_ID."";
  1746.                 $query .= " WHERE p.online=1 AND p.commissions_id!=0 AND p.paymentbasis_id=0 AND p.nosale!=1 AND p.canceled!=1 AND DATE_FORMAT(NOW(), '%Y%m%d%H%i%s') > DATE_FORMAT(p.auctionstart, '%Y%m%d%H%i%s') AND DATE_FORMAT(NOW(), '%Y%m%d%H%i%s') <= DATE_FORMAT(DATE_ADD(p.auctionend, INTERVAL 1 MINUTE), '%Y%m%d%H%i%s') AND p.vendors_id=".$vendor->id." ";
  1747.                 $query .= "AND p.id != ".$obj->id." ";
  1748.                 $query .=" ORDER BY rand() limit 8";
  1749.                 $result mysqli_query($db$query);
  1750.                 if(mysqli_num_rows($result)) {
  1751.                     // Info that this seller has other objects
  1752.                     // -- START VENDOR OBJECT SLIDER
  1753.                     print "    <div class=\"similar-objects\">\n";
  1754.                     print ("
  1755.                     <h2>
  1756.                       <a class='product-info-section__product-link vendor-link' href=\"/vendorpage/".$vendor->id."/\">
  1757.                         <span>"$trans->get('link_button_page-product_same-seller') ."
  1758.                           <span class='link-icon'></span>
  1759.                         </span>
  1760.                       </a>
  1761.                     </h2>\n");
  1762.                     print "      <div class=\"carousel vendor-carousel\">\n";
  1763.                     while($relObj mysqli_fetch_object($result)) {
  1764.                         unset($relObjUrl);
  1765.                         unset($relPicUrl);
  1766.                         unset($antbids);
  1767.                         $relObjUrl $urlGenerator->generate('app.legacy.auction.object', ['produrlname' => $relObj->urlname]);
  1768.                         $relPicUrl $parameters->get('app.image.path')."/image-missing.png";
  1769.                         $relmpres mysqli_query($db"SELECT id, overskrift, bildinfo, updated FROM extrabilder WHERE sida='".$relObj->id."' AND mainpic=1 LIMIT 1");
  1770.                         if(mysqli_num_rows($relmpres)){
  1771.                             $relmp mysqli_fetch_object($relmpres);
  1772.                             $image = new ProductImage($relObj->idnull);
  1773.                             $image->setId($relmp->id)
  1774.                                 ->setExtension($relmp->bildinfo)
  1775.                                 ->setUpdated(new DateTime($relmp->updated))
  1776.                                 ->setText($relmp->overskrift);
  1777.                             $relPicUrl $image->getImageUrl('large');
  1778.                         }
  1779.                         $bsql "SELECT id FROM bids WHERE products_id='".mysqli_real_escape_string($db$relObj->id)."' ORDER BY bid DESC";
  1780.                         $bres mysqli_query($db$bsql);
  1781.                         $antbids mysqli_num_rows($bres);
  1782.                         $wasql "SELECT id, bid, register_id FROM bids WHERE products_id='".mysqli_real_escape_string($db$relObj->id)."' ORDER BY bid DESC LIMIT 1";
  1783.                         $wares mysqli_query($db$wasql);
  1784.                         if(mysqli_num_rows($wares)){
  1785.                             $wa mysqli_fetch_object($wares);
  1786.                         }
  1787.                         else {
  1788.                             $wa = new stdClass();
  1789.                             $wa->bid 0;
  1790.                         }
  1791.                         $showPrice $relObj->price;
  1792.                         if(isset($wa->id)) {
  1793.                             $showPrice $wa->bid;
  1794.                         }
  1795.                         print "           <div class=\"object-cell\" onclick=\"location.href='".$relObjUrl."';\">\n";
  1796.                         print "             <div id=\"object_li_".$relObj->id."\" class=\"listing-box-slider\">\n";
  1797.                         print "               <a href=\"".$relObjUrl."\">\n";
  1798.                         print "                 <div class=\"listing-img-slider\"><img data-lazy='".$relPicUrl."'>";
  1799.                         print "               <div class=\"label-wrapper\">";
  1800.                         if ($relObj->categories_id == RESTCATEGORY) {
  1801.                             print "               <div class=\"stock-auction-ribbon".($parameters->get("app.instance") === 'dk' ' stock-auction-ribbon__dk' '') ."\"></div>\n";
  1802.                         }
  1803.                         if ((int)$relObj->showtype == || (int)$relObj->showtype == || (int)$relObj->showtype == 4) {
  1804.                             print "               <div class=\"bankruptcy-auction-ribbon\"></div>\n";
  1805.                         }
  1806.                         if (isSold($relObj)) {
  1807.                             print "    <div class=\"sold-ribbon\">
  1808.                                         ".$trans->get('text_label_tag-sold')."
  1809.                                        </div>\n";
  1810.                         }
  1811.                         print "             </div>\n<!-- end .label-wrapper -->";
  1812.                         print "</div>\n";
  1813.                         print "               </a>\n";
  1814.                         print "               <span class=\"object-title-slider\">".$relObj->name."</span>\n";
  1815.                         print "               <span class=\"object-maker-slider\">".($relObj->fabrikat != "" $relObj->fabrikat "&nbsp;")."</span>\n";
  1816.                         print "               <span class=\"object-county-slider\">".($counties[$relObj->county_id] != "" $counties[$relObj->county_id] : "&nbsp;")."</span>\n";
  1817.                         print "               <div class=\"no-of-bids-box-slider\">" .
  1818.                             $trans->get('text_label_page-product_amount-bids') .
  1819.                             ": <b id=\"antbids_".$relObj->id."\">" .
  1820.                             $trans->get('text_label_page-product_amount-bids-total', ['bids' => $antbids]) . "</b></div>\n";
  1821.                         print "               <div class=\"close-box-slider\">
  1822.                                         <span id=\"timeleft_".$relObj->id."\" class=\"end\">
  1823.                                             ".$container->get(TimeLeftUtil::class)->timeleft(new DateTime($relObj->ddend))."
  1824.                                         </span>
  1825.                                     </div>\n";
  1826.                         print "               <div class=\"highest-bid-slider notranslate\" id=\"bid_".$relObj->id."\">
  1827.                                         "$trans->get(
  1828.                                 'info_label_page-product_show-price',
  1829.                                 ['showprice' => $showPrice]
  1830.                             ) ."
  1831.                                     </div>\n";
  1832.                         print "           </div>\n<!-- end .listing-box-slider -->";
  1833.                         print "        </div>\n<!-- end .object-cell -->";
  1834.                     }
  1835.                     print "      </div>\n<!-- end .vendor-carousel -->";
  1836.                     print "</div>\n<!-- end .similar-objects -->";
  1837.                 }
  1838.             }
  1839.             // -- OTHER OBJECTS END
  1840.             // -- START SIMILAR OBJECT SLIDER
  1841.             $categoriesForProductListning = [];
  1842.             try {
  1843.                 $categoriesForProductListning $categoriesObject->getCategoriesForProductListing($obj->categories_id);
  1844.             } catch (Exception $e) {}
  1845.             $query  "SELECT p.id, p.price, p.focus, p.categories_id, p.resprice, p.showtype,  p.artno, pd.name, pd.county_id, pd.fabrikat, pd.model, pd.urlname, pd.description, pd.short_description, ";
  1846.             $query .= "DATE_FORMAT(p.auctionend, '%Y%m%d%H%i%s') AS fullend, ";
  1847.             $query .= "DATE_FORMAT(p.auctionstart, '%Y%m%d%H%i%s') AS objstart ";
  1848.             $query .= ", p.auctionend as ddend ";
  1849.             $query .= ", CASE WHEN (p.auctionend < NOW() AND p.paymentbasis_id > 0) THEN 1 ELSE 0 END AS isSold ";
  1850.             $query .= "FROM products p";
  1851.             $query .= " LEFT JOIN products_description pd ON pd.products_id=p.id AND pd.language_id=".LANGUAGE_ID." ";
  1852.             $query .= "WHERE p.online=1 AND p.commissions_id!=0 AND p.categories_id IN (" implode(','$categoriesForProductListning) . ") ";
  1853.             $query .= "AND p.paymentbasis_id=0 AND p.nosale!=1 AND p.canceled!=1 ";
  1854.             $query .= "AND DATE_FORMAT(NOW(), '%Y%m%d%H%i%s') > DATE_FORMAT(p.auctionstart, '%Y%m%d%H%i%s') ";
  1855.             $query .= "AND DATE_FORMAT(NOW(), '%Y%m%d%H%i%s') <= DATE_FORMAT(DATE_ADD(p.auctionend, INTERVAL 1 MINUTE), '%Y%m%d%H%i%s') ";
  1856.             $query .= "AND p.id != ".$obj->id." ";
  1857.             $query .=" ORDER BY rand() limit 8";
  1858.             if (count($categoriesForProductListning) > 0) {
  1859.                 $result mysqli_query($db$query);
  1860.                 if (mysqli_num_rows($result)) {
  1861.                     print "<div class=\"similar-objects other-objects\">\n";
  1862.                     $categoryModel $categoriesObject->getClosestPublicCategory($obj->categories_id);
  1863.                     if (!is_null($categoryModel->getId())) {
  1864.                         printf(
  1865.                             ' <h2>
  1866.                         <a class="product-info-section__product-link other-link" href="%s">
  1867.                               <span>%s
  1868.                               <span class="link-icon">
  1869.                               </span>
  1870.                         </a>
  1871.                     </h2>',
  1872.                             $categoryModel->getCompleteUrl(),
  1873.                             $categoryModel->getDisplayName()
  1874.                         );
  1875.                     }
  1876.                     print " <div class=\"carousel object-carousel\">\n";
  1877.                     while ($relObj mysqli_fetch_object($result)) {
  1878.                         unset($relObjUrl);
  1879.                         unset($relPicUrl);
  1880.                         unset($antbids);
  1881.                         $relObjUrl $urlGenerator->generate(
  1882.                             'app.legacy.auction.object',
  1883.                             ['produrlname' => $relObj->urlname]
  1884.                         );
  1885.                         $relPicUrl $parameters->get('app.image.path') . "/image-missing.png";
  1886.                         $relmpres mysqli_query(
  1887.                             $db,
  1888.                             "SELECT id, overskrift, bildinfo, updated FROM extrabilder WHERE sida='" $relObj->id "' AND mainpic=1 LIMIT 1"
  1889.                         );
  1890.                         if (mysqli_num_rows($relmpres)) {
  1891.                             $relmp mysqli_fetch_object($relmpres);
  1892.                             $image = new ProductImage($relObj->idnull);
  1893.                             $image->setId($relmp->id)
  1894.                                 ->setExtension($relmp->bildinfo)
  1895.                                 ->setUpdated(new DateTime($relmp->updated))
  1896.                                 ->setText($relmp->overskrift);
  1897.                             $relPicUrl $image->getImageUrl('large');
  1898.                         }
  1899.                         $bsql "SELECT id FROM bids WHERE products_id='" mysqli_real_escape_string(
  1900.                                 $db,
  1901.                                 $relObj->id
  1902.                             ) . "' ORDER BY bid DESC, id DESC";
  1903.                         $bres mysqli_query($db$bsql);
  1904.                         $antbids mysqli_num_rows($bres);
  1905.                         $wasql "SELECT id, bid, register_id FROM bids WHERE products_id='" mysqli_real_escape_string(
  1906.                                 $db,
  1907.                                 $relObj->id
  1908.                             ) . "' ORDER BY bid DESC, id DESC LIMIT 1";
  1909.                         $wares mysqli_query($db$wasql);
  1910.                         if (mysqli_num_rows($wares)) {
  1911.                             $wa mysqli_fetch_object($wares);
  1912.                         } else {
  1913.                             $wa = new stdClass();
  1914.                             $wa->bid 0;
  1915.                         }
  1916.                         $showPrice $relObj->price;
  1917.                         if (isset($wa->id)) {
  1918.                             $showPrice $wa->bid;
  1919.                         }
  1920.                         print "           <div class=\"object-cell\" onclick=\"location.href='" $relObjUrl "';\">\n";
  1921.                         print "             <div id=\"object_li_" $relObj->id "\" class=\"listing-box-slider\">\n";
  1922.                         print "               <a href=\"" $relObjUrl "\">\n";
  1923.                         print "                 <div class=\"listing-img-slider\"><img data-lazy='" $relPicUrl "'>";
  1924.                         print "               <div class=\"label-wrapper\">";
  1925.                         if ($relObj->categories_id == $parameters->get('app.rest.category.id')) {
  1926.                             print "               <div class=\"stock-auction-ribbon". ($parameters->get("app.instance") === 'dk' ' stock-auction-ribbon__dk' '') ."\"></div>\n";
  1927.                         }
  1928.                         if ((int)$relObj->showtype == || (int)$relObj->showtype == || (int)$relObj->showtype == 4) {
  1929.                             print "               <div class=\"bankruptcy-auction-ribbon\"></div>\n";
  1930.                         }
  1931.                         if (isSold($relObj)) {
  1932.                             print "               <div class=\"sold-ribbon\">
  1933.                                                     ".$trans->get('text_label_tag-sold')."
  1934.                                                   </div>\n";
  1935.                         }
  1936.                         print "               </div>\n<!-- end .label-wrapper -->";
  1937.                         print "</div>\n";
  1938.                         print "               </a>\n";
  1939.                         print "               <span class=\"object-title-slider\">" $relObj->name "</span>\n";
  1940.                         print "               <span class=\"object-maker-slider\">" . ($relObj->fabrikat != "" $relObj->fabrikat "&nbsp;") . "</span>\n";
  1941.                         print "               <span class=\"object-county-slider\">" . ($counties[$relObj->county_id] != "" $counties[$relObj->county_id] : "&nbsp;") . "</span>\n";
  1942.                         print "               <div class=\"no-of-bids-box-slider\">" .
  1943.                             $trans->get('text_label_page-product_amount-bids') .
  1944.                             ": <b id=\"antbids_" $relObj->id "\">" .
  1945.                             $trans->get('text_label_page-product_amount-bids-total', ['bids' => $antbids]
  1946.                             ) . "</b></div>\n";
  1947.                         print "               <div class=\"close-box-slider\">
  1948.                                                 <span id=\"timeleft_" $relObj->id "\" class=\"end\">
  1949.                                                     ".$container->get(TimeLeftUtil::class)->timeleft(new DateTime($relObj->ddend))."
  1950.                                                 </span>
  1951.                                 </div>\n";
  1952.                         print "               <div class=\"highest-bid-slider notranslate\" id=\"bid_" $relObj->id "\">
  1953.                                 " $trans->get(
  1954.                                 'info_label_page-product_show-price',
  1955.                                 ['showprice' => $showPrice]
  1956.                             ) . "
  1957.                             </div>\n";
  1958.                         print "             </div>\n<!-- end .listing-box-slider -->";
  1959.                         print "           </div>\n<!-- end .other-objects -->";
  1960.                     }
  1961.                     print "           </div> <!-- carousel object-carousel end -->
  1962.                                     </div> <!-- end .object-carousel -->";
  1963.                 }
  1964.             }
  1965.             //// Trustpilot-showcase
  1966.             echo $container->get('twig')->render('public/trustpilot/trustpilot_small.html.twig');
  1967.             ?>
  1968.             <?php print $obj->script_code?>
  1969.             <script>
  1970.                 var secleft = <?php print $secleft?>;
  1971.             </script>
  1972.         </div> <!-- END .similar-objects-row-->
  1973.       </div> <!-- end .product-grid -->
  1974.     </div> <!-- end .topbar_full -->
  1975.     <?php }
  1976.     else {
  1977.       print "<div class='row'>";
  1978.       print "<div class='column xlarge-4 xlarge-offset-4 large-6 large-offset-3 medium-8 medium-offset-2 small-12'>";
  1979.       print "<div class='auction_not_started'>";
  1980.       print "<video loop autoplay playsinline muted width='65'>";
  1981.       print "<source src='/images/video/Timglas.mp4' type='video/mp4'>";
  1982.       print "</video>";
  1983.       print "<h2>".$trans->get("ALIAS_PRODUCT_NOT_STARTED_HEADLINE")."</h2>";
  1984.       print "<p class='ingress'>".$trans->get("ALIAS_PRODUCT_NOT_STARTED_TEXT")."</p>";
  1985.       print "<a class='klaravik-link-button' href='/'>"$trans->get('link_button_page-product_all-auctions') ."</a>";
  1986.       print "</div>";
  1987.       print "</div>";
  1988.       print "</div>";
  1989.     }
  1990.   }
  1991.   else {
  1992.       ?>
  1993.           <div class='row'>
  1994.             <div class='column large-6 large-offset-3 medium-8 medium-offset-2 small-12 page-main'>
  1995.                 <div class='noValidProduct'>
  1996.                     <div class='noValidProduct__lottie'>
  1997.                         <div class='noValidProduct__lottie-magnifyer' data-src='/images/lottie-animations/magnifying-glass.json' autoplay loop></div>
  1998.                     </div>
  1999.                     <div class='noValidProduct__title'>
  2000.                         <?php $trans->eGet('text_label_page-product_no-valid-prod-caption'); ?>
  2001.                     </div>
  2002.                     <p><?php $trans->eGet('text_label_page-product_no-valid-prod-text'); ?></p>
  2003.                     <a href='/'>
  2004.                         <button class='noValidProduct__button button--medium button--primary'>
  2005.                             <?php $trans->eGet('link_button_page-product_all-auctions'); ?>
  2006.                         </button>
  2007.                     </a>
  2008.                 </div>
  2009.             </div>
  2010.           </div>
  2011.       <?php
  2012.   }
  2013. }
  2014. else {
  2015.   print $trans->get('text_label_page-product_missing-valid-param');
  2016. }
  2017. ?>
  2018. <!-- Vue teleportation of snackbars will end here -->
  2019. <div class="snackbars"></div>
  2020. <k-modal id="saved-object-modal" data-position="center">
  2021.     <i slot="close-icon" class="ri-close-fill"></i>
  2022.     <div slot="header" class="saved-object-modal__header">
  2023.         <span class="saved-object-modal__header-img"></span>
  2024.     </div>
  2025.     <div slot="body" class="saved-object-modal__body">
  2026.         <h1 class="saved-object-modal__heading"><?php $trans->eGet("text_heading_saved-object-modal_save-object")?></h1>
  2027.         <p class="saved-object-modal__subheading"><?php $trans->eGet("text_bodytext_saved-object-modal_login")?></p>
  2028.     </div>
  2029.     <div slot="footer" class="saved-search-modal__footer saved-object-modal__footer-btns">
  2030.         <a href="<?php echo($urlGenerator->generate('app.legacy.pages.login', ['continue' => $request->getRequestUri()])) ?>" class="button--large button--primary button--rounded" saved-object-cta="login">
  2031.             <i class="ri-user-fill"></i><?php $trans->eGet("text_label_saved-object-modal_login"?>
  2032.         </a>
  2033.         <a href="<?php echo($urlGenerator->generate('app.legacy.pages.register')) ?>" class="button--large button--rounded button--secondary" saved-object-cta="create-account">
  2034.             <i class="ri-user-add-line"></i><?php $trans->eGet("text_label_saved-object-modal_create-account"?>
  2035.         </a>
  2036.     </div>
  2037. </k-modal>
  2038. <script>
  2039.   let sessionBuyer = <?php
  2040.       if (array_key_exists('register_id'$_SESSION) && isset($obj->id)) {
  2041.           $sessionRegisterId $_SESSION['register_id'];
  2042.           $bidderNumbers getBidderNumbers($db$obj->id);
  2043.           echo array_key_exists(
  2044.               $sessionRegisterId$bidderNumbers) ? $bidderNumbers[$sessionRegisterId] : -1;
  2045.       } else {
  2046.           echo 0;
  2047.       }
  2048.       ?>;
  2049. </script>
  2050. <?php
  2051. $manifestAssets
  2052.     ->add('bundle-pages-product')
  2053.     ->add('bundle-requests-ajaxMarkObject');