{% set stylePrefix = j3.document.isPopup('quickview') ? 'quickviewPageStyle' : 'productPageStyle' %}
{% set direction = j3.settings.get(stylePrefix ~ 'AdditionalImagesPosition') == 'left' or j3.settings.get(stylePrefix ~ 'AdditionalImagesPosition') == 'right' ? 'vertical' : 'horizontal' %}
{% set carousel = direction == 'vertical' or j3.settings.get(stylePrefix ~ 'AdditionalImagesCarousel') %}
{% set carouselOptions = {
  slidesPerView: 'auto',
  spaceBetween: j3.settings.get(stylePrefix ~ 'AdditionalImagesSpacing')|default(0),
  direction: direction
} %}
{% set galleryOptions = {
  thumbWidth: j3.settings.get('image_dimensions_popup_thumb.width'),
  thumbConHeight: j3.settings.get('image_dimensions_popup_thumb.height'),
  addClass: 'lg-product-images'
} %}
{% set quickviewExpand = j3.settings.get('globalExpandCharactersLimit') > 0 and description and description|length <= j3.settings.get('globalExpandCharactersLimit') ? 'no-expand': '' %}
{{ header }}

			<div class="inova" style="background-color:#08CE1B !important;">
			<a class="inova whatsapp" target="_blank" href="https://api.whatsapp.com/send?phone={{ telephone }}&amp;text=Sipariş%20vermek%20istiyorum. {{ heading_title }} - {{ model }}" type="image/x-icon" />
<button type="button" class="btn btn-success">
<i class="fa fa-whatsapp"></i>WhatsApp Sipariş</button></a></div>
			
{% if not j3.document.isPopup() %}
<ul class="breadcrumb">
  {% for breadcrumb in breadcrumbs %}
  <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
  {% endfor %}
