<?php $kproduct = get_query_var('kproduct'); ?>
<?php $woo_currency = get_woocommerce_currency_symbol(); ?>
<div class="product product-eleven overflow-hidden"> 
<div class="product-image">
<?php if ( is_plugin_active( 'woo-smart-compare/wpc-smart-compare.php' ) ): ?>
<?php echo do_shortcode( '[woosc id="".<?php echo get_the_ID(); ?>.""]' );  ?>
<?php endif; ?>
<?php if($kproduct['kaveh_custom']['product_stock_status'] === 'outofstock'): ?>
    <div class="status">
    ناموجود
    </div>
<?php endif; ?>
<?php if ( $kproduct['kaveh_custom']['is_on_sale'] === true ): ?>
<div class="discount">
<?php if($kproduct['kaveh_custom']['product_type'] === 'variable'): ?>
    <?php echo (int)(( ( (float)$kproduct['kaveh_custom']['min_regular_price'] - (float)$kproduct['kaveh_custom']['min_sale_price'] ) / (float)$kproduct['kaveh_custom']['min_regular_price'] ) * 100); ?><?php echo ' '.'%'; ?>
<?php elseif($kproduct['kaveh_custom']['product_type'] === 'simple'): ?>
    <?php echo (int)(( ( (float)$kproduct['kaveh_custom']['normal_price'] - (float)$kproduct['kaveh_custom']['sale_price'] ) / (float)$kproduct['kaveh_custom']['normal_price'] ) * 100); ?><?php echo ' '.'%'; ?>
<?php endif; ?>
</div>
<button type="button" class="bookmark btn btn-warning p-0 position-absolute">
<i class="isax isax-ticket-discount5"></i>
</button>
<?php endif; ?>
<ul class="colors position-absolute">
<?php
$terms = get_the_terms( $pr_id , 'pa_color' );
foreach ( $terms as $term ):
$val     = get_term_meta( $term->term_id, 'wpcvs_color', true ) ?: '';
$tooltip = get_term_meta( $term->term_id, 'wpcvs_tooltip', true ) ?: $term->name;
?>
<li>
<a href="<?php echo $kproduct['link'] ?>" class="rounded-circle d-block hint--right" aria-label="<?php echo esc_attr( $tooltip ) ?>" title="<?php echo esc_attr( $tooltip ) ?>" style="background-color: <?php echo esc_attr( $val ) ?>;"></a>
</li>
<?php endforeach; ?>
</ul>
<a href="<?php echo $kproduct['link'] ?>">
    <img src="<?php echo $kproduct['kaveh_custom']['thumbnail_url'] ?>" alt="product">
</a>
</div>
<div class="detail">
<?php if($kproduct['kaveh_custom']['product_stock_status'] !== 'outofstock'): ?>
<?php if($kproduct['kaveh_custom']['product_type'] !== 'variable'): ?>
<?php if ( $kproduct['kaveh_custom']['is_on_sale'] === true ): ?>
<div class="offer">
<?php if(!empty($kproduct['kaveh_custom']['normal_price'])): ?>
<?php echo number_format($kproduct['kaveh_custom']['normal_price'], 0, '.', ','); ?>
<?php endif; ?>
</div>
<div class="price">
<?php if(!empty($kproduct['kaveh_custom']['sale_price'])): ?>
    <?php echo number_format($kproduct['kaveh_custom']['sale_price'], 0, '.', ','); ?>
<?php endif; ?>
<span> <?php echo $woo_currency; ?> </span>
</div>
<?php else: ?>
<div class="price nor12p">
<?php if(!empty($kproduct['kaveh_custom']['normal_price'])): ?>
<?php echo number_format($kproduct['kaveh_custom']['normal_price'], 0, '.', ','); ?>
<?php endif; ?>
<span> <?php echo $woo_currency; ?></span>
</div>
<?php endif; ?>
<?php else: ?>
<div class="price">
<?php if($kproduct['kaveh_custom']['min_regular_price'] !== $kproduct['kaveh_custom']['max_regular_price']): ?>
    <?php if(!empty($kproduct['kaveh_custom']['min_regular_price'])): ?>
    <?php echo number_format($kproduct['kaveh_custom']['min_regular_price'], 0, '.', ',') . ' - ' . number_format($kproduct['kaveh_custom']['max_regular_price'], 0, '.', ',') . ' '; ?>
<?php endif; ?>
<?php else: ?>
    <?php if(!empty($kproduct['kaveh_custom']['min_regular_price'])): ?>
    <?php echo number_format($kproduct['kaveh_custom']['min_regular_price'], 0, '.', ',')  . ' '; ?>
<?php endif; ?>
<?php endif; ?>
<span> <?php echo $woo_currency; ?> </span>
</div>
<?php endif; ?>
<?php else: ?>
<div class="mt-p12"></div>
<?php endif; ?>
<?php if(empty($kproduct['kaveh_custom']['normal_price'])): ?>
<div class="mt-p121"></div>
<?php endif; ?>
<h2>
<a href="<?php echo $kproduct['link'] ?>"><?php echo $kproduct['title']['rendered']; ?></a>
</h2>
<div class="btns d-flex align-items-center justify-content-center">
<?php if($kproduct['kaveh_custom']['product_type'] !== 'variable'): ?>
<?php if($kproduct['kaveh_custom']['product_stock_status'] !== 'outofstock'): ?>
<button type="button" class="add-to-cart single_add_to_cart_button position-relative cart11" value="<?php echo $kproduct['id']; ?>">
<i class="icon icon-cart-3"></i>
</button>
<?php endif; ?>
<?php endif; ?>
<button id="eyeid" type="button" value="<?php echo $kproduct['id']; ?>" class="rounded-circle text-center d-block eyeid" data-bs-toggle="modal" data-bs-target="#modal-product">
<i class="isax isax-eye3"></i>
</button>
<?php if ( is_plugin_active( 'woo-smart-wishlist/wpc-smart-wishlist.php' ) ): ?>
<?php echo do_shortcode( '[woosw id="".<?php echo get_the_ID(); ?>.""]' ); ?>
<?php endif; ?>
</div>
</div>
</div>