<?php echo $header; ?>
<div class="container-fluid p-0 bread_backg">
  <div class="container">
      <ul class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
        <?php } ?>
      </ul>
  </div>
</div>
<div id="img_loader" class="lodaer_class">
    <img src="<?php echo HTTPS_SERVER."image/loader.gif"?>" class="loadinggif" >
</div>
<div class="PP container">
  <div class="container mt-10"><?php echo $column_left; ?>
    <?php if ($column_left && $column_right) { ?>
    <?php $class = 'col-sm-6'; ?>
    <?php } elseif ($column_left || $column_right) { ?>
    <?php $class = 'col-sm-9'; ?>
    <?php } else { ?>
    <?php $class = 'col-sm-12'; ?>
    <?php } ?>
    <div id="content" class="<?php echo $class; ?>"><?php echo $content_top; ?>
      <div class="row">
        <?php if ($column_left || $column_right) { ?>
        <?php $class = 'col-sm-6'; ?>
        <?php } else { ?>
        <?php $class = 'col-sm-5'; ?>
        <?php } ?>
<div id="loading" class="<?php echo $class; ?> text-center">
          <img src="/catalog/view/theme/deercase/image/placeholder250.png" class="w-100" />
        </div>
<!-- Image Canvas -->
<div class="bLoading d-none <?php echo $class; ?>">
<? preg_match ('/(SEFFAF_SAYDAM-SILVER|SEFFAF_SAYDAM-BLACK)/', $thumb, $__fImage); ?>
<? if ($__fImage && $__fImage [0]): ?>
            <div class="fImage__Colors">
              <button class="fImage__Color fImage__Color--BLACK" onclick="$('.thumbnails > .owl-carousel').addClass ('d-none'); $('.fImage__BLACK--Carousel').removeClass ('d-none'); $('.fImage__SILVER').hide (); $('.fImage__BLACK').show (); $('#CustomizationText').appendTo ('.fImage__BLACK--Carousel .ThumbBox--Customization'); $('#product_image').val ($('#product_image--BLACK').val ());"></button>
              <button class="fImage__Color fImage__Color--SILVER" onclick="$('.thumbnails > .owl-carousel').addClass ('d-none'); $('.fImage__SILVER--Carousel').removeClass ('d-none'); $('.fImage__BLACK').hide (); $('.fImage__SILVER').show (); $('#CustomizationText').appendTo ('.fImage__SILVER--Carousel .ThumbBox--Customization'); $('#product_image').val ($('#product_image--SILVER').val ());"></button>
            </div>
          <? endif; ?>
<ul class="thumbnails">
<? if ($__fImage && $__fImage [0]): ?>
              <li class="fImage__BLACK--Carousel owl-carousel custom-0008">
                <div class="ThumbBox--Customization" id="img_canvas">
                  <div id="canvas_media"></div>
                  <img class="Second_Layer" src="" title="" alt="" />
                  <div id="CustomizationText" class="TextFont--Glitter <?= ($product_type != 4)? 'TextPosition--Bottom': 'TextPosition--Horizontal'; ?>"></div>
                  <input type="hidden" name="product_image--BLACK" id="product_image--BLACK" value="" />
                </div>
              </li>
              <li class="fImage__SILVER--Carousel d-none owl-carousel custom-0008">
                <div class="ThumbBox--Customization" id="img_canvas">
                  <div id="canvas_media"></div>
                  <img class="Second_Layer" src="" title="" alt="" />
                  <input type="hidden" name="product_image--SILVER" id="product_image--SILVER" value="" />
                </div>
              </li>
            <? else: ?>
              <li class="owl-carousel custom-0008">
                <div class="ThumbBox--Customization" id="img_canvas">
                  <div id="canvas_media">
                    <? if ($product_type == 0): ?>
                      <img id="pimage" src="<?= $popup; ?>" width="500">
                    <? endif; ?>
                  </div>
                  <img class="Second_Layer" src="" title="" alt="" />
                  <div id="CustomizationText" class="TextFont--Glitter <?= ($product_type != 4)? 'TextPosition--Bottom': 'TextPosition--Horizontal'; ?>"></div>
                </div>
                <!--<?php foreach ($images as $image): ?>
                  <div class="ThumbBox mr-20">
                    <img class="PP__Image w-100" src="<?= $image['popup']; ?>" />
                  </div>
                <?php endforeach; ?>-->
              </li>
            <? endif; ?>
<div class="clearfix hidden-xs"></div>
            <br class="hidden-xs" />
<? if ($__fImage && $__fImage [0]): ?>
              <li class="fImage__<?= ($__fImage [0] == 'SEFFAF_SAYDAM-BLACK')? 'BLACK': 'SILVER'; ?> image-additional hidden-xs">
                <a class="thumbnail border-0" href="javascript: $('.thumbnails > .owl-carousel.fImage__BLACK--Carousel').trigger ('to.owl', [0, 300]);">
                  <img src="<?= $thumb; ?>" data-src="<?= $popup; ?>" />
                </a>
              </li>
            <? else: ?>
              <li class="image-additional hidden-xs">
                <a class="thumbnail border-0" href="javascript: $('.thumbnails > .owl-carousel').trigger ('to.owl', [0, 300]);">
                  <img src="<?= $thumb; ?>" data-src="<?= $popup; ?>" />
                </a>
              </li>
            <? endif; ?>
            <?php foreach ($images as $index => $image): ?>
              <? preg_match ('/(SEFFAF_SAYDAM-SILVER|SEFFAF_SAYDAM-BLACK)/', $image ['thumb'], $__fImage); ?>
              <? if ($__fImage && $__fImage [0]): ?>
                <?
                  $__fImageBlackCarouselIndex = 0;
                  $__fImageSilverCarouselIndex = 0;
                ?>
                <? if ($__fImage [0] == "SEFFAF_SAYDAM-BLACK"): ?>
                  <li class="fImage__BLACK image-additional hidden-xs">
                    <a class="thumbnail border-0" href="javascript: $('.thumbnails > .owl-carousel.fImage__BLACK--Carousel').trigger ('to.owl', [<?= $__fImageBlackCarouselIndex++; ?>, 300]);">
                      <img src="<?= $image['thumb']; ?>" data-src="<?= $image['popup']; ?>" />
                    </a>
                  </li>
                <? elseif ($__fImage [0] == "SEFFAF_SAYDAM-SILVER"): ?>
                  <li class="fImage__SILVER image-additional hidden-xs">
                    <a class="thumbnail border-0" href="javascript: $('.thumbnails > .owl-carousel.fImage__SILVER--Carousel').trigger ('to.owl', [<?= $__fImageSilverCarouselIndex++; ?>, 300]);">
                      <img src="<?= $image['thumb']; ?>" data-src="<?= $image['popup']; ?>" />
                    </a>
                  </li>
                <? else: ?>
                <? endif; ?>
              <? else: ?>
                <li class="image-additional hidden-xs">
                  <a class="thumbnail border-0" href="javascript: $('.thumbnails > .owl-carousel').trigger ('to.owl', [<?= $index + 1; ?>, 300]);">
                    <img src="<?= $image['thumb']; ?>" data-src="<?= $image['popup']; ?>" />
                  </a>
                </li>
              <? endif; ?>
            <?php endforeach; ?>
</ul>
<script>
            jQuery (function ($) {
              $('.thumbnails > .owl-carousel').owlCarousel ({
                items: 1,
                pagination: true
              });
            });
          </script>
