You are here:  » Subcategories


Subcategories

Submitted by comp123 on Wed, 2013-10-02 18:17 in

Hello,
Does anyone know how we can implement subcategories?
I have some feed with subcategories, and I would love to have that up on the website.

Thanks

Submitted by support on Thu, 2013-10-03 08:06

Hello comp123 and welcome to the forum!

Sub-categories aren't supported "out of the box" I'm afraid which is a concious decision I've made ever since the very first version of Price Tapestry because of the lack of availability of good quality and consistent (across merchants) hierarchical category data. (even single level category still requires a significant amount of mapping if working with multiple merchants).

However, if you have a feed(s) that have good quality category/sub-category data then I can talk you through the steps of getting it imported and then ultimately creating a simple navigation around it.

First of all, add "subcategory" as a new field to your site following the standard instructions in this thread. That will add a "subcategory" field to your site, and on Feed Registration Step 2, you will be able to select a Subcategory field in addition to the normal category field.

The next step would be to add support for a search operator, which is easily done. In search.php, look for the following code at line 98:

      case "brand":
        $fields = array("merchant","category","brand");

...and REPLACE with:

      case "brand":
      case "subcategory":
        $fields = array("merchant","category","brand","subcategory");

With that in place, make a test search using the URL:

http://www.yoursite.com/search.php?q=category:Main+Category:subcategory:Sub+Category

The "+" character is just how spaces are represented in URLs - when it comes to creating a navigation these will be inserted automatically by url encoding, but for testing when creating the URL manually simply insert a + in place of spaces in the main category and sub category names.

Once all up and running, let me know how you'd like to present the category / subcategory information and I'll point you in the right direction..

Cheers,
David.
--
PriceTapestry.com