</ul>
{% if j3.settings.get('pageTitlePosition') == 'top' %}
  <h1 class="title page-title"><span>{{ heading_title }}</span></h1>
{% endif %}
{{ j3.loadController('opencartvip/layout', 'top') }}
<div id="product-product" class="container">
  <div class="row">{{ column_left }}
    <div id="content" class="{{ class }}">
      {% endif %}
      {% if not j3.document.isPopup('options') %}
        {% if j3.settings.get('pageTitlePosition') == 'default' or j3.document.isPopup('quickview') %}
          <h1 class="title page-title">{{ heading_title }}</h1>
        {% endif %}
      {% endif %}
      {{ content_top }}
      {% set classes = j3.classes({
        'out-of-stock': not product_quantity,
        'has-countdown': date_end,
        'has-zero-price': not product_price_value,
        'has-extra-button': product_extra_buttons,
      }) %}
      <div class="product-info {{ classes }}">
        {% if not j3.document.isPopup('options') %}
        <div class="product-left">
          <div class="product-image direction-{{ direction }} position-{{ j3.settings.get(stylePrefix ~ 'AdditionalImagesPosition') }}">
            <div class="swiper main-image" data-options='{{ j3.carousel(j3.document.getJs(), stylePrefix ~ 'ImageCarouselStyle')|json_encode(constant('JSON_FORCE_OBJECT')) }}' {% if images|length > 1 and j3.settings.get(stylePrefix ~ 'AdditionalImagesStatus') and carousel and direction == 'vertical' %}style="width: calc(100% - {{ j3.settings.get('image_dimensions_additional.width') }}px)"{% endif %}>
              <div class="swiper-container" {% if j3.isRTL() %}dir="rtl"{% endif %}>
                <div class="swiper-wrapper">
                  {% set gallery = [] %}
                  {% for image in images %}
                    {% set gallery = gallery|merge([{src: image.popup, thumb: image.galleryThumb, subHtml: heading_title}]) %}
                    <div class="swiper-slide" {% if not j3.document.isPopup() and j3.settings.get(stylePrefix ~ 'GalleryStatus') %} data-gallery=".lightgallery-product-images" data-index="{{ loop.index0 }}" {% endif %}>
                      <img src="{{ image.image }}" data-largeimg="{{ image.popup }}" alt="" width="{{ j3.settings.get('image_dimensions_thumb.width') }}" height="{{ j3.settings.get('image_dimensions_thumb.height') }}"/>
                    </div>
                  {% endfor %}
                </div>
              </div>
              <div class="swiper-controls">
                <div class="swiper-buttons">
                  <div class="swiper-button-prev"></div>
                  <div class="swiper-button-next"></div>
                </div>
                <div class="swiper-pagination"></div>
              </div>
              {% if product_labels %}
                <div class="product-labels">
                  {% for id, label in product_labels %}
                    <span class="product-label product-label-{{ id }} product-label-{{ label.display }}"><b>{{ label.label }}</b></span>
                  {% endfor %}
                </div>
              {% endif %}
            </div>
            {% if images|length > 1 and j3.settings.get(stylePrefix ~ 'AdditionalImagesStatus') %}
              {% if carousel %}
                <div class="swiper additional-images" data-options='{{ carouselOptions|json_encode(constant('JSON_FORCE_OBJECT')) }}' {% if direction == 'vertical' %}style="width: {{ j3.settings.get('image_dimensions_additional.width') }}px"{% endif %}>
                  <div class="swiper-container" {% if j3.isRTL() %}dir="rtl"{% endif %}>
                    <div class="swiper-wrapper">
                      {% for image in images %}
                        <div class="swiper-slide additional-image" data-index="{{ loop.index0 }}">
                          <img src="{{ image.thumb }}" alt=""/>
                        </div>
                      {% endfor %}
                    </div>
                  </div>
                  <div class="swiper-buttons">
                    <div class="swiper-button-prev"></div>
                    <div class="swiper-button-next"></div>
                  </div>
                  <div class="swiper-pagination"></div>
                </div>
              {% else %}
                <div class="additional-images">
                  {% for image in images %}
                    <div class="additional-image" data-index="{{ loop.index0 }}">
                      <img src="{{ image.thumb }}" alt=""/>
                    </div>
                  {% endfor %}
                </div>
              {% endif %}
            {% endif %}
          </div>
          {% if not j3.document.isPopup() and j3.settings.get(stylePrefix ~ 'GalleryStatus') %}
          <div class="lightgallery lightgallery-product-images" data-images='{{ gallery|json_encode|e }}' data-options='{{ galleryOptions|json_encode(constant('JSON_FORCE_OBJECT')) }}'></div>
          {% endif %}

				 {% if reviewfeatured %}
				 <h3> {{ textadmin.text_featured }}</h3>
			<div class="featuredreview"></div>
			{% endif %}
			
          {% if not j3.document.isPopup('options') %}
            <div class="product-blocks blocks-image">
              {{ product_blocks.image|join }}
            </div>
          {% endif %}
          {% if j3.document.isPopup('quickview') and (j3.settings.get('quickviewDescription')and j3.settings.get('quickviewDescriptionPosition') == 'image') %}
            <div class="description {{ quickviewExpand }}">
              <div class="expand-block">
                <div class="expand-content">
                  {{ description }}
                </div>
                {% if j3.settings.get('quickviewExpandButton') %}
                  <div class="block-expand-overlay"><a class="block-expand btn"></a></div>
                {% endif %}
              </div>
            </div>
          {% endif %}
          {% if tags and not j3.document.isPopup() and (j3.settings.get(stylePrefix ~ 'TagsPosition') == 'image') %}
            <div class="tags">
              <span class="tags-title">{{ text_tags }}</span>
              {% for tag in tags %}
                <a href="{{ tag.href }}">{{ tag.tag }}</a>
                {% if not loop.last %}<b>,</b>{% endif %}
              {% endfor %}
            </div>
          {% endif %}
        </div>
        {% endif %}
        <div class="product-right">
          <div id="product" class="product-details">
          {% if not j3.document.isPopup('options') %}
          <div class="title page-title">{{ heading_title }}</div>
          {{ product_blocks.top|join }}
          {% endif %}

          {% if j3.document.isPopup('quickview') and (j3.settings.get('quickviewDescription')and j3.settings.get('quickviewDescriptionPosition') == 'top') %}
            <div class="description {{ quickviewExpand }}">
              <div class="expand-block">
                <div class="expand-content">
                  {{ description }}
                </div>
                {% if j3.settings.get('quickviewExpandButton') %}
                  <div class="block-expand-overlay"><a class="block-expand btn"></a></div>
                {% endif %}
              </div>
            </div>
          {% endif %}

          {% if not j3.document.isPopup('options') and j3.settings.get(stylePrefix ~ 'Stats') and (j3.settings.get(stylePrefix ~ 'StatsPosition') == 'default') %}
            <div class="product-stats">
              <ul class="list-unstyled">
                {% if j3.settings.get(stylePrefix ~ 'ProductStock')%}
                  <li class="product-stock {% if product_quantity %}in-stock{% else %}out-of-stock{% endif %}"><b>{{ text_stock }}</b> <span>{{ stock }}</span></li>
                {% endif %}
                {% if manufacturer and j3.settings.get(stylePrefix ~ 'ProductManufacturer') and (j3.settings.get(stylePrefix ~ 'ProductManufacturerDisplay') == 'list') %}
                  <li class="product-manufacturer"><b>{{ text_manufacturer }}</b> <a href="{{ manufacturers }}">{{ manufacturer }}</a></li>
                {% endif %}
                {% if j3.settings.get(stylePrefix ~ 'ProductReward') and reward %}
                  <li class="product-reward"><b>{{ text_reward }}</b> <span>{{ reward }}</span></li>
                {% endif %}
                {% if j3.settings.get(stylePrefix ~ 'ProductModel') and model %}
                  <li class="product-model"><b>{{ text_model }}:</b> <span>{{ model }}</span></li>
                {% endif %}
                {% if j3.settings.get(stylePrefix ~ 'ProductWeight') and product_weight %}
                  <li class="product-weight"><b>{{ text_weight }}:</b> <span>{{ product_weight }}</span></li>
                {% endif %}
                {% if j3.settings.get(stylePrefix ~ 'ProductDimension') and product_dimension %}
                  <li class="product-dimension"><b>{{ text_dimension }}:</b> <span>{{ product_length }} x {{ product_width }} x {{ product_height }}</span></li>
                {% endif %}
                {% if j3.settings.get(stylePrefix ~ 'ProductSKU') and product_sku %}
                  <li class="product-sku"><b>{{ j3.settings.get(stylePrefix ~ 'ProductSKUText') }}:</b> <span> {{ product_sku }}</span></li>
                {% endif %}
                {% if j3.settings.get(stylePrefix ~ 'ProductUPC') and product_upc %}
                  <li class="product-upc"><b>{{ j3.settings.get(stylePrefix ~ 'ProductUPCText') }}:</b> <span>{{ product_upc }}</span></li>
                {% endif %}
                {% if j3.settings.get(stylePrefix ~ 'ProductJAN') and product_jan %}
                  <li class="product-jan"><b>{{ j3.settings.get(stylePrefix ~ 'ProductJANText') }}:</b> <span>{{ product_jan }}</span></li>
                {% endif %}
                {% if j3.settings.get(stylePrefix ~ 'ProductISBN') and product_isbn %}
                  <li class="product-isbn"><b>{{ j3.settings.get(stylePrefix ~ 'ProductISBNText') }}:</b> <span>{{ product_isbn }}</span></li>
                {% endif %}
                {% if j3.settings.get(stylePrefix ~ 'ProductMPN') and product_mpn %}
                  <li class="product-mpn"><b>{{ j3.settings.get(stylePrefix ~ 'ProductMPNText') }}:</b> <span>{{ product_mpn }}</span></li>
                {% endif %}
              </ul>
              {% if manufacturer and j3.settings.get(stylePrefix ~ 'ProductManufacturer') and (j3.settings.get(stylePrefix ~ 'ProductManufacturerDisplay') == 'image') %}
                <div class="brand-image product-manufacturer">
                  <a href="{{ manufacturers }}">
                    {% if manufacturer_image %}
                      <img src="{{ manufacturer_image }}" alt="{{ manufacturer }}"/>
                    {% endif %}
                    <span>{{ manufacturer }}</span>
                  </a>
                </div>
              {% endif %}
              {% if j3.settings.get(stylePrefix ~ 'CustomStats')%}
                <div class="custom-stats">
                  {% if j3.settings.get(stylePrefix ~ 'ProductSold')%}
                    <div class="product-sold"><b>{{ j3.settings.getWithValue(stylePrefix ~ 'SoldText', products_sold) }}</b></div>
                  {% endif %}
                  {% if j3.settings.get(stylePrefix ~ 'ProductViews')%}
                    <div class="product-views"><b>{{ j3.settings.getWithValue(stylePrefix ~ 'ViewsText', product_views) }}</b></div>
                  {% endif %}
                </div>
              {% endif %}
            </div>
          {% endif %}

          {% if review_status and not j3.document.isPopup() %}
            <div class="rating rating-page">
              <div class="rating-stars">
                {% for i in 1..5 %}
                  
				{% if forstars < i %}
			
                    <span class="fa fa-stack">
                      <i class="fa fa-star-o fa-stack-1x"></i>
                    </span>{% 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>
                  {% endif %}
                {% endfor %}
              </div>
              <div class="review-links">
                <a>
				{% if reviewstotal %}{{ reviewstotal }}{% else %}{{ reviews }}{% endif %}
			</a>
                <b>{{ j3.settings.get(stylePrefix ~ 'RatingSeparator') }}</b>
                <a>{{ text_write }}</a>
              </div>
            </div>
          {% endif %}

          {% if date_end and j3.settings.get(j3.document.isPopup() ? 'quickviewCountdown' : 'countdownStatus') %}
            <div class="countdown-wrapper">
              {% if j3.settings.get(stylePrefix ~ 'CountdownText') %}
              <h5 class="countdown-title title">{{ j3.settings.get(stylePrefix ~ 'CountdownText') }}</h5>
              {% endif %}
              <div class="countdown" data-date="{{ date_end }}">
                <div><i class="fa fa-spinner fa-spin"></i><span>{{ j3.settings.get('countdownDay') }}</span></div>
                <div><i class="fa fa-spinner fa-spin"></i><span>{{ j3.settings.get('countdownHour') }}</span></div>
                <div><i class="fa fa-spinner fa-spin"></i><span>{{ j3.settings.get('countdownMin') }}</span></div>
                <div><i class="fa fa-spinner fa-spin"></i><span>{{ j3.settings.get('countdownSec') }}</span></div>
              </div>
            </div>
          {% endif %}

          {% if price and not j3.document.isPopup('options') %}
          <div class="product-price-group">
           <div class="price-wrapper">
             <div class="price-group">
               {% if not special %}
                 <div class="product-price">{{ price }}</div>
               {% else %}
                 <div class="product-price-new">{{ special }}</div>
                 <div class="product-price-old">{{ price }}</div>
               {% endif %}
             </div>
             {% if tax %}
               <div class="product-tax">{{ text_tax }} {{ tax }}</div>
             {% endif %}
             {% if points %}
               <div class="product-points">{{ text_points }} {{ points }}</div>
             {% endif %}

             {% if discounts %}
               <div class="discounts">
                 {% for discount in discounts %}
                   <div class="product-discount">{{ discount.quantity }}{{ text_discount }}{{ discount.price }}</div>
                 {% endfor %}
               </div>
             {% endif %}
           </div>
            {% if not j3.document.isPopup('options') and j3.settings.get(stylePrefix ~ 'Stats') and (j3.settings.get(stylePrefix ~ 'StatsPosition') == 'price') %}
              <div class="product-stats">
                <ul class="list-unstyled">
                  {% if j3.settings.get(stylePrefix ~ 'ProductStock')%}
                    <li class="product-stock {% if product_quantity %}in-stock{% else %}out-of-stock{% endif %}"><b>{{ text_stock }}</b> <span>{{ stock }}</span></li>
                  {% endif %}
                  {% if manufacturer and j3.settings.get(stylePrefix ~ 'ProductManufacturer') and (j3.settings.get(stylePrefix ~ 'ProductManufacturerDisplay') == 'list') %}
                    <li class="product-manufacturer"><b>{{ text_manufacturer }}</b> <a href="{{ manufacturers }}">{{ manufacturer }}</a></li>
                  {% endif %}
                  {% if j3.settings.get(stylePrefix ~ 'ProductReward') and reward %}
                    <li class="product-reward"><b>{{ text_reward }}</b> <span>{{ reward }}</span></li>
                  {% endif %}
                  {% if j3.settings.get(stylePrefix ~ 'ProductModel') and model %}
                    <li class="product-model"><b>{{ text_model }}:</b> <span>{{ model }}</span></li>
                  {% endif %}
                  {% if j3.settings.get(stylePrefix ~ 'ProductWeight') and product_weight %}
                    <li class="product-weight"><b>{{ text_weight }}:</b> <span>{{ product_weight }}</span></li>
                  {% endif %}
                  {% if j3.settings.get(stylePrefix ~ 'ProductDimension') and product_dimension %}
                    <li class="product-dimension"><b>{{ text_dimension }}:</b> <span>{{ product_length }} x {{ product_width }} x {{ product_height }}</span></li>
                  {% endif %}
                  {% if j3.settings.get(stylePrefix ~ 'ProductSKU') and product_sku %}
                    <li class="product-sku"><b>{{ j3.settings.get(stylePrefix ~ 'ProductSKUText') }}:</b> <span> {{ product_sku }}</span></li>
                  {% endif %}
                  {% if j3.settings.get(stylePrefix ~ 'ProductUPC') and product_upc %}
                    <li class="product-upc"><b>{{ j3.settings.get(stylePrefix ~ 'ProductUPCText') }}:</b> <span>{{ product_upc }}</span></li>
                  {% endif %}
                  {% if j3.settings.get(stylePrefix ~ 'ProductJAN') and product_jan %}
                    <li class="product-jan"><b>{{ j3.settings.get(stylePrefix ~ 'ProductJANText') }}:</b> <span>{{ product_jan }}</span></li>
                  {% endif %}
                  {% if j3.settings.get(stylePrefix ~ 'ProductISBN') and product_isbn %}
                    <li class="product-isbn"><b>{{ j3.settings.get(stylePrefix ~ 'ProductISBNText') }}:</b> <span>{{ product_isbn }}</span></li>
                  {% endif %}
                  {% if j3.settings.get(stylePrefix ~ 'ProductMPN') and product_mpn %}
                    <li class="product-mpn"><b>{{ j3.settings.get(stylePrefix ~ 'ProductMPNText') }}:</b> <span>{{ product_mpn }}</span></li>
                  {% endif %}
                </ul>
                {% if manufacturer and j3.settings.get(stylePrefix ~ 'ProductManufacturer') and (j3.settings.get(stylePrefix ~ 'ProductManufacturerDisplay') == 'image') %}
                  <div class="brand-image product-manufacturer">
                    <a href="{{ manufacturers }}">
                      {% if manufacturer_image %}
                        <img src="{{ manufacturer_image }}" alt="{{ manufacturer }}"/>
                      {% endif %}
                      <span>{{ manufacturer }}</span>
                    </a>
                  </div>
                {% endif %}
                {% if j3.settings.get(stylePrefix ~ 'CustomStats')%}
                  <div class="custom-stats">
                    {% if j3.settings.get(stylePrefix ~ 'ProductSold')%}
                      <div class="product-sold"><b>{{ j3.settings.getWithValue(stylePrefix ~ 'SoldText', products_sold) }}</b></div>
                    {% endif %}
                    {% if j3.settings.get(stylePrefix ~ 'ProductViews')%}
                      <div class="product-views"><b>{{ j3.settings.getWithValue(stylePrefix ~ 'ViewsText', product_views) }}</b></div>
                    {% endif %}
                  </div>
                {% endif %}
              </div>
            {% endif %}
          </div>
          {% endif %}

          
            
			<!--BOF Product Series -->	 
			<!--if this is a master then load list of slave products, if this is a slave product then load other slave products under the same master -->
			{% if(pds is not empty) %}
				<div class="price pds">
					{% if(display_add_to_cart) %}
						{{ text_in_the_same_series }}<br/>
					{% else %}
						{{ no_add_to_cart_message }}<br/>
					{% endif %}
					{% for p in pds %}
						<a class="{{ pds_enable_preview ? 'preview' : '' }} {{ (p.product_id == product_id) ? 'pds-current' : '' }}"
						title="{{ p.product_name }}"
						href="{{ p.product_link }}"
						rel="{{ p.product_main_image }}">
							<img src="{{ p.product_pds_image }}" alt="{{ p.product_name }}" />
						</a>
					{% endfor %}
				</div>
			{% endif %}
			{% if(not display_add_to_cart) %}
				<style>
					/*Hide cart and options*/
					#content .cart, .options, .buttons-cart, .input-qty, #product_buy, #product_options, #button-cart, .form-group {display: none !important;}
					.price {margin-bottom: 15px}
				</style>
			{% endif %}
			<!--EOF Product Series -->
			{% if options %}
       
          <div class="product-options">
            <h3 class="options-title title">{{ text_option }}</h3>
            {% for option in options %}
            {% if option.type == 'select' %}
            <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }} {% if j3.settings.get(stylePrefix ~ 'OptionsPushSelect') %}push-option{% endif %}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <select name="option[{{ option.product_option_id }}]" id="input-option{{ option.product_option_id }}" class="form-control">
                <option value="">{{ text_select }}</option>
                {% for option_value in option.product_option_value %}
                <option value="{{ option_value.product_option_value_id }}" data-points="{{ option_value.apo_points_value }}" data-prefix="{{ option_value.price_prefix }}" data-price="{{ option_value.apo_price_value }}">{{ option_value.name }}
                {% if option_value.price %}
                ({% if option_value.price_prefix == '+' or option_value.price_prefix == '-' %}{{ option_value.price_prefix }}{% endif %}{{ option_value.price }})
                {% endif %} </option>
                {% endfor %}
              </select>
            </div>
            {% endif %}
            {% if option.type == 'radio' %}
            <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }} {% if j3.settings.get(stylePrefix ~ 'OptionsPushRadio') %}push-option{% endif %}">
              <label class="control-label">{{ option.name }}</label>
              <div id="input-option{{ option.product_option_id }}"> {% for option_value in option.product_option_value %}
                <div class="radio">
                  <label>
                    <input type="radio" name="option[{{ option.product_option_id }}]" value="{{ option_value.product_option_value_id }}" data-points="{{ option_value.apo_points_value }}" data-prefix="{{ option_value.price_prefix }}" data-price="{{ option_value.apo_price_value }}" />
                    {% if option_value.image %} <img src="{{ option_value.image }}" alt="{{ option_value.name }} {% if option_value.price %} {{ option_value.price_prefix }} {{ option_value.price }} {% endif %}" data-toggle="tooltip" data-tooltip-class="push-tooltip" data-placement="{{ j3.settings.get(stylePrefix ~ 'PushTooltipPosition') }}" title="{{ option_value.name }} {% if option_value.price %} ({% if option_value.price_prefix == '+' or option_value.price_prefix == '-' %}{{ option_value.price_prefix }}{% endif %}{{ option_value.price }}) {% endif %}"/> {% endif %}
                    <span class="option-value" {% if option_value.quantity <= '5' %} data-toggle="tooltip" data-original-title="Son {{ option_value.quantity }} Adet" data-placement="top" {% endif %}>
                      {{ option_value.name }}
                      {% if option_value.price %}
                        <span class="option-price">
                          ({% if option_value.price_prefix == '+' or option_value.price_prefix == '-' %}{{ option_value.price_prefix }}{% endif %}{{ option_value.price }})
                        </span>
                      {% endif %}
                    </span>
                  </label>
                </div>
                {% endfor %} </div>
            </div>
            {% endif %}
            {% if option.type == 'checkbox' %}
            <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }} {% if j3.settings.get(stylePrefix ~ 'OptionsPushCheckbox') %}push-option{% endif %}">
              <label class="control-label">{{ option.name }}</label>
              <div id="input-option{{ option.product_option_id }}"> {% for option_value in option.product_option_value %}
                <div class="checkbox">
                  <label>
                    <input type="checkbox" name="option[{{ option.product_option_id }}][]" value="{{ option_value.product_option_value_id }}" data-points="{{ option_value.apo_points_value }}" data-prefix="{{ option_value.price_prefix }}" data-price="{{ option_value.apo_price_value }}" />
                    {% if option_value.image %} <img src="{{ option_value.image }}" alt="{{ option_value.name }} {% if option_value.price %} {{ option_value.price_prefix }} {{ option_value.price }} {% endif %}" data-toggle="tooltip" data-tooltip-class="push-tooltip" data-placement="{{ j3.settings.get(stylePrefix ~ 'PushTooltipPosition') }}" title="{{ option_value.name }} {% if option_value.price %} ({% if option_value.price_prefix == '+' or option_value.price_prefix == '-' %}{{ option_value.price_prefix }}{% endif %}{{ option_value.price }}) {% endif %}"/> {% endif %}
                    <span class="option-value">
                      {{ option_value.name }}
                      {% if option_value.price %}
                        <span class="option-price">({% if option_value.price_prefix == '+' or option_value.price_prefix == '-' %}{{ option_value.price_prefix }}{% endif %}{{ option_value.price }})</span>
                      {% endif %}
                    </span>
                  </label>
                </div>
                {% endfor %} </div>
            </div>
            {% endif %}
            {% if option.type == 'text' %}
            <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" placeholder="{{ option.name }}" id="input-option{{ option.product_option_id }}" class="form-control" />
            </div>
            {% endif %}
            {% if option.type == 'textarea' %}
            <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <textarea name="option[{{ option.product_option_id }}]" rows="5" placeholder="{{ option.name }}" id="input-option{{ option.product_option_id }}" class="form-control">{{ option.value }}</textarea>
            </div>
            {% endif %}
            {% if option.type == 'file' %}
            <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
              <label class="control-label">{{ option.name }}</label>
              <button type="button" id="button-upload{{ option.product_option_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default btn-block"><i class="fa fa-upload"></i> {{ button_upload }}</button>
              <input type="hidden" name="option[{{ option.product_option_id }}]" value="" id="input-option{{ option.product_option_id }}" />
            </div>
            {% endif %}
            {% if option.type == 'date' %}
            <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <div class="input-group date" data-picker-class="product-options pp-date-time-picker">
                <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="YYYY-MM-DD" id="input-option{{ 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>
            {% endif %}
            {% if option.type == 'datetime' %}
            <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <div class="input-group datetime" data-picker-class="product-options pp-date-time-picker">
                <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="YYYY-MM-DD HH:mm" id="input-option{{ 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>
            {% endif %}
            {% if option.type == 'time' %}
            <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
              <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
              <div class="input-group time" data-picker-class="product-options pp-date-time-picker">
                <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="HH:mm" id="input-option{{ 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>
            {% endif %}
            {% endfor %}
          </div>
          {% endif %}

          {% if recurrings %}
            <h3 class="title recurring-title">{{ text_payment_recurring }}</h3>
            <div class="form-group required">
              <select name="recurring_id" class="form-control">
                <option value="">{{ text_select }}</option>
                {% for recurring in recurrings %}
                <option value="{{ recurring.recurring_id }}">{{ recurring.name }}</option>
                {% endfor %}
              </select>
              <div class="help-block" id="recurring-description"></div>
            </div>
          {% endif %}

          {% if j3.settings.get('catalogCartStatus') or j3.settings.get('catalogWishlistStatus') or j3.settings.get('catalogCompareStatus') or (product_extra_buttons and not j3.document.isPopup()) %}
          <div class="button-group-page">
            <div class="buttons-wrapper">
              <div class="stepper-group">
                {% if j3.settings.get('catalogCartStatus') %}
				{% if out_of_stock_notify and not total_quantity > 0 %}
				{% else %}
				  {% if (idquantity['product']) %} 
				<div class="input-group">
					<span class="input-group-btn">
					  <a class="btn btn-default btn-number minus" data-type="minus" data-field="category" onclick="descrement($(this).parent().parent())" min="{{ min }}">
						  <span class="glyphicon glyphicon-minus"></span>
						  </a>
					 </span>
					 <input id="product-quantity" type="text" name="quantity" class="form-control input-number" value="{{ min }}">
					 <input id="product-id" type="hidden" name="product_id" value="{{ product_id }}" />
					<span class="input-group-btn">
					  <a class="btn btn-default btn-number plus" data-type="plus" data-field="category" onclick="increment($(this).parent().parent())" max="{{ max }}">
						  <span class="glyphicon glyphicon-plus"></span>
					  </a>
					</span>
				</div>	
				{% endif %}	
				{% endif %}
                <a type="button" {% if out_of_stock_notify and not total_quantity > 0 %}onclick="notify_when_available('{{ product_id }}');"{% else %}id="button-cart"{% endif %} data-loading-text="<span class='btn-text'>{% if out_of_stock_notify and ((product.name and not product.quantity > 0) or product.cart_btn_class or (product_id and not total_quantity > 0 and not product.name)) %}{{ text_notify_button }}{% else %}{{ button_cart }}{% endif %}</span>" class="btn btn-cart" {% if (j3.settings.get(stylePrefix ~ 'CartDisplay') == "icon") and (j3.settings.get(stylePrefix ~ 'CartTooltipStatus')) %} data-toggle="tooltip" data-tooltip-class="pp-cart-tooltip" data-placement="{{ j3.settings.get(stylePrefix ~ 'CartTooltipPosition') }}" title="{% if out_of_stock_notify and ((product.name and not product.quantity > 0) or product.cart_btn_class or (product_id and not total_quantity > 0 and not product.name)) %}{{ text_notify_button }}{% else %}{{ button_cart }}{% endif %}" {% endif %}><span class="btn-text">{% if out_of_stock_notify and ((product.name and not product.quantity > 0) or product.cart_btn_class or (product_id and not total_quantity > 0 and not product.name)) %}{{ text_notify_button }}{% else %}{{ button_cart }}{% endif %}</span></a>
                {% endif %}
				{% if out_of_stock_notify and not total_quantity > 0 %}
				{% else %}
                {% if product_extra_buttons and not j3.document.isPopup() %}
                  <div class="extra-group">
                    {% for id, extra_button in product_extra_buttons %}
                      <a class="btn btn-extra btn-extra-{{ id }}" {% if (j3.settings.get(stylePrefix ~ 'ExtraDisplay') == "icon") and (j3.settings.get(stylePrefix ~ 'ExtraTooltipStatus')) %} data-toggle="tooltip" data-tooltip-class="extra-tooltip pp-extra-tooltip" data-placement="{{ j3.settings.get(stylePrefix ~ 'ExtraTooltipPosition') }}" title="{{ extra_button.label }}" {% endif %} {% if extra_button.action == 'quickbuy' %}data-quick-buy{% endif %} {% if extra_button.action == 'link' and extra_button.link.href %}href="{{ extra_button.link.href }}" data-product_id="{{ product_id }}"{% endif %} data-loading-text="<span class='btn-text'>{{ extra_button.label }}</span>"><span class="btn-text">{{ extra_button.label }}</span></a>
                    {% endfor %}
                  </div>
                {% endif %}
				{% endif %}
              </div>

              {% if j3.settings.get('catalogWishlistStatus') or j3.settings.get('catalogCompareStatus') %}
              <div class="wishlist-compare">
                {% if not j3.document.isPopup('options') %}
                  {% if j3.settings.get('catalogWishlistStatus') %}
                  <a type="button" class="btn btn-wishlist" {% if (j3.settings.get(stylePrefix ~ 'WishlistDisplay') == "icon") and (j3.settings.get(stylePrefix ~ 'WishlistTooltipStatus')) %} data-toggle="tooltip" data-tooltip-class="pp-wishlist-tooltip" data-placement="{{ j3.settings.get(stylePrefix ~ 'WishlistTooltipPosition') }}" title="{{ button_wishlist }}" {% endif %} onclick="parent.wishlist.add({{ product_id }});"><span class="btn-text">{{ button_wishlist }}</span></a>
                  {% endif %}

                  {% if j3.settings.get('catalogCompareStatus') %}
                  <a type="button" class="btn btn-compare" {% if (j3.settings.get(stylePrefix ~ 'CompareDisplay') == "icon") and (j3.settings.get(stylePrefix ~ 'CompareTooltipStatus')) %} data-toggle="tooltip" data-tooltip-class="pp-compare-tooltip" data-placement="{{ j3.settings.get(stylePrefix ~ 'CompareTooltipPosition') }}" title="{{ button_compare }}" {% endif %} onclick="parent.compare.add({{ product_id }});"><span class="btn-text">{{ button_compare }}</span></a>
                  {% endif %}
                {% endif %}
                {% if j3.document.isPopup('quickview') %}
                  <a class="btn btn-more-details" href="{{ view_more_url }}" target="_top" {% if (j3.settings.get(stylePrefix ~ 'MoreDetailsDisplay') == "icon") and (j3.settings.get(stylePrefix ~ 'MoreDetailsTooltipStatus')) %} data-toggle="tooltip" data-tooltip-class="more-details-tooltip" data-placement="{{ j3.settings.get(stylePrefix ~ 'MoreDetailsTooltipPosition') }}" title="{{ j3.settings.get('quickviewExtraText') }}" {% endif %}><span class="btn-text">{{ j3.settings.get('quickviewExtraText') }}</span></a>
                {% endif %}
              </div>
              {% endif %}
            </div>
          </div>
          {% endif %}

          {% if minimum > 1 %}
            <div class="minimum alert alert-info"><i class="fa fa-info-circle"></i> {{ text_minimum }}</div>
          {% endif %}
          </div>
          {% if not j3.document.isPopup('options') %}
            {{ product_blocks.bottom|join }}
          {% endif %}
          {% if tags and not j3.document.isPopup() and (j3.settings.get(stylePrefix ~ 'TagsPosition') == 'details') %}
            <div class="tags">
              <span class="tags-title">{{ text_tags }}</span>
              {% for tag in tags %}
                <a href="{{ tag.href }}">{{ tag.tag }}</a>
                {% if not loop.last %}<b>,</b>{% endif %}
              {% endfor %}
            </div>
          {% endif %}
        </div>
      </div>
      {% if j3.document.isPopup('quickview') and j3.settings.get('quickviewDescription') and (j3.settings.get('quickviewDescriptionPosition') == 'default') %}
        <div class="description {{ quickviewExpand }}">
          <div class="expand-block">
            <div class="expand-content">
              {{ description }}
            </div>
            {% if j3.settings.get('quickviewExpandButton') %}
              <div class="block-expand-overlay"><a class="block-expand btn"></a></div>
            {% endif %}
          </div>
        </div>
      {% endif %}
      {% if not j3.document.isPopup('options') %}
        <div class="product-blocks blocks-bottom">
          {{ product_blocks.default|join }}
        </div>
      {% endif %}
      {% if tags and not j3.document.isPopup() and (j3.settings.get(stylePrefix ~ 'TagsPosition') == 'default') %}
        <div class="tags">
          <span class="tags-title">{{ text_tags }}</span>
          {% for tag in tags %}
            <a href="{{ tag.href }}">{{ tag.tag }}</a>
            {% if not loop.last %}<b>,</b>{% endif %}
          {% endfor %}
        </div>
      {% endif %}
      {% if not j3.document.isPopup() %}
      {{ content_bottom }}</div>
    {{ column_right }}</div>
