Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: Randomize Featured Products Listing  (Read 493 times)

Offline kavlito

  • Newbie
  • *
  • Posts: 21
  • Karma: +4/-0
    • View Profile
Randomize Featured Products Listing
« on: May 13, 2020, 09:50:51 AM »
I use the Featured Products listing on my homepage. However, the display order is static and I prefer it to be random.

This can be easily accomplished by adding one line to this file: /storefront/view/*mytemplate*/template/blocks/product_list.tpl

Insert: shuffle($products);
between: $icount = 0;
and: foreach ($products as $product) {

See attachment.


(one caveat: this does not work with HTML Cache enabled - Update 5/26/20 - this statement is moot as of v1.2.16 as HTML Cache has been deprecated)
« Last Edit: May 26, 2020, 02:30:34 PM by kavlito »


Powered by SMFPacks Social Login Mod