複数のチェックボックスがあり、onClick で URL に値を送信し、PHP で URL から値を取得して、クエリから結果を選択できるようにしています。
米国市場と国際市場を選択した場合、URL は"product.php?market=US" です が、タイルとスラブを選択すると"product.php?market=US-International&type=tiles&type=slabs" と表示され、その後戻ったときに表示されますもう一度市場をインターナショナルに選択すると、「product.php?market=US&type=tiles&type=slabs&market=International」と表示されます
daraz.pk/women/clothing/kurtas-shalwar-kameez/ のような URL の取得値を管理するには、左側のフィルターで行っています。
チェックボックスの構造体:
市場 :
米国国際
タイプ :
タイルスラブ
カテゴリー :
オイニクス ETC
CODE :
<div class="widgetTitle">
<h3 class="garis">Market</h3>
<div class="productsline"></div>
</div>
<nav class="categories">
<input name="check_list[]" onclick="window.location.href = '?market=Pakistan'" type="checkbox" id="checkbox-1" class="regular-checkbox" /><label for="checkbox-1"></label>
<input name="check_list[]" onclick="window.location.href = '?International&'" type="checkbox" id="checkbox-2" class="regular-checkbox" /><label for="checkbox-2"></label>
International
</nav>
</div>
<div class="widgetTitle">
<h3 class="garis">Type</h3>
<div class="productsline"></div>
</div>
<nav class="categories">
<input name="check_list[]" onclick="window.location.href = '&type=blocks'" type="checkbox" id="checkbox-3" class="regular-checkbox" /><label for="checkbox-3"></label>
Blocks
<input name="check_list[]" onclick="window.location.href = '<?=$path;?>&type=slabs'" type="checkbox" id="checkbox-4" class="regular-checkbox" /><label for="checkbox-4"></label>
Slabs
<input name="check_list[]" onclick="window.location.href = '&type=tiles'" type="checkbox" id="checkbox-5" class="regular-checkbox" /><label for="checkbox-5"></label>
Tiles
<input name="check_list[]" onclick="window.location.href = '&type=mosaics'" type="checkbox" id="checkbox-6" class="regular-checkbox" /><label for="checkbox-6"></label>
Mosaics
</nav>
</div>