</div>
{% endif %}
<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-dismissible, .text-danger').remove();

			if (json['success']) {
				$('#recurring-description').html(json['success']);
			}
		}
	});
});
//--></script>
<script type="text/javascript"><!--
$('#button-cart, [data-quick-buy]').on('click', function () {
  var $btn = $(this);
  $.ajax({
    url: 'index.php?route=checkout/cart/add',
    type: 'post',
    data: $(
      '#product .button-group-page input[type=\'text\'], #product .button-group-page input[type=\'hidden\'], #product .button-group-page input[type=\'radio\']:checked, #product .button-group-page input[type=\'checkbox\']:checked, #product .button-group-page select, #product .button-group-page textarea, ' +
      '#product .product-options input[type=\'text\'], #product .product-options input[type=\'hidden\'], #product .product-options input[type=\'radio\']:checked, #product .product-options input[type=\'checkbox\']:checked, #product .product-options select, #product .product-options textarea, ' +
      '#product select[name="recurring_id"]'
    ),
    dataType: 'json',
    beforeSend: function () {
      $('#button-cart').button('loading');
    },
    complete: function () {
      $('#button-cart').button('reset');
    },
    success: function (json) {
      $('.alert-dismissible, .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']) {
        if ($('html').hasClass('popup-options')) {
          parent.$(".popup-options .popup-close").trigger('click');
        }

        if (json['notification']) {
          parent.show_notification(json['notification']);
        } else {
          parent.$('#content').parent().before('<div class="alert alert-success"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
        }

        parent.$('#cart-total').html(json['total']);
        parent.$('#cart-items').html(json['items_count']);

        if (Opencartvip['scrollToTop']) {
          parent.$('html, body').animate({ scrollTop: 0 }, 'slow');
        }

        parent.$('.cart-content ul').load('index.php?route=common/cart/info ul li');

        if (window.location.href.indexOf('quick_buy=true') !== -1) {
          parent.location.href = 'index.php?route=checkout/checkout';
        }

        if ($btn.data('quick-buy') !== undefined) {
          location = 'index.php?route=checkout/checkout';
        }

        if (parent.window['_QuickCheckout']) {
          parent.window['_QuickCheckout'].save();
        }
      }
    },
    error: function (xhr, ajaxOptions, thrownError) {
      alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText);
    }
  });
});
//--></script>
<script type="text/javascript"><!--
$('.date').datetimepicker({
	language: '{{ datepicker }}',
	pickTime: false
});

