我正在shopify上我的收藏页上的过滤器上工作。通过产品标签过滤产品。
这是代码:
Shared random As New Random
Dim Selected As New ArrayList()
Dim RSNo As Integer = 0
Dim RENo As Integer = 19
Dim countSelected As Integer = 0
Dim randomIndex As Integer
Dim i As Integer = 0
While i < totalNum
If i Mod 5 = 0 Then
RSNo = 0
RENo = 19
End If
For j As Integer = RSNo To RENo Step 1
If selected.Contains(j) Then
countSelected += 1
Else
Exit For
End If
Next
If countSelected = 20 Then
randomIndex = random.Next(0, 99)
While selected.Contains(randomIndex)
randomIndex = random.Next(0, 99)
End While
Else
randomIndex = random.Next(RSNo, RENo)
While selected.Contains(randomIndex)
randomIndex = random.Next(RSNo, RENo)
End While
End If
selected.Add(randomIndex)
i += 1
RSNo = RENo + 1
RENo += 20
countSelected = 0
End While
这可行,但是我的问题是,如果有人先选择一个过滤器,然后再选择“全部”以删除过滤器,则该过滤器实际上并没有被删除,它仍然显示基于第一个选择过滤的产品。 有人知道如何解决这个问题吗?