Jump to content

Desaparece botón "añadir al carrito" en product-list.tpl presta 1.6.x


Recommended Posts

hola , primero gracias por esta comunidad de prestashop.

Me sucede algo raro en la pagina de productos , product-list.tpl , no se me muestran ni el icono de 'qv-wrap' y 'cart-btn' al menos que ordene la lista por referencia, precio, nombre ,inventario.

al seleccionar cualquiera de esas opciones , se muestra los 4 iconos.

dejare el código tanto del product-list.tpl como el del global.js

a ver que pueden ver que yo no veo. 

Gracias

product-list.tpl

{if isset($products) && $products}
  {*define number of products per line in other page for desktop*}
  {if ($hide_left_column || $hide_right_column) && ($hide_left_column !='true' || $hide_right_column !='true')}     {* left or right column *}
    {assign var='nbItemsPerLine' value=3}
    {assign var='nbItemsPerLineTablet' value=2}
    {assign var='nbItemsPerLineMobile' value=2}
  {elseif ($hide_left_column && $hide_right_column) && ($hide_left_column =='true' && $hide_right_column =='true')} {* no columns *}
    {assign var='nbItemsPerLine' value=4}
    {assign var='nbItemsPerLineTablet' value=3}
    {assign var='nbItemsPerLineMobile' value=2}
  {else}																											  {* left and right column *}
    {assign var='nbItemsPerLine' value=2}
    {assign var='nbItemsPerLineTablet' value=1}
    {assign var='nbItemsPerLineMobile' value=2}
  {/if}
  {*define numbers of product per line in other page for tablet*}
  
  {assign var='nbLi' value=$products|@count}
  {math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
  {math equation="nbLi/nbItemsPerLineTablet" nbLi=$nbLi nbItemsPerLineTablet=$nbItemsPerLineTablet assign=nbLinesTablet}
  
  <!-- Products list -->
  <ul{if isset($id) && $id} id="{$id}"{/if} class="product_list grid row{if isset($class) && $class} {$class}{/if}">
    {foreach from=$products item=product name=products}
      {math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo}
      {math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineTablet assign=totModuloTablet}
      {math equation="(total%perLineM)" total=$smarty.foreach.products.total perLineM=$nbItemsPerLineMobile assign=totModuloMobile}
      {if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
      {if $totModuloTablet == 0}{assign var='totModuloTablet' value=$nbItemsPerLineTablet}{/if}
      {if $totModuloMobile == 0}{assign var='totModuloMobile' value=$nbItemsPerLineMobile}{/if}
      <li class="ajax_block_product col-xs-{12/$nbItemsPerLineMobile} col-sm-{12/$nbItemsPerLineTablet} col-md-{12/$nbItemsPerLine}{if $smarty.foreach.products.iteration%$nbItemsPerLine == 0} last-in-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLine == 1} first-in-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModulo)} last-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 0} last-item-of-tablet-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 1} first-item-of-tablet-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 0} last-item-of-mobile-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 1} first-item-of-mobile-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModuloMobile)} last-mobile-line{/if}">
        <div class="product-container" itemscope itemtype="https://schema.org/Product">
          <div class="left-block">
            <div class="product-image-container">
              {capture name='displayProductListGallery'}{hook h='displayProductListGallery' product=$product}{/capture}
              {if $smarty.capture.displayProductListGallery}
                {hook h='displayProductListGallery' product=$product}
              {else}
                <a class="product_img_link" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url">
                  <img class="replace-2x img-responsive" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}"title="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}"{if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} itemprop="image" />
                </a>
              {/if}
              {if isset($product.new) && $product.new == 1}
                <a class="new-box" href="{$product.link|escape:'html':'UTF-8'}">
                  <span class="new-label">{l s='New'}</span>
                </a>
              {/if}
              {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
                <a class="sale-box" href="{$product.link|escape:'html':'UTF-8'}">
                  <span class="sale-label">{l s='Sale!'}</span>
                </a>
              {/if}
            </div>
            {if isset($product.is_virtual) && !$product.is_virtual}{hook h="displayProductDeliveryTime" product=$product}{/if}
            {hook h="displayProductPriceBlock" product=$product type="weight"}
          </div>
          <div class="right-block">
            <h5 itemprop="name">
              {if isset($product.pack_quantity) && $product.pack_quantity}{$product.pack_quantity|intval|cat:' x '}{/if}
              <a class="product-name" href="{$product.link|escape:'html':'UTF-8'}" title="{$product.name|escape:'html':'UTF-8'}" itemprop="url" >
                <span class="list-name">{$product.name|truncate:100:'...'|escape:'html':'UTF-8'}</span>
                <span class="grid-name">{$product.name|truncate:45:'...'|escape:'html':'UTF-8'}</span>
              </a>
            </h5>
            <p class="product-desc" itemprop="description">
              <span class="list-desc">{$product.description_short|strip_tags:'UTF-8'|truncate:220:'...'}</span>
              <span class="grid-desc">{$product.description_short|strip_tags:'UTF-8'|truncate:50:'...'}</span>
            </p>
            {if (!$PS_CATALOG_MODE && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
              <div class="content_price">
                {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
                  {hook h="displayProductPriceBlock" product=$product type='before_price'}
                  {if $product.price_without_reduction > 0 && isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
                    {if $product.specific_prices.reduction_type == 'percentage'}
                      <span class="price-percent-reduction">-{$product.specific_prices.reduction * 100}%</span>
                    {/if}
                  {/if}
                  <span class="price product-price{if isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0} product-price-new{/if}">
                    {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
                  </span>
                  {if $product.price_without_reduction > 0 && isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}
                    {hook h="displayProductPriceBlock" product=$product type="old_price"}
                    <span class="old-price product-price">
                      {displayWtPrice p=$product.price_without_reduction}
                    </span>
                    {hook h="displayProductPriceBlock" id_product=$product.id_product type="old_price"}
                  {/if}
                  {hook h="displayProductPriceBlock" product=$product type="price"}
                  {hook h="displayProductPriceBlock" product=$product type="unit_price"}
                  {hook h="displayProductPriceBlock" product=$product type='after_price'}
                {/if}
              </div>
            {/if}
            {if (!$PS_CATALOG_MODE && $PS_STOCK_MANAGEMENT && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
              {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
                <span class="availability">
                  {if ($product.allow_oosp || $product.quantity > 0)}
                    <span class="{if $product.quantity <= 0 && isset($product.allow_oosp) && !$product.allow_oosp} label-danger{elseif $product.quantity <= 0} label-warning{else} label-success{/if}">
                      {if $product.quantity <= 0}{if $product.allow_oosp}{if isset($product.available_later) && $product.available_later}{$product.available_later}{else}{l s='In Stock'}{/if}{/if}{else}{if isset($product.available_now) && $product.available_now}{$product.available_now}{else}{l s='In Stock'}{/if}{/if}
                    </span>
                  {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
                    <span class="label-warning">
                      {l s='Product available with different options'}
                    </span>
                  {else}
                    <span class="label-danger">
                      {l s='Out of stock'}
                    </span>
                  {/if}
                </span>
              {/if}
            {/if}
            {if isset($product.color_list)}
              <div class="color-list-container">{$product.color_list}</div>
            {/if}
            <div class="product-flags">
              {if (!$PS_CATALOG_MODE && ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                {if isset($product.online_only) && $product.online_only}
                  <span class="online_only">{l s='Online only'}</span>
                {/if}
              {/if}
              {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
              {elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
                <span class="discount">{l s='Reduced price!'}</span>
              {/if}
            </div>
            <div class="functional-buttons clearfix">
              {if isset($quick_view) && $quick_view}
                <div class="qv-wrap"><a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" data-href="{$product.link|escape:'html':'UTF-8'}"></a></div>
              {/if}
              {hook h='displayProductListFunctionalButtons' product=$product}
              {if isset($comparator_max_item) && $comparator_max_item}
                <div class="compare">
                  <a class="add_to_compare" href="{$product.link|escape:'html':'UTF-8'}" data-id-product="{$product.id_product}" title="{l s='Add to Compare'}"></a>
                </div>
              {/if}
              {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
                {if ($product.allow_oosp || $product.quantity > 0)}
                  <div class="cart-btn">
                    {if (!isset($product.customization_required) || !$product.customization_required)}
                      {capture}add=1&amp;id_product={$product.id_product|intval}{if isset($product.id_product_attribute) && $product.id_product_attribute}&amp;ipa={$product.id_product_attribute|intval}{/if}{if isset($static_token)}&amp;token={$static_token}{/if}{/capture}
                      <a class="ajax_add_to_cart_button btn btn-sm btn-primary" href="{$link->getPageLink('cart', true, NULL, $smarty.capture.default, false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product-attribute="{$product.id_product_attribute|intval}" data-id-product="{$product.id_product|intval}" data-minimal_quantity="{if isset($product.product_attribute_minimal_quantity) && $product.product_attribute_minimal_quantity >= 1}{$product.product_attribute_minimal_quantity|intval}{else}{$product.minimal_quantity|intval}{/if}">
                        <span>{l s='Add to cart'}</span>
                      </a>
                    {else}
                      <a class="customization btn btn-sm btn-primary" href="{$product.link|escape:'html':'UTF-8'}"  title="{l s='Customize'}">
                        <span>{l s='Customize'}</span>
                      </a>
                    {/if}
                  </div>
                {/if}
              {/if}
            </div>
          </div>
        </div><!-- .product-container> -->
      </li>
    {/foreach}
  </ul>
  {addJsDefL name=min_item}{l s='Please select at least one product' js=1}{/addJsDefL}
  {addJsDefL name=max_item}{l s='You cannot add more than %d product(s) to the product comparison' sprintf=$comparator_max_item js=1}{/addJsDefL}
  {addJsDef comparator_max_item=$comparator_max_item}
  {addJsDef comparedProductsIds=$compared_products}
  {addJsDef nbItemsPerLine=$nbItemsPerLine}
  {addJsDef nbItemsPerLineTablet=$nbItemsPerLineTablet}
  {addJsDef nbItemsPerLineMobile=$nbItemsPerLineMobile}
{/if}

global.js

//global variables
var responsiveflag = false;
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
var isiPad = /iPad/i.test(navigator.userAgent);
$(document).ready(function() {
  controller = new ScrollMagic();
  highdpiInit();
  responsiveResize();
  $(window).resize(responsiveResize);
  if (navigator.userAgent.match(/Android/i)) {
    var viewport = document.querySelector('meta[name="viewport"]');
    viewport.setAttribute('content', 'initial-scale=1.0,maximum-scale=1.0,user-scalable=0,width=device-width,height=device-height');
    window.scrollTo(0, 1);
  }
  blockHover();
  if (typeof quickView !== 'undefined' && quickView) {
    quick_view();
  }
  dropDown();
  sitemapAccordion();
  counter();
  testimonialsSlider();
  toTop();
  if (typeof page_name != 'undefined' && !in_array(page_name, ['index', 'product', 'module-tmlookbook-pages'])) {
    bindGrid();
    $(document).on('change', '.selectProductSort', function(e) {
      if (typeof request != 'undefined' && request) {
        var requestSortProducts = request;
      }
      var splitData = $(this).val().split(':');
      var url = '';
      if (typeof requestSortProducts != 'undefined' && requestSortProducts) {
        url += requestSortProducts;
        if (typeof splitData[0] !== 'undefined' && splitData[0]) {
          url += ( requestSortProducts.indexOf('?') < 0 ? '?' : '&') + 'orderby=' + splitData[0] + (splitData[1] ? '&orderway=' + splitData[1] : '');
          if (typeof splitData[1] !== 'undefined' && splitData[1]) {
            url += '&orderway=' + splitData[1];
          }
        }
        document.location.href = url;
      }
    });
    $(document).on('change', 'select[name="n"]', function() {
      $(this.form).submit();
    });
    $(document).on('change', 'select[name="currency_payment"]', function() {
      setCurrency($(this).val());
    });
  }
  $(document).on('change', 'select[name="manufacturer_list"], select[name="supplier_list"]', function() {
    if (this.value != '') {
      location.href = this.value;
    }
  });
  $(document).on('click', '.back', function(e) {
    e.preventDefault();
    history.back();
  });
  jQuery.curCSS = jQuery.css;
  if (!!$.prototype.cluetip) {
    $('a.cluetip').cluetip({
      local: true,
      cursor: 'pointer',
      dropShadow: false,
      dropShadowSteps: 0,
      showTitle: false,
      tracking: true,
      sticky: false,
      mouseOutClose: true,
      fx: {
        open: 'fadeIn',
        openSpeed: 'fast'
      }
    }).css('opacity', 0.8);
  }
  if (typeof(FancyboxI18nClose) !== 'undefined' && typeof(FancyboxI18nNext) !== 'undefined' && typeof(FancyboxI18nPrev) !== 'undefined' && !!$.prototype.fancybox) {
    $.extend($.fancybox.defaults.tpl, {
      closeBtn: '<a title="' + FancyboxI18nClose + '" class="fancybox-item fancybox-close" href="javascript:;"></a>',
      next: '<a title="' + FancyboxI18nNext + '" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
      prev: '<a title="' + FancyboxI18nPrev + '" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
    });
  }
  // Close Alert messages
  $('.alert.alert-danger').on('click', this, function(e) {
    if (e.offsetX >= 16 && e.offsetX <= 39 && e.offsetY >= 16 && e.offsetY <= 34) {
      $(this).fadeOut();
    }
  });
});
function highdpiInit() {
  if (typeof highDPI === 'undefined') {
    return;
  }
  if (highDPI && $('.replace-2x').css('font-size') == '1px') {
    var els = $('img.replace-2x').get();
    for (var i = 0; i < els.length; i++) {
      src = els[i].src;
      extension = src.substr((src.lastIndexOf('.') + 1));
      src = src.replace('.' + extension, '2x.' + extension);
      var img = new Image();
      img.src = src;
      img.height != 0 ? els[i].src = src : els[i].src = els[i].src;
    }
  }
}
// Used to compensante Chrome/Safari bug (they don't care about scroll bar for width)
function scrollCompensate() {
  var inner = document.createElement('p');
  inner.style.width = '100%';
  inner.style.height = '200px';
  var outer = document.createElement('div');
  outer.style.position = 'absolute';
  outer.style.top = '0px';
  outer.style.left = '0px';
  outer.style.visibility = 'hidden';
  outer.style.width = '200px';
  outer.style.height = '150px';
  outer.style.overflow = 'hidden';
  outer.appendChild(inner);
  document.body.appendChild(outer);
  var w1 = inner.offsetWidth;
  outer.style.overflow = 'scroll';
  var w2 = inner.offsetWidth;
  if (w1 == w2) {
    w2 = outer.clientWidth;
  }
  document.body.removeChild(outer);
  return (w1 - w2);
}
function responsiveResize() {
  compensante = scrollCompensate();
  if (($(window).width() + scrollCompensate()) <= 767 && responsiveflag == false) {
    accordion('enable');
    accordionFooter('enable');
    responsiveflag = true;
    if (typeof bindUniform !== 'undefined') {
      bindUniform();
    }
  } else if (($(window).width() + scrollCompensate()) >= 768) {
    accordion('disable');
    accordionFooter('disable');
    responsiveflag = false;
    if (typeof bindUniform !== 'undefined') {
      bindUniform();
    }
  }
}
function blockHover(status) {
  $(document).off('mouseenter').on('mouseenter', '.product_list.grid li.ajax_block_product .product-container', function(e) {
    if ('ontouchstart' in document.documentElement) {
      return;
    }
    if ($('body').find('.container').width() >= 1170) {
      $(this).parent().addClass('hovered');
    }
  });
  $(document).off('mouseleave').on('mouseleave', '.product_list.grid li.ajax_block_product .product-container', function(e) {
    if ($('body').find('.container').width() >= 1170) {
      $(this).parent().removeClass('hovered');
    }
  });
}
function quick_view() {
  $(document).on('click', '.quick-view:visible, .quick-view-mobile:visible', function(e) {
    e.preventDefault();
    var url = $(this).attr('data-href');
    if (!url && url == 'undefined') {
      var url = this.rel;
    }
    var anchor = '';
    if (url.indexOf('#') != -1) {
      anchor = url.substring(url.indexOf('#'), url.length);
      url = url.substring(0, url.indexOf('#'));
    }
    if (url.indexOf('?') != -1) {
      url += '&';
    } else {
      url += '?';
    }
    if (!!$.prototype.fancybox) {
      var qvwidth = 1280;
      if ($(window).width() < 1500) {
        qvwidth = 1000;
      }
      if ($(window).width() < 1050) {
        qvwidth = 580;
      }
      $.fancybox({
        'padding': 0,
        'width': qvwidth,
        'height': 500,
        'type': 'iframe',
        'href': url + 'content_only=1' + anchor
      });
    }
  });
}
function bindGrid() {
  var storage = false;
  if (typeof(getStorageAvailable) !== 'undefined') {
    storage = getStorageAvailable();
  }
  if (!storage) {
    return;
  }
  var view = $.totalStorage('display');
  if (!view && (typeof displayList != 'undefined') && displayList) {
    view = 'list';
  }
  if (view && view != 'grid') {
    display(view);
  } else {
    $('.display').find('li#grid').addClass('selected');
  }
  $(document).on('click', '#grid, #list', function(e) {
    e.preventDefault();
    if (!$(this).hasClass('selected')) {
      display($(this).attr('id'));
    }
  });
}
function display(view) {
  if (view == 'list') {
    $('ul.product_list').removeClass('grid').addClass('list row');
    $('.product_list > li:visible')
      .removeAttr('class')
      .addClass('ajax_block_product col-xs-12');
    $('.product_list > li:visible').each(function(index, element) {
      var html = '';
      html = '<div class="product-container"><div class="row">';
      html += '<div class="left-block col-xs-5 col-sm-5 col-md-6 col-lg-5">' + $(element).find('.left-block').html() + '</div>';
      html += '<div class="right-block col-xs-7 col-sm-7 col-md-6 col-lg-7">';
      html += '<div class="product-flags">' + $(element).find('.product-flags').html() + '</div>';
      html += '<h5 itemprop="name">' + $(element).find('h5').html() + '</h5>';
      var price = $(element).find('.content_price').html();  // check : catalog mode is enabled
      if (price != null) {
        html += '<div class="content_price">' + price + '</div>';
      }
      var availability = $(element).find('.availability').html();  // check : catalog mode is enabled
      if (availability != null) {
        html += '<span class="availability">' + availability + '</span>';
      }
      html += '<p class="product-desc">' + $(element).find('.product-desc').html() + '</p>';
      var colorList = $(element).find('.color-list-container').html();
      if (colorList != null) {
        html += '<div class="color-list-container">' + colorList + '</div>';
      }
      html += '<div class="functional-buttons clearfix">' + $(element).find('.functional-buttons').html() + '</div>';
      html += '</div></div>';
      $(element).html(html);
      var qv = $(element).find('.qv-wrap');
      if (qv) {
        qv.appendTo($(element).find('.product-image-container'));
      }
    });
    $('.display').find('li#list').addClass('selected');
    $('.display').find('li#grid').removeAttr('class');
    $.totalStorage('display', 'list');
    if ($('.product_list li div.wishlist').length) {
      WishlistButton();
    }
  } else {
    $('ul.product_list').removeClass('list').addClass('grid row');
    if (nbItemsPerLine && nbItemsPerLineTablet && nbItemsPerLineMobile) {
      var totModulo = ($('.product_list > li').length) % nbItemsPerLine;
      totModulo == 0 ? totModulo = nbItemsPerLine : totModulo = totModulo;
      var totModuloLine = ($('.product_list > li').length) - totModulo;
      var totModuloTab = ($('.product_list > li').length) % nbItemsPerLineTablet;
      totModuloTab == 0 ? totModuloTab = nbItemsPerLineTablet : totModuloTab = totModuloTab;
      var totModuloTabLine = ($('.product_list > li').length) - totModuloTab;
      var totModuloMob = ($('.product_list > li').length) % nbItemsPerLineMobile;
      totModuloMob == 0 ? totModuloMob = nbItemsPerLineMobile : totModuloMob = totModuloMob;
      var totModuloMobLine = ($('.product_list > li').length) - totModuloMob;
    }
    $('.product_list > li:visible').each(function(index, element) {
      if (nbItemsPerLine && nbItemsPerLineTablet && nbItemsPerLineMobile) {
        $(element)
          .removeAttr('class')
          .addClass('ajax_block_product col-xs-' + 12 / nbItemsPerLineMobile + ' col-sm-' + 12 / nbItemsPerLineTablet + ' col-md-' + 12 / nbItemsPerLine);
        (index + 1) % nbItemsPerLine == 0 ? $(element).addClass('last-in-line') : false;
        (index + 1) % nbItemsPerLine == 1 ? $(element).addClass('first-in-line') : false;
        (index + 1) > totModuloLine ? $(element).addClass('last-line') : false;
        (index + 1) % nbItemsPerLineTablet == 0 ? $(element).addClass('last-item-of-tablet-line') : false;
        (index + 1) % nbItemsPerLineTablet == 1 ? $(element).addClass('first-item-of-tablet-line') : false;
        (index + 1) > totModuloTabLine ? $(element).addClass('last-tablet-line') : false;
        (index + 1) % nbItemsPerLineMobile == 0 ? $(element).addClass('last-item-of-mobile-line') : false;
        (index + 1) % nbItemsPerLineMobile == 1 ? $(element).addClass('first-item-of-mobile-line') : false;
        (index + 1) > totModuloMobLine ? $(element).addClass('last-mobile-line') : false;
      }
      var html = '';
      html += '<div class="product-container">';
      html += '<div class="left-block">' + $(element).find('.left-block').html() + '</div>';
      html += '<div class="right-block">';
      html += '<h5 itemprop="name">' + $(element).find('h5').html() + '</h5>';
      html += '<p itemprop="description" class="product-desc">' + $(element).find('.product-desc').html() + '</p>';
      var price = $(element).find('.content_price').html(); // check : catalog mode is enabled
      if (price != null) {
        html += '<div class="content_price">' + price + '</div>';
      }
      var availability = $(element).find('.availability').html(); // check : catalog mode is enabled
      if (availability != null) {
        html += '<span class="availability">' + availability + '</span>';
      }
      var colorList = $(element).find('.color-list-container').html();
      if (colorList != null) {
        html += '<div class="color-list-container">' + colorList + '</div>';
      }
      html += '<div class="product-flags">' + $(element).find('.product-flags').html() + '</div>';
      html += '<div class="functional-buttons clearfix">' + $(element).find('.functional-buttons').html() + '</div>';
      html += '</div>';
      html += '</div>';
      $(element).html(html);
      var qv = $(element).find('.qv-wrap');
      if (qv) {
        qv.prependTo($(element).find('.functional-buttons'));
      }
    });
    $('.display').find('li#grid').addClass('selected');
    $('.display').find('li#list').removeAttr('class');
    $.totalStorage('display', 'grid');
    if ($('.product_list li div.wishlist').length) {
      WishlistButton();
    }
  }
}
function dropDown() {
  elementClick = '#header .current';
  elementSlide = 'ul.toogle_content';
  activeClass = 'active';
  $(elementClick).on('click', function(e) {
    e.stopPropagation();
    var subUl = $(this).next(elementSlide);
    if (subUl.is(':hidden')) {
      subUl.slideDown();
      $(this).addClass(activeClass);
    } else {
      subUl.slideUp();
      $(this).removeClass(activeClass);
    }
    $(elementClick).not(this).next(elementSlide).slideUp();
    $(elementClick).not(this).removeClass(activeClass);
    e.preventDefault();
  });
  $(elementSlide).on('click', function(e) {
    e.stopPropagation();
  });
  $(document).on('click', function(e) {
    e.stopPropagation();
    if (e.which != 3) {
      var elementHide = $(elementClick).next(elementSlide);
      $(elementHide).slideUp();
      $(elementClick).removeClass('active');
    }
  });
}
function accordionFooter(status) {
  if (status == 'enable') {
    $('#footer .footer-block h4').on('click', function(e) {
      $(this)
        .toggleClass('active')
        .parent()
        .find('.toggle-footer')
        .stop()
        .slideToggle('medium');
      e.preventDefault();
    });
    $('#footer')
      .addClass('accordion')
      .find('.toggle-footer')
      .slideUp('fast');
  } else {
    $('.footer-block h4').removeClass('active').off().parent().find('.toggle-footer').removeAttr('style').slideDown('fast');
    $('#footer').removeClass('accordion');
  }
}
//  TOGGLE COLUMNS
function accordion(status) {
  if (status == 'enable') {
    $('#product .product-information .tab-content > h3, #right_column .block:not(#layered_block_left) .title_block, #left_column .block:not(#layered_block_left) .title_block, #left_column #newsletter_block_left h4').on('click', function() {
      $(this)
        .toggleClass('active')
        .parent()
        .find('.block_content')
        .stop()
        .slideToggle('medium');
      $(this)
        .next('.tab-pane')
        .stop()
        .slideToggle('medium');
    });
    $('#right_column, #left_column')
      .addClass('accordion')
      .find('.block:not(#layered_block_left) .block_content')
      .slideUp('fast');
    $('#product .product-information .tab-content > h3:first').addClass('active');
    if (typeof(ajaxCart) !== 'undefined') {
      ajaxCart.collapse();
    }
  } else {
    $('#product .product-information .tab-content > h3, #right_column .block:not(#layered_block_left) .title_block, #left_column .block:not(#layered_block_left) .title_block, #left_column #newsletter_block_left h4')
      .removeClass('active')
      .off()
      .parent()
      .find('.block_content, .tab-pane')
      .removeAttr('style')
      .not('.tab-pane')
      .slideDown('fast');
    $('#left_column, #right_column').removeClass('accordion');
    $('#product .product-information .tab-content > h3:first').addClass('active');
  }
}
function bindUniform() {
  if (!!$.prototype.uniform) {
    $('select.form-control').not('.not_uniform').uniform();
  }
}
function listBlocksAnimate(block, element, row, offset, difEffect) {
  if (!isMobile && jQuery(block).length) {
    var i = 0;
    var j = row;
    var k = 1;
    var effect = -1;
    $(element).each(function() {
      i++;
      if (i > j) {
        j += row;
        k = i;
        effect = effect * (-1);
      }
      effect == -1 && difEffect == true ? ef = TweenMax.from(element + ':nth-child(' + i + ')', 0.5, {
        left: -1 * 200 - i * 300 + 'px',
        alpha: 0,
        ease: Power1.easeOut
      }) : ef = TweenMax.from(element + ':nth-child(' + i + ')', 0.5, {
        right: -1 * 200 - i * 300 + 'px',
        alpha: 0,
        ease: Power1.easeOut
      });
      var scene_new = new ScrollScene({
        triggerElement: element + ':nth-child(' + k + ')',
        offset: offset,
      }).setTween(ef)
        .addTo(controller)
        .reverse(false);
    });
  }
}
//  TOGGLE SITEMAP
function sitemapAccordion() {
  $('#sitemap #center_column ul.tree > li > ul')
    .addClass('accordion_content')
    .parent()
    .find('> a')
    .wrap('<p class="page-subheading accordion_current"></p>');
  $('#center_column .accordion_current').on('click', function() {
    $(this)
      .toggleClass('active')
      .parent()
      .find('.accordion_content')
      .stop()
      .slideToggle('medium');
  });
  $('#center_column')
    .addClass('accordionBox')
    .find('.accordion_content')
    .slideUp('fast');
  if (typeof(ajaxCart) !== 'undefined') {
    ajaxCart.collapse();
  }
}
function counter() {
  $('.count').each(function() {
    $(this).prop('Counter', 0).animate({
      Counter: $(this).text()
    }, {
      duration: 4000,
      easing: 'swing',
      step: function(now) {
        $(this).text(Math.ceil(now));
      }
    });
  });
}
function testimonialsSlider() {
  var testimonials_slider = $('#testimonials');
  testimonials_slider.bxSlider({
    responsive: true,
    useCSS: false,
    minSlides: 1,
    maxSlides: 1,
    slideWidth: 1200,
    slideMargin: 0,
    moveSlides: 1,
    pager: false,
    autoHover: false,
    speed: 500,
    pause: 3000,
    controls: true,
    autoControls: true,
    startText: '',
    stopText: '',
    prevText: '',
    nextText: ''
  });
}
function toTop() {
  var o = $('html');
  if (o.hasClass('desktop')) {
    $().UItoTop({
      easingType: 'easeOutQuart',
      containerClass: 'ui-to-top fa fa-angle-up'
    });
  }
}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...