You are here:  » Dynamically update index categories/brands and featured list


Dynamically update index categories/brands and featured list

Submitted by murph on Wed, 2006-10-11 10:14 in

Hi,
Firstly, apologies in advance for all my questions (this thread and previous ones)...it's such a great script i'm eagerly pushing it to where i think it can go...

1/ Featured products - i notice that some products that are specifically listed are no longer available in an update, so the list is out of date. Can this list be dynamically generated...ie randomly pick 20 items as featured? Or can the list be bypassed altogether, and the featured products display dynamically choose 20 products from the entire product range?

2/ I would like to have my index page dynamically list both the brands and the categories, so that any new ones are added on an update, and any old ones are removed. Should i just add all the code form the brands.php and categories.php to the index.php page?

Cheers

Submitted by support on Wed, 2006-10-11 10:46

Hi,

1/ It's easy to make the featured products random picked from the database rather than using the list - the code is in this thread:

http://www.pricetapestry.com/node/353

2/ You can just bring the code from brands.php and categories.php into index.php. The thing you will have to watch is that they both incorporate the html/atoz.php include file; so you will need to do it something like this:

  // ********************
  // code from brands.php
  // ********************
  require("html/atoz.php");
  // clear the atoz array
  unset($atoz);
  // ************************
  // code from categories.php
  // ************************
  require("html/atoz.php");

Where you bring in the code from the other script, you don't need require("includes/common.php") as this will generate redefinition errors - just the code following that line down until (but not including) the require("html/header.php");

Cheers,
David.

Submitted by murph on Wed, 2006-10-11 11:29

Thanks.

For the brand part, i just want an option list, so i don't need the splitting up into A's, B's etc...

Submitted by murph on Wed, 2006-10-11 11:33

Got it, just removed all the excess code :)