[{if !isset($oConfig)}]
  [{assign var="oConfig" value=$oViewConf->getConfig()}]
[{/if}]

<div class="item compare-item">
    [{assign var="currency" value=$oView->getActCurrency()}]
    [{if $showMainLink}]
        [{assign var='_productLink' value=$product->getMainLink()}]
    [{else}]
        [{assign var='_productLink' value=$product->getLink()}]
    [{/if}]

    <div class="row picture">
        <div class="col-12">
            <a href="[{$_productLink}]" [{if $oView->noIndex()}]rel="nofollow"[{/if}]>
                <img src="[{if $size=='big'}][{$product->getPictureUrl(1)}][{elseif $size=='thinest'}][{$product->getIconUrl()}][{else}][{$product->getThumbnailUrl()}][{/if}]" alt="[{$product->oxarticles__oxtitle->value|strip_tags}] [{$product->oxarticles__oxvarselect->value|default:''}]" class="img-fluid">
            </a>
        </div>
    </div>

    <div class="title">
        <a id="[{$testid}]" href="[{$_productLink}]" class="title" title="[{$product->oxarticles__oxtitle->value}] [{$product->oxarticles__oxvarselect->value}]">
            <span>[{$product->oxarticles__oxtitle->value}] [{$product->oxarticles__oxvarselect->value}]</span>
        </a>
    </div>

    [{capture assign="sPriceContent"}]
    <div class="price text-center">
        <div class="content">
            [{block name="widget_product_listitem_grid_price"}]
            [{oxhasrights ident="SHOWARTICLEPRICE"}]
            [{assign var="oUnitPrice" value=$product->getUnitPrice()}]
            [{assign var="tprice"     value=$product->getTPrice()}]
            [{assign var="price"      value=$product->getPrice()}]

            [{if $tprice && $tprice->getBruttoPrice() > $price->getBruttoPrice()}]
            <span class="oldPrice text-muted">
                                    <del>[{$product->getFTPrice()}] [{$currency->sign}]</del>
                                </span>
            [{/if}]

            [{block name="widget_product_listitem_grid_price_value"}]
            [{if $product->getFPrice()}]
            <span class="lead text-nowrap">
                                        [{if $product->isRangePrice()}]
                                            [{oxmultilang ident="PRICE_FROM"}]
                                            [{if !$product->isParentNotBuyable()}]
                                                [{$product->getFMinPrice()}]
                                            [{else}]
                                                [{$product->getFVarMinPrice()}]
                                            [{/if}]
                                        [{else}]
                                            [{if !$product->isParentNotBuyable()}]
                                                [{$product->getFPrice()}]
                                            [{else}]
                                                [{$product->getFVarMinPrice()}]
                                            [{/if}]
                                        [{/if}]
                                        [{$currency->sign}]
                                        [{if $oView->isVatIncluded()}]
                                             [{if !($product->hasMdVariants() || ($oViewConf->showSelectListsInList() && $product->getSelections(1)) || $product->getVariants())}]*[{/if}]
                                        [{/if}]
                                    </span>
            [{/if}]
            [{/block}]
            [{if $oUnitPrice}]
            <span id="productPricePerUnit_[{$testid}]" class="pricePerUnit">
                                    [{$product->oxarticles__oxunitquantity->value}] [{$product->getUnitName()}] | [{oxprice price=$oUnitPrice currency=$currency}]/[{$product->getUnitName()}]
                                </span>
            [{/if}]
            [{/oxhasrights}]
            [{/block}]
        </div>
    </div>
    [{/capture}]

    [{capture assign="sStockContent"}]
		[{if !$product->isMaterialStatusNoLongerProduced() && $product->showStock() && $product->showPricesAtList() && !$product->isPriceZero()}]
		  [{if $product->getStockStatus() == -1}]
		  <span class="stockFlag notOnStock text-danger">
		              [{if $product->oxarticles__oxnostocktext->value}]
		                  [{$product->oxarticles__oxnostocktext->value}]
		              [{elseif $oViewConf->getStockOffDefaultMessage()}]
		                  [{oxmultilang ident="LIST_MESSAGE_NOT_ON_STOCK"}]
		              [{/if}]
		              [{if $product->getDeliveryDate()}]
		                  [{oxmultilang ident="LIST_AVAILABLE_ON"}] [{$product->getDeliveryDate()}]
		              [{/if}]
		          </span>
		  [{elseif $product->getStockStatus() == 1}]
		  <span class="stockFlag lowStock text-success">
		              [{oxmultilang ident="LIST_LOW_STOCK"}]
		          </span>
		  [{elseif $product->getStockStatus() == 0}]
		  <span class="stockFlag text-success">
		              [{if $product->oxarticles__oxstocktext->value}]
		                  [{$product->oxarticles__oxstocktext->value}]
		              [{elseif $oViewConf->getStockOnDefaultMessage()}]
		                  [{oxmultilang ident="LIST_READY_FOR_SHIPPING"}]
		              [{/if}]
		          </span>
		  [{/if}]
	  [{/if}]
    [{/capture}]

    <div class="price-n-stuff">
        <div class="art-n-stock">
            <span class="art-nr">[{oxmultilang ident="LIST_ART_NR"}] [{$product->oxarticles__oxartnum->value}]</span>
            [{$sStockContent}]
        </div>
        [{$sPriceContent}]
    </div>

    [{assign var="aVariantSelections" value=$product->getVariantSelections(null,null,1)}]
    [{assign var="blShowToBasket" value=true}] [{* tobasket or more info ? *}]
    [{if $product->isNotBuyable()||($aVariantSelections&&$aVariantSelections.selections)||$product->hasMdVariants()||($oViewConf->showSelectListsInList() && $product->getSelections(1))||$product->getVariants()}]
        [{assign var="blShowToBasket" value=false}]
    [{/if}]

		[{if !$product->isSellable()}]
        [{assign var="blShowToBasket" value=false}]
				[{assign var="sReasonsForNotSellable" value=$product->getReasonForNotSellable()}]
				<span style="display:none;">[{$sReasonsForNotSellable}]</span>
    [{/if}]

		[{assign var="blArticleSetDisableSaleable" value=$oConfig->getConfigParam('blArticleSetDisableSaleable')}]
		[{if !$blArticleSetDisableSaleable}]
    <form name="tobasket.[{$testid}]" [{if $blShowToBasket}]action="[{$oViewConf->getSelfActionLink()}]" method="post"[{else}]action="[{$_productLink}]" method="get"[{/if}]>
        <div class="variants">
            [{oxhasrights ident="TOBASKET"}]
                [{if $blShowToBasket}]
                    [{$oViewConf->getHiddenSid()}]
                    [{$oViewConf->getNavFormParams()}]
                    <input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
                    [{if $owishid}]
                        <input type="hidden" name="owishid" value="[{$owishid}]">
                    [{/if}]
                    [{if $toBasketFunction}]
                        <input type="hidden" name="fnc" value="[{$toBasketFunction}]">
                    [{else}]
                        <input type="hidden" name="fnc" value="tobasket">
                    [{/if}]
                    <input type="hidden" name="aid" value="[{$product->oxarticles__oxid->value}]">
                    [{if $altproduct}]
                        <input type="hidden" name="anid" value="[{$altproduct}]">
                    [{else}]
                        <input type="hidden" name="anid" value="[{$product->oxarticles__oxnid->value}]">
                    [{/if}]
                    [{if $recommid}]
                        <input type="hidden" name="recommid" value="[{$recommid}]">
                    [{/if}]
                    <input type="hidden" name="pgNr" value="[{$oView->getActPage()}]">
                [{/if}]
            [{/oxhasrights}]
        </div>

        <div class="tobasket add-to-basket">
            <div class="tobasketFunction clear">
                [{if $blShowToBasket}]
                    [{oxhasrights ident="TOBASKET"}]
                        <div class="input-group">
                            <input type="text" name="am" value="1" size="3" autocomplete="off" class="form-control" title="[{oxmultilang ident="QUANTITY"}]">
                            <span class="input-group-append">
                                <button name="addToBasketFromCompareList" type="submit" class="btn btn-primary hasTooltip" title="[{oxmultilang ident="TO_CART"}]"
																	data-brand="[{if $product->isSoloByAlko()}]solobyAL-KO[{else}]AL-KO[{/if}]" data-title="[{$product->oxarticles__oxtitle->value}]" data-artnum="[{$product->oxarticles__oxartnum->value}]" data-price="[{$price->getBruttoPrice()}]">
                                    <i class="fa fa-shopping-cart"></i>
                                </button>
                            </span>
                        </div>
                    [{/oxhasrights}]
                [{else}]
                    <span class="">
                        <a id="variantMoreInfo_[{$testid}]" class="my-2 btn btn-primary btn-block" href="[{$_productLink}]" onclick="oxid.mdVariants.getMdVariantUrl('mdVariant_[{$testid}]'); return false;">[{oxmultilang ident="MORE_INFO"}]</a>
                    </span>
                [{/if}]
            </div>

            [{* additional info *}]
            <div class="additionalInfo clear">
                [{assign var="oUnitPrice" value=$product->getUnitPrice()}]
                [{if $oUnitPrice}]
                    <span id="productPriceUnit">[{oxprice price=$oUnitPrice currency=$currency}]/[{$product->getUnitName()}]</span>
                [{/if}]
            </div>

        </div>

    </form>
		[{else}]
			<span >
        <a class="my-2 btn btn-primary btn-block" href="[{$_productLink}]">[{oxmultilang ident="MORE_INFO"}]</a>
    	</span>
		[{/if}] 

    <form action="[{$oViewConf->getSelfActionLink()}]" method="post">
        <div class="hidden">
            [{$oViewConf->getHiddenSid()}]
            [{$oViewConf->getNavFormParams()}]
            <input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
            <input type="hidden" name="fnc" value="tocomparelist">
            <input type="hidden" name="aid" value="[{$product->oxarticles__oxid->value}]">
            <input type="hidden" name="anid" value="[{$product->oxarticles__oxnid->value}]">
            <input type="hidden" name="pgNr" value="0">
            <input type="hidden" name="am" value="1">
            <input type="hidden" name="removecompare" value="1">
        </div>
        [{oxhasrights ident="TOBASKET"}]
            <button class="btn btn-outline-secondary btn-sm" id="remove_cmp_[{$product->oxarticles__oxid->value}]" type="submit" title="[{oxmultilang ident="REMOVE"}]" name="send">
                <i class="fal fa-times-circle"></i> [{oxmultilang ident="REMOVE"}]
            </button>
        [{/oxhasrights}]
    </form>
</div>