$('.datetime').datetimepicker({
	language: '{{ datepicker }}',
	pickDate: true,
	pickTime: true
});

$('.time').datetimepicker({
	language: '{{ datepicker }}',
	pickDate: false
});

$('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"><!--
$(function () {
  $('#review').delegate('.pagination a', 'click', function(e) {
    e.preventDefault();

    $('#review').fadeOut('slow');

    $('#review').load(this.href);

    $('#review').fadeIn('slow');
  });

  
				{% if reviewprostatus %}
				$('#review').load('index.php?route=extension/reviewpro/reviewpro&product_id={{ product_id }}');
				{% else %}
				$('#review').load('index.php?route=product/product/review&product_id={{ product_id }}');
				{% endif %}
				{% if reviewprostatus and reviewfeatured %}
				$('.featuredreview').load('index.php?route=extension/reviewpro/featuredreviewpro&product_id={{ product_id }}');
				{% endif %}
			

  $('#button-review').on('click', function() {
    $.ajax({
      url: 'index.php?route=product/product/write&product_id={{ 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-dismissible').remove();

        if (json['error']) {
          $('#review').after('<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '</div>');
        }

        if (json['success']) {
          $('#review').after('<div class="alert alert-success alert-dismissible"><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
		}
	});
});

$(document).ready(function () {
  $('.review-links a').on('click', function () {
    var $review = $('#review');
    if ($review.length) {
      $('a[href="#' + $review.closest('.module-item').attr('id') + '"]').trigger('click');
      $('a[href="#' + $review.closest('.panel-collapse').attr('id') + '"]').trigger('click');

      $([document.documentElement, document.body]).animate({
        scrollTop: $review.offset().top - 100
      }, 200);
    }
  });
});
//--></script>
{% if not j3.document.isPopup() %}
{{ j3.loadController('opencartvip/seo/rich_snippets', breadcrumbs) }}
{% endif %}
<!-- << Related Options  -->
				
				{% if ( ro_product_page_script ?? false ) %}
					{{ ro_product_page_script }}
				{% endif %}
	
				<!-- >> Related Options  -->

<!--autocalc_price_option_v4-->
<script type="text/javascript"><!--
function price_format(price) { 
c={{ autocalc_currency.decimals }};d='{{ autocalc_currency.decimal_point }}';t='{{ autocalc_currency.thousand_point }}';sl='{{ autocalc_currency.symbol_left }}';sr='{{ autocalc_currency.symbol_right }}';n=price*{{ autocalc_currency.value }};i=parseInt(n=Math.abs(n).toFixed(c))+''; j=((j=i.length)>3)?j%3:0;price_text=sl+(j?i.substr(0,j)+t:'')+i.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+t)+(c?d+Math.abs(n-i).toFixed(c).slice(2):'')+sr;{% if autocalc_currency2 %}c={{ autocalc_currency2.decimals }};d='{{ autocalc_currency2.decimal_point }}';t='{{ autocalc_currency2.thousand_point }}';sl='{{ autocalc_currency2.symbol_left }}';sr='{{ autocalc_currency2.symbol_right }}';n=price*{{ autocalc_currency2.value }};i=parseInt(n=Math.abs(n).toFixed(c))+''; j=((j=i.length)>3)?j%3:0; price_text+='  <span class="currency2">(' + sl+(j?i.substr(0,j)+t:'')+i.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+t)+(c?d+Math.abs(n-i).toFixed(c).slice(2):'')+sr + ')</span>';{% endif %}return price_text;
}
function points_format(v) {
return v.toFixed(0);
}
function process_discounts(price, quantity) {
{% for discounts in discounts_raw %}if(quantity>={{ discounts.quantity }}){price={{ discounts.price }};}{% endfor %}return price;
}
function calculate_tax(price) {
var p=price;{% for tax_rate in tax_rates %}{% if tax_rate.type == 'F' %}p+={{ tax_rate.rate }};{% endif %}{% if tax_rate.type == 'P' %}p+=price*{{ tax_rate.rate / 100.0 }};{% endif %}{% endfor %}return p;
}
function autocalc_aap(s,p,ff){$(s).each(function(){var $t=$(this);$({value:$t.data('value')||0}).animate({value:p},{easing:'swing',duration:500,step:function(value){$t.html(ff(value));$t.data('value',value);}});});}
function recalculateprice() {
    var main_price = {{ apo_price_value + 0.0 }};
    var special = {{ apo_special_value + 0.0 }};
    var input_quantity = Number($('#product input[name="quantity"]').val()) || 1;
    var discount_coefficient = 1;
    var option_price = 0;
    var discount_quantity = 0;
    
    $('#product .owq-option input[type="checkbox"]').each(function() {
        $qty = $(this).closest('tr').find('.owq-input');
        if ($(this).data('split')=='/') discount_quantity += Number($qty.val()) || 0;
    });    
    if (discount_quantity == 0) discount_quantity = input_quantity;
    
    {% if special %}
    special_coefficient = {{ apo_price_value / apo_special_value }};
    {% else %}
    {% if autocalc_option_discount %}
    if (main_price) discount_coefficient = process_discounts(main_price, discount_quantity) / main_price;
    {% else %}
    main_price = process_discounts(main_price, discount_quantity);
    {% endif %}
    {% endif %}
    
    {% if points %}
    var points = {{ apo_points_value }};
    $('#product input:checked,#product option:selected').each(function() {
        if ($(this).data('points')) points += Number($(this).data('points'));
    });
    autocalc_aap('.autocalc-product-points', points, points_format);
    {% endif %}
    
    $('#product input:checked,#product option:selected').each(function() {
    if ($(this).data('prefix') == '=') {
        option_price += Number($(this).data('price'));
        main_price = 0;
        special = 0;
    }
    });
    
    $('#product input:checked,#product option:selected').each(function() {
    if ($(this).data('prefix') == '+') {
        option_price += Number($(this).data('price'));
    }
    if ($(this).data('prefix') == '-') {
        option_price -= Number($(this).data('price'));
    }
    if ($(this).data('prefix') == '%') {
        pcnt = 1.0 + (Number($(this).data('price')) / 100.0);
        option_price *= pcnt;
        main_price *= pcnt;
        special *= pcnt;
    }
    if ($(this).data('prefix') == '*') {
        option_price *= Number($(this).data('price'));
        main_price *= Number($(this).data('price'));
        special *= Number($(this).data('price'));
    }
    if ($(this).data('prefix') == '/') {
        option_price /= Number($(this).data('price'));
        main_price /= Number($(this).data('price'));
        special /= Number($(this).data('price'));
    }
    });
    
    special += option_price;
    main_price += option_price;

    {% if special %}
    {% if autocalc_option_special %}
    special = main_price / special_coefficient;
    {% else %}
    main_price = special * special_coefficient;
    {% endif %}
    tax = special;
    {% else %}
    {% if autocalc_option_discount %}
    main_price *= discount_coefficient;
    {% endif %}
    tax = main_price;
    {% endif %}
    
    {% if tax %}
    main_price = calculate_tax(main_price);
    {% if special %}
    special = calculate_tax(special);
    {% endif %}
    {% endif %}
    
    {% if not autocalc_not_mul_qty %}
    if (input_quantity > 0) {
        main_price *= input_quantity;
        special *= input_quantity;
        {% if tax %}tax *= input_quantity;{% endif %}
    }
    {% endif %}
    
    autocalc_aap('.autocalc-product-price', main_price, price_format);
    {% if special %}autocalc_aap('.autocalc-product-special', special, price_format);{% endif %}
    {% if tax %}autocalc_aap('.autocalc-product-tax', tax, price_format);{% endif %}
}

$(document).ready(function() {
    $('#product input[type="checkbox"],#product input[type="radio"],#product select').each(function(){if($(this).data('autocalc'))return;$(this).data('autocalc',1).on('change',function(){recalculateprice();});});    
    $('#product input[name="quantity"]').each(function(){if($(this).data('autocalc'))return;var $q=$(this);$q.data('autocalc',1).data('val',$q.val());(function(){if($q.val()!=$q.data('val')){$q.data('val',$q.val());recalculateprice();}setTimeout(arguments.callee,250);})();});
    
    {% if autocalc_select_first %}
    $('#product select[name^="option"] option[value=""]').remove();
    last_name='';$('#product input[type="radio"][name^="option"]').each(function(){if($(this).attr('name')!=last_name)$(this).prop('checked',true);last_name=$(this).attr('name');});
    {% endif %}
    
    recalculateprice();
});
//--></script>
      

{% if owq_of_data %}
<script>
var owqof = {{ owq_of_data }};
$('input[type="radio"][name^="option"], input[type="checkbox"][name^="option"], select[name^="option"]').on('change', function(){
    $('.owqof-info').remove();
    var all_html = '';
    $('input[type="radio"][name^="option"]:checked, input[type="checkbox"][name^="option"]:checked, select[name^="option"] option:selected').each(function(){
        var $c=$(this).closest('.form-group');var id = $(this).val(); if (!owqof[id]) return;
        var html='';
        if (owqof[id].description) html += '<div>'+owqof[id].description+'</div>';
        if (owqof[id].sku) html += '<div>SKU: '+owqof[id].sku+'</div>';
        if (owqof[id].upc) html += '<div>UPC: '+owqof[id].upc+'</div>';
        if (owqof[id].model) html += '<div>Модель: '+owqof[id].model+'</div>';
        if (!html) return;
        all_html+=html;
        {% if not owq_description_selector %}
        $c.append('<div class="owqof-info">'+html+'</div>');
        {% endif %}
    });
    {% if owq_description_selector %}
    $('{{ owq_description_selector }}').html(all_html);
    {% endif %}
});
</script>
{% endif %}
      
				{{ footer }}
