<?php
$product = $viewData['product'];
$showRating = $viewData['showRating'];
if (!class_exists('CurrencyDisplay'))
    require(JPATH_ROOT.DS.'administrator'.DS.'components'.DS.'com_virtuemart'.DS.'helpers' . DS . 'currencydisplay.php');
$currency = CurrencyDisplay::getInstance( );
$ItemidStr = '';
$Itemid = shopFunctionsF::getLastVisitedItemId();
if(!empty($Itemid)){
    $ItemidStr = '&Itemid='.$Itemid;
}
if (!empty($product->images[0])) {
    $image = $product->images[0]->displayMediaThumb ('class="featuredProductImage"', FALSE);
    $image_full = $product->images[0]->displayMediaFull();
} else {
    $image = '';
}
$url = JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' .
    $product->virtuemart_category_id);
?>
<div class="wrap item">
    <div class="feature-image">
        <div class="icon">
            <a class="quick_view" data-toggle="modal" data-target="#productModal<?php echo $product->virtuemart_product_id;?>"><i class="fa fa-search"></i></a>

        </div>
        <a href="<?php echo $url;?>" class="link_product">
        <?php
        echo $image;
        ?>
        </a>
    </div>
    <div class="stats">
        <div class="product_title">
            <?php echo JHtml::link ($url, $product->product_name); ?>
            <?php
            // 		echo $currency->priceDisplay($product->prices['salesPrice']);
            if (!empty($product->prices['salesPrice'])) {
                echo $currency->createPriceDiv ('salesPrice', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
            }
            // 		if ($product->prices['salesPriceWithDiscount']>0) echo $currency->priceDisplay($product->prices['salesPriceWithDiscount']);
            if (!empty($product->prices['salesPriceWithDiscount'])) {
                echo $currency->createPriceDiv ('salesPriceWithDiscount', '', $product->prices, FALSE, FALSE, 1.0, TRUE);
            }
            ?>
        </div>
        <div class="cart">
            <?php echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'row'=>0,'pos_btn'=>'grid')); ?>
        </div>

    </div>
    <!-- Modal -->
    <div id="productModal<?php echo $product->virtuemart_product_id;?>" class="modal fade" role="dialog">
        <div class="modal-dialog">
            <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-body">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <?php echo shopFunctionsF::renderVmSubLayout('ob_lightbox',array('product'=>$product,'currency'=>$currency)); ?>
                </div>
            </div>

        </div>
    </div>
</div>