You are here:  » A - Z mod

Support Forum



A - Z mod

Submitted by chrisst1 on Fri, 2011-08-12 15:12 in

Hi David

Is this a-z mod: http://www.pricetapestry.com/node/266 ok to use with your latest version? I was thinking of using it more so for the brands, could you modify it to show initially 20 random brands on the brands page.

Chris

Submitted by support on Fri, 2011-08-12 15:20

Hi Chris,

Yes, - modifications to brands.php and the new brandsAZ.php are still relevant; do you mean you want to include 20 random brands on the brandsAZ.php page in addition to the A-Z index?

Cheers,
David.
--
PriceTapestry.com

Submitted by chrisst1 on Fri, 2011-08-12 15:31

David

I did not explain that well, what I'm looking to do is show the a-z links bar with a link to each letter with twenty or so random displayed brands below on the brands page (as a space filler) but only the alphabetical list of brands when clicked through the a-z links.

If that makes sence.

Chris

Submitted by support on Fri, 2011-08-12 15:40

Hi Chris,

Sure - in your new brandsAZ.php, you'll have the following towards the end:

  require("html/footer.php");

To insert 20 random brands before that point, start by REPLACEing the above with something like this:

  $sql = "SELECT DISTINCT(brand) AS brand FROM `".$config_databaseTablePrefix."products` WHERE brand <> '' ORDER BY RAND() LIMIT 20";
  if (database_querySelect($sql,$rows))
  {
    print "<ul>";
    foreach($rows as $row)
    {
      if ($config_useRewrite)
      {
        $href = $config_baseHREF."brand/".tapestry_hyphenate($row["brand"])."/";
      }
      else
      {
        $href = $config_baseHREF."search.php?q=brand:".urlencode($row["brand"]).":";
      }
      print "<li><a href='".$href."'>".$row["brand"]."</a></li>";
    }
    print "</ul>";
  }
  require("html/footer.php");

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by chrisst1 on Fri, 2011-08-12 15:49

Thanks David

I should have known that, I've used the same on our other sites in the past. Trouble is you look at something new and you automatically think it's going to be more complex.

Chris

Submitted by support on Fri, 2011-08-12 15:55

No worries Chris!

I did just notice a missing "brand/" in the construction of the rewrite version of $href above, correct accordingly...

Cheers,
David.
--
PriceTapestry.com