<script>
            jQuery (function ($) {
              $('.thumbnails').bind('contextmenu', function(e) {return false;});
            });
          </script>
        </div>
<!-- Image Canvas -->
<?php if ($column_left || $column_right) { ?>
        <?php $class = 'col-sm-6'; ?>
        <?php } else { ?>
        <?php $class = 'col-sm-5 col-sm-push-1'; ?>
        <?php } ?>
        <div class="<?php echo $class; ?>">
<h1 class="mt-0 mb-3 PP__Title"><?php echo $heading_title; ?></h1>
          <input type="hidden" name="product_id" value="<?=$product_id;?>" />
          <input type="hidden" name="model" value="<?=$model;?>" />
          <?=$model;?>
          <?php if ($price) { ?>
          <ul class="list-unstyled">
            <?php if (!$special) { ?>
            <li>
              <h3 class="d-inline PP__Price"><?php echo $price; ?></h3>
            </li>
            <?php } else { ?>
            <li>
              <span style="text-decoration: line-through;"><?php echo $price; ?></span>
              <h3 class="d-inline ml-5 PP__Price"><?php echo $special; ?></h3>
            </li>
             <?php } ?>
</ul>
          <?php } ?>
<br />
          <label class="PP__OptionTitle">Telefon Modelini Seçiniz</label>
            <select class="CategorySelectbox ml-0 custom-0002" id="all_categories" >
            </select>
            <div class="CategorySelectbox__Appearance">
              <i class="CategorySelectbox__AppearanceIcon fa fa-chevron-down"></i>
            </div>
<select class="CategorySelectbox ml-10 custom-0002" id="sub_categories">
            </select>
            <div class="CategorySelectbox__Appearance">
              <i class="CategorySelectbox__AppearanceIcon fa fa-chevron-down"></i>
            </div>
          <div class="<?= ($product_type == 0)? 'd-none': ''; ?>">
            <label class="PP__OptionTitle">Bu Modeli Başka Bir Kılıfta Dene</label>
            <div class="row px-15" id="attribute_cases">
</div>
            <label class="PP__OptionTitle Disabled">Bu modeldeki stoklarımız tükenmiştir.</label>
            <div class="clearfix"></div>
            <br />
          </div>
          <label class="PP__OptionTitle">Kılıf Rengini Seçin</label>
          <div class="row px-15" id="attribute_color_cases">
</div>
          <div class="clearfix"></div>
          <br />
          <?php if ($product_type != 0): ?>
            <div class="PP__CustomizationText">
              <input class="PP__CustomizationTextInput" type="text" name="customizetext" id="customizetext" placeholder="DOKUN VE BURAYA İSMİNİ YAZ" maxlength="10" />
              <div class="PP__CustomizationTextColors">
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--000000" data-color="000000"></button>
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--FFFFFF" data-color="FFFFFF"></button>
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--5F4D80" data-color="5F4D80"></button>
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--133168" data-color="133168"></button>
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--FFC3D0" data-color="FFC3D0"></button>
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--FF43A5" data-color="FF43A5"></button>
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--FA6827" data-color="FA6827"></button>
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--F4CE11" data-color="F4CE11"></button>
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--F8F4CA" data-color="F8F4CA"></button>
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--B8DEC6" data-color="B8DEC6"></button>
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--CAE8EA" data-color="CAE8EA"></button>
                <button class="PP__CustomizationTextColor PP__CustomizationTextColor--C8AFD5" data-color="C8AFD5"></button>
              </div>
              <input type="hidden" name="customizeColor" id="customizeColor">
              <input type="hidden" name="customizeFont" id="customizeFont">
              <input type="hidden" name="customizetextPosition" id="customizetextPosition">
              <div class="d-flex justify-content-between">
                <div class="PP__CustomizationTextFonts">
                  <button class="PP__CustomizationTextFont PP__CustomizationTextFont--Glitter" data-font="Glitter">a</button>
                  <button class="PP__CustomizationTextFont PP__CustomizationTextFont--RobotoMono" data-font="RobotoMono">a</button>
                  <button class="PP__CustomizationTextFont PP__CustomizationTextFont--Runway" data-font="Runway">a</button>
                </div>
                <div class="PP__CustomizationTextPositions" style="display: none">
                  <?php if ($product_type != 4): ?>
                    <button class="PP__CustomizationTextPosition PP__CustomizationTextPosition--Center" data-position="Center"></button>
                    <button class="PP__CustomizationTextPosition PP__CustomizationTextPosition--Bottom" data-position="Bottom"></button>
                  <?php else: ?>
                    <button class="PP__CustomizationTextPosition PP__CustomizationTextPosition--Horizontal" data-position="Horizontal"></button>
                    <button class="PP__CustomizationTextPosition PP__CustomizationTextPosition--Vertical" data-position="Vertical"></button>
                  <?php endif; ?>
                </div>
              </div>
              <script>
                jQuery (function ($) {
// .PP__CustomizationTextInput#customizetext: Change
                  $('.PP__CustomizationTextInput#customizetext').keyup (function () {
if($('#customizetextPosition').val()!='Vertical'){
                          if($('#product_type').val()==4){
                              $('.Second_Layer').attr('src','');
                          }
                    if ($('#CustomizationText').hasClass ('TextFont--Glitter') && $(this).val () != '') $('#CustomizationText').text ('[' + $(this).val () + ']');
                    else $('#CustomizationText').text ($(this).val ());
if ($(this).val () != '')
                    {
if ($('#CustomizationText').hasClass ('TextFont--Glitter'))
                      {
                        if ($('#CustomizationText').hasClass ('TextPosition--Vertical'))
                          if (768 < $(window).width ()) targetWidth = 440;
                          else targetWidth = 265;
else
                          if (768 < $(window).width ()) targetWidth = 215;
                          else targetWidth = 132;
$('#CustomizationText').css ('font-size', '1px');
                        do {
                          $('#CustomizationText').css ('font-size', (parseInt($('#CustomizationText').css ('font-size')) + 1) + "px");
                        } while ($('#CustomizationText').width () <= targetWidth);
                      }
else $('#CustomizationText').css ('font-size', '20px');
}
                      }else{
                          $('#CustomizationText').text ('');
                      }
});
// .PP__CustomizationTextColor: Click
                  $('.PP__CustomizationTextColor').click (function () {
                    $('#customizeColor').val($(this).attr('data-color'));
                    $('#CustomizationText')
                      .removeClass (function (index, className) {
                          return (className.match (/(^|\s)TextColor--\S+/g) || []).join(' ');
                      })
                      .addClass ('TextColor--' + $(this).attr ('data-color'));
                  });
// .PP__CustomizationTextFont: Click
                  $('.PP__CustomizationTextFont').click (function () {
                    $('#customizeFont').val($(this).attr('data-font'));
                    $('#CustomizationText')
                      .removeClass (function (index, className) {
                          return (className.match (/(^|\s)TextFont--\S+/g) || []).join(' ');
                      })
                      .addClass ('TextFont--' + $(this).attr ('data-font'));
$('.PP__CustomizationTextInput').trigger ('keyup');
                  });
// .PP__CustomizationTextPosition: Click
                  $('.PP__CustomizationTextPosition').click (function () {
                    $('#customizetextPosition').val($(this).attr('data-position'));
                    $('#CustomizationText')
                      .removeClass (function (index, className) {
                          return (className.match (/(^|\s)TextPosition--\S+/g) || []).join(' ');
                      })
                      .addClass ('TextPosition--' + $(this).attr ('data-position'));
$('.PP__CustomizationTextInput').trigger ('keyup');
                  });
});
              </script>
            </div>
          <?php endif; ?>
