You are here:  » extra field and menu

Support Forum



extra field and menu

Submitted by henk on Thu, 2006-12-14 20:55 in

I make extra fields in the database and show them in my site : model en fabrikant Link

Is it possible to make in this page : Link

a block with all models en fabrikant

Cheers HEnk

Submitted by support on Thu, 2006-12-14 21:05

Hi Henk,

It should be no problem, the search script selects all fields (using SELECT * FROM) so all the fields in your products table are available in the search results.

In html/searchresults.php you will see how each product is displayed in a loop:

<?php foreach($searchresults["products"] as $product): ?>

Within the loop, you can access your new fields in the $product array, just like the existing fields are accessed:

<p><?php print substr($product["description"],0,250); ?></p>

So you might be able to use something like:

<p>Model: <?php print $product["model"]; ?></p>

Cheers,
David.

Submitted by henk on Thu, 2006-12-14 21:22

Yes i have it in the description but now as a menu just like this:
link on the left side.

HEnk

Submitted by support on Fri, 2006-12-15 09:42

Hi Henk,

I see what you want to do. This will require 2 things;

i) Code to generate the menu in exactly the same way as you are using the category or brand fields

ii) An additional case statement in search.php to support your new search keywords; for example "model:abc1234".

For i) you should be able to copy the code you have for the category menu; simply changing "category" for "model" as required; so that the links go to things like:

/search.php?q=model:ABC1234

The word that you use ("model" in this example) must match exactly the field name that you have created in your database in the products table. Then, in search.php, find the following code (in the switch statement)

      case "merchant":
        // pass through to category
      case "category":
        // pass through to brand
      case "brand":

...and just add your new field at the top:

      case "model":
        // pass through to merchant
      case "merchant":
        // pass through to category
      case "category":
        // pass through to brand
      case "brand":

Hope this helps!
Cheers,
David.

Submitted by henk on Fri, 2006-12-15 19:25

hmmmm, ii) is the simple part this is working.

But i) must i change the navigation file to ?

Like in http://www.pricetapestry.com/node/636

Sry and Thx

Cheers HEnk

Submitted by support on Fri, 2006-12-15 19:45

Hi Henk,

You should not need to change navigation because you are not adding a new parameter the URL. This can all be done through your new query format "model:abcdef" just like the existing query formats e.g. "merchant:abcdef".

For i); you need to use similar code to your modification to display the scroll box of categories etc.; just querying the database on your new field "model" instead of category...

Cheers,
David.

Submitted by henk on Thu, 2006-12-21 22:58

Almost done only link and filter for sub category doesn't work.

Link

Thx.
Henk

Submitted by support on Fri, 2006-12-22 12:39

Hello Henk,

There doesn't seem to be any change at all when "fabrikant=...." is in the URL (I tried fabrikantFilter as well which was in the last code you sent to me). Can you email me your latest version and i'll take a look - it should be reasonably easy to spot becuase the variable simply isn't being used...

Cheers,
David.

Submitted by Henk3001 on Fri, 2006-12-22 13:08

I cant send it now, but you have my ftp login you can use it.

Thx HEnk

Submitted by support on Fri, 2006-12-22 14:08

Hi Henk,

Please email the file over as I don't keep emails that contain login details...

Cheers,
David.