<?php
require_once __DIR__ . '/includes/auctionfee.php';
require_once __DIR__ . '/includes/Categories.php';
require_once __DIR__ . '/includes/ProductFieldsTableRender.php';
/**
* $products_id is defined in index.phtml
* @var mysqli $db defined in require.phtml, included thru index.phtml
*
* @var Trans $trans
* @var UrlGeneratorInterface $urlGenerator
* @var \Symfony\Component\DependencyInjection\ContainerInterface $container
* @var ContainerBagInterface $parameters
* @var \Klaravik\Assets\ManifestAssets $manifestAssets
*/
use Klaravik\Enum\ProductFieldsEnum;
use Klaravik\Exception\MissingResultException;
use Klaravik\Images\ProductImage;
use Klaravik\Images\ProductImagesViewCollection;
use Klaravik\includes\ProductFieldsTableRender;
use Klaravik\includes\Categories;
use Klaravik\Breadcrumb\Breadcrumb;
use Klaravik\Model\ExtraVehicle;
use Klaravik\Model\VendorType;
use Klaravik\Product\BasicData\RenderBasicProductData;
use Klaravik\Product\Condition\RenderConditionData;
use Klaravik\Product\Equipment\RenderEquipmentData;
use Klaravik\Product\Util\TimeLeftUtil;
use Klaravik\Repository\ProductDescriptionRepo;
use Klaravik\Repository\ProductsRegisterRefRepo;
use Klaravik\Repository\VendorTypeRepo;
use Klaravik\Translate\Trans;
use Klaravik\Product\ExtraVehicle\RenderExtraVehicleData;
use Klaravik\Repository\ExtraVehicleRepo;
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Klaravik\Repository\UserRepo;
use Klaravik\Repository\ProductFlagRepo;
use Klaravik\Exception\RepositoryException;
use Klaravik\Repository\RegisterRepository;
$categoriesObject = new Categories($trans, $urlGenerator);
$productFieldsRender = null;
/**
* Returns a valid url for getting back to vendor view
*
* @param UrlGeneratorInterface $urlGenerator
* @return string
*/
function getReturnUrl(UrlGeneratorInterface $urlGenerator): string {
if (isset($_GET['vendorTab'])) {
$params = ['vendortab' => $_GET['vendorTab']];
if (isset($_GET['productspage'])) {
$params['productspage'] = $_GET['productspage'];
}
return $urlGenerator->generate('app.legacy.pages.vendor.subpage', $params);
}
return '';
}
/**
* @return bool
*/
function isKam(): bool
{
$userIsKam = FALSE;
if (isset($_SESSION['users_id'])) {
try {
$userIsKam = (new UserRepo())->userIsKam($_SESSION['users_id'])->getId() === $_SESSION['users_id'];
} catch (RepositoryException | MissingResultException $e) {}
}
return $userIsKam;
}
/**
* Check if a product needs to be reviewed by KAM
*
* @throws RepositoryException
*/
function mustBeReviewed(int $products_id): int
{
return (new ProductFlagRepo())->getByProductId($products_id)->getMustBeReviewed();
}
function buildProductQuery($db, $useTable, $products_id, $language) {
$query = "SELECT p.*, pd.name AS name, pd.description AS description, pd.county_id, pd.fabrikat AS fabrikat, pd.model AS model, pd.enteredByKam, ";
$query .= "pd.includesForewordInDescription as includesForewordInDescription, pd.previewHash, pd.extraVehicleDescription, pd.extraDescription, pd.descriptionPreamble, ";
$query .= "CASE WHEN (p.auctionend < NOW() AND p.paymentbasis_id > 0) THEN 1 ELSE 0 END AS isSold, ";
$query .= "pd.filelinkname AS filelinkname, pd.urlname AS urlname, p.price AS price, p.resprice AS resprice, p.canceled AS canceled, ";
$query .= "DATE_FORMAT(p.auctionstart, '%Y-%m-%d') AS astartdate, DATE_FORMAT(p.auctionstart, '%H:%i') AS astartkl, ";
$query .= "DATE_FORMAT(p.auctionend, '%Y-%m-%d') AS aenddate, DATE_FORMAT(p.auctionend, '%H:%i') AS aendkl, ";
$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, ";
$query .= "DATE_FORMAT(p.auctionend, '%Y-%m-%d %H:%i:%s') AS ddend, ";
$query .= "DATE_FORMAT(p.auctionend, '%H:%i') AS kl, ";
$query .= "DATE_FORMAT(p.auctionend, '%Y') AS oyear, DATE_FORMAT(p.auctionend, '%m') AS omonth, DATE_FORMAT(p.auctionend, '%d') AS oday ";
$query .= "FROM ".$useTable." p, products_description pd ";
$query .= "WHERE p.id='".mysqli_real_escape_string($db, $products_id)."' ";
//$query .= "AND p.online=1 AND p.commissions_id!=0 ";
$query .= "AND pd.products_id=p.id AND pd.language_id='".$language."'";
//print $query."<br />";
return $query;
}
/**
* @param mysqli $db
* @param int $products_id
* @return string
*/
function recentProductChanges(mysqli $db, int $products_id) {
$rpcRes = mysqli_query($db, "SELECT * FROM recentProductChanges WHERE `products_id` = " . $products_id);
if (mysqli_num_rows($rpcRes)) {
$rpcObj = mysqli_fetch_object($rpcRes);
if (!empty($rpcObj->changes)) {
return $rpcObj->changes;
}
}
return '';
}
/**
* @param mysqli $db
* @param int $products_id
* @return array
*/
function getHighlightedFieldsAndValues(mysqli $db, int $products_id): array
{
$highlightedFieldsArray = [];
$hfRes = mysqli_query($db, "SELECT pV.value, pF.value AS productFieldName FROM productvalues pV
LEFT JOIN productfields pF on pF.id = pV.productfields_id
WHERE pF.highlight = 1 AND `products_id` = " . $products_id);
if (mysqli_num_rows($hfRes)) {
$values = mysqli_fetch_all($hfRes, MYSQLI_ASSOC);
foreach($values as $value) {
$highlightedFieldsArray[$value['productFieldName']] = $value['value'];
}
}
return $highlightedFieldsArray;
}
if(isset($products_id) && is_numeric($products_id)){
$counties = getAllCounties($db);
$shortDescription = (new ProductDescriptionRepo())->getByProductsId($products_id)->getShortDescription() ?: null;
$useTable = 'products';
$query = buildProductQuery($db, $useTable, $products_id, LANGUAGE_ID);
$result = mysqli_query($db, $query);
if (mysqli_num_rows($result) == 0) {
$useTable = 'products_archive';
$query = buildProductQuery($db, $useTable, $products_id, LANGUAGE_ID);
$result = mysqli_query($db, $query);
}
if(mysqli_num_rows($result)){
$obj = mysqli_fetch_object($result);
$productFieldsRender = new ProductFieldsTableRender($db, $obj);
// If copiedFrom_id and leasing_company_id and 'manuel försäljning' is isset/true then read bids from the original product.
$getBidBoxFromCopy = false;
if ($obj->leasing_company_id > 0 && $obj->copiedFrom_id > 0 && $obj->annulment_reasons_id = 100) {
$getBidBoxFromCopy = getBidHistoryFromCopy($db, $obj->id, $obj->copiedFrom_id);
}
$county = getNodei($db, "county",$obj->county_id);
$countyParent = getNodei($db, 'county',$county->parent_id);
$images = array();
try {
$images = new ProductImagesViewCollection($db, $obj->id);
} catch (Exception $exception) {
}
$previewAvailable = false;
if(
((new DateTime() < new DateTime($obj->auctionstart)) || !$obj->online)
) {
if (array_key_exists('preview', $_REQUEST)) {
$previewAvailable = ($_REQUEST['preview'] === $obj->previewHash);
} elseif (
(isset($_SESSION['users_id']) && array_key_exists($obj->vendors_id, $_SESSION['vendorAccess']))
|| (array_key_exists('is_admin', $_SESSION) && $_SESSION['is_admin'])
) {
$previewAvailable = true;
}
}
if (
((int)$obj->online === 1
&& (int)$obj->commissions_id !== 0
&& (int)$obj->fullstart > 0 &&
date("YmdHis") >= $obj->fullstart)
|| (isset($_SESSION['users_id']) && array_key_exists($obj->vendors_id, $_SESSION['vendorAccess']))
|| (array_key_exists('is_admin', $_SESSION) && $_SESSION['is_admin'])
|| $previewAvailable
){
mysqli_query($db, "UPDATE products SET viewcounter=(viewcounter + 1) WHERE id='".mysqli_real_escape_string($db, $obj->id)."'");
$secleft = 0;
$timeleft = $trans->get('text_label_page-product_not-started');
if($obj->ddend > date("Y-m-d H:i:s")) {
$secleft = strtotime($obj->ddend) - strtotime(date("Y-m-d H:i:s"));
$timeleft = $container->get(TimeLeftUtil::class)->withoutIcon()->timeLeft(new \DateTime($obj->ddend));
} elseif ($obj->ddend < date("Y-m-d H:i:s")) {
$timeleft = $trans->get('text_label_ajax-product-json_time-left-completed');
}
if($obj->canceled) {
$secleft = 0;
$timeleft = $trans->get('text_label_page-product_cancelled');
}
$nbrBids = 0;
$highBid = 0;
$highestBidder = null;
$lastBid = new stdClass();
$lastBid->bid = -1;
$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 ";
$mbidSqlId = $obj->id;
if($getBidBoxFromCopy) {
$mbidSqlId = $obj->copiedFrom_id;
}
$mbidSql .= "WHERE products_id= " . (int) $mbidSqlId . " ORDER BY bid DESC, id DESC";
$mbidRes = mysqli_query($db, $mbidSql);
$nbrBids = mysqli_num_rows($mbidRes);
if($nbrBids){
$i = 1;
while($mbid = mysqli_fetch_object($mbidRes)){
if($i == 1){
$highestBidder = $mbid->register_id;
$lastBid = $mbid;
$highBid = $mbid->bid;
}
$i++;
}
}
$bidinc = 0;
$bssql = "SELECT * FROM biddingsteps ORDER BY level DESC";
$bsres = mysqli_query($db, $bssql);
while($bs = mysqli_fetch_object($bsres)){
if($lastBid->bid <= $bs->level){
$bidinc = $bs->step;
}
}
if($nbrBids > 0) $bidtext = $trans->get('text_label_page-product_min-bid-increased');
else $bidtext = $trans->get('text_label_page-product_min-bid');
$minimumBid = ($highBid + $bidinc);
if($highBid == 0) $minimumBid = $obj->price;
if ($minimumBid == 0) $minimumBid = $bidinc;
$vendor = getNodei($db, "vendors", $obj->vendors_id);
if($vendor->isAnon){
$vendorName = $trans->get('text_label_page-product_anonymous');
if($vendor->companytype){
$vendortype = getNodei($db, "vendortypes", $vendor->companytype);
if($vendortype->typename != ""){
$vendorName = $vendortype->typename;
}
}
}
else {
$vendorName = $vendor->company;
}
$vendorType = new VendorType();
try {
$vendorType = (new VendorTypeRepo())->getById($vendor->companytype);
} catch (MissingResultException|RepositoryException $e) {
}
$bids = array();
$mbidSqlId = $obj->id;
if($getBidBoxFromCopy) {
$mbidSqlId = $obj->copiedFrom_id;
}
$bidsSql = "SELECT id, register_id, bid, ip, entered, DATE_FORMAT(entered, '%m') AS bmonth,
DATE_FORMAT(entered, '%d') AS bday, DATE_FORMAT(entered, '%H:%i') AS kl
FROM bids
WHERE products_id={$mbidSqlId}
ORDER BY bid DESC, id DESC";
$bidders = getBidderNumbers($db, $products_id);
$leaderBidderNumber = array_key_exists($highestBidder, $bidders) ? $bidders[$highestBidder] : 0;
$bidsResult = mysqli_query($db, $bidsSql);
if (mysqli_num_rows($bidsResult) > 0) {
while ($bid = mysqli_fetch_object($bidsResult)) {
// SPECIAL: Pga krockande maxbud kan visa bud vara sparade som xxx99 men ska visas som jämnt 100-tal
if ($bid->bid % 10) {
$bid->bid += 1;
}
$isAutoBid = false;
if ($bid->ip === "Budhöjaren") {
$isAutoBid = true;
}
$negotiation = false;
if ($bid->ip === "Förhandling") {
$negotiation = true;
}
$bidderNumber = array_key_exists($bid->register_id, $bidders) ? $bidders[$bid->register_id] : 0;
$userIsBidder = false;
if (array_key_exists('register_id', $_SESSION) &&
(int)$_SESSION['register_id'] === (int)$bid->register_id) {
$userIsBidder = true;
}
$bidData = array(
'id' => $bid->id,
'bidTime' => $trans->get(
'text_label_page-product_date-time_day-short-month-time',
['dateTime' => new DateTime($bid->entered)]
),
'bidTimeUnix' => (new DateTime($bid->entered))->getTimestamp(),
'userIsBidder' => $userIsBidder,
'user' => $bidderNumber,
'bidSum' => (int)$bid->bid,
'autoBid' => $isAutoBid,
'negotiation' => $negotiation,
);
if (array_key_exists('is_admin', $_SESSION) && (bool)$_SESSION['is_admin']) {
$bidData['userId'] = (int)$bid->register_id;
}
$bids[] = $bidData;
}
}
?>
<div class="row">
<div class="columns large-12">
<div class="product-page-breadcrumbs">
<div class="left-blur"></div>
<div id="breadcrumbs" class="breadcrumbs">
<?php
$breadcrumb = new Breadcrumb($trans, $urlGenerator);
$breadcrumbs = $breadcrumb->activeAuctionBreadcrumbs($obj->categories_id);
$httpRefer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$urlParams = [];
$closedAuction = false;
if (strpos($httpRefer, 'bankruptcy') !== false) {
echo '<a href="'.$urlGenerator->generate('app.legacy.auction.listing.bankruptcy').'">'.
$trans->get('text_label_page-product_bankruptcy_auctions') .'</a>';
$breadcrumbs = array();
}
if($obj->fullend > 0 && date("YmdHis") > $obj->fullend){
$closedAuction = true;
$breadcrumbs = $breadcrumb->closedAuctionBreadcrumbs($obj->categories_id);
}
if (strpos($httpRefer, 'searchtext')) {
$breadcrumbs = $breadcrumb->getBreadcrumbs($obj->categories_id, array(
array(
'url' => '',
'name' => $trans->get('text_label_page-product_all-search-result'),
)
));
preg_match('/searchtext=([a-zA-Z\d%+]+)&?/', $httpRefer, $matches);
if (count($matches)) {
$urlParams = array_merge($urlParams, ['searchtext' => $matches[1], 'dosearch' => '']);
}
}
$parseUrl = parse_url($httpRefer);
if (isset($parseUrl['query'])) {
parse_str($parseUrl['query'], $querys);
if (isset($querys['setcountyflag'])) {
$urlParams['setcountyflag'] = $querys['setcountyflag'];
}
if (isset($querys['setmunicipality'])) {
$urlParams['setmunicipality'] = $querys['setmunicipality'];
}
}
foreach($breadcrumbs as $index => $breadcrumbArray) {
$breadcrumbUrlParams = $urlParams;
$routeName = $closedAuction ? 'app.legacy.auction.listing.closed' : 'app.legacy.auction.listing';
if (!empty($breadcrumbArray['url'])) {
$routeName = $closedAuction ? 'app.legacy.auction.listing.closed.category' : 'app.legacy.auction.listing.category';
$breadcrumbUrlParams['caturlname'] = $breadcrumbArray['url'];
}
echo '<a href="'.$urlGenerator->generate($routeName, $breadcrumbUrlParams).'">'.$breadcrumbArray['name'].'</a>';
}
echo '<span>'. $trans->get('text_label_page-product_object', ['object_id' => $obj->id]) .'</span>';
?>
</div>
<div class="right-blur"></div>
<hr>
</div>
</div>
</div>
<?php
if ($previewAvailable) {
$respricePrice = $trans->get('info_label_page-product_reserved-price', ['resprice' => (int)$obj->resprice]);
}
$regObj = null;
$registerAllowedToBid = false;
$canBidBankId = true;
if (isset($_SESSION['register_id'])) {
$regObj = getNodei($db, "register", $_SESSION['register_id']);
}
$reservPriceReached = ($nbrBids && $lastBid->bid >= $obj->resprice && $obj->resprice > 0) || (int)$obj->resprice === 0;
$reservationPriceAlias = $trans->get("ALIAS_RESERVATIONPRICE_INFO");
$aendtime = '';
if ((int)$obj->omonth) {
$aendtime = $trans->get(
'text_label_page-product_date-time_day-short-month-time',
['dateTime' => new DateTime($obj->auctionend)]
);
// Add year to the endTime if the year is not the current year.
if (date("Y",strtotime($obj->ddend)) != date("Y")) {
$aendtime = $trans->get(
'text_label_page-product_date-time_day-short-month-year-time',
['dateTime' => new DateTime($obj->auctionend)]
);
}
}
if ($regObj) {
// Precaution because we don't know how these are saved as.
$private = $vendor->clientnbr && str_contains(strtolower($vendor->clientnbr), 'privat');
$vendorClientNBR = trim(preg_replace('/\D/', '', $vendor->clientnbr));
$registerClientNBR = trim(preg_replace('/\D/', '', $regObj->clientnbr));
$allowedClientType = 'allowedBidder' . $regObj->clienttype;
$deniedBidderAlias = 'ALIAS_DENIEDBIDDER_' . $regObj->clienttype;
$deniedBidderHeaderAlias = 'ALIAS_DENIEDBIDDER_HEADER_' . $regObj->clienttype;
if ((int)$obj->{$allowedClientType} === 1 && ($vendorClientNBR !== $registerClientNBR || ($private && $parameters->get("app.instance") === 'dk'))) {
$registerAllowedToBid = true;
}
}
if (
$parameters->get('app.bankid.enable') &&
$parameters->get('app.bankid.force') &&
isset($_SESSION['register_id']) &&
isset($_SESSION['bankIDActive']) &&
!$_SESSION['bankIDActive'] &&
!$_SESSION['exceptRequiredAuthentication']
) {
$canBidBankId = false;
}
if ($registerAllowedToBid && !isset($_SESSION['late_payments']) && !isset($_SESSION['user_banned'])) {
unset($umb);
$umbSql = "SELECT * FROM maxbids WHERE products_id='" . mysqli_real_escape_string($db, $obj->id) . "' ";
$umbSql .= "AND register_id='" . mysqli_real_escape_string($db, $_SESSION["register_id"]) . "' AND reached='N'";
$umbRes = mysqli_query($db, $umbSql);
if (mysqli_num_rows($umbRes)) {
$umb = mysqli_fetch_object($umbRes);
}
}
$bidBoxData = array(
'bid' => (int)$highBid,
);
$status = 'online';
if (new DateTime($obj->ddend) < new DateTime()) {
$status = 'ended';
}
if ((int) $obj->canceled) {
$status = 'canceled';
}
$closeBoxData = array(
'timeLeft' => $timeleft,
'auctionEndTime' => $aendtime,
'auctionEndTimeUnix' => strtotime($obj->fullend),
'printData' => array(
'imgSrc' => $parameters->get('app.image.path') . '/icon-calender.svg',
),
'status' => $status,
);
$biddingBox = array(
'bidder' => $leaderBidderNumber,
'noBids' => count($bids),
'bids' => $bids,
);
$userData = array(
'type' => (array_key_exists("register_clientType", $_SESSION) ? $_SESSION["register_clientType"] : ""),
'isLoggedIn' => array_key_exists('register_id', $_SESSION),
'incVat' => false,
'canBid' => (
(
$registerAllowedToBid
&& !isset($_SESSION['late_payments'])
&& !isset($_SESSION['user_banned'])
&& $obj->canceled === 0
)
&& (
$regObj->clienttype == "SF"
|| $regObj->clienttype == "SP"
|| (
(
$regObj->clienttype == "UF" || $regObj->clienttype == "UP"
)
&& $regObj->vatValidated == 1
)
)
&& date("YmdHis") >= $obj->fullstart
&& $obj->fullstart !== 0
&& $obj->online === 1
),
'canBidBankid' => $canBidBankId,
'bankIdEnable' => $parameters->get('app.bankid.enable'),
'umb' => (isset($umb) ? number_format($umb->bid, 0, ',', '') : false),
'inPreviewMode' => $previewAvailable,
'vatable' => (is_object($regObj) ? (int)$regObj->vatable:0),
);
$isFav = false;
if (isset($_SESSION['register_id']) && !($obj->fullend > 0 && date("YmdHis") > $obj->fullend) ):
try {
$isFav = (new ProductsRegisterRefRepo())
->registerHasProductAsFavorite($obj->id, $_SESSION['register_id']);
} catch (RepositoryException $e) {}
endif;
$productData = array(
'id' => $obj->id,
'isFav' => $isFav,
'previewHash' => isset($_REQUEST['preview']) ? htmlspecialchars($_REQUEST['preview'], ENT_QUOTES) : '',
'closed' => ($obj->fullend > 0 && date("YmdHis") > $obj->fullend ? true : ''),
'vat' => ($obj->momsavdrag == 1 ? (int)$obj->moms : 0),
'vmb' => (int)$obj->vmb,
"nextBid" => (int)$minimumBid,
'momsavdrag' => (int)$obj->momsavdrag,
'bidStep' => (int)$bidinc,
'auctionFee' => (int)auctionFee($db, (int)$products_id),
'bidBox' => $bidBoxData,
'reservePriceReached' => $reservPriceReached,
'closeBox' => $closeBoxData,
'biddingBox' => $biddingBox,
'user' => $userData,
'region' => (isset($_SESSION['register_country_region']) ? (int)$_SESSION['register_country_region'] : ""),
'vatValidated' => (isset($_SESSION['vatValidated']) ? (int)$_SESSION['vatValidated'] : ""),
'url' => $urlGenerator->generate('app.legacy.auction.object', ['produrlname' => $obj->urlname]),
'bidInfoManual' => $trans->get('ALIAS_PRODUCT_BID_INFO_MANUAL'),
'bidButtonManual' => $trans->get('ALIAS_PRODUCT_BID_BUTTON_MANUAL'),
'bidButtonAuto' => $trans->get("ALIAS_PRODUCT_BID_BUTTON_AUTO"),
'bidInfoAuto' => $trans->get('ALIAS_PRODUCT_BID_INFO_AUTO'),
'urlRegister' => $urlGenerator->generate('app.legacy.pages.register'),
'urlLoginBuyer' => $urlGenerator->generate('app.legacy.pages.login', ['continue' => $urlGenerator->generate('app.legacy.auction.object', ['produrlname' => $obj->urlname])]),
'zendeskChat' => ZENDESKCHAT,
'switchAccount' => !$multiUserCollection->empty(),
);
$showFinance = true;
$yearModelExists = false;
$serialNumberExists = false;
$displayFinancing = false;
$resYear = mysqli_query($db, "SELECT `pv`.`value`, `pf`.`mascusDbname`, `pf`.`infocarElement` FROM `productvalues` `pv`
LEFT JOIN `productfields` `pf` ON `pf`.`id` = `pv`.`productfields_id`
LEFT JOIN `products` `p` ON `p`.`id` = `pv`.`products_id`
LEFT JOIN `categories` `c` ON `c`.`id` = `pf`.`categories_id` AND `p`.`categories_id` = `c`.`id`
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
AND (`pf`.`mascusDbname` = 'yearofmanufacture' or `pf`.`infocarElement` = 'generationSold' or `pf`.`infocarElement` = 'generationDesign' or `pf`.`infocarElement` = 'vinCode' or `pf`.`mascusDbname` = 'manufacturenumber')");
while($rowYear = mysqli_fetch_object($resYear)) {
if ($rowYear->mascusDbname === 'manufacturenumber' || $rowYear->infocarElement === 'vinCode') {
if (strlen($rowYear->value) > 0) {
$serialNumberExists = true;
}
} else {
if (strlen((int)$rowYear->value) == 4) {
if ((int)date("Y")-((int)$rowYear->value) <= SGFINANCE_YEARLIMIT) {
$yearModelExists = true;
}
}
}
}
$displayFinancingForUser = true;
if ($obj->fullend > 0 && date("YmdHis") > $obj->fullend) {
$displayFinancingForUser = false;
$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");
if (mysqli_num_rows($bidRes)) {
$bidObj = mysqli_fetch_object($bidRes);
if (isset($_SESSION['register_id']) && (int)$_SESSION["register_id"] === (int)$bidObj->register_id) {
$displayFinancingForUser = true;
}
}
}
if (
(int)$obj->allowedBidderSF === 1 && $yearModelExists && $serialNumberExists &&
((int)$obj->market_value >= SGFINANCE_MARKET_VALUE_MINIMUM && (int)$obj->showSgDespiteLowMarketValue === 0 || (int)$obj->showSgDespiteLowMarketValue === 1)
&& $displayFinancingForUser
) {
$displayFinancing = true;
}
if (USE_SG_FINANCING == false) {
$displayFinancing = false;
}
// Only show SG Finance for BO users when SGFINANCE_AUTH_ACCESS is set to true.
// Note that nothing will be shown if USE_SG_FINANCING is set to false.
if (SGFINANCE_AUTH_ACCESS && !array_key_exists('is_admin', $_SESSION)) {
$displayFinancing = false;
}
if (!$showFinance) {
$displayFinancing = false;
}
// don't show financing for banned users
if (isset($_SESSION['user_banned'])) {
$displayFinancing = false;
}
$youtube = null;
$youtubeThumb = null;
if (empty($obj->youtubelink)) {
$youtubeQuery = "SELECT id FROM products_youtube WHERE products_id=".(int)$obj->id;
$youtubeResult = $db->query($youtubeQuery);
if (false !== $youtubeResult && 0 !== $youtubeResult->num_rows) {
$youtubeObject = $youtubeResult->fetch_object();
$filename = '/products_youtube_video' . $youtubeObject->id . '.mp4';
if (is_file($parameters->get('youtube.path') . $filename)) {
$youtube = $parameters->get('youtube.url') . $filename;
$thumbFile = '/products_youtube' . $youtubeObject->id . '.jpg';
if (is_file($parameters->get('youtube.path') . $thumbFile)) {
$youtubeThumb = $parameters->get('youtube.url') . $thumbFile;
}
}
}
}
// TODO: This should be delivered to the view as a simple variable
$conditions = 0;
if($obj->includesForewordInDescription == 1) {
// Check if there are used productfields with tabtype = 2 (conditions category)
$pfSql = "SELECT * FROM productfields WHERE categories_id='".mysqli_real_escape_string($db, $obj->categories_id)."' AND tabtype='2' ";
$pfSql .= "AND online>0 AND parent_id=0 AND hideOnObjectPage=0 ORDER BY sortorder";
$pfRes = mysqli_query($db, $pfSql);
if(mysqli_num_rows($pfRes)){
while($pf = mysqli_fetch_object($pfRes)){
unset($pv);
$pvSql = "SELECT * FROM productvalues WHERE productfields_id='".mysqli_real_escape_string($db, $pf->id)."' AND products_id='".mysqli_real_escape_string($db, $obj->id)."' ";
$pvRes = mysqli_query($db, $pvSql);
if(mysqli_num_rows($pvRes)){
$pv = mysqli_fetch_object($pvRes);
if ((int)$pv->refid !== 0) {
$pfoRes = mysqli_query($db, "SELECT placeholder FROM productfields WHERE id=" . (int)$pv->refid);
if (mysqli_num_rows($pfoRes)) {
$pfo = mysqli_fetch_object($pfoRes);
if (!(int)$pfo->placeholder) {
if ($pv->value !== "" && $pv->value != $trans->get('text_label_page-product_select-grading')) {
$conditions++;
}
}
}
} elseif ($pv->value !== "") {
$conditions++;
}
}
}
}
}
$hasNotice = false;
if($obj->fullend > 0 && date("YmdHis") > $obj->fullend) {
$hasNotice = true;
}
$externalLink = false;
if (!empty($obj->filelink)) {
$externalLink = [
'filename' => !empty($obj->filelinkname) ? $obj->filelinkname : $trans->get("ALIAS_FILELINK_SHOW"),
'filelink' => checkUrl($obj->filelink)
];
}
$renderEquipmentData = new RenderEquipmentData();
$equipmentData = $renderEquipmentData->renderHtml($obj->id, $obj->categories_id);
$renderProductBasicData = new RenderBasicProductData($trans, $obj);
$basicProductData = $renderProductBasicData->renderHtml($obj->id, $obj->categories_id);
$hasFiles = $externalLink || canShowTab($trans, $db, $obj->id, 3);
$hasEquipment = !empty($equipmentData);
$renderConditionData = new RenderConditionData($trans);
$hasCondition = !empty($renderConditionData->renderHtml($obj->id, $obj->categories_id));
$menuItems = [];
$menuItems['slider'] = true; // an object always needs media, try so sell stuff without images?
$menuItems['desc'] = true; // an object always needs a description
$menuItems['condition'] = $hasCondition;
$menuItems['equipment'] = $hasEquipment;
$menuItems['geolocation'] = true; // should always be able to find where the object is located
$menuItems['files'] = $hasFiles;
$vendorType = new VendorType();
try {
$vendorType = (new VendorTypeRepo())->getById($vendor->companytype);
} catch (MissingResultException|RepositoryException $e) {
}
$departmentIsObest = (
isset($_SESSION["vendorAccess"][$obj->vendors_id])
&& isset($_SESSION["users_id"])
&& $vendorType->getDepartment() === 'Obest'
&& (int)$obj->fullend === 0
);
$showVendorInfoIds = $previewAvailable && $departmentIsObest;
?>
<div class="product-grid">
<div class="product-grid__aside">
<?php
if ($showVendorInfoIds):
?>
<div class="vendor-info vendor-info--hide-desktop">
<div class="vendor-info__content">
<?php
$vendorIsTypeSeven = (
isset($_SESSION["vendorAccess"][$obj->vendors_id])
&& isset($_SESSION["users_id"])
&& ($vendorType->getDepartment() === 'Obest' && $vendorType->getBankruptcy() === 0)
&& (int)$obj->fullend === 0
);
// Info area - Intern-id and reserved price, Vendor.
if ($previewAvailable && $vendorIsTypeSeven) { ?>
<div class="vendor-info">
<div class="vendor-info__content">
<?php
// Info area - Intern-id and reserved price, Vendor.
if ($showVendorInfoIds): ?>
<div>
<div class="item">
<span><?php $trans->eGet('text_label_page-product_internal-id'); ?></span>
<?php print $obj->artno ?>
</div>
<div class="item">
<span><?php $trans->eGet('info_label_page-product_rek-res-price'); ?></span>
<?php print $respricePrice; ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php } ?>
</div>
</div>
<?php endif;
// AUCTION ENDED
if ($obj->fullend > 0 && date("YmdHis") > $obj->fullend) {
?>
<div class='product-grid__notice'>
<div class="product-grid__ended">
<video height='49' width='49' loop="" muted="" autoplay="" playsinline="">
<source src='/assets/videos/klubbad-150x150.mp4' type='video/mp4'>
</video>
<div class="product-grid__ended-text">
<h5><?php $trans->eGet('ALIAS_PRODUCT_CLOSED_HEADER'); ?></h5>
<?php print nl2br($trans->get('ALIAS_PRODUCT_CLOSED_HEADER__DESCRIPTION')); ?>
</div>
</div>
</div>
<?php
}
?>
<!-- Object Id -->
<div class="product-grid__object-id">
<span class='product-grid__object-id-label'>
<?php $trans->eGet('text_label_page-product_object-id');?>
</span>
<?php if(isset($_SESSION['is_admin']) ) { ?>
<span id='object-id-copy' class="tag">
<?php print $obj->id; ?>
</span>
<span class='id-copied'>
<?php $trans->eGet('info_label_page-product_copied-clipboard');?>
</span>
<?php } else { ?>
<span class="tag">
<?php print $obj->id; ?>
</span>
<?php } ?>
</div>
<!-- Object Title Aside -->
<h1 class="product-grid__aside-title"><?php echo $obj->name; ?></h1>
<div class="product-grid__company">
<!-- Object Municipaity -->
<div class="product-grid__municipality">
<i class="ri-map-pin-fill"></i> <a href="#nav-freight" data-scroll-smoothly><?php echo $county->name .", ". $countyParent->name;?></a>
</div>
<!-- Object Seller Type -->
<span class='product-grid__company-type'>
<i class="ri-user-fill"></i> <span><?php echo $vendorName;?> </span>
</span>
</div>
<div class="product-grid__interactions">
<div class="share-menu">
<button class="button--icon-cta" data-share-menu__trigger>
<i class="ri-share-fill"></i>
</button>
<div>
<a class="share-menu__item share-menu__item--facebook" target="_blank">
<div class="button--icon-cta">
<i class="ri-facebook-circle-fill"></i>
</div>
</a>
<a class="share-menu__item share-menu__item--linkedin" target="_blank">
<div class="button--icon-cta">
<i class="ri-linkedin-box-fill"></i>
</div>
</a>
<a class="share-menu__item share-menu__item--email">
<div class="button--icon-cta">
<i class="ri-mail-fill"></i>
</div>
</a>
<a class="share-menu__item share-menu__item--sms">
<div class="button--icon-cta">
<i class="ri-chat-3-fill"></i>
</div>
</a>
<a class="share-menu__item share-menu__item--copy">
<div class="button--icon-cta">
<i class="ri-link"></i>
</div>
</a>
<div class="share-menu__overlay"></div>
</div>
</div>
<?php
if (!($obj->fullend > 0 && date("YmdHis") > $obj->fullend) ): ?>
<button class="button--icon-cta product-grid__button-save"
<?php print isset($_SESSION['register_id']) ? '' : ' data-no-session ' ?>
data-object-marked="<?php print $isFav ? '1' : '0'; ?>"
data-object-id="<?php print $obj->id; ?>"
data-object-name="<?php print htmlspecialchars($obj->name); ?>"
>
<span></span>
</button>
<?php endif; ?>
</div>
<?php $sideNavItems = [];
if ($menuItems['slider']) {
$sideNavItems[] = [
'href' => '#nav-slider',
'icon' => 'image-fill',
'label' => $trans->get('text_label_page-product_side-nav_slider')
];
}
if ($menuItems['desc']) {
$sideNavItems[] = [
'href' => '#nav-desc',
'icon' => 'search-eye-line',
'label' => $trans->get('text_label_page-product_side-nav_desc')
];
}
if ($menuItems['equipment']) {
$sideNavItems[] = [
'href' => '#nav-base',
'icon' => 'play-list-add-line',
'label' => $trans->get('text_label_page-product_side-nav_equipment')
];
}
if ($menuItems['condition']) {
$sideNavItems[] = [
'href' => '#nav-condition',
'icon' => 'calendar-check-fill"',
'label' => $trans->get('text_label_page-product_side-nav_condition')
];
}
if ($menuItems['files']) {
$sideNavItems[] = [
'href' => '#nav-files',
'icon' => 'file-copy-2-fill',
'label' => $trans->get('text_label_page-product_side-nav_files')
];
}
if ($menuItems['geolocation']) {
$sideNavItems[] = [
'href' => '#nav-freight',
'icon' => 'map-pin-fill',
'label' => $trans->get('text_label_page-product_side-nav_geolocation')
];
}
?>
<div class="product-grid__aside-side-nav">
<ul class="page-nav" data-nav>
<?php foreach ($sideNavItems as &$item):?>
<li class="page-nav__item">
<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>
</li>
<?php endforeach ?>
</ul>
</div>
</div> <!-- end product-grid__aside -->
<div class="print-content product-grid__slider--print">
<div class="print-header">
<img src="<?php print $parameters->get('app.image.path') . '/klaravik-print-logo.svg'; ?>" class="klaravik-print">
<div class="print-content-date-time">
<p class="print-content-date-time__label">
<?php $trans->eGet('text_label_page-product_printed'); ?>
</p>
<p id="print-date-time">
<?php print date('Y-m-d', time());?> <span><?php print date('h:i', time());?></span>
</p>
</div>
</div>
<?php if ($showVendorInfoIds): ?>
<div class="vendor-info">
<div class="vendor-info__content">
<?php
// Info area - Intern-id and reserved price, Vendor.
if ($showVendorInfoIds): ?>
<div>
<div class="item">
<span><?php $trans->eGet('text_label_page-product_internal-id'); ?></span>
<?php print $obj->artno ?>
</div>
<div class="item">
<span><?php $trans->eGet('info_label_page-product_rek-res-price'); ?></span>
<?php print $respricePrice; ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php endif;?>
<?php
$printImageUrl = '/images/image-missing-large.png';
/** @var ProductImage|bool $printImage */
$printImage = $images->first();
if (false !== $printImage) {
$printImageUrl = $printImage->getImageUrl('large');
}
?>
<img src="<?php print $printImageUrl;?>" alt="<?php print $obj->name;?>"/>
</div>
<div id="nav-slider" class="product-grid__slider">
<div class="carousel-wrapper">
<div class="carousel__toolbar-wrapper">
<div class="carousel__counter">
<span class="carousel__index">1</span>
<span class="carousel__separator"><?php $trans->eGet('text_label_page-product_slider_count-separator'); ?></span>
<span class="carousel__count"></span>
</div>
</div>
<div id="lightbox" class="carousel f-carousel">
<?php
foreach ($images as $index => $image) {
if ( $index === 1) {
if ($obj->youtubelink) {
//TODO: make a fallback solution to check if maxresdefault exists otherwise change to hqdefault.jpg
$fancyBoxLink = $obj->youtubelink;
$videoElement = '
<img
class="hidden"
loading="lazy"
src="https://img.youtube.com/vi/' . youtubeIdFromLink($fancyBoxLink) . '/maxresdefault.jpg"
alt=""
/>
';
} elseif (null !== $youtube) {
$fancyBoxLink = $youtube;
$videoElement = '
<video>
<source src="'.$youtube.'#t=0.001" type="video/mp4">
'.$trans->get("info_label_page-product_browser-support").'
</video>
';
if (null !== $youtubeThumb) {
$videoElement = '
<img
class="hidden"
loading="lazy"
src="' . $youtubeThumb . '"
alt=""
/>
';
}
}
if (!empty($fancyBoxLink)) { ?>
<div class="carousel__slide carousel__slide--youtube f-carousel__slide">
<a data-fancybox="object_gallery" href='<?php print $fancyBoxLink; ?>' class="item youtube">
<div class="digitalViewingBox--slider">
<div class="title-box">
<div class="title-box__icon"></div>
<div class="title-box__text"><?php $trans->eGet('text_label_page-product_digital-viewing-caption'); ?></div>
</div>
</div>
<?php print $videoElement; ?>
<span class="carousel__slide__video-btn"><i class="ri-play-fill"></i></span>
</a>
</div>
<?php
}
}
if ($image->getHasVideo()) { ?>
<div class="carousel__slide f-carousel__slide">
<a
data-fancybox="object_gallery"
data-thumb="<?php echo $image->getImageUrl('large'); ?>"
data-src="<?php echo $image->getVideoUrl(); ?>"
>
<video>
<source src="<?php echo $image->getVideoUrl(); ?>" type="video/mp4">
Your browser does not support HTML5 video.
</video>
<span class="carousel__slide__video-btn"><i class="ri-play-fill"></i></span>
</a>
</div>
<?php
} else { ?>
<div class="carousel__slide f-carousel__slide">
<a data-fancybox="object_gallery" href="<?php echo $image->getImageUrl('large'); ?>">
<img
class="carousel-cell-image hidden"
loading="lazy"
src="<?php echo $image->getImageUrl('large'); ?>"
alt="<?php echo $obj->name; ?>"
>
</a>
</div>
<?php
}
}
?>
<div class="carousel__button-wrapper">
<a class="button button--medium button--ghost button--icon button--icon-image-fill" data-fancybox-trigger="object_gallery" data-fancybox-index="0">
<?php $trans->eGet('text_button_page-product_slider_all-media'); ?>
</a>
</div>
</div>
</div>
</div> <!-- nav-slider end -->
<div class="product-grid__bidding-info">
<?php
if ((int)$obj->special_terms_uf == 1) {
$aliasName = isset($_SESSION['register_id']) && ($regObj->clienttype == "UP" || $regObj->clienttype == "UF") ?
'ALIAS_PRODUCT_TAB_SPECIAL_TERM_UP' :
'ALIAS_PRODUCT_TAB_SPECIAL_TERM';
?>
<div class="bid-box-container">
<div id="bidbox" class="bid-box">
<div class="row">
<div class="large-12 medium-12 small-12 columns">
<div class="descriptionBox specialTerms">
<h4><?php $trans->eGet($aliasName); ?></h4>
<div class="object_desc">
<p><?php print nl2br($trans->get($aliasName . '__DESCRIPTION')); ?><p>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<!-- Vue instance, bidding component -->
<div id="page-product__sidebar"
data-id="<?php echo $obj->id; ?>"
data-notifier-url="<?php echo NOTIFIER_URL; ?>"
data-preview-hash="<?php echo (isset($_REQUEST['preview']) ? htmlspecialchars($_REQUEST['preview'], ENT_QUOTES) : '' ); ?>"
data-closed="<?php echo ($obj->fullend > 0 && date("YmdHis") > $obj->fullend ? 'true' : ''); ?>">
<close-box :product-data='<?php echo json_encode($productData); ?>'></close-box>
<bid-box :product-data='<?php echo json_encode($productData); ?>'>
<?php if ($hasNotice): ?>
<div class='closed-auction-seller'>
<h3><?php $trans->eGet('text_label_page-product_closed-auction-seller-caption'); ?></h3>
<p><?php $trans->eGet('text_label_page-product_closed-auction-seller-text'); ?></p>
<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'); ?>">
<?php $trans->eGet('link_button_page-product_closed-auction-seller-link'); ?>
<i class="ri-arrow-right-line"></i>
</a>
</div>
<?php endif; ?>
</bid-box>
<bid-form :product-data='<?php echo json_encode($productData); ?>'></bid-form>
<bid-payment-info :product-data='<?php echo json_encode($productData); ?>'>
<?php
if (!$productData['closed']) {
if ($regObj) {
if ((int)$obj->{$allowedClientType} === 0) {
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));
} elseif ($vendorClientNBR === $registerClientNBR) {
if (!$private && $parameters->get("app.instance") === 'dk') {
printf('<div class="prohibited-bid">%s</div>', $trans->get('ALIAS_BIDDER_SAME_ORGNUMBER_AS_SELLER'));
}
}
if (($regObj->clienttype == "UF" || $regObj->clienttype == "UP") && ($regObj->vatValidated == 0)) { ?>
<div class="prohibited-bid">
<div class="prohibited-bid__header">
<i class="ri-information-fill prohibited-bid__icon"></i>
<?php echo $trans->get("ALIAS_UP_NOVATVALIDATED_CANT_BID__HEADER"); ?>
</div>
<div class="prohibited-bid__body">
<?php echo $trans->get("ALIAS_UP_NOVATVALIDATED_CANT_BID__DESCRIPTION"); ?>
</div>
<div class="prohibited-bid__footer">
<span class="prohibited-bid__footer__item">
<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>
</span>
<span class="prohibited-bid__footer__item">
<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>
</span>
</div>
</div>
<?php
}
}
$buyerBlocked = false;
if(!isset($_SESSION["register_id"]) || !is_numeric($_SESSION["register_id"]) || isset($_SESSION["late_payments"]) || isset($_SESSION["user_banned"])) {
$buyerBlocked = true;
if (isset($_SESSION["user_banned"]) || isset($_SESSION['late_payments'])) {
$showFinance = false;
print " <div class=\"prohibited-bid prohibited-bid--banned-cant-bid\">";
print " <div class=\"prohibited-bid__header\">";
print " <i class=\"ri-information-fill prohibited-bid__icon\"></i>";
print " <span>".$trans->get('ALIAS_USER_BANNED_CANT_BID_HEADER')."</span>";
print " </div>\n";
print " <div class=\"prohibited-bid__body\">".$trans->get("ALIAS_USER_BANNED_CANT_BID")."</div>";
print " <div class=\"prohibited-bid__footer\">";
print " <span class=\"prohibited-bid__footer__item\">";
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>";
print " </span>\n";
print " <span class=\"prohibited-bid__footer__item\">";
print " <i class=\"prohibited-bid__icon ri-mail-fill\"></i><a href=\"mailto:".$trans->get("email_customer-service")."\">".$trans->get("email_customer-service")."</a>";
print " </span>\n";
print " </div>\n";
print " </div>\n";
}
}
}
?>
</bid-payment-info>
<bidding-box :product-data='<?php echo json_encode($productData); ?>'></bidding-box>
</div> <!-- page-product__sidebar end, End of Vue instance, bidding component -->
<div class="product-info-section">
<div class="quick-information">
<div class="head-wrapper">
<div class="icon freight-icon">
<i class="ri-truck-line"></i>
</div>
<div class="title">
<?php $trans->eGet('text_caption_page-product_shipping')?>
</div>
<div class="arrow">
<i class="ri-arrow-down-s-line"></i>
</div>
</div>
<div class="content-wrapper">
<div class="content">
<?php if ($vendor->freightinfo != "") {
$freightString = nl2br(strip_tags($vendor->freightinfo));
} else {
$freightString = $trans->get(
'text_placeholder_page-product_map-and-freight_content',
[
'freightLink' => $urlGenerator->generate(
'app.legacy.pages.text',
['urlname' => 'fraktforfragan'],
UrlGeneratorInterface::ABSOLUTE_URL
)
]
);
}?>
<p><?php print $freightString; ?></p>
</div>
</div>
</div>
</div> <!-- product-info-section end -->
<?php
$loadingHelp = $basicProductData['loadingHelpText'];
switch ($basicProductData['loadingHelp']) {
case ProductFieldsEnum::LOADINGHELP_YES()->label:
$loadingHelpIcon = 'ri-checkbox-circle-fill';
$loadingHelpClass = '';
break;
case ProductFieldsEnum::LOADINGHELP_MAYBE()->label:
$loadingHelpIcon = 'ri-checkbox-circle-fill';
$loadingHelpClass = 'orange';
break;
case ProductFieldsEnum::LOADINGHELP_NO()->label:
$loadingHelpIcon = 'ri-close-circle-fill';
$loadingHelpClass = 'red';
break;
default: // Fallback if no loadinghelp is found
$loadingHelp = false;
}
if ($loadingHelp):?>
<div class="quick-information">
<div class="head-wrapper no-hover">
<div class="icon <?php echo $loadingHelpClass ?>">
<i class="<?php echo $loadingHelpIcon ?>"></i>
</div>
<div class="title">
<?php echo $loadingHelp ?>
</div>
</div>
</div> <!-- quick-information end -->
<?php endif; ?>
<div class="quick-information">
<div class="head-wrapper">
<div class="icon">
<i class="ri-shield-check-fill"></i>
</div>
<div class="title">
<?php $trans->eGet('text_label_page-product_secure-payments-expander') ?>
</div>
<div class="arrow">
<i class="ri-arrow-down-s-line"></i>
</div>
</div>
<div class="content-wrapper">
<div class="content">
<?php $trans->eGet('text_body-text_page-product_secure-payments-expander') ?>
</div>
<div class="content-icons-row">
<div class="payex-icon">
<img alt="payex-logo" src="/images/payex-logo.png" />
</div>
<?php if($parameters->get("app.instance") === 'se'): ?>
<div class="swish-icon">
<img alt="swish-logo" src="/images/swish/swish-logo.svg"/>
</div>
<?php endif;?>
</div>
</div>
</div> <!-- quick-information end -->
<?php
$displayDnb = !isset($_SESSION['user_banned']) && $categoriesObject->getCategory($obj->categories_id)->getAllowPrivateLoan() &&
(
!isset($_SESSION["register_id"])
|| ((bool)$obj->allowedBidderSP && isset($regObj) && $regObj->clienttype === 'SP')
|| ((bool)$obj->allowedBidderSF && isset($regObj) && $regObj->clienttype === 'SF' && !$displayFinancing)
);
?>
<?php
if (!$displayDnb && !$displayFinancing && $parameters->get('financing.offer.assistance')) :
?>
<div class="quick-information">
<div class="head-wrapper">
<div class="icon financing-fallback">
</div>
<div class="title">
<?php $trans->eGet('text_label_page-product_financing-expander-fallback'); ?>
</div>
<div class="arrow">
<i class="ri-arrow-down-s-line"></i>
</div>
</div>
<div class="content-wrapper">
<div class="content">
<?php $trans->eGet('text_content_page-product_financing-expander-fallback'); ?>
</div>
</div>
</div> <!-- quick-information end -->
<?php
endif;
if ($displayDnb)
// DNB FINANCING
// 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.
{ ?>
<a class="dnb-button-link" target="_blank" href="https://dnbprivatlan.se/klaravik/" rel="nofollow noopener">
<div class="dnb-button">
<div class="dnb-button__text">
<?php $trans->eGet('text_label_page-product_dnb-apply-loan'); ?>
<span class="dnb-button__img-wrapper"><div class="dnb-logo"></div></span>
</div>
</div>
</a>
<?php
}
// Financing Nordea
$monthSteps = array();
$defaultStep = 0;
$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);
if ($displayFinancing && mysqli_num_rows($resFinancing) > 0) {
$financing = array();
while($rowFinancing = mysqli_fetch_object($resFinancing)) {
if (count($financing) == 0) {
$defaultStep = $rowFinancing->months;
$minAmount = $rowFinancing->minAmount;
$maxAmount = $rowFinancing->maxAmount;
$minmonths = $rowFinancing->months;
$maxmonths = $rowFinancing->months;
}
$financing[] = array(
'minAmount' => $rowFinancing->minAmount,
'maxAmount' => $rowFinancing->maxAmount,
'months' => $rowFinancing->months,
'factor' => $rowFinancing->factor
);
$monthSteps[] = $rowFinancing->months;
if ($rowFinancing->months > $defaultStep) { $defaultStep = $rowFinancing->months; }
if ($rowFinancing->minAmount < $minAmount) { $minAmount = $rowFinancing->minAmount; }
if ($rowFinancing->maxAmount > $maxAmount) { $maxAmount = $rowFinancing->minAmount; }
if ($rowFinancing->months < $minmonths) { $minmonths = $rowFinancing->months; }
if ($rowFinancing->months > $maxmonths) { $maxmonths = $rowFinancing->months; }
}
if (in_array(60,$monthSteps)) {
$defaultStep = 60;
} else if (in_array(48,$monthSteps)) {
$defaultStep = 48;
} else if (in_array(36,$monthSteps)) {
$defaultStep = 36;
}
if ($maxAmount >= 3000000) {
$maxAmount = 3000000;
}
$curBid = 0;
if (isset($highBid)) {
$curBid = (round($highBid/1000)*1000);
if ($highBid >= 3000000) {
$maxAmount = 5000000;
}
}
// If curBid is still zero, then set it to the bidstep.
if ((int)$curBid === 0) {
$curBid = $bidinc;
}
require_once __DIR__ . '/includes/nordeaFinanceProductForm.php';
if ($highBid > 5000000) {
renderNordeaFinanceProductFormBidOverLimit($trans);
} else {
/** @var \Klaravik\Financing\Nordea\Calculate $calculateFinancing */
$calculateFinancing = $container->get(\Klaravik\Financing\Nordea\Calculate::class);
$disablePriceAdjustment = false;
if ($obj->fullend > 0 && date("YmdHis") > $obj->fullend) {
$disablePriceAdjustment = true;
}
renderNordeaFinanceProductForm($trans, $urlGenerator, $db, $obj, 5000000, $curBid, $minmonths, $maxmonths, $defaultStep, $financing, $calculateFinancing, $disablePriceAdjustment);
}
}
?>
</div> <!-- bidding-info end -->
<div class="product-grid__content">
<div class="product-grid__content-title-box">
<h1><?php echo $obj->name; ?></h1>
<div class="share-menu">
<button class="button--icon-cta" data-share-menu__trigger>
<i class="ri-share-fill"></i>
</button>
<div>
<!-- facebook -->
<a class="share-menu__item share-menu__item--facebook" target="_blank">
<div class="button--icon-cta">
<i class="ri-facebook-circle-fill"></i>
</div>
</a>
<!-- linkedin -->
<a class="share-menu__item share-menu__item--linkedin" target="_blank">
<div class="button--icon-cta">
<i class="ri-linkedin-box-fill"></i>
</div>
</a>
<a class="share-menu__item share-menu__item--email">
<div class="button--icon-cta">
<i class="ri-mail-fill"></i>
</div>
</a>
<a class="share-menu__item share-menu__item--sms">
<div class="button--icon-cta">
<i class="ri-chat-3-fill"></i>
</div>
</a>
<a class="share-menu__item share-menu__item--copy">
<div class="button--icon-cta">
<i class="ri-link"></i>
</div>
</a>
<div class="share-menu__overlay"></div>
</div>
</div>
<?php if (!($obj->fullend > 0 && date("YmdHis") > $obj->fullend) ): ?>
<button class="button--icon-cta product-grid__button-save"
<?php print isset($_SESSION['register_id']) ? '' : ' data-no-session ' ?>
data-object-marked="<?php print $isFav ? 1 : 0 ?>"
data-object-id="<?php print $obj->id; ?>"
data-object-name="<?php print htmlspecialchars($obj->name);?>"
>
<span></span>
</button>
<?php endif; ?>
</div>
<?php if ($showVendorInfoIds): ?>
<div class="vendor-info vendor-info--hide-mobile">
<div class="vendor-info__content">
<?php
// Info area - Intern-id and reserved price, Vendor.
if ($showVendorInfoIds): ?>
<div>
<div class="item">
<span><?php $trans->eGet('text_label_page-product_internal-id'); ?></span>
<?php print $obj->artno ?>
</div>
<div class="item">
<span><?php $trans->eGet('info_label_page-product_rek-res-price'); ?></span>
<?php print $respricePrice; ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php endif;?>
<?php
$recentChanges = recentProductChanges($db, $products_id);
if (!empty($recentChanges)):
?>
<div class="product-grid__new-information">
<?php print nl2br(recentProductChanges($db, $products_id)); ?>
</div>
<?php endif; ?>
<?php
if ($vendorType->getDepartment() === 'Obest' && $vendorType->getBankruptcy() === 1) { ?>
<div class="alert-box--department-information">
<div class="alert-box__department-title"></div>
<p class="alert-box__content"><?php print nl2br($trans->get('ALIAS_PRODUCT_BANKRUPT_TEXT__DESCRIPTION'));?></p>
</div>
<?php
}?>
<!--- DESCRIPTION -->
<div class="product-grid__description">
<?php $extraDesc = !empty($obj->extraDescription) ? nl2br($obj->extraDescription) : null; ?>
<div id="nav-desc">
<?php $descPreamble = !empty($obj->descriptionPreamble) ? nl2br($obj->descriptionPreamble) : null; ?>
<?php if ($obj->description != "" || $vendor->foreword != ""): ?>
<div class="object_desc product-grid__description-overview">
<div class="object-information__header">
<span class="object-information__header-icon"><i class="ri-search-eye-line"></i></span>
<span class="object-information__header-text"><?php $trans->eGet('text_label_page-product_description-title');?></span>
</div>
<?php print $obj->includesForewordInDescription == 0 && $vendor->foreword != "" ? nl2br($vendor->foreword) . '<br>' : ''; ?>
<?php
if (!empty($descPreamble)) print '<p class="product-grid__description-preamble">' . $descPreamble . '</p>';
if ($obj->includesForewordInDescription == 0) { print '<p class="product-grid__description-extra">' . nl2br($obj->description) . '</p>'; }
print $basicProductData['htmlOutput'];
?>
</div>
<?php endif; ?>
<?php
print "<div class='extra-vehicle'>";
try {
$extraVehicleModel = (new ExtraVehicleRepo())->getByProductId($obj->id);
$renderExtraVehicleData = new RenderExtraVehicleData($trans);
echo $renderExtraVehicleData->renderHtml($extraVehicleModel);
} catch (MissingResultException $e) {
$extraVehicleModel = new ExtraVehicle();
}
print "</div>";
$extraDesc = !empty($obj->extraDescription) ? $obj->extraDescription : null;
if (!empty($extraVehicleModel->getOtherInformation())) {
$extraDesc .= PHP_EOL . PHP_EOL . $extraVehicleModel->getOtherInformation();
}
?>
<?php if (!empty($extraDesc)): ?>
<div class="object-information__header object-information__header--small object-information__header--mock"></div>
<p class="product-grid__description-extra"><?php print nl2br(trim($extraDesc))?></p>
<?php endif; ?>
</div>
<?php
if ($hasEquipment): ?>
<div class="object-information__equipment object-equipment" id="nav-base">
<div class="object-information__header">
<span class="object-information__header-icon"><i class="ri-menu-add-line"></i></span>
<span class="object-information__header-text"><?php $trans->eGet('text_label_page-product_equipment-title');?></span>
</div>
<div class="object-equipment__content">
<?php print $equipmentData; ?>
</div>
</div>
<?php endif; ?>
</div>
<?php
// CONDITION
if(canShowTab($trans, $db, $obj->id, 2)) {
?>
<div id="nav-condition" class="product-grid__condition product-condition product-info-section">
<div class="object-information__header">
<span class="object-information__header-icon"><i class="ri-calendar-check-fill"></i></span>
<span class="object-information__header-text"><?php $trans->eGet('text_label_page-product_condition-caption');?></span>
</div>
<?php
try {
$renderRenderConditionData = new RenderConditionData($trans);
print $renderRenderConditionData->renderHtml($obj->id, $obj->categories_id);
} catch (RepositoryException $e) {}
?>
</div> <!-- nav-condition end div-->
<?php
}
// DIGITAL SHOWCASE
if ($obj->youtubelink) {
$fancyBoxLink = $obj->youtubelink;
$videoElement = '
<img
class="digital-viewing-box__video"
loading="lazy"
src="https://img.youtube.com/vi/' . youtubeIdFromLink($fancyBoxLink) . '/maxresdefault.jpg"
alt=""
>
';
}
elseif (null !== $youtube) {
$fancyBoxLink = $youtube;
$videoElement = '
<video>
<source src="' . $fancyBoxLink . '#t=0.001" type="video/mp4">
' . $trans->get('info_label_page-product_browser-support') . '
</video>
';
}
if (!empty($fancyBoxLink)) { ?>
<div class="digital-viewing-box" id="digitalViewing-youtube">
<div class="digital-viewing-box__title-and-text">
<div class="digital-viewing-box__title">
<div class="digital-viewing-box__title__icon"></div>
<div class="digital-viewing-box__title__text">
<?php $trans->eGet('text_label_page-product_digital-viewing-caption'); ?>
</div>
</div>
<span class="digital-viewing-box__preamble">
<?php $trans->eGet('text_label_page-product_digital-viewing-tour-caption'); ?>
</span>
</div>
<div class="digital-viewing-box__video-and-arrow">
<a
data-fancybox-trigger="object_gallery"
data-fancybox-index="1"
href='<?php print $fancyBoxLink; ?>'
class="digital-viewing-box__video-holder"
>
<?php print $videoElement ?>
<span class="digital-viewing-box__video-play-btn">
<i class="ri-play-fill"></i>
</span>
</a>
<div class="digital-viewing-box__arrow-holder">
<img class="digital-viewing-box__arrow" src="/images/arrow-illustr-below.png">
</div>
</div>
</div>
<?php
}
// IMPORTANT INFORMATION
// Temp hack, 419 ska inte med in i item page
if(canShowTab($trans, $db, $obj->id, 5) && !in_array($obj->categories_id, [375, 419], true)) {
// KAM
$aliasName = 'ALIAS_PRODUCT_TAB_OTHER_TEXT__DESCRIPTION';
if ((int)$obj->enteredByKam === 0) {
// Ej KAM
$aliasName = 'ALIAS_PRODUCT_TAB_OTHER_TEXT__DESCRIPTION_NON-KAM';
}
if ($vendorType->getDepartment() === 'Obest' && $vendorType->getBankruptcy() === 1) {
// Konkurs
$aliasName = 'ALIAS_PRODUCT_TAB_OTHER_TEXT_BANKRUPTCY__DESCRIPTION';
}
$aliasDescription = $trans->get($aliasName);
?>
<div class="object-information__important">
<div class='alert-box alert-box--regular'>
<span class='alert-box__title'><i class="ri-error-warning-line"></i><?php $trans->eGet('text_caption_page-product_important-information')?></span>
<p class='alert-box__content'>
<?php print $aliasDescription !== '' ? nl2br($aliasDescription) : ''; ?>
</p>
</div>
</div>
<?php } ?>
<!-- NORWAY IMPORT INFORMATION -->
<?php
$categoryModel = $categoriesObject->getClosestPublicCategory($obj->categories_id);
if (
$regObj &&
in_array($regObj->clienttype, ['UP', 'UF']) &&
$categoryModel->getForeignBuyerAuctionText() &&
$categoryModel->getForeignBuyerAuctionHeadline()
) {
$countryResult = $db->query("SELECT id FROM countries WHERE iso2='NO'");
if ($countryResult->num_rows && $countryResult->fetch_object()->id === $regObj->country_id) {?>
<div class='alert-box alert-box--message'>
<p class='alert-box__title'><?php print $categoryModel->getForeignBuyerAuctionHeadline(); ?></p>
<p class='alert-box__content'><?php print $categoryModel->getForeignBuyerAuctionText(); ?></p>
</div>
<?php }
}?>
<?php if ($hasFiles): ?>
<div id="nav-files" class="product-grid__documents grid-segment">
<div class="object-information__header">
<span class="object-information__header-icon"><i class="ri-file-copy-2-fill"></i></span>
<span class="object-information__header-text"><?php $trans->eGet('text_caption_page-product_section_document');?></span>
</div>
<?php
showFilebank($urlGenerator, $trans, $db, $obj->id, $externalLink);
?>
</div>
<?php endif; ?>
<?php
// Anthesis calculation on LCA Value
/** @var \Klaravik\Anthesis\CarbonDioxideEmissions $carbonDioxideEmission */
$carbonDioxideEmission = $container->get(\Klaravik\Anthesis\CarbonDioxideEmissions::class);
try {
$carbonDioxideEmissionValue = $carbonDioxideEmission->getEmissionByProductsIdAndLcaValue(
$obj->id, $categoriesObject->getCategory($obj->categories_id)->getLcaValue()
);
} catch (\Klaravik\Anthesis\Exception\CarbonDioxidEmissionException $e) {}
?>
<?php if (isset($carbonDioxideEmissionValue)): ?>
<div class="product__esg" data-object-id="<?php print $obj->id; ?>">
<div class="product__esg-calculation">
<div id="lottie-esg" class="product__esg-lottie" data-src="/images/lottie-animations/lottie-esg.json"></div>
<p class="product__esg-value">
<?php $trans->eGet('text_label_page-product_esg-kg', ['weight' => $carbonDioxideEmissionValue]); ?>
</p>
</div>
<a id="esgOpenModal" class="product__esg-how">
<?php $trans->eGet('text_label_page-product_esg-modal-cta'); ?>
</a>
<p class="product__esg-text"><?php $trans->eGet('text_label_page-product_esg-caption'); ?></p>
<p class="product__esg-text-comparison">
<?php $trans->eGet('text_label_page-product_esg-comparison'); ?>
</p>
<k-modal id="esg-modal">
<div slot="header">
<h3 class="bidding-modal__header">
<span class="bidding-modal__header__icon"><img src="/images/icons/icn-exclamation-green.svg" alt=""></span>
</h3>
</div>
<div slot="body" class="product__esg-text">
<p><?php $trans->eGet('text_label_page-product_esg-modal-caption'); ?></p>
<p class="product__esg-text-comparison">
<?php $trans->eGet('text_label_page-product_esg-modal-source'); ?>
</p>
<a href="/assets/pdf/Anthesis-Koldioxid-och-resurskalkylator-Metodik.pdf" id="esgReadMore" target="_blank" class="button--medium button--primary button--outlined">
<i class="ri-file-text-line"></i><?php $trans->eGet('text_label_page-product_esg-modal-method'); ?>
</a>
</div>
<div slot="footer" class="product__esg-modal-footer">
<a id="esg-modal__close" class="k-modal__close-button button--medium button--negate button--v-text">
<?php $trans->eGet('text_label_page-product_esg-modal-close'); ?>
</a>
</div>
</k-modal>
</div>
<?php endif; ?>
</div> <!-- product-grid__content end -->
<div id="nav-freight" class="object-position-and-freight">
<div class="object-position-and-freight__inner">
<div class="object-position">
<div class="object-information__header">
<span class="object-information__header-icon"><i class="ri-map-pin-fill"></i></span>
<span class="object-information__header-text"><?php $trans->eGet("text_headline_page-product_map-and-freight"); ?></span>
</div>
<div class="object-position__information">
<span class="object-position__municipallity"><?php echo $county->name .", ". $countyParent->name;?>.</span>
<?php $trans->eGet('text_preamble_page-product_map-and-freight'); ?>
</div>
<div id="page-product__county-map">
<county-map country="<?php echo $parameters->get('app.instance'); ?>" :county=<?php echo (int)$county->code; ?>></county-map>
</div>
</div>
<div class="object-freight">
<div class="object-information__header object-information__header--sub">
<span class="object-information__header-icon"><i class="ri-truck-line"></i></span>
<span class="object-information__header-text"><?php $trans->eGet('text_subheadline_page-product_map-and-freight') ?></span>
</div>
<div class="object-freight__content">
<?php if ($vendor->freightinfo != "") {
$freightString = nl2br(strip_tags($vendor->freightinfo));
} else {
$freightString = $trans->get('text_placeholder_page-product_map-and-freight_content', [
'freightLink' => $urlGenerator->generate(
'app.legacy.pages.text',
['urlname' => 'fraktforfragan'],
UrlGeneratorInterface::ABSOLUTE_URL
)
]);
}?>
<p><?php print $freightString; ?></p>
</div>
</div>
</div>
</div> <!-- nav-freight end -->
<div class="map-background"></div>
<div class="bidding-info-background"></div>
<div class="product-footer-row">
<div class="faq-cta">
<div class="faq">
<div class="article-select__faq-section">
<h2><?php $trans->eGet('text_caption_page-product_faq') ?></h2>
<div class="faq-item">
<p
class="faq-item-q"
data-article-link-id="faq1-1"
data-article-group-id="faq"
data-selected-class="faq-item-q--selected"
>
<?php $trans->eGet('text_label_page-product_vat-question') ?>
</p>
<p
class="faq-item-a"
data-article-id="faq1-1"
>
<?php $trans->eGet('text_label_page-product_vat-answer') ?>
</p>
<p
class="faq-item-q"
data-article-link-id="faq1-2"
data-article-group-id="faq"
data-selected-class="faq-item-q--selected"
>
<?php $trans->eGet('text_label_page-product_res-price-question') ?></p>
<p
class="faq-item-a"
data-article-id="faq1-2"
>
<?php $trans->eGet('text_label_page-product_res-price-answer') ?>
</p>
<p
class="faq-item-q"
data-article-link-id="faq1-3"
data-article-group-id="faq"
data-selected-class="faq-item-q--selected"
>
<?php $trans->eGet('text_label_page-product_buying-question') ?></p>
<div class="faq-item-a" data-article-id="faq1-3">
<p><?php $trans->eGet('text_label_page-product_buying-answer') ?></p>
<?php if ('se' === $parameters->get('app.instance')): ?>
<div class="faq-video">
<iframe
src="https://www.youtube.com/embed/CUjII3ljg-U"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen=""
width="560"
height="315"
frameborder="0">
</iframe>
</div>
<?php endif; ?>
</div>
<p
class="faq-item-q"
data-article-link-id="faq1-4"
data-article-group-id="faq"
data-selected-class="faq-item-q--selected"
>
<?php $trans->eGet('text_label_page-product_auction-question') ?>
</p>
<p
class="faq-item-a"
data-article-id="faq1-4"
>
<?php $trans->eGet('text_label_page-product_auction-answer') ?>
<a href="<?php echo $urlGenerator->generate('app.legacy.pages.contact') ?>" target="_blank">
<?php $trans->eGet('link_button_page-product_customer-service') ?>
</a>
</p>
<p
class="faq-item-q"
data-article-link-id="faq1-5"
data-article-group-id="faq"
data-selected-class="faq-item-q--selected"
>
<?php $trans->eGet('text_label_page-product_something-wrong-question') ?>
</p>
<p
class="faq-item-a"
data-article-id="faq1-5"
>
<?php $trans->eGet('text_label_page-product_something-wrong-answer') ?>
</p>
</div>
<div class="how-to-buy-link">
<a href="<?php echo $urlGenerator->generate('app.legacy.pages.howtobuy') ?>">
<?php $trans->eGet('text_link_page-product_faq-kpk'); ?>
</a>
<i class="ri-arrow-right-line"></i>
</div>
</div>
</div> <!-- faq end-->
<div class="cta">
<div class="cta-header">
<div class="cta-header__pre"><?php $trans->eGet('text_label_page-product_cta-header-pre'); ?></div>
<div class="cta-header__main"><?php $trans->eGet('text_label_page-product_cta-header-main'); ?></div>
</div>
<div class="cta-content">
<?php $trans->eGet('text_label_page-product_cta-content'); ?>
</div>
<div class="cta-content__link">
<a href="<?php echo $urlGenerator->generate('app.legacy.pages.howtosell') ?>" class="button button--rounded button--large button--highlight">
<?php $trans->eGet('text_button_page-product_spk-cta-link'); ?><i class="ri-arrow-right-line"></i>
</a>
</div>
</div> <!-- cta end-->
</div> <!-- END FAQ-CTA -->
</div> <!-- END product-footer-row -->
<?php
print "<div class='similar-objects-row'>";
// -- OTHER OBJECTS SLIDER
if($vendor->hideOtherProductsSlider != 1) {
$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, ";
$query .= "DATE_FORMAT(p.auctionend, '%Y%m%d%H%i%s') AS fullend, ";
$query .= "DATE_FORMAT(p.auctionstart, '%Y%m%d%H%i%s') AS objstart, ";
$query .= "CASE WHEN (p.auctionend < NOW() AND p.paymentbasis_id > 0) THEN 1 ELSE 0 END AS isSold ";
$query .= ", p.auctionend as ddend ";
$query .= "FROM products p";
$query .= " LEFT JOIN products_description pd ON pd.products_id=p.id AND pd.language_id=".LANGUAGE_ID."";
$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." ";
$query .= "AND p.id != ".$obj->id." ";
$query .=" ORDER BY rand() limit 8";
$result = mysqli_query($db, $query);
if(mysqli_num_rows($result)) {
// Info that this seller has other objects
// -- START VENDOR OBJECT SLIDER
print " <div class=\"similar-objects\">\n";
print ("
<h2>
<a class='product-info-section__product-link vendor-link' href=\"/vendorpage/".$vendor->id."/\">
<span>". $trans->get('link_button_page-product_same-seller') ."
<span class='link-icon'></span>
</span>
</a>
</h2>\n");
print " <div class=\"carousel vendor-carousel\">\n";
while($relObj = mysqli_fetch_object($result)) {
unset($relObjUrl);
unset($relPicUrl);
unset($antbids);
$relObjUrl = $urlGenerator->generate('app.legacy.auction.object', ['produrlname' => $relObj->urlname]);
$relPicUrl = $parameters->get('app.image.path')."/image-missing.png";
$relmpres = mysqli_query($db, "SELECT id, overskrift, bildinfo, updated FROM extrabilder WHERE sida='".$relObj->id."' AND mainpic=1 LIMIT 1");
if(mysqli_num_rows($relmpres)){
$relmp = mysqli_fetch_object($relmpres);
$image = new ProductImage($relObj->id, null);
$image->setId($relmp->id)
->setExtension($relmp->bildinfo)
->setUpdated(new DateTime($relmp->updated))
->setText($relmp->overskrift);
$relPicUrl = $image->getImageUrl('large');
}
$bsql = "SELECT id FROM bids WHERE products_id='".mysqli_real_escape_string($db, $relObj->id)."' ORDER BY bid DESC";
$bres = mysqli_query($db, $bsql);
$antbids = mysqli_num_rows($bres);
$wasql = "SELECT id, bid, register_id FROM bids WHERE products_id='".mysqli_real_escape_string($db, $relObj->id)."' ORDER BY bid DESC LIMIT 1";
$wares = mysqli_query($db, $wasql);
if(mysqli_num_rows($wares)){
$wa = mysqli_fetch_object($wares);
}
else {
$wa = new stdClass();
$wa->bid = 0;
}
$showPrice = $relObj->price;
if(isset($wa->id)) {
$showPrice = $wa->bid;
}
print " <div class=\"object-cell\" onclick=\"location.href='".$relObjUrl."';\">\n";
print " <div id=\"object_li_".$relObj->id."\" class=\"listing-box-slider\">\n";
print " <a href=\"".$relObjUrl."\">\n";
print " <div class=\"listing-img-slider\"><img data-lazy='".$relPicUrl."'>";
print " <div class=\"label-wrapper\">";
if ($relObj->categories_id == RESTCATEGORY) {
print " <div class=\"stock-auction-ribbon".($parameters->get("app.instance") === 'dk' ? ' stock-auction-ribbon__dk' : '') ."\"></div>\n";
}
if ((int)$relObj->showtype == 2 || (int)$relObj->showtype == 3 || (int)$relObj->showtype == 4) {
print " <div class=\"bankruptcy-auction-ribbon\"></div>\n";
}
if (isSold($relObj)) {
print " <div class=\"sold-ribbon\">
".$trans->get('text_label_tag-sold')."
</div>\n";
}
print " </div>\n<!-- end .label-wrapper -->";
print "</div>\n";
print " </a>\n";
print " <span class=\"object-title-slider\">".$relObj->name."</span>\n";
print " <span class=\"object-maker-slider\">".($relObj->fabrikat != "" ? $relObj->fabrikat : " ")."</span>\n";
print " <span class=\"object-county-slider\">".($counties[$relObj->county_id] != "" ? $counties[$relObj->county_id] : " ")."</span>\n";
print " <div class=\"no-of-bids-box-slider\">" .
$trans->get('text_label_page-product_amount-bids') .
": <b id=\"antbids_".$relObj->id."\">" .
$trans->get('text_label_page-product_amount-bids-total', ['bids' => $antbids]) . "</b></div>\n";
print " <div class=\"close-box-slider\">
<span id=\"timeleft_".$relObj->id."\" class=\"end\">
".$container->get(TimeLeftUtil::class)->timeleft(new DateTime($relObj->ddend))."
</span>
</div>\n";
print " <div class=\"highest-bid-slider notranslate\" id=\"bid_".$relObj->id."\">
". $trans->get(
'info_label_page-product_show-price',
['showprice' => $showPrice]
) ."
</div>\n";
print " </div>\n<!-- end .listing-box-slider -->";
print " </div>\n<!-- end .object-cell -->";
}
print " </div>\n<!-- end .vendor-carousel -->";
print "</div>\n<!-- end .similar-objects -->";
}
}
// -- OTHER OBJECTS END
// -- START SIMILAR OBJECT SLIDER
$categoriesForProductListning = [];
try {
$categoriesForProductListning = $categoriesObject->getCategoriesForProductListing($obj->categories_id);
} catch (Exception $e) {}
$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, ";
$query .= "DATE_FORMAT(p.auctionend, '%Y%m%d%H%i%s') AS fullend, ";
$query .= "DATE_FORMAT(p.auctionstart, '%Y%m%d%H%i%s') AS objstart ";
$query .= ", p.auctionend as ddend ";
$query .= ", CASE WHEN (p.auctionend < NOW() AND p.paymentbasis_id > 0) THEN 1 ELSE 0 END AS isSold ";
$query .= "FROM products p";
$query .= " LEFT JOIN products_description pd ON pd.products_id=p.id AND pd.language_id=".LANGUAGE_ID." ";
$query .= "WHERE p.online=1 AND p.commissions_id!=0 AND p.categories_id IN (" . implode(',', $categoriesForProductListning) . ") ";
$query .= "AND p.paymentbasis_id=0 AND p.nosale!=1 AND p.canceled!=1 ";
$query .= "AND DATE_FORMAT(NOW(), '%Y%m%d%H%i%s') > DATE_FORMAT(p.auctionstart, '%Y%m%d%H%i%s') ";
$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') ";
$query .= "AND p.id != ".$obj->id." ";
$query .=" ORDER BY rand() limit 8";
if (count($categoriesForProductListning) > 0) {
$result = mysqli_query($db, $query);
if (mysqli_num_rows($result)) {
print "<div class=\"similar-objects other-objects\">\n";
$categoryModel = $categoriesObject->getClosestPublicCategory($obj->categories_id);
if (!is_null($categoryModel->getId())) {
printf(
' <h2>
<a class="product-info-section__product-link other-link" href="%s">
<span>%s
<span class="link-icon">
</span>
</a>
</h2>',
$categoryModel->getCompleteUrl(),
$categoryModel->getDisplayName()
);
}
print " <div class=\"carousel object-carousel\">\n";
while ($relObj = mysqli_fetch_object($result)) {
unset($relObjUrl);
unset($relPicUrl);
unset($antbids);
$relObjUrl = $urlGenerator->generate(
'app.legacy.auction.object',
['produrlname' => $relObj->urlname]
);
$relPicUrl = $parameters->get('app.image.path') . "/image-missing.png";
$relmpres = mysqli_query(
$db,
"SELECT id, overskrift, bildinfo, updated FROM extrabilder WHERE sida='" . $relObj->id . "' AND mainpic=1 LIMIT 1"
);
if (mysqli_num_rows($relmpres)) {
$relmp = mysqli_fetch_object($relmpres);
$image = new ProductImage($relObj->id, null);
$image->setId($relmp->id)
->setExtension($relmp->bildinfo)
->setUpdated(new DateTime($relmp->updated))
->setText($relmp->overskrift);
$relPicUrl = $image->getImageUrl('large');
}
$bsql = "SELECT id FROM bids WHERE products_id='" . mysqli_real_escape_string(
$db,
$relObj->id
) . "' ORDER BY bid DESC, id DESC";
$bres = mysqli_query($db, $bsql);
$antbids = mysqli_num_rows($bres);
$wasql = "SELECT id, bid, register_id FROM bids WHERE products_id='" . mysqli_real_escape_string(
$db,
$relObj->id
) . "' ORDER BY bid DESC, id DESC LIMIT 1";
$wares = mysqli_query($db, $wasql);
if (mysqli_num_rows($wares)) {
$wa = mysqli_fetch_object($wares);
} else {
$wa = new stdClass();
$wa->bid = 0;
}
$showPrice = $relObj->price;
if (isset($wa->id)) {
$showPrice = $wa->bid;
}
print " <div class=\"object-cell\" onclick=\"location.href='" . $relObjUrl . "';\">\n";
print " <div id=\"object_li_" . $relObj->id . "\" class=\"listing-box-slider\">\n";
print " <a href=\"" . $relObjUrl . "\">\n";
print " <div class=\"listing-img-slider\"><img data-lazy='" . $relPicUrl . "'>";
print " <div class=\"label-wrapper\">";
if ($relObj->categories_id == $parameters->get('app.rest.category.id')) {
print " <div class=\"stock-auction-ribbon". ($parameters->get("app.instance") === 'dk' ? ' stock-auction-ribbon__dk' : '') ."\"></div>\n";
}
if ((int)$relObj->showtype == 2 || (int)$relObj->showtype == 3 || (int)$relObj->showtype == 4) {
print " <div class=\"bankruptcy-auction-ribbon\"></div>\n";
}
if (isSold($relObj)) {
print " <div class=\"sold-ribbon\">
".$trans->get('text_label_tag-sold')."
</div>\n";
}
print " </div>\n<!-- end .label-wrapper -->";
print "</div>\n";
print " </a>\n";
print " <span class=\"object-title-slider\">" . $relObj->name . "</span>\n";
print " <span class=\"object-maker-slider\">" . ($relObj->fabrikat != "" ? $relObj->fabrikat : " ") . "</span>\n";
print " <span class=\"object-county-slider\">" . ($counties[$relObj->county_id] != "" ? $counties[$relObj->county_id] : " ") . "</span>\n";
print " <div class=\"no-of-bids-box-slider\">" .
$trans->get('text_label_page-product_amount-bids') .
": <b id=\"antbids_" . $relObj->id . "\">" .
$trans->get('text_label_page-product_amount-bids-total', ['bids' => $antbids]
) . "</b></div>\n";
print " <div class=\"close-box-slider\">
<span id=\"timeleft_" . $relObj->id . "\" class=\"end\">
".$container->get(TimeLeftUtil::class)->timeleft(new DateTime($relObj->ddend))."
</span>
</div>\n";
print " <div class=\"highest-bid-slider notranslate\" id=\"bid_" . $relObj->id . "\">
" . $trans->get(
'info_label_page-product_show-price',
['showprice' => $showPrice]
) . "
</div>\n";
print " </div>\n<!-- end .listing-box-slider -->";
print " </div>\n<!-- end .other-objects -->";
}
print " </div> <!-- carousel object-carousel end -->
</div> <!-- end .object-carousel -->";
}
}
//// Trustpilot-showcase
echo $container->get('twig')->render('public/trustpilot/trustpilot_small.html.twig');
?>
<?php print $obj->script_code; ?>
<script>
var secleft = <?php print $secleft; ?>;
</script>
</div> <!-- END .similar-objects-row-->
</div> <!-- end .product-grid -->
</div> <!-- end .topbar_full -->
<?php }
else {
print "<div class='row'>";
print "<div class='column xlarge-4 xlarge-offset-4 large-6 large-offset-3 medium-8 medium-offset-2 small-12'>";
print "<div class='auction_not_started'>";
print "<video loop autoplay playsinline muted width='65'>";
print "<source src='/images/video/Timglas.mp4' type='video/mp4'>";
print "</video>";
print "<h2>".$trans->get("ALIAS_PRODUCT_NOT_STARTED_HEADLINE")."</h2>";
print "<p class='ingress'>".$trans->get("ALIAS_PRODUCT_NOT_STARTED_TEXT")."</p>";
print "<a class='klaravik-link-button' href='/'>". $trans->get('link_button_page-product_all-auctions') ."</a>";
print "</div>";
print "</div>";
print "</div>";
}
}
else {
?>
<div class='row'>
<div class='column large-6 large-offset-3 medium-8 medium-offset-2 small-12 page-main'>
<div class='noValidProduct'>
<div class='noValidProduct__lottie'>
<div class='noValidProduct__lottie-magnifyer' data-src='/images/lottie-animations/magnifying-glass.json' autoplay loop></div>
</div>
<div class='noValidProduct__title'>
<?php $trans->eGet('text_label_page-product_no-valid-prod-caption'); ?>
</div>
<p><?php $trans->eGet('text_label_page-product_no-valid-prod-text'); ?></p>
<a href='/'>
<button class='noValidProduct__button button--medium button--primary'>
<?php $trans->eGet('link_button_page-product_all-auctions'); ?>
</button>
</a>
</div>
</div>
</div>
<?php
}
}
else {
print $trans->get('text_label_page-product_missing-valid-param');
}
?>
<!-- Vue teleportation of snackbars will end here -->
<div class="snackbars"></div>
<k-modal id="saved-object-modal" data-position="center">
<i slot="close-icon" class="ri-close-fill"></i>
<div slot="header" class="saved-object-modal__header">
<span class="saved-object-modal__header-img"></span>
</div>
<div slot="body" class="saved-object-modal__body">
<h1 class="saved-object-modal__heading"><?php $trans->eGet("text_heading_saved-object-modal_save-object")?></h1>
<p class="saved-object-modal__subheading"><?php $trans->eGet("text_bodytext_saved-object-modal_login")?></p>
</div>
<div slot="footer" class="saved-search-modal__footer saved-object-modal__footer-btns">
<a href="<?php echo($urlGenerator->generate('app.legacy.pages.login', ['continue' => $request->getRequestUri()])) ?>" class="button--large button--primary button--rounded" saved-object-cta="login">
<i class="ri-user-fill"></i><?php $trans->eGet("text_label_saved-object-modal_login") ?>
</a>
<a href="<?php echo($urlGenerator->generate('app.legacy.pages.register')) ?>" class="button--large button--rounded button--secondary" saved-object-cta="create-account">
<i class="ri-user-add-line"></i><?php $trans->eGet("text_label_saved-object-modal_create-account") ?>
</a>
</div>
</k-modal>
<script>
let sessionBuyer = <?php
if (array_key_exists('register_id', $_SESSION) && isset($obj->id)) {
$sessionRegisterId = $_SESSION['register_id'];
$bidderNumbers = getBidderNumbers($db, $obj->id);
echo array_key_exists(
$sessionRegisterId, $bidderNumbers) ? $bidderNumbers[$sessionRegisterId] : -1;
} else {
echo 0;
}
?>;
</script>
<?php
$manifestAssets
->add('bundle-pages-product')
->add('bundle-requests-ajaxMarkObject');