Show random items on home page or main catalog page (v. 2.72)
The 2.72 release allows you to show any of the following on the home page or main catalog page:
- New Products (sorted by the 'Date Entered' field in the product screen)
- Featured Products (only items marked as 'featured' are displayed)
- Sale Products (only items on sale are displayed)
- Category List (one to six columns of categories are displayed)
If you wish to allow clients to also show random items (different every time the page is loaded), you can modify the script:
-
Open the pages.php file in the /storeadmin/ folder.
-
Find the line:
echo "value="sale">Sale Products";
around line 546 and just under that, add the lines:
echo "";
-
Open the catalog.php file in the /enc/ folder.
-
Find the lines:
if ($catalogproducts == "new") $searchquery .= " ORDER BY DateEdited DESC";
and just underneath, add:
else if ($catalogproducts == "rand") $searchquery .= " ORDER BY rand()";
- Save and reload all files.
Now, when a client selects 'Random Products' under the 'Show Products' field under either the home page or catalog page, it will display those products randomly.