Редактирует тему HTML / CSS и не может включить SOLD OUT - PullRequest
0 голосов
/ 25 мая 2018

Итак, я редактирую тему Shopify, подобную этой: https://fashe -theme.myshopify.com / collection / all

Для этой темы она должна отключить продукт и иметьраспроданный оверлей, запрещающий пользователю заходить на страницу продукта.

Вот product.liquid:

<!--  -->
      <div class="p-t-33 p-b-60">
        <form action="/cart/add" method="post" enctype="multipart/form-data" id="form_buy">
          <div class="form-group p-b-10"  {% if product.variants.size == 1 and product.variants.first.title contains 'Default' %}style="display:none"{% endif %}>
            <select name="id" id="productSelect" class="form-control">
              {% for variant in product.variants %}
              {% if variant.available %}
              <option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %} data-sku="{{ variant.sku }}" value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money_with_currency }}</option>
              {% else %}
              <option disbled="disabled">
                {{ variant.title }} - {{ 'products.product.sold_out' | t }}
              </option>
              {% endif %}
              {% endfor %}
            </select>
            {% if product.available and product.variants.size > 1 %}
            
            {% for option in product.options %}
            {% include 'swatch' with option %}
            {% endfor %}
            {% endif %}
          </div>
          <div class="form-group">
            {% if settings.product_quantity_enable %}
            <div class="flex-r-m flex-w p-t-12">
              <div class="w-size160 flex-m flex-w">
                <div class="flex-w bo5 of-hidden m-r-22 m-t-10 m-b-10">
                  <button class="btn-num-product-down color1 flex-c-m size7 bg8 eff2">
                    <i class="fs-12 fa fa-minus" aria-hidden="true"></i>
                  </button>
                  <input class="size8 m-text18 t-center num-product" type="number" id="Quantity" name="num-product" value="1">
                  <button class="btn-num-product-up color1 flex-c-m size7 bg8 eff2">
                    <i class="fs-12 fa fa-plus" aria-hidden="true"></i>
                  </button>
                </div>
                <div class="btn-addcart-product-detail size9 trans-0-4 m-t-10 m-b-10">
                  <!-- Button -->
                  <button class="flex-c-m sizefull bg1 bo-rad-23 hov1 s-text1 trans-0-4" type="button" id="button-cart" data-loading-text="{{ 'products.product.loading' | t }}">
                    {{ 'products.product.add_to_cart' | t }}
                  </button>
                </div>
              </div>
            </div>
            {% endif %}
            {% if settings.product_quantity_message %}
            <span id="variantQuantity" class="variant-quantity"></span>
            {% endif %}
          </div>
        </form>
      </div>

Вот код продукта-grid-item.liquid, в котором отображается миниатюра продукта:

{% unless current_collection %}
{% assign current_collection = collection %}
{% endunless %}

{% assign on_sale = false %}
{% if product.compare_at_price > product.price %}
{% assign on_sale = true %}
{% endif %}

{% assign sold_out = true %}
{% if product.available  %}
{% assign sold_out = false %}
{% endif %}
{% assign img_size = settings.img_size_grid %}
<!-- Block2 -->
<div class="block2">
  {% assign product_created_at = product.created_at | date: '%s' %}
  {% assign time_ago = 'now' | date: '%s' | minus: product_created_at | divided_by: 86400 %}
  {% assign product_new_time = settings.product_new_time | times: 1 %}
  <div class="block2-img wrap-pic-w of-hidden pos-relative {% if time_ago < product_new_time %}block2-labelnew{% endif %} {% if on_sale %} block2-labelsale{% endif %}">
    <a href="{{ product.url | within: collection }}">
      <img class="" src="{{ product.featured_image.src | img_url: img_size }}" alt="{{ product.featured_image.alt | escape }}">
    </a>
    <div class="block2-overlay trans-0-4" onclick="location.href= '{{ product.url }}'" >
      <a href="{{ product.url }}" class="block2-btn-addwishlist hov-pointer trans-0-4">
        <!-- <i class="icon-wishlist icon_heart_alt" aria-hidden="true"></i>
        <i class="icon-wishlist icon_heart dis-none" aria-hidden="true"></i> -->
      </a>
      <div class="block2-btn-addcart w-size1 trans-0-4">
        <!-- Button -->
        <button class="flex-c-m size1 bg4 bo-rad-23 hov1 s-text1 trans-0-4" data-toggle="tooltip" data-loading-text="{{ 'products.product.loading' | t }}" onclick="cart.add('{{ product.variants.first.id }}', '{{ product.title }}');">
          {{ 'products.product.add_to_cart' | t }}
        </button>
      </div>
    </div>
  </div>
  <div class="block2-txt p-t-20">
    <a href="{{ product.url | within: collection }}" class="block2-name dis-block s-text3 p-b-5">
      {{ product.title }}
    </a>
    {% if product.compare_at_price > product.price %}
    <span class="block2-oldprice m-text7 p-r-5">
      {{ product.compare_at_price_max | money }}
    </span>
    <span class="block2-newprice m-text8 p-r-5">
      {{ product.price | money }}
    </span>
    {% else %}
    <span class="block2-price m-text6 p-r-5">
      {{ product.price | money }}
    </span>
    {% endif %}
  </div>
</div>

1 Ответ

0 голосов
/ 27 мая 2018

Очень трудно ответить на этот вопрос, не имея демо-версии, где можно было бы исследовать проблему с помощью инструментов отладки веб-браузера.

Я предлагаю вам использовать Инструменты отладки Firefox, чтобы увидеть, как DOM построен на визуализированной странице и где расположен слой, который вы хотели бы видеть.Возможно это позади другого слоя.А может, его там нет.Вы должны сделать это самостоятельно, возможно, с помощью некоторого учебного пособия о том, как использовать отладчик: https://www.youtube.com/watch?v=yueecwKDZxQ

В противном случае вам придется поделиться предоставленным HTML-кодом и всем CSS-кодом страницы.

В первом фрагменте кода отображается только опция выбора для отключения.Во втором фрагменте кода вы определяете только переменную sold_out, но не используете ее.Я думаю, что вы должны использовать его где-нибудь для визуализации распроданного слоя ...

...