<?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; ?>">
<ul class="thumbnails">
<li class="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 TextPosition--Bottom"></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>
<div class="clearfix hidden-xs"></div>
            <br class="hidden-xs" />
<li class="image-additional hidden-xs">
              <a class="thumbnail border-0" href="javascript:;" data-index="0">
                <img src="<?= $thumb; ?>" data-src="<?= $popup; ?>" />
              </a>
            </li>
            <?php foreach ($images as $index => $image): ?>
              <li class="image-additional hidden-xs">
                <a class="thumbnail border-0" href="javascript:;" data-index="<?= $index + 1; ?>">
                  <img src="<?= $image['thumb']; ?>" data-src="<?= $image['popup']; ?>" />
                </a>
              </li>
            <?php endforeach; ?>
</ul>
<script>
            jQuery (function ($) {
              $('.thumbnails > .owl-carousel').owlCarousel ({
                items: 1,
                pagination: true
              });
$('.thumbnails .thumbnail').click (function () {
                $('.thumbnails > .owl-carousel').trigger ('owl.jumpTo', $(this).attr ('data-index'));
              });
            });
          </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>
          <label class="PP__OptionTitle">Bu Modeli Başka Bir Kılıfta Dene</label>
          <div class="row px-15" id="attribute_cases">
</div>
          <div class="clearfix"></div>
          <br />
          <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 />
          <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">
                <button class="PP__CustomizationTextPosition PP__CustomizationTextPosition--Center" data-position="Center"></button>
                <button class="PP__CustomizationTextPosition PP__CustomizationTextPosition--Bottom" data-position="Bottom"></button>
              </div>
            </div>
            <script>
              jQuery (function ($) {
// .PP__CustomizationTextInput: Change
                $('.PP__CustomizationTextInput').keyup (function () {
                  if ($('#CustomizationText').hasClass ('TextFont--Glitter') && $(this).val () != '') $('#CustomizationText').text ('[' + $(this).val () + ']');
                  else $('#CustomizationText').text ($(this).val ());
if ($(this).val () != '')
                  {
                    if (768 < $(window).width ()) targetWidth = $('#CustomizationText').hasClass ('TextFont--Glitter')? 215: 120;
                    else targetWidth = $('#CustomizationText').hasClass ('TextFont--Glitter')? 115: 70;
$('#CustomizationText').css ('font-size', '1px');
                    do {
                      $('#CustomizationText').css ('font-size', (parseInt($('#CustomizationText').css ('font-size')) + 1) + "px");
                    } while ($('#CustomizationText').width () <= targetWidth);
                  }
                });
// .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'));
                });
});
            </script>
          </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 if ($option['type'] == 'text') { ?>
            <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>
              <input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['value']; ?>" placeholder="<?php echo $option['name']; ?>" id="input-option<?php echo $option['product_option_id']; ?>" class="form-control" />
            </div>
            <?php } ?>
            <?php if ($option['type'] == 'textarea') { ?>
            <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>
              <textarea name="option[<?php echo $option['product_option_id']; ?>]" rows="5" placeholder="<?php echo $option['name']; ?>" id="input-option<?php echo $option['product_option_id']; ?>" class="form-control"><?php echo $option['value']; ?></textarea>
            </div>
            <?php } ?>
            <?php if ($option['type'] == 'file') { ?>
            <div class="form-group<?php echo ($option['required'] ? ' required' : ''); ?>">
              <label class="control-label"><?php echo $option['name']; ?></label>
              <button type="button" id="button-upload<?php echo $option['product_option_id']; ?>" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-default btn-block"><i class="fa fa-upload"></i> <?php echo $button_upload; ?></button>
              <input type="hidden" name="option[<?php echo $option['product_option_id']; ?>]" value="" id="input-option<?php echo $option['product_option_id']; ?>" />
            </div>
            <?php } ?>
            <?php if ($option['type'] == 'date') { ?>
            <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>
              <div class="input-group date">
                <input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['value']; ?>" data-date-format="YYYY-MM-DD" id="input-option<?php echo $option['product_option_id']; ?>" class="form-control" />
                <span class="input-group-btn">
                <button class="btn btn-default" type="button"><i class="fa fa-calendar"></i></button>
                </span></div>
            </div>
            <?php } ?>
            <?php if ($option['type'] == 'datetime') { ?>
            <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>
              <div class="input-group datetime">
                <input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['value']; ?>" data-date-format="YYYY-MM-DD HH:mm" id="input-option<?php echo $option['product_option_id']; ?>" class="form-control" />
                <span class="input-group-btn">
                <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
                </span></div>
            </div>
            <?php } ?>
            <?php if ($option['type'] == 'time') { ?>
            <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>
              <div class="input-group time">
                <input type="text" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option['value']; ?>" data-date-format="HH:mm" id="input-option<?php echo $option['product_option_id']; ?>" class="form-control" />
                <span class="input-group-btn">
                <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
                </span></div>
            </div>
            <?php } ?>
            <?php } ?>
            <?php } ?>
            <?php if ($recurrings) { ?>
            <hr>
            <h3><?php echo $text_payment_recurring; ?></h3>
            <div class="form-group required">
              <select name="recurring_id" class="form-control">
                <option value=""><?php echo $text_select; ?></option>
                <?php foreach ($recurrings as $recurring) { ?>
                <option value="<?php echo $recurring['recurring_id']; ?>"><?php echo $recurring['name']; ?></option>
                <?php } ?>
              </select>
              <div class="help-block" id="recurring-description"></div>
            </div>
            <?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_id_n" value="<?php echo $product_id; ?>" />
              <input type="hidden" name="pre_attrib" value="" />
              <input type="hidden" name="pre_case_attrib" value="" />
              <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>
    $('#button-cart').on('click', function () {
        $('#img_loader').show();
      var temp=$('#canvas_media').html();
      $('#canvas_media').html('');
      var img=  '<img src="'+ $('#product_image').val() +'" width="500" />';
      $('#canvas_media').html(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(){
       $('#canvas_media').html();
                  $('#canvas_media').html(temp);
$.ajax({
            url: 'index.php?route=piyerSoft/cases',
            type: 'post',
            data: $('#pattern_url,#pattern_mask,#customizetext,#customizeColor,#customizeFont,#customizetextPosition'),
            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'),
		dataType: 'json',
		beforeSend: function() {
			$('#button-cart').button('loading');
		},
		complete: function() {
			$('#button-cart').button('reset');
            $('#img_loader').hide();
		},
		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);
        }
	});
            }
        });
          }, 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>
$(() => {
    //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']){
            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');
          }
}
      });
    });
});
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']){
            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']);
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 src="'+ json['product_info']['media'] +'" width="500" />';
        }
$('#img_canvas #canvas_media').html(html);
         $('#pattern_url').val(json['product_info']['pattern']);
          $('#product_image').val(json['product_info']['product_image']);
$('#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='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']);
}
    });
  }
</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>
<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 echo $footer; ?>
