<?php if(count($products)): ?>

    <?php $prices = app('App\Lib\Prices'); ?>



    <?php
        $class = 'pb';
        if($type == 'r' && $num == 4){
            $class = 'pb col-xs-6 col-md-4 col-lg-3';
        } elseif ($type == 'r' && $num == 6){
            $class = 'pb col-xs-6 col-md-3 col-lg-2';
        }

        $lang = (session()->has('clang')) ? session('clang') : app()->getLocale();

    ?>

    <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

        <?php

            // Link
            $link = tr_url($product->slug);
            // Sticker
            $sticker_html = '';
            $stickerpath = public_path($product->sticker);
            if(is_file($stickerpath) && is_readable($stickerpath)){
                $salt = (!is_null($product->pos_name)) ? $product->pos_name : 'akcija';
                $sticker_html = '<a class="sticker" href="'.$link.'">
                                    <img src="'.$product->sticker.'" alt="'.$salt.'" width="90" height="90">
                                </a>';
            }

            // Image
            $imgpath = public_path($product->prod_simg);
            $imgsrc = (file_exists($imgpath) && is_readable($imgpath)) ? $product->prod_simg : config('images.no_image_paths.s');

            // Title
            $title = $product->brand_name.' '.$product->prod_name;
            $desc = (is_object(json_decode($product->sdesc))) ? json_decode($product->sdesc)->{$lang} : $product->sdesc;

        ?>

        <div class="<?php echo e($class); ?>">
            <div class="pb-inner">
                <div class="pb-img">
                    <?php echo $sticker_html; ?>

                    <a href="<?php echo e(url($link)); ?>" title="<?php echo e(ucfirst($title)); ?>">
                    <img src="<?php echo e(url($imgsrc)); ?>" alt="cisco-1140-ap-series">
                    </a>
                </div>
                <h4 class="product-name"><a href="<?php echo e(url($link)); ?>" title="<?php echo e(ucfirst($title)); ?>"><?php echo e(ucfirst($title)); ?></a></h4>
                <?php if($product->cat_desc_type != 'n'): ?>
                <div class="pb-description"><?php echo nl2br($desc); ?></div>
                <?php endif; ?>
                <div class="pb-prices">
                    <?php if($product->prod_if_price): ?>
                        <?php
                            $oldPrice = $prices->getOldPrice($product);
                            $price = $prices->getPrice($product);
                            $saving = ($oldPrice > $price) ? $oldPrice-$price : false;
                        ?>
                        <div class="old-price"><?php echo ($saving) ? $prices::formatPrice($oldPrice) : '&nbsp;'; ?></div>
                        <div class="savings"><?php echo ($saving) ? __('frontside.common.saving').': '.$prices::formatPrice($saving) : '&nbsp;'; ?></div>
                        <div class="price"><?php echo e($prices->formatPrice($price)); ?></div>
                    <?php else: ?>
                        Pozvati za cenu
                    <?php endif; ?>
                </div>
                <div class="pb-buttons">
                    <button class="button btn-cart list-add-to-cart" data-ind="<?php echo e($product->prod_id); ?>" type="button" title=" Dodaj u korpu"><span> <?php echo e(__('frontside.common.add_to_cart')); ?></span></button>
                    
                    <button class="button btn-compare hidden-sm comparebtn" type="button" title="Compare this Product" data-id="<?php echo e($product->prod_id); ?>"><span><?php echo e(__('frontside.common.compare_product')); ?></span></button>
                    <br clear="all" />
                </div>
            </div>
        </div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>