<?php
/**
 * --------------------------------------------------------------------------------
 *  Group Products
 * --------------------------------------------------------------------------------
 * @package     Joomla 3.x
 * @subpackage  J2 Store
 * @author      Alagesan, J2Store <support@j2store.org>
 * @copyright   Copyright (c) 2016 J2Store . All rights reserved.
 * @license     GNU GPL v3 or later
 * @link        http://j2store.org
 * --------------------------------------------------------------------------------
 *
 * */
defined('_JEXEC') or die;
?>
<?php $images = $this->loadTemplate('images');
J2Store::plugin()->event('BeforeDisplayImages', array(&$images, $this, 'com_j2store.products.list.bootstrap'));
echo $images;
?>
<?php echo $this->loadTemplate('title'); ?>
<?php if(isset($this->product->event->afterDisplayTitle)) : ?>
    <?php echo $this->product->event->afterDisplayTitle; ?>
<?php endif;?>


<?php if(isset($this->product->event->beforeDisplayContent)) : ?>
    <?php echo $this->product->event->beforeDisplayContent; ?>
<?php endif;?>

<?php echo $this->loadTemplate('description'); ?>

<?php //echo $this->loadTemplate('price'); ?>

<?php if($this->params->get('catalog_mode', 0) == 0): ?>

    <form action="<?php echo $this->product->cart_form_action; ?>"
          method="post" class="j2store-addtocart-form"
          id="j2store-addtocart-form-<?php echo $this->product->j2store_product_id; ?>"
          name="j2store-addtocart-form-<?php echo $this->product->j2store_product_id; ?>"
          data-product_id="<?php echo $this->product->j2store_product_id; ?>"
          data-product_type="<?php echo $this->product->product_type; ?>"
          enctype="multipart/form-data">

        <?php $cart_type = $this->params->get('list_show_cart', 1); ?>
        <?php if($cart_type == 1) : ?>
            <?php echo $this->loadTemplate('groups'); ?>
            <?php echo $this->loadTemplate('groupcart'); ?>

        <?php elseif( ($cart_type == 2 && count($this->product->options)) || $cart_type == 3 ):?>
            <?php echo J2Store::plugin()->eventWithHtml('BeforeGroupProductLink',array($this->product,$this->params))?>
            <!-- we have options so we just redirect -->
            <a href="<?php echo $this->product->product_link; ?>" class="<?php echo $this->params->get('choosebtn_class', 'btn btn-success'); ?>"><?php echo JText::_('J2STORE_VIEW_PRODUCT_DETAILS'); ?></a>
        <?php else: ?>
            <?php echo $this->loadTemplate('groups'); ?>
            <?php echo $this->loadTemplate('groupcart'); ?>
            <?php //echo $this->loadTemplate('cart'); ?>
        <?php endif; ?>

    </form>
<?php endif;?>
<?php if(isset($this->product->event->afterDisplayContent)) : ?>
    <?php echo $this->product->event->afterDisplayContent; ?>
<?php endif;?>