<div class="PP__CustomizationText gradient" style="display: none">
                <input class="PP__CustomizationTextInput" type="text" name="gradienttext" id="gradienttext" placeholder="DOKUN VE BURAYA HARFİNİ YAZ" maxlength="3" />
                <input type="hidden" name="texture" id="texture"> 
                  <input type="hidden" name="ref_img" id="ref_img"> 
                  <label class="pt-10 pb-2 ml-10">HARFİNİN RENGİNİ DEĞİŞTİR</label>
                  <div class="" style="padding-bottom: 10px;">
                    <span class="ml-10"><img class="texture" height="30" width="30" src="<?php echo $texture1 ?>" > </span>
                    <span class="ml-10"><img class="texture" height="30" width="30" src="<?php echo $texture2 ?>" > </span>
                    <span class="ml-10"><img class="texture" height="30" width="30" src="<?php echo $texture3 ?>" > </span>
                    <span class="ml-10"><img class="texture" height="30" width="30" src="<?php echo $texture4?>" > </span>
                    <span class="ml-10"><img class="texture" height="30" width="30" src="<?php echo $texture5 ?>" > </span>
                    <span class="ml-10"><img class="texture" height="30" width="30" src="<?php echo $texture6 ?>" > </span>
                    <span class="ml-10"><img class="texture" height="30" width="30" src="<?php echo $texture7 ?>" > </span>
                    <span class="ml-10"><img class="texture" height="30" width="30" src="<?php echo $texture8 ?>" > </span>
                  </div>
              </div>
          <div id="product">
          	   <input type="hidden" name="pattern_url" id="pattern_url">
                <input type="hidden" name="product_image" id="product_image">
