0

Is there way to add the same block to cache in different versions to cache, for example for different sorting in products' grid, but for the same request params - for example random sorting, which should be different every time? It would be good to have for example 10-20 versions of block with different order of products and just take different versions from cache. It is not good solution to clean cache for every request with random sorting parameter.

asked Feb 12, 2017 at 14:14

1 Answer 1

0

For random sorting, i prefer to have 1 cached version of the block, and use javascript to shuffle the items client side. This reduces the load on the server and the result is the same for the customer.

This is assuming that shuffling the shown results (limited to the items on page 1) is sufficient.

If you want to shuffle more products, spanning multiple result pages, that would be more difficult are require server side customization.

answered Feb 12, 2017 at 14:56
3
  • yes - JS is server is 1 page limited, that is the point maybe having some infite scroll extension there it could be done, as extension like that usually loads pages via ajax and caches next page Commented Feb 12, 2017 at 15:45
  • It really depends how random you want to make this. In my experience some random effect is usually enough and not worth the extra server load. Also, randomizing results can be frustrating as customers see something on your page, but cannot find it again on a second visit. Commented Feb 12, 2017 at 17:17
  • Of course random sorting is not intented to be default one. It is worth considering if our approach is not enough. Commented Feb 13, 2017 at 8:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.