<?php
global $config, $loader, $registry;

$store_id = $config->get('config_store_id');
$lang = $config->get('config_language_id');

$loader->model('custom/general');
$model = $registry->get('model_custom_general');

$buyshop_general = $config->get('buyshop_general');
$buyshop_productlabels = $config->get('buyshop_productlabels');

$sale = $buyshop_productlabels['sale'][$store_id];
$video = $buyshop_productlabels['video'][$store_id];
$saleposition = $buyshop_productlabels['saleposition'][$store_id];
$videoposition = $buyshop_productlabels['videoposition'][$store_id];

$ajaxcart = $buyshop_general['ajaxcart'][$store_id];

foreach ($products as $product) {

    $youtube = $model->getProductOption($product['product_id'], 'youtube');

    ?>
<div class="four columns product_wrapper product-layout product-<?php echo (isset($list_type) ? 'grid' : 'grid'); ?>">

    <div class="product">
        <?php if ($product['thumb']) { ?>
        <div class="image product-image-wrapper">

            <?php if ( $sale != 0) : ?>
            <span class="product_sticker sticker_sale sticker_onsale_<?php echo $saleposition; ?> <?php echo ($sale ? ($product['special'] ? 'sticker_display' : 'sticker_display_none') : 'sticker_display_none'); ?>"></span>
            <?php endif; ?>
            <?php if ( $video != 0) : ?>
            <span class="product_sticker sticker_video sticker_video_<?php echo $videoposition; ?> <?php echo ($video ? (($youtube != '') ? 'sticker_display' : 'sticker_display_none') : 'sticker_display_none'); ?>"></span>
            <?php endif; ?>

            <a style="display: block;" class="img_conteiner" href="<?php echo $product['href']; ?>">
                <img class="scale-with-grid image-<?php echo $product['product_id']; ?>" src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" />

                <?php if ($product['popup']) { ?>
                <div class="roll_over_img">
                    <img class="scale-with-grid" src="<?php echo $product['popup']; ?>" alt="<?php echo $product['name']; ?>" />
                </div>
                <?php } ?>



                <div class="product-image-wrapper-hover"></div>
            </a>
        </div>
        <?php } ?>
        <div class="wrapper-hover">

            <div class="description"><?php echo $product['description']; ?></div>
            <?php if ($product['price']) { ?>
            <div class="product-price">
                <div class="price">
                    <?php if (!$product['special']) { ?>
                    <span class="regular_price"><?php echo $product['price']; ?></span>
                    <?php } else { ?>
                    <span class="price-old"><?php echo $product['price']; ?></span> <span class="price-new"><?php echo $product['special']; ?></span>
                    <?php } ?>
                    <?php if ($product['tax']) { ?>
                    <br />
                    <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
                    <?php } ?>
                </div>
            </div>
            <?php } ?>
            <div class="product-name">
                <div class="name">
                    <a href="<?php echo $product['href']; ?>"><?php echo $product['name-main']; ?></a>
                </div>
                <div class="cart">
                    <a onclick="cart_theme.add('<?php echo $ajaxcart; ?>', '<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"></a>
                </div>
            </div>

            <div class="listing_cart">
                <input class="listing_button" type="button" value="Add to Cart" onclick="cart_theme.add('<?php echo $ajaxcart; ?>', '<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');">
            </div>

        </div>

    </div>

</div>
<?php } ?>
