私がやろうとしているのは、カタログページのサブカテゴリのインデックスページにショートカットを作成することです。カタログページには、コレクションを閲覧するための次のコードがあります。
<form action="" class="navigation">
<div class="category-selector-wrapper">
<label>Browse by collection:</label>
<div class="category">
<select class="navigationSelector">
<option value="/collections/all">All</option>
{% for col in collections %}
<option value="{{ col.url }}"{% if collection.handle == col.handle %}selected="selected"{% endif %}>{{ col.title }}</option>
{% endfor %}
</select>
</div>
</div>
{% assign colItems = collection.all_tags | size %}
{% if colItems > 0 %}
<div class="category-selector-wrapper">
<label>Subcategory:</label>
<div class="category">
<select class="navigationSelector">
{% if collection.handle %}
<option value="/collections/{{ collection.handle }}">All</option>
{% elsif collection.products.first.type == collection.title %}
<option value="{{ collection.title | url_for_type }}">All</option>
{% elsif collection.products.first.vendor == collection.title %}
<option value="{{ collection.title | url_for_vendor }}">All</option>
{% endif %}
{% for tag in collection.all_tags %}
{% if current_tags contains tag %}
<option value="/collections/{{ collection.handle }}/{{ tag | handleize }}" selected="selected">{{ tag }}</option>
{% else %}
<option value="/collections/{{ collection.handle }}/{{ tag | handleize }}">{{ tag }}</option>
{% endif %}
{% endfor %}
</select>
</div>
</div>
{% endif %}
<label class="total">{{ collection.products_count }} {{ collection.products_count | pluralize: 'item', 'items' }} total</label>
</form>
私が試したのは、以下のindex.liquidにこのコードを入力することです。
<form action="" class="navigation">
<div class="category-selector-wrapper">
<label>Subcategory:</label>
<div class="category">
<select class="navigationSelector">
{% if collection.handle %}
<option value="/collections/{{ collection.handle }}">All</option>
{% elsif collection.products.first.type == collection.title %}
<option value="{{ collection.title | url_for_type }}">All</option>
{% elsif collection.products.first.vendor == collection.title %}
<option value="{{ collection.title | url_for_vendor }}">All</option>
{% endif %}
<option value="/collections/{{ collection.handle }}/{{ tag | handleize }}" selected="selected">{{ tag }}</option>
<option value="/collections/{{ collection.handle }}/{{ tag | handleize }}">{{ tag }}</option>
</select>
</div>
</div>
</form>
このコードはショートカットを表示しますが、「すべて」しか選択できません。ドロップダウンには、他のサブカテゴリは表示されません。助言がありますか?ありがとうございました!