Paginate only available products

Excursionist
125 0 8

We have products that are sometimes marked as 'unavailable' that we still want to be visible via third party product indexes, such as Google Products.  But we don't want them to appear in collection listings on our website.

The problem is liquid doesn't offer us the ability to pass the paginate object a product array filtered by the 'available' property e.g. 'collection.products.available' and therefore we are left with 2 choices when considering pagination:

1. Either remove all unavailable products completely from the website and other third party indexes (losing traffic)

or

2. Have our collections cluttered up with unavailable products

Anyone have any suggestions or work-arounds?

 

An outdated thread on the same subject:

http://ecommerce.shopify.com/c/ecommerce-design/t/paginate-available-products-20332

http://www.tapwellbathrooms.co.uk/collections/bathroom-furniture
0 Likes
Excursionist
125 0 8

Bumping for any advice.

http://www.tapwellbathrooms.co.uk/collections/bathroom-furniture
0 Likes
New Member
13 0 0

I'm not sure I can answer the question directly - I do a fair amount of hacking around... but there are some clever people in these forums, and maybe this sets you/them in the right direction.

You might check out this wiki.  I used it to create sub collection filters within collection grids; when I select a new filter the products without that tag dynamically disappear; so it's possible to create pagination of a collection and exclude items based on criteria without removing them from the shop.

I guess you've already tried {% UNLESS product.available == 'false' %} right before your grid generates the <li{% cycle ...'end' > of each product in the grid ?  Or perhaps right after {% FOR product in collection.products %}

0 Likes
Excursionist
125 0 8

When you say 'dynamically', was this through Javascript/Ajax without a page postback?

An IF statement would only do half the job unfortunately; the unavailable products wouldn't output as per the IF statement, but it would break the pagination.  The pagination thinks there are more products than are actually displayed, which causes all sorts of issues.

Another solution, an idea that your post triggered, would be to dynamically load a new set of products as the user scrolls down the page, negating the need for pagination at all.  Ultimately, this would be perfect, but beyond our abilities for now.

Thanks for your feedback.

http://www.tapwellbathrooms.co.uk/collections/bathroom-furniture
0 Likes