<?php // BEGIN PHP
session_start(); // start session
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php';


// END PHP ?> 
<html lang="en">
  
  <!-- File generated by Dolibarr website module editor -->
  <body id="bodywebsite" class="bodywebsite bodywebpage-">
    <div id="page">
      <div class="header-container">
        <?php includeContainer('header'); ?>
      </div>
      <div class="columns-container">
        <div id="columns" class="container">
          <div id="slider_row" class="row">
            <div id="top_column" class="center_column col-xs-12 col-sm-12"></div>
          </div>
          <div class="row">
            <!-- include lefet sidebar container -->
            <?php includeContainer('sidebar'); ?>
            
            <?php
                $current_lang = $_SESSION['lang']['code'];
                $product_id = GETPOST('id', 'alpha');
                $product_extid = GETPOST('extid', 'alpha');
                
                $product = new Product($db);
                if (!empty($product_id)) {
                    $result = $product->fetch($product_id);
                } else {
                    $result = $product->fetch('', '', $product_extid);
                }
                
                if ($result <= 0 || $product->status != 1) {
                  print $weblangs->trans("noProductToDisplay");
                } else {
                    
                    $__PAGE__TITLE__ = $product->label;
                    $__PAGE__KEYWORDS__ = $product->array_options['options_marketplace_module_keywords'];
                    $__PAGE__DESC__ = $product->description;

                    // check discount and calculate discounted price
        		    $discount = marketplace_check_discount($product->id);
        		    $discounted_price = marketplace_calculate_discounted_price($product->price_ttc, $discount);
            ?>
                <div id="center_column" class="center_column col-xs-12 col-sm-9">
              <div class="clearfix">

				
              <div itemscope itemtype="http://schema.org/Product">
                <div class="primary_block row">
                  <div class="container">
                    <div class="top-hr"></div>
                  </div>
                  <!-- left infos-->
                  <div class="pb-left-column col-xs-12 col-sm-4 col-md-5">
                    <!-- product img-->
                    <div id="image-block" class="clearfix">
                      <span id="view_full_size">
                        <img id="bigpic" itemprop="image" src="<?php print(getImagePublicURLOfObject($product,1)); ?>" title="<?php print $product->label; ?>" alt="<?php print $product->label; ?>" width="458" height="458" />
                        <a href="<?php print(getImagePublicURLOfObject($product,1)); ?>" src="<?php print(getImagePublicURLOfObject($product,1)); ?>" class="span_link no-print lightbox_trigger" id="view_large_button"><?php print $weblangs->trans("PhotoViewLarger"); ?></a>
                      </span>
                    </div>
                  </div>
                  <!-- end pb-left-column -->
                  <!-- end left infos-->
                  <!-- center infos -->
                  <div class="pb-center-column col-xs-12 col-sm-5 col-md-5">
                    <h1 itemprop="name"><?php print $product->label; ?></h1>
                      <p id="product_reference">
                        <label><?php print $weblangs->trans("model"); ?> </label>
                        <span class="editable"><?php print $product->ref; ?></span>
                      </p>
                    <?php if(strtotime($product->date_creation) > strtotime('-30 days')): ?>
                      <p id="product_condition">
                        <label><?php print $weblangs->trans("condition"); ?> </label>
                        <link itemprop="itemCondition" href="https://schema.org/NewCondition" />
                        <span class="editable"><?php print $weblangs->trans("new"); ?></span>
                      </p>
                    <?php endif ?>
                    <div id="short_description_block">
                      <div id="short_description_content" class="rte align_justify" itemprop="description">
                        <p>
                        <?php 
                          if (isset($product->description)){
                            print $product->description;
                          }
                        ?>
                      </div>

                      <!---->
                    </div>
                    <!-- end short_description_block -->

                    <!-- Out of stock hook -->
                    <div id="oosHook" style="display: none;"></div>
                    <!-- usefull links-->
                    <br>
                    <ul id="usefull_link_block" class="clearfix no-print">
                      <!-- 


	<br><b>This module has not been sold enough or has been on sale for a too short to have statistics</b><li id="left_share_fb"><a href="http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.dolistore.com%2Fen%2Fmodules%2F1998-Advanced-Notifier.html&amp;t=Advanced+Notifier" class="_blank">Share on Facebook!</a></li> -->
                      <li class="print">
                        <a href="javascript:print();"> <?php print $weblangs->trans("print"); ?> </a>
                      </li>
                    </ul>
                  </div>
                  <!-- end center infos-->
                  <!-- pb-right-column-->
                  <div class="pb-right-column col-xs-12 col-sm-3 col-md-2">
                      
                      
                    <!-- add to cart form-->
                    <?php if ($product->price_ttc > 0): ?>
                        <form class="addtocart" method="post">
                    <?php endif ?>
                      <!-- hidden datas -->
                      <p class="hidden">
                        <input type="hidden" name="product_id" value="<?php print $product->id; ?>">
                        <input type="hidden" name="product_thumb" value="<?php print getImagePublicURLOfObject($product,1); ?>">
                      </p>
                      <div class="box-info-product">
                        <div class="content_prices clearfix">
                          <!-- prices -->
                          <div class="price">
                            <p class="our_price_display" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
                              <link itemprop="availability" href="https://schema.org/InStock" />
                                <?php if ($product->price_ttc > 0): ?>
                                    <?php if ($discounted_price != $product->price_ttc): ?>
                                    	<span class="price product-price original-price-product-view"> <?php print price($product->price_ttc); ?> € </span>
                                    	<span class="price product-price" id="our_price_display"><?php print price($discounted_price); ?> €</span>
                                    <?php else: ?>
                					    <span id="our_price_display"><?php print price($product->price_ttc); ?> €</span>
                					<?php endif ?>
                				<?php else: ?>
                    			    <span class="our_price_display"> FREE </span>
                    			<?php endif ?>
					
                              
                              <!-- tax incl. -->
                              <meta itemprop="price" content="<?php print price($product->price_ttc); ?>" />
                              <meta itemprop="priceCurrency" content="EUR" />
                            </p>
                            <p id="reduction_percent" style="display:none;">
                              <span id="reduction_percent_display"></span>
                            </p>
                            <p id="reduction_amount" style="display:none">
                              <span id="reduction_amount_display"></span>
                            </p>
                            <p id="old_price" class="hidden">
                              <span id="old_price_display"></span>
                              <!-- tax incl. -->
                            </p>
                          </div>
                          <!-- end prices -->
                          <div class="clear"></div>
                        </div>
                        <!-- end content_prices -->
                        <?php if ($product->price_ttc > 0): ?>
                            <div class="product_attributes clearfix">
                              <!-- quantity wanted -->
                              <p id="quantity_wanted_p">
                                <label><?php print $weblangs->trans("Quantity"); ?></label>
                                <input type="text" name="product_quantity" id="quantity_wanted" class="text" value="1" />
                                <a href="#" data-field-qty="product_quantity" class="btn btn-default button-minus product_quantity_down">
                                  <span>
                                    <i class="icon-minus"></i>
                                  </span>
                                </a>
                                <a href="#" data-field-qty="product_quantity" class="btn btn-default button-plus product_quantity_up">
                                  <span>
                                    <i class="icon-plus"></i>
                                  </span>
                                </a>
                                <span class="clearfix"></span>
                              </p>
                            </div>
                        <?php endif ?>
                        <!-- end product_attributes -->
                        <div class="box-cart-bottom">
                          <div>

                            <?php if ($product->price_ttc > 0): ?>
                                <p id="add_to_cart" class="buttons_bottom_block no-print">
                                  <button class="btn btn-default btn-lg btn-add-to-cart-product">
                                    <i class="icon-cart-plus"></i> <p><?php print $weblangs->trans("addToCart"); ?></p>
                                  </button>
                                </p>
                			<?php else: ?>
                			    <?php 
    						        // Get attached file
									$files = getPublicFilesOfObject($product);
									$url_attached_file = '';
									foreach ($files as $file) {
                                        if ($file['position'] == 100) {
                                            $url_attached_file = $file['url'];
                                        }
                                    }
								?>
								<?php if (!empty($url_attached_file)) : ?>
                    			    <a href="<?php print $url_attached_file; ?>" target="new">
                    			         <p id="add_to_cart" class="buttons_bottom_block no-print">
                                            <button class="btn btn-default btn-lg btn-add-to-cart-product">
                                                <i class="icon-cloud-download"></i> <p><?php print $weblangs->trans("download"); ?></p>
                                            </button>
                                        </p>
                                    </a>
                                <?php else : ?>
                                    <!-- Disabled button with message -->
                                    <p id="add_to_cart" class="buttons_bottom_block no-print">
                                        <button class="btn btn-default btn-lg btn-add-to-cart-product" disabled style="opacity: 0.5;" title="<?php print $weblangs->trans("NoAttachedFileFound"); ?>">
                                            <i class="icon-cloud-download"></i>
                                            <p><?php print $weblangs->trans("download"); ?></p>
                                        </button>
                                        <p style="
                                            color: #721c24;
                                            font-size: 11.5px;
                                            max-width: 90%;
                                            margin: 0px auto;
                                        ">
                                            <?php print $weblangs->trans("NoAttachedFileFound"); ?>
                                        </p>
                                    </p>
                                <?php endif; ?>
                			<?php endif ?>
                          </div>
                        </div>
                        <!-- end box-cart-bottom -->
                      </div>
                      <!-- end box-info-product -->
                    </form>
                  </div>
                  <!-- end pb-right-column-->
                  
                  <!-- thumbnails -->
                  <div id="views_block" class="clearfix ">
                      <?php if (getNbOfImagePublicURLOfObject($product) > 4): ?>
                        <span class="view_scroll_spacer">
                        	<a id="view_scroll_left" class="" title="<?php print $weblangs->trans("otherViews"); ?>" href="javascript:{}"> Previous </a>
                        </span>
                      <?php endif ?>
                    <div id="thumbs_list">
                      <ul id="thumbs_list_frame">
                        <?php for ($i=1; $i <= getNbOfImagePublicURLOfObject($product) ; $i++): ?>
                          <li id="thumbnail_<?php print $i; ?>">
                            <a href="<?php print getImagePublicURLOfObject($product,$i); ?>" src="<?php print getImagePublicURLOfObject($product,$i); ?>" class="lightbox_trigger" title="<?php print $product->label; ?>">
                              <img class="img-responsive" id="thumb_9597" src="<?php print getImagePublicURLOfObject($product,$i); ?>" alt="<?php print $product->label; ?>" title="<?php print $product->label; ?>" height="80" width="80" itemprop="image" />
                            </a>
                          </li>
                        <?php endfor ?>
                      </ul>
                    </div>
                    <!-- end thumbs_list -->
                    <?php if (getNbOfImagePublicURLOfObject($product) > 4): ?>
                        <a id="view_scroll_right" title="<?php print $weblangs->trans("otherViews"); ?>" href="javascript:{}"> Next </a>
                    <?php endif ?>
                  </div>
                  <!-- end thumbnails -->
                </div>
                <!-- end primary_block -->
                <!-- More info -->
                <section class="page-product-box">
                  <div>
                  <table class="info-table-box">
                    <tbody>
                        <tr>
                            <td>
                                <ul class="info-list-box">
                                  <?php if (isset($product->array_options['options_marketplace_module_version'])): ?>
                                    <li><b><?php print $weblangs->trans("moduleVersion"); ?></b> <span class="infos-module"><?php print $product->array_options['options_marketplace_module_version']; ?></span> </li>
                                  <?php endif ?>
                                  <?php if (isset($product->array_options['options_marketplace_min_version']) && $product->array_options['options_marketplace_max_version']): ?>
                                    <li><b><?php print $weblangs->trans("compatibility"); ?></b> <span class="infos-module"><?php print $product->array_options['options_marketplace_min_version']; ?> - <?php print $product->array_options['options_marketplace_max_version']; ?></span> </li>
                                  <?php endif ?>
                                  <?php if (isset($product->date_creation)): ?>
                                    <li><b><?php print $weblangs->trans("releaseDate"); ?></b> <span class="infos-module"><?php print $product->date_creation; ?></span> </li>
                                  <?php endif ?>
                                </ul>
                            </td>
                            <td>
                                <ul class="info-list-box">
                                  <?php if (isset($product->date_modification)): ?>
                                    <li><b><?php print $weblangs->trans("lastUpdate"); ?></b> <span class="infos-module"><?php print $product->date_modification; ?></span> </li>
                                  <?php endif ?>
                                  <?php if (isset($product->array_options['options_marketplace_contact_support'])): ?>
                                    <li><b><?php print $weblangs->trans("contactSupport"); ?></b> <span class="infos-module"><?php print $product->array_options['options_marketplace_contact_support']; ?></span> </li>
                                  <?php endif ?>
                                </ul>
                            </td>
                        </tr>
                    </tbody>
                  </table>
                  </div>
                  <h3 class="page-product-heading"><?php print $weblangs->trans("moreInfo"); ?></h3>
                  <!-- full description -->
                  <div class="rte">
                    <?php
                        if (isset($product->multilangs[$current_lang]["other"])){
                            print $product->multilangs[$current_lang]["other"];
                        }
                    ?>
                  </div>
                  <br>
                  <br>
                  <!--<ul id="usefull_link_block" class="clearfix no-print">
                    <br>
                    <b>This module has not been sold enough or has been on sale for a too short to have statistics</b>
                    <li id="left_share_fb">
                      <a href="#" class="_blank">Share on Facebook!</a>
                    </li>
                  </ul>-->
                </section>
                <!--end  More info -->
                <!--HOOK_PRODUCT_TAB -->
                <section class="page-product-box"></section>
                <!--end HOOK_PRODUCT_TAB -->
                <!-- description & features -->
              </div>
              <!-- itemscope product wrapper -->
              </div>
            </div>
            <?php } ?>
          </div>
        </div>
      </div>
      <!-- .columns-container -->
      <div class="footer-container">
        <?php includeContainer('footer'); ?>
      </div>
    </div>
    <script src="/document.php?modulepart=medias&file=js/all.js"></script>

  </body>
</html>