<input type="hidden" name="pattern_mask" id="pattern_mask">
               <input type="hidden" name="order_img" id="order_img">
                <input type="hidden" name="customer_order_image" id="customer_order_image">
            <?php if ($options) { ?>
            <hr>
            <h3><?php echo $text_option; ?></h3>
            <?php foreach ($options as $option) { ?>
            <?php if ($option['type'] == 'select') { ?>
            <div class="form-group<?php echo ($option['required'] ? ' required' : ''); ?>">
              <label class="control-label" for="input-option<?php echo $option['product_option_id']; ?>"><?php echo $option['name']; ?></label>
              <select name="option[<?php echo $option['product_option_id']; ?>]" id="input-option<?php echo $option['product_option_id']; ?>" class="form-control">
                <option value=""><?php echo $text_select; ?></option>
                <?php foreach ($option['product_option_value'] as $option_value) { ?>
                <option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
                <?php if ($option_value['price']) { ?>
                (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
                <?php } ?>
                </option>
                <?php } ?>
              </select>
            </div>
            <?php } ?>
            <?php if ($option['type'] == 'radio') { ?>
            <div class="form-group<?php echo ($option['required'] ? ' required' : ''); ?>">
              <label class="control-label"><?php echo $option['name']; ?></label>
              <div id="input-option<?php echo $option['product_option_id']; ?>">
                <?php foreach ($option['product_option_value'] as $option_value) { ?>
                <div class="radio">
                  <label>
                    <input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" />
                    <?php if ($option_value['image']) { ?>
                    <img src="<?php echo $option_value['image']; ?>" alt="<?php echo $option_value['name'] . ($option_value['price'] ? ' ' . $option_value['price_prefix'] . $option_value['price'] : ''); ?>" class="img-thumbnail" />
                    <?php } ?>
                    <?php echo $option_value['name']; ?>
                    <?php if ($option_value['price']) { ?>
                    (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
                    <?php } ?>
                  </label>
                </div>
                <?php } ?>
              </div>
            </div>
            <?php } ?>
            <?php if ($option['type'] == 'checkbox') { ?>
            <div class="form-group<?php echo ($option['required'] ? ' required' : ''); ?>">
              <label class="control-label"><?php echo $option['name']; ?></label>
              <div id="input-option<?php echo $option['product_option_id']; ?>">
                <?php foreach ($option['product_option_value'] as $option_value) { ?>
                <div class="checkbox">
                  <label>
                    <input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" />
                    <?php if ($option_value['image']) { ?>
                    <img src="<?php echo $option_value['image']; ?>" alt="<?php echo $option_value['name'] . ($option_value['price'] ? ' ' . $option_value['price_prefix'] . $option_value['price'] : ''); ?>" class="img-thumbnail" />
                    <?php } ?>
                    <?php echo $option_value['name']; ?>
                    <?php if ($option_value['price']) { ?>
                    (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
                    <?php } ?>
                  </label>
                </div>
                <?php } ?>
              </div>
            </div>
            <?php } ?>
            <?php } ?>
            <?php } ?>
            <div class="form-group">
              <label class="control-label d-none" for="input-quantity"><?php echo $entry_qty; ?></label>
              <input type="text" name="quantity" value="<?php echo $minimum; ?>" size="2" id="input-quantity" class="form-control d-none" />
              <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
                <input type="hidden" name="product_type" id="product_type" value="<?php echo $product_type; ?>" />
              <input type="hidden" name="product_id_n" value="<?php echo $product_id; ?>" />
              <input type="hidden" name="pre_attrib" value="<?php echo $color_attr_id; ?>" />
              <input type="hidden" name="pre_case_attrib" value="<?php echo $collection_attr_id; ?>" />
              <button type="button" id="button-cart" data-loading-text="<?php echo $text_loading; ?>" class="PP__Button btn btn-primary btn-lg"><?php echo $button_cart; ?></button>
              <button type="button" id="button-checkout" data-loading-text="<?php echo $text_loading; ?>" class="PP__Button PP__Button--Green btn btn-primary btn-lg px-15 pull-right"><?= $text_buynow; ?></button>
            </div>
            <?php if ($minimum > 1) { ?>
            <div class="alert alert-info"><i class="fa fa-info-circle"></i> <?php echo $text_minimum; ?></div>
            <?php } ?>
          </div>
        </div>
      </div>
      <ul class="nav nav-tabs mb-0 custom-0005">
        <li class="active"><a href="#tab-description" data-toggle="tab"><?php echo $tab_description; ?></a></li>
        <?php if ($attribute_groups) { ?>
        <li><a href="#tab-specification" data-toggle="tab"><?php echo $tab_attribute; ?></a></li>
        <?php } ?>
        <?php if ($review_status) { ?>
        <li><a href="#tab-review" data-toggle="tab"><?php echo $tab_review; ?></a></li>
        <?php } ?>
      </ul>
      <div class="tab-content p-10 bgc-f2f2f2 custom-0006">
        <div class="tab-pane active" id="tab-description"><?php echo $description; ?></div>
        <?php if ($attribute_groups) { ?>
        <div class="tab-pane" id="tab-specification">
          <table class="table table-bordered bgc-fff">
            <?php foreach ($attribute_groups as $attribute_group) { ?>
            <thead>
              <tr>
                <td colspan="2"><strong><?php echo $attribute_group['name']; ?></strong></td>
              </tr>
            </thead>
            <tbody>
              <?php foreach ($attribute_group['attribute'] as $attribute) { ?>
              <tr>
                <td><?php echo $attribute['name']; ?></td>
                <td><?php echo $attribute['text']; ?></td>
              </tr>
              <?php } ?>
            </tbody>
            <?php } ?>
          </table>
        </div>
        <?php } ?>
        <?php if ($review_status) { ?>
        <div class="tab-pane" id="tab-review">
          <form class="form-horizontal" id="form-review">
            <div id="review"></div>
            <h2><?php echo $text_write; ?></h2>
            <?php if ($review_guest) { ?>
            <div class="form-group required">
              <div class="col-sm-12">
                <label class="control-label" for="input-name"><?php echo $entry_name; ?></label>
                <input type="text" name="name" value="<?php echo $customer_name; ?>" id="input-name" class="form-control" />
              </div>
            </div>
            <div class="form-group required">
              <div class="col-sm-12">
                <label class="control-label" for="input-review"><?php echo $entry_review; ?></label>
                <textarea name="text" rows="5" id="input-review" class="form-control"></textarea>
                <div class="help-block"><?php echo $text_note; ?></div>
              </div>
            </div>
            <div class="form-group required">
              <div class="col-sm-12">
                <style>
                    #Reytingsss {}
                        #Reytingsss .rating-group {display: inline-flex;}
                        #Reytingsss .rating__icon {pointer-events: none;}
                        #Reytingsss .rating__input {position: absolute !important; left: -9999px !important;}
                        #Reytingsss .rating__input--none {display: none;}
                        #Reytingsss .rating__label {cursor: pointer; padding: 0 0.1em; font-size: 2rem;}
                        #Reytingsss .rating__icon--star {color: orange; font-size: 2rem;}
                        #Reytingsss .rating__input:checked ~ .rating__label .rating__icon--star {color: #DDD;}
                        #Reytingsss .rating-group:hover .rating__label .rating__icon--star {color: orange;}
                        #Reytingsss .rating__input:hover ~ .rating__label .rating__icon--star {color: #DDD;}
                </style>
                <div id="Reytingsss">
                    <div class="rating-group">
                        <input disabled checked class="rating__input rating__input--none" name="rating" id="rating-none" value="0" type="radio">
                        <label aria-label="1 star" class="rating__label" for="rating-1"><i class="rating__icon rating__icon--star fa fa-star"></i></label>
                        <input class="rating__input" name="rating" id="rating-1" value="1" type="radio">
                        <label aria-label="2 stars" class="rating__label" for="rating-2"><i class="rating__icon rating__icon--star fa fa-star"></i></label>
                        <input class="rating__input" name="rating" id="rating-2" value="2" type="radio">
                        <label aria-label="3 stars" class="rating__label" for="rating-3"><i class="rating__icon rating__icon--star fa fa-star"></i></label>
                        <input class="rating__input" name="rating" id="rating-3" value="3" type="radio">
                        <label aria-label="4 stars" class="rating__label" for="rating-4"><i class="rating__icon rating__icon--star fa fa-star"></i></label>
                        <input class="rating__input" name="rating" id="rating-4" value="4" type="radio">
                        <label aria-label="5 stars" class="rating__label" for="rating-5"><i class="rating__icon rating__icon--star fa fa-star"></i></label>
                        <input class="rating__input" name="rating" id="rating-5" value="5" type="radio">
                    </div>
                </div>
              </div>
            </div>
            <?php echo $captcha; ?>
            <div class="buttons clearfix">
              <div class="pull-right">
                <button type="button" id="button-review" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary"><?php echo $button_continue; ?></button>
              </div>
            </div>
            <?php } else { ?>
            <?php echo $text_login; ?>
            <?php } ?>
          </form>
        </div>
        <?php } ?>
      </div>
      <?php if ($products) { ?>
      <h3><?php echo $text_related; ?></h3>
      <div class="row">
        <?php $i = 0; ?>
        <?php foreach ($products as $product) { ?>
        <?php if ($column_left && $column_right) { ?>
        <?php $class = 'col-xs-8 col-sm-6'; ?>
        <?php } elseif ($column_left || $column_right) { ?>
        <?php $class = 'col-xs-6 col-md-4'; ?>
        <?php } else { ?>
        <?php $class = 'col-xs-6 col-sm-3'; ?>
        <?php } ?>
        <div class="<?php echo $class; ?>">
          <div class="product-thumb transition">
            <div class="image"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" alt="<?php echo $product['name']; ?>" title="<?php echo $product['name']; ?>" class="img-responsive" /></a></div>
            <div class="caption">
              <h4><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></h4>
              <p><?php echo $product['description']; ?></p>
              <?php if ($product['rating']) { ?>
              <div class="rating">
                <?php for ($j = 1; $j <= 5; $j++) { ?>
                <?php if ($product['rating'] < $j) { ?>
                <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-1x"></i></span>
                <?php } else { ?>
                <span class="fa fa-stack"><i class="fa fa-star fa-stack-1x"></i><i class="fa fa-star-o fa-stack-1x"></i></span>
                <?php } ?>
                <?php } ?>
              </div>
              <?php } ?>
              <?php if ($product['price']) { ?>
              <p class="price">
                <?php if (!$product['special']) { ?>
                <?php echo $product['price']; ?>
                <?php } else { ?>
                <span class="price-new"><?php echo $product['special']; ?></span> <span class="price-old"><?php echo $product['price']; ?></span>
                <?php } ?>
                <?php if ($product['tax']) { ?>
                <span class="price-tax"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
                <?php } ?>
              </p>
              <?php } ?>
            </div>
            <div class="button-group">
              <button type="button" onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');"><span class="hidden-xs hidden-sm hidden-md"><?php echo $button_cart; ?></span> <i class="fa fa-shopping-cart"></i></button>
              <button type="button" data-toggle="tooltip" title="<?php echo $button_wishlist; ?>" onclick="wishlist.add('<?php echo $product['product_id']; ?>');"><i class="fa fa-heart"></i></button>
              <button type="button" data-toggle="tooltip" title="<?php echo $button_compare; ?>" onclick="compare.add('<?php echo $product['product_id']; ?>');"><i class="fa fa-exchange"></i></button>
            </div>
          </div>
        </div>
        <?php if (($column_left && $column_right) && (($i+1) % 2 == 0)) { ?>
        <div class="clearfix visible-md visible-sm"></div>
        <?php } elseif (($column_left || $column_right) && (($i+1) % 3 == 0)) { ?>
        <div class="clearfix visible-md"></div>
        <?php } elseif (($i+1) % 4 == 0) { ?>
        <div class="clearfix visible-md"></div>
        <?php } ?>
        <?php $i++; ?>
        <?php } ?>
      </div>
      <?php } ?>
      <?php if ($tags) { ?>
      <p><?php echo $text_tags; ?>
        <?php for ($i = 0; $i < count($tags); $i++) { ?>
        <?php if ($i < (count($tags) - 1)) { ?>
        <a href="<?php echo $tags[$i]['href']; ?>"><?php echo $tags[$i]['tag']; ?></a>,
        <?php } else { ?>
        <a href="<?php echo $tags[$i]['href']; ?>"><?php echo $tags[$i]['tag']; ?></a>
        <?php } ?>
        <?php } ?>
      </p>
      <?php } ?>
      <?php echo $content_bottom; ?></div>
    <?php echo $column_right; ?></div>
</div>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js"></script>
<script>
    var _changeInterval = null;
    if($('#product_type').val()=='2' || $('#product_type').val()=='3')
        {
$("#gradienttext").keyup(function() {
clearInterval(_changeInterval)
  _changeInterval = setInterval(function() {
    clearInterval(_changeInterval)
    var customizeColor=  $('#customizeColor').val(); 
      var  texture=	 $('#texture').val();
            var gradienttext=  $('#gradienttext').val();
            var product_image=  $('#product_image').val();
            var ref_img=  $('#ref_img').val();
      var product_type=  $("input[name='product_type']").val();
    $.ajax({
		url: 'index.php?route=piyerSoft/cases/getimage',
		type: 'post',
         data: { gradienttext : gradienttext,texture:texture,product_type:product_type,customizeColor:customizeColor,product_image:product_image,ref_img:ref_img },
		dataType: 'json',
		success: function(json) {
            $('#pimage').attr('src',json['src']);
             $('#ref_img').val(json['ref']);
		},
        error: function (xhr, ajaxOptions, thrownError) {
             $('#img_loader').hide();
                        alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	});
  }, 300);
});
    $('.texture').on('click', function () {
   var filename=$(this).attr('src').substring($(this).attr('src').lastIndexOf('/')+1);
                	 $('#texture').val(filename);
      var gradienttext=  $('#gradienttext').val();
        var customizeColor=  $('#customizeColor').val();
         var product_image=  $('#product_image').val();
         var product_type=  $("input[name='product_type']").val();
 var ref_img=  $('#ref_img').val();       
    $('#img_loader').show();
        $.ajax({
		url: 'index.php?route=piyerSoft/cases/getimage',
		type: 'post',
            data: { gradienttext : gradienttext,texture:filename,product_type:product_type,customizeColor:customizeColor,product_image:product_image,ref_img:ref_img },
		dataType: 'json',
		success: function(json) {
             //$('#pimage').attr('src','');
             $('#pimage').attr('src',json['src']);
            $('#ref_img').val(json['ref']);
             $('#img_loader').hide();
		},
        error: function (xhr, ajaxOptions, thrownError) {
             $('#img_loader').hide();
                        alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	});
});
        }
$('.PP__CustomizationTextColor').click (function () {
    var product_type=  $("input[name='product_type']").val();
   var customizetextPosition  =$('#customizetextPosition').val();
    if(product_type==2|| product_type==3 ){
        var customizeColor=  $(this).attr('data-color'); 
      var texture=	 $('#texture').val();
            var gradienttext=  $('#gradienttext').val();
var product_image=  $('#product_image').val();
            var ref_img=  $('#ref_img').val();
$('#img_loader').show();
        $.ajax({
		url: 'index.php?route=piyerSoft/cases/getimage',
		type: 'post',
         data: { gradienttext : gradienttext,texture:texture,product_type:product_type,customizeColor:customizeColor,product_image:product_image,ref_img:ref_img },
		dataType: 'json',
		success: function(json) {
            // $('#pimage').attr('src','');
             $('#pimage').attr('src',json['src']);
            $('#ref_img').val(json['ref']);
             $('#img_loader').hide();
		},
        error: function (xhr, ajaxOptions, thrownError) {
             $('#img_loader').hide();
                        alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	});
}else if(product_type==4 && customizetextPosition=='Vertical'){
         $('#img_loader').show(); 
        var customizetext=  $('#customizetext').val();
        var customizeFont=  $('#customizeFont').val();
        var ref_img=  $('#ref_img').val();
         var customizeColor=  $(this).attr('data-color'); 
var pattern_mask=  $('#pattern_mask').val();
           $.ajax({
		url: 'index.php?route=piyerSoft/cases/getverticaltextimage',
		type: 'post',
         data: { customizetext : customizetext,customizeFont:customizeFont,customizeColor:customizeColor,product_mask:pattern_mask,ref_img:ref_img },
		dataType: 'json',
		success: function(json) {
            // $('#pimage').attr('src','');
             $('.Second_Layer').attr('src',json['src']);
            $('#ref_img').val(json['ref']);
             $('#img_loader').hide();
		},
        error: function (xhr, ajaxOptions, thrownError) {
             $('#img_loader').hide();
                        alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	}); 
    } 
});
    $('.PP__CustomizationTextPosition--Vertical').click (function () { 
    var product_type=  $("input[name='product_type']").val();
if(product_type==4){
var customizetext=  $('#customizetext').val();
        var customizeFont=  $('#customizeFont').val();
        var ref_img=  $('#ref_img').val();
         var customizeColor=  $('#customizeColor').val();
        var pattern_mask=  $('#pattern_mask').val();
        $('#img_loader').show();
$.ajax({
		url: 'index.php?route=piyerSoft/cases/getverticaltextimage',
		type: 'post',
         data: { customizetext : customizetext,customizeFont:customizeFont,customizeColor:customizeColor,product_mask:pattern_mask,ref_img:ref_img },
		dataType: 'json',
		success: function(json) {
            // $('#pimage').attr('src','');
             $('.Second_Layer').attr('src',json['src']);
            $('#ref_img').val(json['ref']);
             $('#img_loader').hide();
		},
        error: function (xhr, ajaxOptions, thrownError) {
             $('#img_loader').hide();
                        alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	}); 
    } 
});
     $('.PP__CustomizationTextFont').click (function () { 
    var product_type=  $("input[name='product_type']").val();
          var customizetextPosition=  $("#customizetextPosition").val();
    if(product_type==4 && customizetextPosition== 'Vertical'){
var customizetext=  $('#customizetext').val();
        var customizeFont=  $(this).attr('data-font');
        var ref_img=  $('#ref_img').val();
         var customizeColor=  $('#customizeColor').val();
        var pattern_mask=  $('#pattern_mask').val();
$('#img_loader').show();
           $.ajax({
		url: 'index.php?route=piyerSoft/cases/getverticaltextimage',
		type: 'post',
         data: { customizetext : customizetext,customizeFont:customizeFont,customizeColor:customizeColor,product_mask:pattern_mask,ref_img:ref_img },
		dataType: 'json',
		success: function(json) {
            // $('#pimage').attr('src','');
             $('.Second_Layer').attr('src',json['src']);
            $('#ref_img').val(json['ref']);
             $('#img_loader').hide();
		},
        error: function (xhr, ajaxOptions, thrownError) {
             $('#img_loader').hide();
                        alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	}); 
    } 
});
$('.texture').on('click', function () {
     var filename=$(this).attr('src').substring($(this).attr('src').lastIndexOf('/')+1);
               	 $('#texture').val(filename);
});
</script>
<script>
    $('#button-cart').on('click', function () {
        $('#img_loader').show();
      var temp=$('#CustomizationText').siblings ('#canvas_media').html();
      if(!$('#CustomizationText').siblings ("#canvas_media").children ("#pimage").length){
        $('#CustomizationText').siblings ('#canvas_media').html('');
      var img=  '<img src="'+ $('#product_image').val() +'" width="500" />';
      $('#CustomizationText').siblings ('#canvas_media').html(img);
      }//console.log (temp, img)
      html2canvas(document.getElementById("img_canvas"), {
                    onrendered: function (canvas) {
                        canvas.className = "html2canvas";
                        var image = canvas.toDataURL("image/png");
                        var imgdata = image.replace(/^data:image\/(png|jpg);base64,/, "");
                        $('#customer_order_image').val(imgdata);
                    },
                    useCORS: true
                });
      setTimeout(function(){
       $('#CustomizationText').siblings ('#canvas_media').html('');
                  $('#CustomizationText').siblings ('#canvas_media').html(temp);
$.ajax({
            url: 'index.php?route=piyerSoft/cases',
            type: 'post',
            data: $('#pattern_url,#pattern_mask,#customizetext,#customizeColor,#customizeFont,#customizetextPosition,#product_type'),
            dataType: 'json',
            beforeSend: function () {
                $('#button-cart').button('loading');
},
            complete: function () {
                $('#button-cart').button('reset');
            },
            success: function (res) {
              if(res.responce=='success'){
                $('#order_img').val(res.order_img);
               }
                $.ajax({
		url: 'index.php?route=checkout/cart/add',
		type: 'post',
		data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea,#customizetext,#customizeColor,#customizeFont,#customizetextPosition,#gradienttext,#texture'),
		dataType: 'json',
		beforeSend: function() {
			$('#button-cart').button('loading');
		},
		complete: function() {
			$('#button-cart').button('reset');
            $('#img_loader').hide();
		},
		success: function(response) {
if (response.text_items_only) $('#cart-total').text (response.text_items_only);
if (response.success)
        $.sweetModal ({
            content: response.success,
            icon: $.sweetModal.ICON_SUCCESS,
            timeout: 2000
        });
else
        for (e in response.error.option)
            $.sweetModal ({
                content: response.error.option [e],
                icon: $.sweetModal.ICON_ERROR,
                timeout: 2000
            });
},
        error: function(xhr, ajaxOptions, thrownError) {
            alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	});
            }
        });
          }, 700);
    });
</script>
<script>
jQuery (function ($) {
var ProductID = $('input[name="product_id"]').val ();
$.ajax ({
      url: 'index.php?route=product/product/getProductInfo',
      data: { product_id : ProductID },
      dataType: 'json',
      type: 'POST',
      success: function (jSON) {
jSON ['all_categories'].forEach (function (Item, Index) {
          $('#all_categories').append (
            '<option '+ (Item.category_id == jSON ['category_id']? 'selected="selected"': '') + ' value="' + Item.category_id + '">' + Item.name.replace ('Telefon Kılıfı', '') +'</option>'
          );
if (Index == (jSON ['all_categories'].length - 1))
          {
            var CategoryID =  $('#all_categories option:selected').val ();
$.ajax ({
              url: 'index.php?route=product/category/getSubCategories',
              data: {category_id : CategoryID},
              dataType: 'json',
              type: 'POST',
              success: function (jSON2) {
                jSON2 ['categories'].forEach (function (Item, Index) {
                  $('#sub_categories').append (
                    '<option value="'+ Item.category_id +'">'+ Item.name.replace ('Telefon Kılıfı', '') + '</option>'
                  );
if (Index == (jSON2 ['categories'].length - 1))
                  {
                    $('#sub_categories > option').each (function (Index, Item) {
                      if ($(Item).val () == jSON ['sub_category_id']) $(Item).attr ('selected', 'selected');
if (Index == ($('#sub_categories > option').length - 1))
                      {
                        $("#sub_categories").trigger ("change");
$('*[attribute-data="'+ jSON ['collection_attr_id'] +'"]').trigger ('click');
                        setTimeout (function () {
                          $('*[color-attribute-data="'+ jSON ['color_attr_id'] +'"]').trigger ('click');
                        }, 250);
$('.bLoading, #loading').toggleClass ('d-none');
                      }
                    });
                  }
                });
              }
            });
          }
        });
}
    });
});
</script>
<script>
  jQuery (function ($) {
    $('#all_categories').on ('change', function () {
      var CategoryID =  $('#all_categories option:selected').val ();
$.ajax ({
        url: 'index.php?route=product/category/getSubCategories',
        data: {category_id : CategoryID},
        dataType: 'json',
        type: 'POST',
        success: function (jSON2) {
          $('#sub_categories').empty ();
jSON2 ['categories'].forEach (function (Item, Index) {
            $('#sub_categories').append (
              '<option value="'+ Item.category_id +'">'+ Item.name.replace ('Telefon Kılıfı', '') + '</option>'
            );
if (Index == (jSON2 ['categories'].length - 1))
            {
              $('#sub_categories > option').each (function (Index, Item) {
                if ($(Item).val () == jSON2 ['sub_category_id']) $(Item).attr ('selected', 'selected');
if (Index == ($('#sub_categories > option').length - 1))
                {
                  $("#sub_categories").val ($("#sub_categories > option").first ().val ()).change ();
$('*[attribute-data="'+ jSON2 ['collection_attr_id'] +'"]').trigger ('click');
                  setTimeout (function () {
                    $('*[color-attribute-data="'+ jSON2 ['color_attr_id'] +'"]').trigger ('click');
                  }, 250);
                }
              });
            }
          });
        }
      });
    });
  });
</script>
<script>
$(() => {
    //Alt kategorileri çekiyoruz
$('#sub_categories').on('change', () => {
      $('.bLoading, #loading').toggleClass ('d-none');
let category_id =  $('#sub_categories option:selected').val();
      let product_id = $('input[name=\'product_id\']').val();
      let model = $('input[name=\'model\']').val();
      $('#attribute_cases').html('');
      $('#attribute_color_cases').html('');
      $.ajax({
        url: 'index.php?route=product/product/getAttributes',
        dataType: 'json',
        type: 'POST',
        data: { category_id : category_id, product_id : product_id, model : model },
        success: function(json){
          if(json['attributes'] && json['attributes'].length){
            $('.PP__OptionTitle').show ();
            $('.PP__OptionTitle.Disabled').hide ();
let html = '';
            json['attributes'].forEach((item) =>{
              html += '<div class="col-xs-6 PP__Case"><a onClick="getColorAttribute('+ item.attribute_id +')" class="PP__Case_a" attribute-data="'+ item.attribute_id +'"><img src="'+ item.image +'" /> '+ item.name + '</a></div>';
            });
            $('#attribute_cases').html(html);
            prev = $("input[name='pre_case_attrib']").val();
            if (prev !== ""){
              b = $('a[attribute-data="'+prev+'"]');
              console.log(b);
              if (b.length == 0){
                  //call default one
                  console.log("tdef1");
                  $('#attribute_cases').find ('.PP__Case').first().children('a').trigger ('click');
              }else{
                b.trigger('click');
              }
            }else{
                console.log("def1");
                $('#attribute_cases').find ('.PP__Case').first().children('a').trigger ('click');
            }
$('.bLoading, #loading').toggleClass ('d-none');
          }
else {
            $('.PP__OptionTitle').hide ();
            $('.PP__OptionTitle.Disabled').show ();
$('.bLoading, #loading').toggleClass ('d-none');
          }
}
      });
    });
});
function getColorAttribute(attribute_id,from_attrib = 0) {
    const category_id =  $('#sub_categories option:selected').val();
    let product_id = $('input[name=\'product_id\']').val();
    let model = $('input[name=\'model\']').val();
    $('#attribute_color_cases').html('');
    $.ajax({
      url: 'index.php?route=product/product/getAttributesByOtherAttributeId',
      dataType: 'json',
      type: 'POST',
      data: { category_id : category_id, attribute_id : attribute_id, product_id : product_id, model : model},
      success: function(json){
          if (from_attrib == 0)
            $("input[name='pre_case_attrib']").val(attribute_id);
        if(json['attributes']){
            $('#attribute_color_cases').prev ('.PP__OptionTitle').show ();
pid = 0;
          let html = '';
          json['attributes'].forEach((item) =>{
              pid = item.product_id;
            html += '<div class="PP__CaseCircle" product-data="'+ item.product_id +'"><a onClick="cliclColorAttribute('+ item.attribute_id +', '+ item.product_id +')" color-attribute-data="'+ item.attribute_id +'"><img src="'+ item.image +'" /></a></div>';
          });
          $('#attribute_color_cases').html(html);
          prev = $("input[name='pre_attrib']").val();
          if (prev !== ""){
              b = $('a[color-attribute-data="'+prev+'"]');
              console.log(b);
              if (b.length == 0){
                  //call default one
                  console.log("tdef");
                  $('#attribute_color_cases').find ('.PP__CaseCircle').first().children('a').trigger ('click');
              }else{
                b.trigger('click');
              }
          }else{
              console.log("def");
            $('#attribute_color_cases').find ('.PP__CaseCircle').first().children('a').trigger ('click');
          }
}
}
    });
  }
function cliclColorAttribute(attribute_id, product_id,from_attrib = 0) {
    $.ajax({
      url: 'index.php?route=product/product/getProductDetail',
      dataType: 'json',
      type: 'POST',
      data: { attribute_id : attribute_id, product_id : product_id },
      success: function(json){
        $('.PP__Title').html(json['product_info']['name']);
$('.PP__Price').html((json['product_info']['special'])? json['product_info']['special']: json['product_info']['price']);
        if (json['product_info']['special']) $('.PP__Price').siblings ('span').html(json['product_info']['price']);
$('#gradienttext').val('');
          $('#texture').val('');
          if(json['product_info']['product_type']=='2' || json['product_info']['product_type']=='3'){
              $('.gradient').show();
              $('.PP__CustomizationTextPositions').hide();
          }else{
$('.gradient').hide();
              $('.PP__CustomizationTextPositions').show();
          }
let html = '';
        if(json['product_info']['media_extension'] == 'video'){
          html += '<video playsinline="" autoplay="autoplay" loop="loop" muted="muted">';
          html += '<source src="'+ json['product_info']['media'] +'.webm" type="video/webm; codecs=vp9,vorbis">';
          html += '<source src="'+ json['product_info']['media'] +'.mp4" type="video/mp4">';
          html += '</video>';
        }else{
          html += '<img id="pimage" src="'+ json['product_info']['media'] +'" width="500" />';
        }
if (json ['product_info']['thumb'].match (/(SEFFAF_SAYDAM-SILVER|SEFFAF_SAYDAM-BLACK)/)){
          $('.fImage__BLACK--Carousel #img_canvas #canvas_media').html(html);
          $('#product_image, #product_image--BLACK').val(json['product_info']['product_image']);
        } else {
          $('#img_canvas #canvas_media').html(html);
          $('#product_image').val(json['product_info']['product_image']);
        }
        $('#pattern_url').val(json['product_info']['pattern']);
        $('#pattern_mask').val(json['product_info']['mask']);
        $('#img_canvas').find('img').last().attr('src', json['product_info']['pattern']);
$("input[name='product_id']").val(product_id);
          $("input[name='product_type']").val(json['product_info']['product_type']);
        $("input[name='model']").val(json['product_info']['model']);
        if (from_attrib == 0)
            $("input[name='pre_attrib']").val(attribute_id);
window.history.replaceState(null, null, json['product_info']['href']);
$('.thumbnails .image-additional').eq (0).find ('img').attr ('src', json['product_info']['thumb']);
        $('.thumbnails .image-additional').eq (0).find ('img').attr ('data-src', json['product_info']['popup']);
        $('.thumbnails .image-additional').not (':first').remove ();
        var __fImageBlackCarouselIndex = 1, __fImageSilverCarouselIndex = 0;
        json ['product_info']['images'].forEach (function (Item, Index) {
            if (Item.thumb.match (/(SEFFAF_SAYDAM-SILVER|SEFFAF_SAYDAM-BLACK)/))
            {
              if (Item.thumb.match (/(SEFFAF_SAYDAM-SILVER|SEFFAF_SAYDAM-BLACK)/)[0] == "SEFFAF_SAYDAM-BLACK")
              {
                $('.thumbnails').append (
                  '<li class="fImage__BLACK image-additional hidden-xs">' +
                    '<a class="thumbnail border-0" href="javascript: $(\'.thumbnails > .owl-carousel.fImage__BLACK--Carousel\').trigger (\'to.owl\', [' + (__fImageBlackCarouselIndex++) + ', 300]);">' +
                      '<img src="' + Item.thumb + '" data-src="' + Item.popup + '">' +
                    '</a>' +
                  '</li>'
                );
$('.thumbnails .owl-carousel.fImage__BLACK--Carousel').owlCarousel ('add', (
                  '<div class="ThumbBox mr-20">' +
                    '<img class="PP__Image w-100" src="' + Item.popup + '">' +
                  '</div>'
                )).owlCarousel ('refresh');
$('.thumbnails .owl-carousel.fImage__BLACK--Carousel .ThumbBox').each (function (EachIndex) {
                  if (EachIndex != 0)
                    $('.thumbnails .owl-carousel.fImage__BLACK--Carousel').owlCarousel ('remove', EachIndex).owlCarousel ('refresh');
                });
              }
else if (Item.thumb.match (/(SEFFAF_SAYDAM-SILVER|SEFFAF_SAYDAM-BLACK)/)[0] == "SEFFAF_SAYDAM-SILVER")
              {
                  $('.thumbnails').append (
                    '<li class="fImage__SILVER image-additional hidden-xs">' +
                      '<a class="thumbnail border-0" href="javascript: $(\'.thumbnails > .owl-carousel.fImage__SILVER--Carousel\').trigger (\'to.owl\', [' + (__fImageSilverCarouselIndex) + ', 300]);">' +
                        '<img src="' + Item.thumb + '" data-src="' + Item.popup + '">' +
                      '</a>' +
                    '</li>'
                  );
if (__fImageSilverCarouselIndex != 0)
                  {
                    $('.thumbnails .owl-carousel.fImage__SILVER--Carousel').owlCarousel ('add', (
                      '<div class="ThumbBox mr-20">' +
                        '<img class="PP__Image w-100" src="' + Item.popup + '">' +
                      '</div>'
                    )).owlCarousel ('refresh');
                  }
else
                  {
                    $('.fImage__SILVER--Carousel #img_canvas #canvas_media').html (
                      '<img id="pimage" src="' + Item.popup + '" width="500" />'
                    );
$('#product_image--SILVER').val(Item.no_cache_image);
                  }
$('.thumbnails .owl-carousel.fImage__SILVER--Carousel .ThumbBox').each (function (EachIndex) {
                    if (EachIndex != 0)
                      $('.thumbnails .owl-carousel.fImage__SILVER--Carousel').owlCarousel ('remove', EachIndex).owlCarousel ('refresh');
                  });
__fImageSilverCarouselIndex++;
              }
            }
else
            {console.log (Item);
              $('.thumbnails .owl-carousel .ThumbBox').each (function (EachIndex) {
                if (EachIndex != 0)
                  $('.thumbnails .owl-carousel').owlCarousel ('remove', EachIndex).owlCarousel ('refresh');
              });
$('.thumbnails').append (
                '<li class="image-additional hidden-xs">' +
                  '<a class="thumbnail border-0" href="javascript: $(\'.thumbnails > .owl-carousel\').trigger (\'to.owl\', [' + (Index + 1) + ', 300]);">' +
                    '<img src="' + Item.thumb + '" data-src="' + Item.popup + '">' +
                  '</a>' +
                '</li>'
              );
$('.thumbnails .owl-carousel').owlCarousel ('add', (
                '<div class="ThumbBox mr-20">' +
                  '<img class="PP__Image w-100" src="' + Item.popup + '">' +
                '</div>'
              )).owlCarousel ('refresh');
            }
        });
$('.tab-content').load (window.location.href + " .tab-content > *");
        $('.nav.nav-tabs > li').removeClass ('active');
        $('.nav.nav-tabs > li').eq (0).addClass ('active');
$('.fImage__SILVER').hide ();
}
    });
  }
</script>
<script type="text/javascript"><!--
$('select[name=\'recurring_id\'], input[name="quantity"]').change(function(){
	$.ajax({
		url: 'index.php?route=product/product/getRecurringDescription',
		type: 'post',
		data: $('input[name=\'product_id\'], input[name=\'quantity\'], select[name=\'recurring_id\']'),
		dataType: 'json',
		beforeSend: function() {
			$('#recurring-description').html('');
		},
		success: function(json) {
			$('.alert, .text-danger').remove();
if (json['success']) {
				$('#recurring-description').html(json['success']);
			}
		}
	});
});
//--></script>
<script type="text/javascript"><!--
$('#button-cart_bk').on('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add',
		type: 'post',
		data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
		dataType: 'json',
		beforeSend: function() {
			$('#button-cart').button('loading');
		},
		complete: function() {
			$('#button-cart').button('reset');
		},
		success: function(json) {
			$('.alert, .text-danger').remove();
			$('.form-group').removeClass('has-error');
if (json['error']) {
				if (json['error']['option']) {
					for (i in json['error']['option']) {
						var element = $('#input-option' + i.replace('_', '-'));
if (element.parent().hasClass('input-group')) {
							element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						} else {
							element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						}
					}
				}
if (json['error']['recurring']) {
					$('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');
				}
// Highlight any found errors
				$('.text-danger').parent().addClass('has-error');
			}
if (json['success']) {
				$('.breadcrumb').after('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');
$('#cart > button').html('<span id="cart-total"><i class="fa fa-shopping-cart"></i> ' + json['total'] + '</span>');
$('html, body').animate({ scrollTop: 0 }, 'slow');
$('#cart > ul').load('index.php?route=common/cart/info ul li');
			}
		},
        error: function(xhr, ajaxOptions, thrownError) {
            alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	});
});
//--></script>
<script type="text/javascript"><!--
$('button[id^=\'button-upload\']').on('click', function() {
	var node = this;
$('#form-upload').remove();
$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');
$('#form-upload input[name=\'file\']').trigger('click');
if (typeof timer != 'undefined') {
    	clearInterval(timer);
	}
timer = setInterval(function() {
		if ($('#form-upload input[name=\'file\']').val() != '') {
			clearInterval(timer);
$.ajax({
				url: 'index.php?route=tool/upload',
				type: 'post',
				dataType: 'json',
				data: new FormData($('#form-upload')[0]),
				cache: false,
				contentType: false,
				processData: false,
				beforeSend: function() {
					$(node).button('loading');
				},
				complete: function() {
					$(node).button('reset');
				},
				success: function(json) {
					$('.text-danger').remove();
if (json['error']) {
						$(node).parent().find('input').after('<div class="text-danger">' + json['error'] + '</div>');
					}
if (json['success']) {
						alert(json['success']);
$(node).parent().find('input').val(json['code']);
					}
				},
				error: function(xhr, ajaxOptions, thrownError) {
					alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
				}
			});
		}
	}, 500);
});
//--></script>
<script type="text/javascript"><!--
$('#review').delegate('.pagination a', 'click', function(e) {
    e.preventDefault();
$('#review').fadeOut('slow');
$('#review').load(this.href);
$('#review').fadeIn('slow');
});
$('#review').load('index.php?route=product/product/review&product_id=<?php echo $product_id; ?>');
$('#button-review').on('click', function() {
	$.ajax({
		url: 'index.php?route=product/product/write&product_id=<?php echo $product_id; ?>',
		type: 'post',
		dataType: 'json',
		data: $("#form-review").serialize(),
		beforeSend: function() {
			$('#button-review').button('loading');
		},
		complete: function() {
			$('#button-review').button('reset');
		},
		success: function(json) {
			$('.alert-success, .alert-danger').remove();
if (json['error']) {
				$('#review').after('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '</div>');
			}
if (json['success']) {
				$('#review').after('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + '</div>');
$('input[name=\'name\']').val('');
				$('textarea[name=\'text\']').val('');
				$('input[name=\'rating\']:checked').prop('checked', false);
			}
		}
	});
});
/*
$(document).ready(function() {
	$('.thumbnails').magnificPopup({
		type:'image',
		delegate: 'a',
		gallery: {
			enabled:true
		}
	});
}); */
//--></script>
<?php if ($product_type == 4): ?>
  <script src="//scripts.piyersoft.com/javascript/jquery.sticky.js"></script>
  <script>
      $(document).ready (function () {
          if ($(window).width () <= 768)
              $(".thumbnails").sticky ({
                  topSpacing: 60,
                  bottomSpacing: 494,
                  zIndex: 999
              });
      });
  </script>
<?php endif; ?>
<script>
  jQuery (function ($) {
    $(window).scrollTop (100).scrollTop (0);
setTimeout (function () {
      $(window).scrollTop (100).scrollTop (0);
    }, 1000);
  });
</script>
<!-- sessionStorage: Begin -->
<script>
  /*jQuery (function ($) {
    var URL = '', Path = '', Params = '', PreParams = '';
    URL = window.location.href.split ('/') [window.location.href.split ('/').length - 1];
Path = URL.split ('&') [0];
    var PreParams = URL.split ('&');
    PreParams.shift ();
    URL = '';
    PreParams.forEach (function (Item) {
      URL += Item + '&';
    });
    URL = URL.replace (/\&$/, '');
    Params = new URLSearchParams (URL), __Params = [];
var Filter = {
      Toggle: function (Type, Value, Multiple) {
        if (Params.getAll (Type).toString ().indexOf (Value) == -1)
        {
          __Params = [];
          __Params.push (Value);
          if (Multiple)
            Params.getAll (Type).toString ().split (',').forEach (function (Item) {
              __Params.push (Item);
            });
          Params.set (Type, __Params);
        }
        else
        {
          if (Multiple)
          {
            __Params = [];
            Params.getAll (Type).toString ().split (',').forEach (function (Item) {
              if (Item != Value) __Params.push (Item);
            });
            Params.set (Type, __Params);
          }
        }
window.location.href = (
          Path +
          (Params.getAll ('option').toString ()? ("&option=" + Params.getAll ('option').toString ()): '') +
          (Params.getAll ('attribute').toString ()? ("&attribute=" + Params.getAll ('attribute').toString ()): '') +
          (Params.getAll ('brand').toString ()? ("&brand=" + Params.getAll ('brand').toString ()): '') +
          (Params.getAll ('sort').toString ()? ("&sort=" + Params.getAll ('sort').toString ()): '')
        ).replace (/,&/g, '&').replace (/,$/g, '');
      }
    };
if (sessionStorage.getItem ('customizetext')) $('#customizetext').val (sessionStorage.getItem ('customizetext'));
  });*/
</script>
<!-- sessionStorage: End -->
<?php echo $footer; ?>
