You are here:  » Adding categories to the index page


Adding categories to the index page

Submitted by thepricesite on Mon, 2006-09-04 07:48 in

Hi,
Now i'm begining to get to grips with the site i would like to change the index page or related pages so that i can display a few key categories/products on the main page, dare i say it but similar to Kelkoo.

If anyone could provide details of how to do this it would be hugely appreciated.

Impressed with the forum so far David & everyone!

Regards,

Michael

Submitted by support on Mon, 2006-09-04 08:50

Hi Michael,

The best way to do this is to navigate to a page that you want to link to from the homepage, and copy the URL from the browsers address bar (beginning from the forward slash - you don't need the full www etc.) and use this in the new link on the homepage.

For example, to link to the "Cameras" category, you could add the following code index.php

  print "<a href='/search.php?category:Cameras:'>Cameras</a>";

Similarly, to link to a specific product just copy the product URL, for example

  print "<a href='/products.php?q=ACER+AS3634WLMI'>Acer AS3634WLMI</a>";

Cheers!
David.

Submitted by thepricesite on Mon, 2006-09-04 13:02

Ah super David - being a php beginner where would you recommend i put "We also recommend" ?in the script? With php do i need to do a "print statement" or can i just add in the HTML?

Another query - sorry!
I'm trying to understand the index page, i'm keen to put the categories on the main page with some key products, many thanks for your reply on the forum but i need some further assistance. I plan on putting the category info around line 30 after the print ""; (in index.php)

How would i go about making the category list like the one on Kelkoo for example (see attached). I hope this isn't to much trouble?

Michael @ ThePriceSite

Submitted by support on Mon, 2006-09-04 17:03

Hi Michael,

Within PHP, you can either use the print ""; statement wherever the file is within a PHP block; or you can come out of PHP mode and just code raw HTML which may be easier.

To use raw HTML, and to insert some links to categories after line 30; you would insert something like this:

?>
  <table>
    <tr>
      <td valign='top'>
        <a href='/search.php?q=category:Category-1:'>Category 1</a><br />
        <a href='/search.php?q=category:Category-2:'>Category 2</a><br />
        <a href='/search.php?q=category:Category-3:'>Category 3</a><br />
      </td>
      <td valign='top'>
        <a href='/search.php?q=category:Category-4:'>Category 4</a><br />
        <a href='/search.php?q=category:Category-5:'>Category 5</a><br />
        <a href='/search.php?q=category:Category-6:'>Category 6</a><br />
      </td>
    </tr>
  </table>
<?php

That should give you something very close to what you're looking for. Please note that Price Tapestry does not support a category hierarchy, so there is no logical "master" category to use in each block that would be a link to search results that would incorporate all the sub categories.

Hope this helps!
Cheers,
David.